From 25e2f9601aed6d23923f3200ef248036b7787e7c Mon Sep 17 00:00:00 2001 From: pang.jiabao <pang_jiabao@163.com> Date: 星期二, 29 四月 2025 10:51:31 +0800 Subject: [PATCH] 产品合格校验手动excel导入 --- src/main/webapp/static/js/locDetl/locDetl.js | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) diff --git a/src/main/webapp/static/js/locDetl/locDetl.js b/src/main/webapp/static/js/locDetl/locDetl.js index c94a1c5..beb325d 100644 --- a/src/main/webapp/static/js/locDetl/locDetl.js +++ b/src/main/webapp/static/js/locDetl/locDetl.js @@ -46,12 +46,13 @@ return cols; } -layui.use(['table','laydate', 'form'], function(){ +layui.use(['table','laydate', 'form','upload','layer'], function(){ var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var layDate = layui.laydate; var form = layui.form; + var upload = layui.upload; // 鏁版嵁娓叉煋 tableIns = table.render({ @@ -97,6 +98,28 @@ } }); + upload.render({ + elem: '#uploadExcel', // 缁戝畾鍏冪礌 + url: baseUrl+'/productCalibration', // 涓婁紶鎺ュ彛锛屾浛鎹负浣犵殑鍚庣鎺ュ彛 + headers:{'token': localStorage.getItem('token')}, + accept: 'file', // 鍏佽涓婁紶鐨勬枃浠剁被鍨� + exts: 'xls|xlsx', // 鍏佽涓婁紶鐨勬枃浠跺悗缂� + done: function(res){ + // 涓婁紶瀹屾瘯鍥炶皟 + if(res.code === 200){ + layer.msg(res.msg); + console.log('鏂囦欢鏁版嵁:', res.data); + } else { + layer.msg(res.msg || '涓婁紶澶辫触'); + } + }, + error: function(){ + // 璇锋眰寮傚父鍥炶皟 + layer.msg('涓婁紶澶辫触锛岃閲嶈瘯'); + } + }); + + // 鐩戝惉鎺掑簭浜嬩欢 table.on('sort(locDetl)', function (obj) { var searchData = {}; -- Gitblit v1.9.1