| | |
| | | var pageCurr; |
| | | var locNormalList = []; |
| | | var locArea = []; |
| | | |
| | | function getCol() { |
| | | var cols = []; |
| | |
| | | ) |
| | | cols.push.apply(cols, locNormalCols); |
| | | cols.push( |
| | | {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; |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | // 库区下拉 |
| | | // 获取仓库下拉 |
| | | $.ajax({ |
| | | url: baseUrl + "/locArea/queryAll/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | var html = ""; |
| | | if (res.data && res.data.length > 0) { |
| | | html += res.data.map(function (item) { |
| | | return "<Option value=" + item.uuid + ">" + item.name + "</Option>"; |
| | | }); |
| | | } |
| | | $('#putSiteSelect').append(html); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | layui.use(['table', 'laydate', 'form', 'upload'], function () { |
| | | var table = layui.table; |
| | |
| | | , exts: 'xls|excel|xlsx' |
| | | , auto: false |
| | | , bindAction: '#uploadDo' |
| | | , before: function(obj){ |
| | | , before: function (obj) { |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | layer.load(1, {shade: [0.1, '#fff']}); |
| | | } |
| | | , choose: function(obj){ |
| | | , choose: function (obj) { |
| | | $('#uploadDesc').hide(); |
| | | $('#uploadDemoView').show(); |
| | | obj.preview(function(index, file, result){ |
| | | obj.preview(function (index, file, result) { |
| | | $('#fileMame').html(file.name); |
| | | }); |
| | | } |
| | |
| | | layer.msg(res.msg); |
| | | tableReload(false); |
| | | } |
| | | , error: function(index, upload){ |
| | | , error: function (index, upload) { |
| | | layer.closeAll('loading'); |
| | | } |
| | | }); |
| | | |
| | | /* 导入 */ |
| | | table.on('toolbar(locNormal)', function (obj) { |
| | | debugger |
| | | switch(obj.event) { |
| | | switch (obj.event) { |
| | | // 导入 |
| | | case 'intoData': |
| | | layer.open({ |
| | |
| | | title: '数据导入', |
| | | shadeClose: true, |
| | | content: $('#importDataDiv'), |
| | | success: function(layero, index){ |
| | | success: function (layero, index) { |
| | | uploader.reload(); |
| | | }, |
| | | end: function () { |
| | |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | // 解析库区名称 |
| | | var records = res.data.records; |
| | | records.map(function (item) { |
| | | locArea.map(function (d) { |
| | | if (d.uuid == item.warehouse) { |
| | | item.warehouse = d.name; |
| | | } |
| | | }) |
| | | }); |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | 'data': res.data.records, |
| | | } |
| | | }, |
| | | response: { |
| | |
| | | table.on('edit(locNormal)', function (obj) { |
| | | var count = obj.value; |
| | | var matnr = obj.data.matnr; |
| | | var id = obj.data.id; |
| | | |
| | | if (isNaN(count)) { |
| | | layer.msg("请输入数字"); |
| | |
| | | const param = { |
| | | matnr: matnr, |
| | | anfme: count, |
| | | id: id, |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/update/auth", |
| | |
| | | var data = obj.data; |
| | | var param = { |
| | | matnr: data.matnr, |
| | | id: data.id, |
| | | } |
| | | switch (obj.event) { |
| | | case 'outLocNormal': |
| | | // 出库 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/outLoc/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject(param), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | tableReload(false); |
| | | }, |
| | | layer.confirm('确定要出库['+data.matnr+']吗?', { |
| | | btn: ['确定', '取消'] //可以无限个按钮 |
| | | }, function(index, layero){ |
| | | //确定回调-出库 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/outLoc/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject(param), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | tableReload(false); |
| | | layer.closeAll(); |
| | | layer.msg("出库成功"); |
| | | }, |
| | | }); |
| | | }, function(index){ |
| | | //按钮【按钮二】的回调 |
| | | }); |
| | | break; |
| | | case 'removeLocNormal': |
| | | // 移除 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/removeLoc/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject(param), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | tableReload(false); |
| | | }, |
| | | layer.confirm('确定要移除['+data.matnr+']吗?', { |
| | | btn: ['确定', '取消'] //可以无限个按钮 |
| | | }, function(index, layero){ |
| | | //确定回调-移除 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/removeLoc/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject(param), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | tableReload(false); |
| | | layer.closeAll(); |
| | | layer.msg("移除成功"); |
| | | }, |
| | | }); |
| | | }, function(index){ |
| | | //按钮【按钮二】的回调 |
| | | }); |
| | | break; |
| | | } |