| | |
| | | function getCol() { |
| | | var cols = []; |
| | | cols.push( |
| | | {field: 'orderCode', align: 'center', title: '订单编号', width: 110} |
| | | , {field: 'orderDate', align: 'center', title: '订单日期', width: 120} |
| | | , {field: 'invCode', align: 'center', title: '物料编码', width: 130} |
| | | , {field: 'invName', align: 'center', title: '物料名称', width: 350} |
| | | , {field: 'invStd', align: 'center', title: '规格型号', width: 160} |
| | | , {field: 'invUnit', align: 'center', title: '单位', width: 80, hide: true} |
| | | , {field: 'orderQty', align: 'center', title: '订单数量', width: 120} |
| | | , {field: 'izMrp', align: 'center', title: '大订单(mrp)',width: 115} |
| | | , {field: 'productQty', align: 'center', title: '任务单', width: 110} |
| | | , {field: 'izReceive', align: 'center', title: '小订单', width: 80} |
| | | , {field: 'inQty', align: 'center', title: '入库数量', width: 110} |
| | | , {field: 'disQty', align: 'center', title: '通知单', width: 110} |
| | | , {field: 'outQty', align: 'center', title: '出库数量', width: 110} |
| | | , {field: 'invoiceQty', align: 'center', title: '开票数量', width: 110} |
| | | , {field: 'unInvoiceQty', align: 'center', title: '未开票数量', width: 110} |
| | | , {field: 'deliveryDate', align: 'center', title: '交货日期', width: 110} |
| | | , {field: 'personName', align: 'center', title: '业务员', width: 110} |
| | | , {field: 'outDate', align: 'center', title: '出库日期', width: 110} |
| | | , {field: 'outPrice', align: 'center', title: '出库单价', width: 110} |
| | | , {field: 'outAmount', align: 'center', title: '出库金额', width: 110} |
| | | , {field: 'invoiceDate', align: 'center', title: '开票日期', width: 110} |
| | | , {field: 'invoiceAmount', align: 'center', title: '开票金额', width: 110} |
| | | , {field: 'custName', align: 'center', title: '客户名称', width: 110} |
| | | { type: 'checkbox', fixed: 'left' } |
| | | , { field: 'orderCode', align: 'center', title: '订单编号', width: 110 } |
| | | , { field: 'orderDate', align: 'center', title: '订单日期', width: 120 } |
| | | , { field: 'invCode', align: 'center', title: '物料编码', width: 130 } |
| | | , { field: 'invName', align: 'center', title: '物料名称', width: 350 } |
| | | , { field: 'invStd', align: 'center', title: '规格型号', width: 160 } |
| | | , { field: 'invUnit', align: 'center', title: '单位', width: 80, hide: true } |
| | | , { field: 'orderQty', align: 'center', title: '订单数量', width: 120 } |
| | | , { field: 'izMrp', align: 'center', title: '大订单(mrp)', width: 115 } |
| | | , { field: 'productQty', align: 'center', title: '任务单', width: 110 } |
| | | , { field: 'izReceive', align: 'center', title: '小订单', width: 80 } |
| | | , { field: 'inQty', align: 'center', title: '入库数量', width: 110 } |
| | | , { field: 'disQty', align: 'center', title: '通知单', width: 110 } |
| | | , { field: 'outQty', align: 'center', title: '出库数量', width: 110 } |
| | | , { field: 'invoiceQty', align: 'center', title: '开票数量', width: 110 } |
| | | , { field: 'unInvoiceQty', align: 'center', title: '未开票数量', width: 110 } |
| | | , { field: 'deliveryDate', align: 'center', title: '交货日期', width: 110 } |
| | | , { field: 'personName', align: 'center', title: '业务员', width: 110 } |
| | | , { field: 'outDate', align: 'center', title: '出库日期', width: 110 } |
| | | , { field: 'outPrice', align: 'center', title: '出库单价', width: 110 } |
| | | , { field: 'outAmount', align: 'center', title: '出库金额', width: 110 } |
| | | , { field: 'invoiceDate', align: 'center', title: '开票日期', width: 110 } |
| | | , { field: 'invoiceAmount', align: 'center', title: '开票金额', width: 110 } |
| | | , { field: 'custName', align: 'center', title: '客户名称', width: 110 } |
| | | ); |
| | | return cols; |
| | | } |
| | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#salesOrder', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: 'http://192.168.0.253:8073/api/report/getorderreport', |
| | | headers: { token: localStorage.getItem('token') }, |
| | | url: 'http://127.0.0.1:9090/api/report/getorderreport2', |
| | | height: 650, |
| | | width: '100%', |
| | | page: true, |
| | |
| | | } |
| | | }); |
| | | |
| | | // 工具栏事件 |
| | | table.on('toolbar(salesOrder)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | var data = checkStatus.data; |
| | | |
| | | switch (obj.event) { |
| | | case 'saveToErp': |
| | | if (data.length === 0) { |
| | | layer.msg('请先选择要保存的数据', { icon: 5 }); |
| | | return; |
| | | } |
| | | layer.confirm('确定要将选中的 ' + data.length + ' 条数据保存到ERP吗?', { icon: 3, title: '提示' }, function (index) { |
| | | layer.close(index); |
| | | // 批量保存 |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + '/saleOrder/batchSave/auth', |
| | | type: 'POST', |
| | | contentType: 'application/json', |
| | | headers: { 'token': localStorage.getItem('token') }, |
| | | data: JSON.stringify(data), |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200) { |
| | | layer.msg('保存成功,共保存 ' + data.length + ' 条数据', { icon: 1 }); |
| | | tableReload(false); |
| | | } else { |
| | | layer.msg(res.msg || '保存失败', { icon: 2 }); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.close(loadIndex); |
| | | layer.msg('网络错误,请稍后重试', { icon: 2 }); |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 搜索栏重置事件 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | |
| | | // 时间选择器 |
| | | layDate.render({ |
| | | elem: '#orderTimeRange' |
| | | ,style: 'width: 150px' |
| | | , style: 'width: 150px' |
| | | , range: true |
| | | }); |
| | | layDate.render({ |
| | | elem: '#orderTimeDeliveryRange' |
| | | ,style: 'width: 150px' |
| | | , style: 'width: 150px' |
| | | , range: true |
| | | }); |
| | | layDate.render({ |
| | | elem: '#orderTimeOutRange' |
| | | ,style: 'width: 150px' |
| | | , style: 'width: 150px' |
| | | , range: true |
| | | }); |
| | | |
| | |
| | | /* 表格数据重载 */ |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | searchData[this.name] = this.value; |
| | | if (this.name == 'orderTime') { |
| | | searchData.startTime = this.value.substring(0, 10); |
| | |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | pageCurr=curr; |
| | | pageCurr = curr; |
| | | if (res.data.length === 0 && count !== 0) { |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: { |
| | | curr: pageCurr-1 |
| | | curr: pageCurr - 1 |
| | | } |
| | | }); |
| | | pageCurr -= 1; |