From 510510acc4215ac4b43eb7e31b3450ab9fa3f9fe Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 05 六月 2020 17:06:40 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/matCode/matCode.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/src/main/webapp/static/js/matCode/matCode.js b/src/main/webapp/static/js/matCode/matCode.js index 7886e47..ee89ed4 100644 --- a/src/main/webapp/static/js/matCode/matCode.js +++ b/src/main/webapp/static/js/matCode/matCode.js @@ -1,9 +1,10 @@ var pageCurr; -layui.use(['table','laydate', 'form'], function(){ +layui.use(['table','laydate', 'form','upload'], function(){ var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var layDate = layui.laydate; + var upload = layui.upload; var form = layui.form; // 鏁版嵁娓叉煋 @@ -206,9 +207,53 @@ }); }); break; + case 'intoData': + layer.open({ + type: 1, + title: '鏁版嵁瀵煎叆', + shadeClose: true, + content: $('#importDataDiv'), + success: function(layero, index){ + uploader.reload(); + } + }); + break; } }); + // 瀵煎叆excel + var uploader = upload.render({ + elem: '#uploadEx' + , url: baseUrl + '/matCode/import/auth' + , headers: {token: localStorage.getItem('token')} + , accept: 'file' + , exts: 'xls|excel|xlsx' + , auto: false + , bindAction: '#uploadDo' + , before: function(obj){ + layer.closeAll(); + layer.load(1, {shade: [0.1,'#fff']}); + } + , choose: function(obj){ + $('#uploadDesc').hide(); + $('#uploadDemoView').show(); + obj.preview(function(index, file, result){ + $('#fileMame').html(file.name); + }); + } + , done: function (res) { + limit(); + $('#uploadDesc').show(); + $('#uploadDemoView').hide(); + $('#fileMame').html(""); + layer.closeAll('loading'); + layer.msg(res.msg); + } + , error: function(index, upload){ + layer.closeAll('loading'); + } + }) + // 鐩戝惉琛屽伐鍏蜂簨浠� table.on('tool(matCode)', function(obj){ var data = obj.data; -- Gitblit v1.9.1