From 8e36d6e7a2837df41b35ca46bd3678cc1a8d0533 Mon Sep 17 00:00:00 2001 From: Administrator <876263681@qq.com> Date: 星期一, 30 十二月 2024 08:06:15 +0800 Subject: [PATCH] #导出优化,低库位满时,低库位的货往高库位寻找 --- src/main/webapp/static/js/matV2/matV2.js | 61 +++++++++++++++++++++++++++++- 1 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/static/js/matV2/matV2.js b/src/main/webapp/static/js/matV2/matV2.js index 07fdeab..9f123ae 100644 --- a/src/main/webapp/static/js/matV2/matV2.js +++ b/src/main/webapp/static/js/matV2/matV2.js @@ -1,4 +1,5 @@ var pageCurr; +var admin; layui.config({ base: baseUrl + "/static/layui/lay/modules/" }).extend({ @@ -9,7 +10,7 @@ var layer = layui.layer; var layDate = layui.laydate; var form = layui.form; - var admin = layui.admin; + admin = layui.admin; // 鏁版嵁娓叉煋 tableIns = table.render({ @@ -27,8 +28,8 @@ ,{field: 'id', align: 'center',title: 'ID',hide: true} ,{field: 'uuid', align: 'center',title: '涓婄骇搴忓彿',hide: false} ,{field: 'tagId', align: 'center',title: '褰撳墠搴忓彿',hide: false} - ,{field: 'matnr', align: 'center',title: '鍟嗗搧缂栫爜',hide: false} - ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О',hide: false} + ,{field: 'matnr', align: 'center',title: '鍝佸彿',hide: false} + ,{field: 'maktx', align: 'center',title: '鍝佸悕',hide: false} ,{field: 'name', align: 'center',title: '',hide: true} ,{field: 'specs', align: 'center',title: '瑙勬牸',hide: false} ,{field: 'model', align: 'center',title: '',hide: true} @@ -287,3 +288,57 @@ page: {curr: pageCurr} }); } + +// excel瀵煎叆妯℃澘涓嬭浇 +function excelMouldDownload(){ + layer.load(1, {shade: [0.1,'#fff']}); + location.href = baseUrl + "/matV2/excel/import/mould"; + layer.closeAll('loading'); +} + +// excel瀵煎叆 +function importExcel() { + $("#importExcel").trigger("click"); +} +function upload(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 + "/matV2/excel/import/auth"; + var form = new FormData(); + form.append("file", file); + xhr = new XMLHttpRequest(); + xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐�� + xhr.setRequestHeader('token', localStorage.getItem('token')); + xhr.onload = uploadComplete; //璇锋眰瀹屾垚 + xhr.onerror = uploadFailed; //璇锋眰澶辫触 + xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴� + layer.closeAll('loading'); + $("#importExcel").val(""); + }; + // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般�� + xhr.upload.onloadstart = function(){//涓婁紶寮�濮嬫墽琛屾柟娉� + ot = new Date().getTime(); //璁剧疆涓婁紶寮�濮嬫椂闂� + oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0 + }; + xhr.send(form); + }, function(index){ + $("#importExcel").val(""); + }); +} +function uploadComplete(evt) { + var res = JSON.parse(evt.target.responseText); + if(res.code === 200) { + layer.msg(res.msg, {icon: 1}); + loadTree(""); + } else { + layer.msg(res.msg, {icon: 2}); + } +} +function uploadFailed(evt) { + var res = JSON.parse(evt.target.responseText); + layer.msg(res.msg, {icon: 2}); +} -- Gitblit v1.9.1