| | |
| | | </div> |
| | | |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit |
| | | <button id="searchBtn" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit |
| | | lay-filter="LAY-app-contlist-search"> |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索 |
| | | </button> |
| | |
| | | <button style="margin-right: 5px;" class="layui-btn layui-btn-sm layuiadmin-btn-list addClass" lay-event="add" > |
| | | <i class="layui-icon"></i>添加 |
| | | </button> |
| | | <button style="margin-right: 5px;" id="daoru" class="layui-btn layui-btn-sm layuiadmin-btn-list DaoRuClass" lay-event="import" > |
| | | <i class="layui-icon"></i>导入 |
| | | </button> |
| | | </script> |
| | | |
| | | <script type="text/html" id="toolbarDemoList"> |
| | |
| | | <i class="layui-icon layui-icon-delete"></i>删除</a>`; |
| | | |
| | | } |
| | | if((d.AsnType =="1" || d.AsnType == "4" || d.AsnType == "8") && d.IsPasteCode == "1" && (d.Status == "0" || d.Status == "1")){ |
| | | if((d.AsnType =="1" || d.AsnType == "4") && d.IsPasteCode == "1" && (d.Status == "0" || d.Status == "1")){ |
| | | html += `<a class="layui-btn layui-btn-normal layui-btn-xs addLabelClass" lay-event="Addlabel"> |
| | | <i class="layui-icon layui-icon-edit"></i>生成标签</a>`; |
| | | } |
| | |
| | | |
| | | <script> |
| | | var uid = $.cookie('userId'); |
| | | layui.extend({ |
| | | excel: '../../layuiadmin/layui/layui_exts/excel' // {/}的意思即代表采用自有路径,即不跟随 base 路径 |
| | | }) |
| | | layui.config({ |
| | | base: '../../layuiadmin/' //静态资源所在路径 |
| | | }).extend({ |
| | | index: 'lib/index' //主入口模块 |
| | | }).use(['index', 'form', 'table', 'laypage', 'layer', 'laydate'], function () { |
| | | }).use(['index', 'form', 'table', 'laypage', 'layer', 'laydate', 'upload', 'excel'], function () { |
| | | |
| | | var doing = true; |
| | | |
| | |
| | | form = layui.form, |
| | | laypage = layui.laypage, |
| | | layer = layui.layer; |
| | | |
| | | var upload = layui.upload; |
| | | |
| | | laydate = layui.laydate; |
| | | |
| | |
| | | }, |
| | | cols: colsJson2 |
| | | }); |
| | | |
| | | //绑定导入 |
| | | upload.render({ |
| | | elem: '#daoru' //绑定元素 |
| | | , url: '' //上传接口 |
| | | , auto: false //是否选完文件后自动上传。如果设定 false,那么需要设置 bindAction 参数来指向一个其它按钮提交上传 |
| | | , exts: 'slx|excel|xlsx' //允许上传的文件后缀 |
| | | , accept: 'file' //指定允许上传时校验的文件类型 |
| | | //, bindAction: '#daoru' //指向一个按钮触发上传 |
| | | , choose: function (obj) {// 选择文件回调 |
| | | console.log(obj); |
| | | var files = obj.pushFile(); //将每次选择的文件追加到文件队列 |
| | | var fileArr = Object.values(files);// 注意这里的数据需要是数组,所以需要转换一下 |
| | | console.log(fileArr) |
| | | // 用完就清理掉,避免多次选中相同文件时出现问题 |
| | | for (var index in files) { |
| | | console.log(index); |
| | | if (files.hasOwnProperty(index)) { |
| | | delete files[index]; |
| | | } |
| | | } |
| | | console.log("abs"); |
| | | uploadExcel(fileArr); // 如果只需要最新选择的文件,可以这样写: uploadExcel([files.pop()]) |
| | | } |
| | | , done: function (res) { |
| | | console.log(res); |
| | | //上传完毕回调 |
| | | } |
| | | , error: function (res) { |
| | | console.log(res); |
| | | //请求异常回调 |
| | | } |
| | | }); |
| | | }); |
| | | //#endregion |
| | | } |
| | | |
| | | // 导入入库单据 |
| | | function uploadExcel(files) { |
| | | var noticeList = []; |
| | | try { |
| | | var excel = layui.excel; |
| | | excel.importExcel(files, { |
| | | // 读取数据的同时梳理数据 |
| | | fields: { |
| | | 'SkuNo': 'A', //物料号 |
| | | 'SkuName': 'B', //物料名称 |
| | | 'Qty': 'C', //数量 |
| | | 'LotNo': 'D', //批次 |
| | | 'LotText': 'E', //批次描述 |
| | | 'SupplierLot': 'F', //供货批次 |
| | | 'Lot1': 'G', //生产日期 |
| | | 'Lot2': 'H', //过期日期 |
| | | 'CustomerNo': 'I', //供应商编码 |
| | | 'CustomerName': 'J', //供应商名称 |
| | | } |
| | | }, |
| | | function (data) { |
| | | console.log(data); |
| | | // var arr = new Array(); |
| | | //excel第一行不读取、设置为标题 |
| | | for (i = 1; i < data[0].Sheet1.length; i++) { |
| | | var noticeDetailList = []; |
| | | var Qty = 0; |
| | | if (data[0].Sheet1[i].Qty) { |
| | | Qty = parseFloat(data[0].Sheet1[i].Qty); |
| | | } |
| | | var noticeDetail={ |
| | | SkuNo: data[0].Sheet1[i].SkuNo.toString(), |
| | | SkuName: data[0].Sheet1[i].SkuName.toString(), |
| | | Qty: Qty, |
| | | LotNo: data[0].Sheet1[i].LotNo.toString(), |
| | | LotText: data[0].Sheet1[i].LotText, |
| | | SupplierLot: data[0].Sheet1[i].SupplierLot.toString(), |
| | | Lot1: data[0].Sheet1[i].Lot1, |
| | | Lot2: data[0].Sheet1[i].Lot2, |
| | | |
| | | }; |
| | | noticeDetailList.push(noticeDetail); |
| | | var notice = { |
| | | Type:'1', |
| | | CustomerNo: data[0].Sheet1[i].CustomerNo.toString(), |
| | | CustomerName: data[0].Sheet1[i].CustomerName.toString(), |
| | | AsnDetail:noticeDetailList |
| | | }; |
| | | noticeList.push(notice); |
| | | } |
| | | var param = { |
| | | "ListArrivalNotice": noticeList, |
| | | } |
| | | //console.log('param:'+param) |
| | | layer.load();//打开loading |
| | | sendData(IP + "/BllAsn/ImportArrivalNotice", param, 'post', function (res) { |
| | | layer.closeAll(); //关闭loading |
| | | if (res.code == 0) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function () { |
| | | $('#searchBtn').click(); |
| | | doing = true |
| | | }); |
| | | } else { //不成功 |
| | | if (res.msg == undefined) { |
| | | layer.msg("导入数据格式有误!", { |
| | | icon: 2, |
| | | time: 3000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function () { $('#searchBtn').click(); doing = true }); |
| | | } else { |
| | | layer.msg(res.msg, { |
| | | icon: 2, |
| | | time: 3000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function () { $('#searchBtn').click(); doing = true }); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } catch (e) { |
| | | layer.alert(e.message); |
| | | } |
| | | |
| | | } |
| | | |
| | | function setRight() { |
| | |
| | | $(".clossClass").hide(); |
| | | $(".editDemoClass").hide();//备注 |
| | | $(".checkClass").hide(); //复核 |
| | | $(".addLabelClass").hide(); //生成标签 |
| | | $(".addLabelClass").hide(); //生成标签 |
| | | |
| | | }); |
| | | sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) { |
| | |
| | | } else { //不成功 |
| | | layer.msg(res.msg, { |
| | | icon: 2, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) B2025080501000035 tuopan T2500037 |
| | | }, function () { doing = true }); |
| | | } |
| | | }); |