From d417e332b39e7da99f637e94ebacf199fb158a72 Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期五, 31 五月 2024 18:16:50 +0800 Subject: [PATCH] #1 --- src/main/webapp/static/js/order/order.js | 64 ++++++++++++++++++++++++++++---- 1 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js index 546c384..159fa28 100644 --- a/src/main/webapp/static/js/order/order.js +++ b/src/main/webapp/static/js/order/order.js @@ -45,9 +45,9 @@ cols: [[ {type: 'numbers'}, {field: 'orderNo', title: '鍗曟嵁缂栧彿', templet: '#orderNoTpl'}, - {field: 'itemName', align: 'center', title: '鏍哥畻涓讳綋'}, + //{field: 'itemName', align: 'center', title: '鏍哥畻涓讳綋'}, {field: 'docType$', align: 'center', title: '鍗曟嵁绫诲瀷'}, - {field: 'defNumber', align: 'center', title: '涓氬姟绫诲瀷'}, + //{field: 'defNumber', align: 'center', title: '涓氬姟绫诲瀷'}, //{field: 'postFee', align: 'center', title: '鎬绘暟閲�', minWidth: 130, width: 130}, {align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160}, {field: 'createTime$', title: '鍒涘缓鏃堕棿'}, @@ -100,6 +100,10 @@ $("#importExcel").trigger("click"); }); + $("#orderCheckBtn").click(function () { + $("#importExcel2").trigger("click"); + }); + // 宸ュ叿鏉$偣鍑讳簨浠� table.on('tool(order)', function (obj) { var data = obj.data; @@ -142,7 +146,7 @@ {type: 'numbers'}, {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160}, {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160}, - {field: 'batch', title: '鎵瑰彿'}, + //{field: 'batch', title: '鎵瑰彿'}, {field: 'anfme', title: '鏁伴噺'}, {field: 'qty', title: '浣滀笟鏁伴噺', style: 'font-weight: bold'}, // {field: 'unit', title: '鍗曚綅'}, @@ -153,12 +157,12 @@ // }, // {field: 'inQty', title: '宸插叆搴撻噺'}, // {field: 'color', title: '棰滆壊'}, - {field: 'specs', title: '瑙勬牸鍨嬪彿'}, + //{field: 'specs', title: '瑙勬牸鍨嬪彿'}, {field: 'unit', title: '璁¢噺鍗曚綅'}, - {field: 'manu', title: '琛屽彿'}, - {field: 'threeCode', title: '閿�鍞鍗曞彿'}, - {field: 'deadTime', title: '閿�鍞鍗曡鍙�'}, - {field: 'itemNum', title: '琛屽敮涓�鏍囪瘑'} + //{field: 'manu', title: '琛屽彿'}, + {field: 'threeCode', title: '閿�鍞崟鍙�'}, + {field: 'deadTime', title: '鑷敱椤�'}, + //{field: 'itemNum', title: '琛屽敮涓�鏍囪瘑'} ]], request: { pageName: 'curr', @@ -629,3 +633,47 @@ alert(res.msg); // layer.msg(res.msg, {icon: 2}); } + + +function upload2(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 + "/order/excel/import2/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}); +} -- Gitblit v1.9.1