优化代码

This commit is contained in:
java110 2021-04-08 13:47:56 +08:00
parent 74e3dca1a6
commit 66ac15ccbb
2 changed files with 188 additions and 0 deletions

View File

@ -0,0 +1,66 @@
<div class=" animated fadeInRight ecommerce">
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>待办单</h5>
<div class="ibox-tools" style="top:10px;">
</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">物品ID</th>
<th class="text-center">物品名称</th>
<th class="text-center">源仓库</th>
<th class="text-center">目标仓库</th>
<th class="text-center">调拨数量</th>
<th class="text-center">申请人</th>
<th class="text-center">申请说明</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="auditOrder in allocationStorehouseAuditOrdersInfo.auditOrders">
<td class="text-center">{{auditOrder.resId}}</td>
<td class="text-center">{{auditOrder.resName}}</td>
<td class="text-center">{{auditOrder.shaName}}</td>
<td class="text-center">{{auditOrder.shzName}}</td>
<td class="text-center">{{auditOrder.stock}}</td>
<td class="text-center">{{auditOrder.startUserName}}</td>
<td class="text-center">{{auditOrder.remark}}</td>
<td class="text-center">
<div>
<div class="btn-group"
v-if="allocationStorehouseAuditOrdersInfo.currentUserId != auditOrder.userId">
<button class="btn-white btn btn-xs"
v-on:click="_openAuditOrderModel(auditOrder)">审批
</button>
</div>
<div class="btn-group" v-else>
<button class="btn-white btn btn-xs"
v-on:click="_finishAuditOrder(auditOrder)">结束
</button>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="common/audit" callBackListener="allocationStorehouseAuditOrders" callBackFunction="notifyAudit">
</vc:create>
</div>

View File

@ -0,0 +1,122 @@
/**
审核订单
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
allocationStorehouseAuditOrdersInfo: {
auditOrders: [],
total: 0,
records: 1,
moreCondition: false,
userName: '',
currentUserId: vc.getData('/nav/getUserInfo').userId,
conditions: {
AuditOrdersId: '',
userName: '',
auditLink: '',
},
orderInfo: '',
procure: false
}
},
_initMethod: function () {
vc.component._listAuditOrders(DEFAULT_PAGE, DEFAULT_ROWS);
$that._loadStepStaff();
},
_initEvent: function () {
vc.on('allocationStorehouseAuditOrders', 'listAuditOrders', function (_param) {
vc.component._listAuditOrders(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listAuditOrders(_currentPage, DEFAULT_ROWS);
});
vc.on('myAuditOrders', 'notifyAudit', function (_auditInfo) {
vc.component._auditOrderInfo(_auditInfo);
});
},
methods: {
_listAuditOrders: function (_page, _rows) {
vc.component.allocationStorehouseAuditOrdersInfo.conditions.page = _page;
vc.component.allocationStorehouseAuditOrdersInfo.conditions.row = _rows;
var param = {
params: vc.component.allocationStorehouseAuditOrdersInfo.conditions
};
//发送get请求
vc.http.get('myAuditOrders',
'list',
param,
function (json, res) {
var _allocationStorehouseAuditOrdersInfo = JSON.parse(json);
vc.component.allocationStorehouseAuditOrdersInfo.total = _allocationStorehouseAuditOrdersInfo.total;
vc.component.allocationStorehouseAuditOrdersInfo.records = _allocationStorehouseAuditOrdersInfo.records;
vc.component.allocationStorehouseAuditOrdersInfo.auditOrders = _allocationStorehouseAuditOrdersInfo.resourceOrders;
vc.emit('pagination', 'init', {
total: vc.component.allocationStorehouseAuditOrdersInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAuditOrderModel: function (_auditOrder) {
vc.component.allocationStorehouseAuditOrdersInfo.orderInfo = _auditOrder;
vc.emit('audit', 'openAuditModal', {});
},
_queryAuditOrdersMethod: function () {
vc.component._listAuditOrders(DEFAULT_PAGE, DEFAULT_ROWS);
},
//提交审核信息
_auditOrderInfo: function (_auditInfo) {
console.log("提交得参数:" + _auditInfo);
_auditInfo.taskId = vc.component.allocationStorehouseAuditOrdersInfo.orderInfo.taskId;
_auditInfo.applyOrderId = vc.component.allocationStorehouseAuditOrdersInfo.orderInfo.applyOrderId;
//发送get请求
vc.http.post('myAuditOrders',
'audit',
JSON.stringify(_auditInfo),
{
emulateJSON: true
},
function (json, res) {
vc.toast("处理成功");
vc.component._listAuditOrders(DEFAULT_PAGE, DEFAULT_ROWS);
}, function (errInfo, error) {
console.log('请求失败处理');
vc.toast("处理失败:" + errInfo);
}
);
},
_finishAuditOrder: function (_auditOrder) {
let _auditInfo = {
taskId: _auditOrder.taskId,
applyOrderId: _auditOrder.applyOrderId,
state: '1200',
remark: '处理结束'
};
//发送get请求
vc.http.post('myAuditOrders',
'audit',
JSON.stringify(_auditInfo),
{
emulateJSON: true
},
function (json, res) {
vc.toast("处理成功");
vc.component._listAuditOrders(DEFAULT_PAGE, DEFAULT_ROWS);
}, function (errInfo, error) {
console.log('请求失败处理');
vc.toast("处理失败:" + errInfo);
}
);
}
}
});
})(window.vc);