| | |
| | | ) |
| | | cols.push.apply(cols, locNormalCols); |
| | | cols.push( |
| | | {field: 'warehouse', align: 'center', title: '库区'} |
| | | , {field: 'state', align: 'center', title: '出入库状态', templet: '#locNormalState'} |
| | | {field: 'warehouse$', align: 'center', title: '库区'} |
| | | , {field: 'state$', align: 'center', title: '出入库状态', templet: '#locNormalState'} |
| | | , {field: 'modiUser$', align: 'center', title: '修改人员', hide: true} |
| | | , {field: 'modiTime$', align: 'center', title: '修改时间', hide: true} |
| | | , {field: 'appeTime$', align: 'center', title: '创建时间', hide: true} |
| | |
| | | return cols; |
| | | } |
| | | |
| | | // 获取仓库下拉 |
| | | $.ajax({ |
| | | url: baseUrl+"/locArea/queryAll/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | // data: top.reObject(data), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.data && res.data.length > 0) { |
| | | locArea = res.data; |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | layui.use(['table', 'laydate', 'form', 'upload'], function () { |
| | | var table = layui.table; |
| | |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var upload = layui.upload; |
| | | |
| | | // 库区下拉 |
| | | // 获取仓库下拉 |
| | | $.ajax({ |
| | | url: baseUrl + "/locArea/query/allArea", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | var html = ""; |
| | | if (res.data && res.data.length > 0) { |
| | | locArea = res.data; |
| | | html += res.data.map(function (item) { |
| | | return "<Option value=" + item.uuid + ">" + item.name + "</Option>"; |
| | | }); |
| | | } |
| | | $('#putSiteSelect').append(html); |
| | | layui.form.render('select'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 导入excel |
| | | var uploader = upload.render({ |
| | |
| | | } |
| | | }); |
| | | break; |
| | | // 导出 |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var fields=[]; |
| | | var titles=[]; |
| | | var exportData = {}; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'exportData': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/locNormal/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | // 解析库区名称 |
| | | var records = res.data.records; |
| | | records.map(function (item) { |
| | | locArea.map(function (d) { |
| | | if (d.id == item.warehouse) { |
| | | item.warehouse = d.name; |
| | | } |
| | | }) |
| | | }); |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | |
| | | matnr: matnr, |
| | | anfme: count, |
| | | id: id, |
| | | warehouse: obj.data.warehouse, |
| | | supplier: obj.data.supplier, |
| | | mnemonic: obj.data.mnemonic, |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/update/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject(param), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | }, |
| | | layer.confirm("确定修改" + obj.data.maktx + "的数量吗", { |
| | | btn: ['确定', '取消'] |
| | | }, function () { |
| | | // 按钮1的事件 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/update/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject(param), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.msg("修改成功"); |
| | | }, |
| | | }); |
| | | }, function () { |
| | | // 按钮2的事件 |
| | | tableIns.reload(); |
| | | }); |
| | | }); |
| | | |
| | |
| | | } |
| | | switch (obj.event) { |
| | | case 'outLocNormal': |
| | | layer.confirm('确定要出库['+data.matnr+']吗?', { |
| | | var warehourse = data.warehouse; |
| | | console.log(warehourse); |
| | | |
| | | if(warehourse !== 'cs'){ |
| | | layer.msg("只能出材料平仓"); |
| | | return; |
| | | } |
| | | |
| | | layer.confirm('确定要出库[' + data.matnr + ']吗?', { |
| | | btn: ['确定', '取消'] //可以无限个按钮 |
| | | }, function(index, layero){ |
| | | }, function (index, layero) { |
| | | //确定回调-出库 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/outLoc/auth", |
| | |
| | | layer.msg("出库成功"); |
| | | }, |
| | | }); |
| | | }, function(index){ |
| | | }, function (index) { |
| | | //按钮【按钮二】的回调 |
| | | }); |
| | | break; |
| | | case 'removeLocNormal': |
| | | // 移除 |
| | | layer.confirm('确定要移除['+data.matnr+']吗?', { |
| | | layer.confirm('确定要移除[' + data.matnr + ']吗?', { |
| | | btn: ['确定', '取消'] //可以无限个按钮 |
| | | }, function(index, layero){ |
| | | }, function (index, layero) { |
| | | //确定回调-移除 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/removeLoc/auth", |
| | |
| | | layer.msg("移除成功"); |
| | | }, |
| | | }); |
| | | }, function(index){ |
| | | }, function (index) { |
| | | //按钮【按钮二】的回调 |
| | | }); |
| | | break; |