|  |  |  | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | var admin; | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).use(['table','laydate', 'form', 'admin'], function(){ | 
|---|
|  |  |  | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | var admin = layui.admin; | 
|---|
|  |  |  | admin = layui.admin; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 数据渲染 | 
|---|
|  |  |  | tableIns = table.render({ | 
|---|
|  |  |  | 
|---|
|  |  |  | height: 'full-120', | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{field: 'id', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'specs', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'model', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'cstmr', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'other', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'rowBeg', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'rowEnd', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'bayBeg', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'bayEnd', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'levBeg', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'levEnd', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'limit', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'status', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'createBy', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'updateBy', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'mixed$', align: 'center',title: '是否支持混载'} | 
|---|
|  |  |  | ,{field: 'keepGo$', align: 'center',title: '支持混载情况下,没找到库位是否继续寻找'} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: ''} | 
|---|
|  |  |  | // ,{field: 'id', align: 'center',title: 'ID'} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '商品编号'} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '商品名称', hide: false} | 
|---|
|  |  |  | ,{field: 'model', align: 'center',title: '型号', hide: true} | 
|---|
|  |  |  | ,{field: 'cstmr', align: 'center',title: '客户', hide: true} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: '批号',hide: true} | 
|---|
|  |  |  | ,{field: 'other', align: 'center',title: '其他', hide: true} | 
|---|
|  |  |  | ,{field: 'rowBeg', align: 'center',title: '开始排'} | 
|---|
|  |  |  | ,{field: 'rowEnd', align: 'center',title: '结束排'} | 
|---|
|  |  |  | ,{field: 'bayBeg', align: 'center',title: '开始列'} | 
|---|
|  |  |  | ,{field: 'bayEnd', align: 'center',title: '结束列'} | 
|---|
|  |  |  | ,{field: 'levBeg', align: 'center',title: '开始层'} | 
|---|
|  |  |  | ,{field: 'levEnd', align: 'center',title: '结束层'} | 
|---|
|  |  |  | ,{field: 'limit', align: 'center',title: '上限', hide: true} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '状态', hide: true} | 
|---|
|  |  |  | ,{field: 'createBy$', align: 'center',title: '添加人员', hide: true} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '添加时间', hide: true} | 
|---|
|  |  |  | ,{field: 'updateBy$', align: 'center',title: '修改人员', hide: true} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '修改时间', hide: true} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注', hide: true} | 
|---|
|  |  |  | // ,{field: 'mixed$', align: 'center',title: '混载'} | 
|---|
|  |  |  | ,{field: 'keepGo$', align: 'center',title: '继续搜索'} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | 
|---|
|  |  |  | showEditModel(); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'deleteData': | 
|---|
|  |  |  | if (checkStatus.length === 0) { | 
|---|
|  |  |  | layer.msg('请选择要删除的数据', {icon: 2}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | del(checkStatus.map(function (d) { | 
|---|
|  |  |  | return d.id; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | if (checkStatus.length === 0) { | 
|---|
|  |  |  | layer.msg('请选择要删除的数据', {icon: 2}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | del(checkStatus.map(function (d) { | 
|---|
|  |  |  | return d.id; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'exportData': | 
|---|
|  |  |  | admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
|---|
|  |  |  | var titles=[]; | 
|---|
|  |  |  | 
|---|
|  |  |  | function showEditModel(mData) { | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | area: '600px', | 
|---|
|  |  |  | title: (mData ? '修改' : '添加') + '订单状态', | 
|---|
|  |  |  | area: '1000px', | 
|---|
|  |  |  | title: (mData ? '修改' : '添加') + '库区规则', | 
|---|
|  |  |  | content: $('#editDialog').html(), | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | layDateRender(mData); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 导入销售单 | 
|---|
|  |  |  | $("#importOrder").click(function () { | 
|---|
|  |  |  | $("#importExcel").trigger("click"); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 删除 */ | 
|---|
|  |  |  | function del(ids) { | 
|---|
|  |  |  | 
|---|
|  |  |  | function layDateRender(data) { | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '.layui-laydate-range' | 
|---|
|  |  |  | ,type: 'datetime' | 
|---|
|  |  |  | ,range: true | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#createTime\\$', | 
|---|
|  |  |  | type: 'datetime', | 
|---|
|  |  |  | value: data!==undefined?data['createTime\\$']:null | 
|---|
|  |  |  | 
|---|
|  |  |  | tableIns.reload({ | 
|---|
|  |  |  | where: searchData, | 
|---|
|  |  |  | page: {curr: pageCurr} | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function uploadExcel(obj){ | 
|---|
|  |  |  | if(!obj.files) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var file = obj.files[0]; | 
|---|
|  |  |  | admin.confirm('确认导入 [' + file.name +'] 文件吗?', function (index) { | 
|---|
|  |  |  | layer.load(1, {shade: [0.1,'#fff']}); | 
|---|
|  |  |  | var url = baseUrl + "/locRule/excel/import/auth"; | 
|---|
|  |  |  | var form = new FormData(); | 
|---|
|  |  |  | form.append("file", file); | 
|---|
|  |  |  | let xhr = new XMLHttpRequest(); | 
|---|
|  |  |  | xhr.open("post", url, true); | 
|---|
|  |  |  | xhr.setRequestHeader('token', localStorage.getItem('token')); | 
|---|
|  |  |  | xhr.onload = uploadComplete; | 
|---|
|  |  |  | xhr.onerror =  uploadFailed; | 
|---|
|  |  |  | xhr.onloadend = function () { | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // xhr.upload.onprogress = progressFunction; | 
|---|
|  |  |  | xhr.upload.onloadstart = function(){ | 
|---|
|  |  |  | ot = new Date().getTime(); | 
|---|
|  |  |  | oloaded = 0; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | xhr.send(form); | 
|---|
|  |  |  | }, function(index){ | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function uploadComplete(evt) { | 
|---|
|  |  |  | let res = JSON.parse(evt.target.responseText); | 
|---|
|  |  |  | if(res.code === 200) { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | insTb.reload({page: {curr: 1}}); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | alert(res.msg); | 
|---|
|  |  |  | // layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function uploadFailed(evt) { | 
|---|
|  |  |  | let res = JSON.parse(evt.target.responseText); | 
|---|
|  |  |  | alert(res.msg); | 
|---|
|  |  |  | // layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|