优化代码

This commit is contained in:
wuxw 2023-12-25 22:57:42 +08:00
parent 83193a5106
commit 08d0623c7a
2 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,106 @@
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>
<vc:i18n name="查询条件"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-2">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请选择类型名称','startType')"
v-model="startTypeInfo.conditions.typeName" class=" form-control">
</div>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryWorkTypeMethod()">
<i class="glyphicon glyphicon-search"></i> <span>
<vc:i18n name="查询"></vc:i18n>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>
<vc:i18n name="发起工作单" namespace="startType"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddWorkTypeModal()">
<vc:i18n name="起草" namespace="startType"></vc:i18n>
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">
<vc:i18n name='编号' namespace='startType'></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name='类型名称' namespace='startType'></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name='超时时间' namespace='startType'></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name='创建时间' namespace='startType'></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name='备注' namespace='startType'></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name='操作'></vc:i18n>
</th>
</tr>
</thead>
<tbody>
<tr v-for="work in startTypeInfo.works">
<td class="text-center">{{work.workId}}</td>
<td class="text-center">{{work.wt_id}}</td>
<td class="text-center">{{work.timeout}}</td>
<td class="text-center">{{work.createTime}}</td>
<td class="text-center">{{work.remark}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditWorkTypeModel(work)">
<vc:i18n name='修改'></vc:i18n>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteWorkTypeModel(work)">
<vc:i18n name='删除'></vc:i18n>
</button>
</div>
</td>
</tr>
</tbody>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<!--
<vc:create path="oa/addWorkType" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="oa/editWorkType"></vc:create>
<vc:create path="oa/deleteWorkType"></vc:create> -->
</div>

View File

@ -0,0 +1,73 @@
/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
startTypeInfo: {
startTypes: [],
total: 0,
records: 1,
moreCondition: false,
wtId: '',
conditions: {
wtId: '',
typeName: '',
timeout: '',
}
}
},
_initMethod: function () {
$that._listStartTypes(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('startType', 'listStartType', function (_param) {
$that._listStartTypes(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listStartTypes(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listStartTypes: function (_page, _rows) {
$that.startTypeInfo.conditions.page = _page;
$that.startTypeInfo.conditions.row = _rows;
var param = {
params: $that.startTypeInfo.conditions
};
//发送get请求
vc.http.apiGet('/startType.listStartType',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.startTypeInfo.total = _json.total;
$that.startTypeInfo.records = _json.records;
$that.startTypeInfo.startTypes = _json.data;
vc.emit('pagination', 'init', {
total: $that.startTypeInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddStartTypeModal: function () {
vc.emit('addStartType', 'openAddStartTypeModal', {});
},
_openEditStartTypeModel: function (_startType) {
vc.emit('editStartType', 'openEditStartTypeModal', _startType);
},
_openDeleteStartTypeModel: function (_startType) {
vc.emit('deleteStartType', 'openDeleteStartTypeModal', _startType);
},
_queryStartTypeMethod: function () {
$that._listStartTypes(DEFAULT_PAGE, DEFAULT_ROWS);
},
}
});
})(window.vc);