From 14ab30c9a41b49801e05e3a75c02e59d46bd5661 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 02 六月 2021 16:28:12 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/locNormal/locNormal.js | 120 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 93 insertions(+), 27 deletions(-) diff --git a/src/main/webapp/static/js/locNormal/locNormal.js b/src/main/webapp/static/js/locNormal/locNormal.js index 0fc0998..c331026 100644 --- a/src/main/webapp/static/js/locNormal/locNormal.js +++ b/src/main/webapp/static/js/locNormal/locNormal.js @@ -1,5 +1,6 @@ var pageCurr; var locNormalList = []; +var locArea = []; function getCol() { var cols = []; @@ -8,7 +9,8 @@ ) 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} @@ -16,6 +18,42 @@ ); 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; @@ -34,14 +72,14 @@ , 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); }); } @@ -54,15 +92,14 @@ 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({ @@ -70,7 +107,7 @@ title: '鏁版嵁瀵煎叆', shadeClose: true, content: $('#importDataDiv'), - success: function(layero, index){ + success: function (layero, index) { uploader.reload(); }, end: function () { @@ -101,11 +138,20 @@ pageSize: 'limit' }, parseData: function (res) { + // 瑙f瀽搴撳尯鍚嶇О + 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: { @@ -151,6 +197,7 @@ 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("璇疯緭鍏ユ暟瀛�"); @@ -175,6 +222,7 @@ const param = { matnr: matnr, anfme: count, + id: id, } $.ajax({ url: baseUrl + "/locNormal/update/auth", @@ -204,30 +252,48 @@ 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; } -- Gitblit v1.9.1