Administrator
2024-02-02 ec258841a0f5249935578544ebed9121fbc71b2d
HTML/views/ASNSetting/LabelBox.html
@@ -3,7 +3,7 @@
<head>
   <meta charset="utf-8">
   <title>物料信息录入</title>
   <title>物料标签</title>
   <meta name="renderer" content="webkit">
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
   <meta name="viewport"
@@ -36,14 +36,14 @@
   </style>
   <script>
      // 这里是需要在页面渲染之前执行的代码
      document.addEventListener("DOMContentLoaded", function() {
      document.addEventListener("DOMContentLoaded", function () {
         //获取table默认显示数
         pageCntFirst();
         //判断是否开启table列表列宽调整功能。
         GetIsSetColW();
      });
     </script>
   </script>
</head>
@@ -53,6 +53,13 @@
      <div class="layui-card">
         <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
               <div class="layui-inline" style="margin-right: 0;">
                  <label class="layui-form-label" style="width: 60px;">入库单号</label>
                  <div class="layui-input-inline" style="margin-right: 0;">
                     <input type="text" id="ASNNo" name="ASNNo" placeholder="入库单号" autocomplete="off"
                        class="layui-input">
                  </div>
               </div>
               <div class="layui-inline" style="margin-right: 0;">
                  <label class="layui-form-label" style="width: 60px;">箱 号</label>
                  <div class="layui-input-inline" style="margin-right: 0;">
@@ -77,11 +84,25 @@
                  </div>
               </div>
               <div class="layui-inline" style="margin-right: 0;">
                  <label class="layui-form-label" style="width: 60px;">批次描述</label>
                  <label class="layui-form-label" style="width: 60px;">供货批次</label>
                  <div class="layui-input-inline" style="margin-right: 0;">
                     <div class="layui-input-inline" style="margin-right: 0;">
                        <input type="text" id="LotText" name="LotText" placeholder="批次描述" autocomplete="off"
                           class="layui-input">
                        <input type="text" id="SupplierLot" name="SupplierLot" placeholder="供货批次"
                           autocomplete="off" class="layui-input">
                     </div>
                  </div>
               </div>
               <div class="layui-inline" style="margin-right: 0;">
                  <label class="layui-form-label">是否使用</label>
                  <div class="layui-input-inline" style="margin-right: 0;">
                     <div class="layui-input-inline" style="margin-right: 0;">
                        <select name="IsUse" id="IsUse" lay-filter="IsUse" lay-search>
                           <option value=""></option>
                           <option value="0">否</option>
                           <option value="1">是</option>
                        </select>
                     </div>
                  </div>
               </div>
@@ -108,13 +129,13 @@
            </button> -->
            <div class="position-relative">
               <table id="Box-list" lay-filter="Box-list"></table>
               <div class="headerSetIcon">
                  <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols">
                     <i class="layui-icon">&#xe610;</i>
                  </button>
               </div>
               <script type="text/html" id="templetProductionTime">
                  {{# function GetBtn3(d){
                        return formatDate2(d.ProductionTime);
@@ -130,7 +151,7 @@
                  }}
                  {{ GetBtn4(d) }}
               </script>
               <script type="text/html" id="templetInspectTime">
                  {{# function GetBtn5(d){
                        return formatDate2(d.InspectTime);
@@ -138,7 +159,7 @@
                  }}
                  {{ GetBtn5(d) }}
               </script>
               <script type="text/html" id="templetCompleteTime">
                  {{# function GetBtn6(d){
                        return formatDate(d.CompleteTime);
@@ -159,7 +180,7 @@
                  {{ GetBtn7(d) }}
               </script>
               <script type="text/html" id="templetCreateTime">
                  {{# function GetBtn8(d){
@@ -168,9 +189,9 @@
                  }}
                  {{ GetBtn8(d) }}
               </script>
            </div>
            </div>
            <script type="text/html" id="toolbarDemo">
            <!-- <script type="text/html" id="toolbarDemo">
               <button style="margin-right: 5px;" class="layui-btn layui-btn-sm layuiadmin-btn-list addClass" lay-event="add" >
                  <i class="layui-icon">&#xe654;</i>添加
               </button>
@@ -178,7 +199,7 @@
               <button style="margin-right: 5px;" id="daoru" class="layui-btn layui-btn-sm layuiadmin-btn-list DaoRuClass" lay-event="import" >
                  <i class="layui-icon">&#xe654;</i>导入
               </button>
            </script>
            </script> -->
            <script type="text/html" id="toolbarDemoList">
               {{# function GetBtn2(d){
@@ -226,36 +247,36 @@
         // 搜索方法
         form.on('submit(LAY-app-contlist-search)', function (data) {
            bindTable();
         });
            bindTable();
         });
         // 页面加载绑定Table
         bindTable();
         // 添加导入按钮单机事件
         table.on('toolbar(Box-list)', function (obj) {
            switch (obj.event) {
               case 'add':   // 添加箱支关系
                        // layer.open({
                        //     type: 2,
                        //     title: '自定义列',
                        //     content: '../SystemSettings/HeaderSetting.html',
                        //     maxmin: false,
                        //     resize: false,
                        //     area: ['970px', '650px']
                        // });
                        layer.open({
                            type: 2,
                            title: '打印',
                            content: 'LabelPrint.html?',
                            maxmin: true,
                            area: ['600px', '670px'],
                            btn: ['取消']
                        });
                  // layer.open({
                  //     type: 2,
                  //     title: '自定义列',
                  //     content: '../SystemSettings/HeaderSetting.html',
                  //     maxmin: false,
                  //     resize: false,
                  //     area: ['970px', '650px']
                  // });
                  layer.open({
                     type: 2,
                     title: '打印',
                     content: 'LabelPrint.html?',
                     maxmin: true,
                     area: ['600px', '670px'],
                     btn: ['取消']
                  });
                  break;
               default: break;
            }
         });
@@ -300,52 +321,51 @@
         // 查询录入的箱支关系
         //#region 自定义表头
         var TotalColsArr = [[
            {field: 'BoxNo',title: '箱号',align: 'center',fixed: 'left',width: 220, "disabled": true},
            {field: 'ParentBoxNo',title: '父级箱号',align: 'center',fixed: 'left',width: 220, "disabled": true},
            {field: 'SkuNo',title: '物料编码',align: 'center',fixed: 'left',width: 140, "disabled": true },
            {field: 'SkuName',title: '物料名称',align: 'center',width: 240,  },
                {field: 'Qty',title: '数量',align: 'center',width: 100,},
            {field: 'LotNo',title: '批次号',align: 'center',width: 155,},
            {field: 'LotText',title: '批次描述',align: 'center',width: 165},
                {field: 'AsnNo',title: '单据号',align: 'center',width: 155,},
                {field: 'IsUse',title: '是否使用',align: 'center',templet: '#templetIsUse',width: 90},
            {field: 'Level',title: '级别',align: 'center',width: 90},
            {field: 'ProductionTime',title: '生产日期',align: 'center',width: 160,templet: '#templetProductionTime'},
            {field: 'ExpirationTime',title: '过期日期',align: 'center',width: 160,templet: '#templetExpirationTime'},
            {field: 'InspectTime',title: '复验日期',align: 'center',width: 160,templet: '#templetInspectTime'},
            {field: 'CompleteTime',title: '完成日期',align: 'center',width: 160,templet: '#templetCompleteTime'},
            {field: 'SupplierName',title: '供应商',align: 'center',width: 155},
            {field: 'SupplierLot',title: '供货批次',align: 'center',width: 155},
                {field: 'CreateUserName',title: '创建人',align: 'center',width: 100},
                {field: 'CreateTime',title: '创建时间',align: 'center',width: 160,templet: '#templetCreateTime'},
                {field: 'caozuo',title: '操作',fixed: 'right',width: 100,align: 'center',toolbar: '#toolbarDemoList', "disabled": true}
            ]];
            //url编码
         var TotalColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
            { field: 'AsnNo', title: '入库单号', align: 'center', width: 155, "disabled": true },
            { field: 'BoxNo', title: '箱号', align: 'center', fixed: 'left', width: 220, "disabled": true },
            { field: 'ParentBoxNo', title: '父级箱号', align: 'center', fixed: 'left', width: 220, "disabled": true },
            { field: 'SkuNo', title: '物料编码', align: 'center', fixed: 'left', width: 140, "disabled": true },
            { field: 'SkuName', title: '物料名称', align: 'center', width: 240, },
            { field: 'Qty', title: '数量', align: 'center', width: 100, },
            { field: 'LotNo', title: '批次号', align: 'center', width: 155, },
            { field: 'LotText', title: '批次描述', align: 'center', width: 165 },
            { field: 'IsUse', title: '是否使用', align: 'center', templet: '#templetIsUse', width: 90 },
            { field: 'Level', title: '级别', align: 'center', width: 90 },
            { field: 'ProductionTime', title: '生产日期', align: 'center', width: 160, templet: '#templetProductionTime' },
            { field: 'ExpirationTime', title: '过期日期', align: 'center', width: 160, templet: '#templetExpirationTime' },
            { field: 'InspectTime', title: '复验日期', align: 'center', width: 160, templet: '#templetInspectTime' },
            { field: 'CompleteTime', title: '完成日期', align: 'center', width: 160, templet: '#templetCompleteTime' },
            { field: 'SupplierName', title: '供应商', align: 'center', width: 155 },
            { field: 'SupplierLot', title: '供货批次', align: 'center', width: 155 },
            { field: 'CreateUserName', title: '创建人', align: 'center', width: 100 },
            { field: 'CreateTime', title: '创建时间', align: 'center', width: 160, templet: '#templetCreateTime' },
            { field: 'caozuo', title: '操作', fixed: 'right', width: 100, align: 'center', toolbar: '#toolbarDemoList', "disabled": true }
         ]];
         //url编码
         var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
         //#endregion
         function bindTable() {
            //#region 自定义表头
            var colsJson
            var param1={
               Href:'BllAsn/GetLabelBoxList'
            var param1 = {
               Href: 'BllAsn/GetLabelBoxList'
            };
            sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function(res) {
               if (res.code == 0){
                  if(res.data=='' || res.data==undefined || res.data==null){
                     colsJson=TotalColsArr
                  }else{
                     colsJson= eval(res.data);
            sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function (res) {
               if (res.code == 0) {
                  if (res.data == '' || res.data == undefined || res.data == null) {
                     colsJson = TotalColsArr
                  } else {
                     colsJson = eval(res.data);
                  }
               }else{
                  colsJson=TotalColsArr
               } else {
                  colsJson = TotalColsArr
               }
               var param = {
                  BoxNo: $("#BoxNo").val(),
                  // BoxNo2: $("#BoxNo2").val(),
                  BoxNo3: $("#BoxNo3").val(),
                  SkuNo: $("#SkuNo").val(),
                  LotNo: $("#LotNo").val(),
@@ -353,7 +373,6 @@
                  ProductionTime: $("#ProductionTime").val(),
                  InspectMark: $("#InspectMark").val(),
                  BitBoxMark: $("#BitBoxMark").val(),
                  // Origin: "录入",
               };
               table.render({
                  elem: '#Box-list',
@@ -363,7 +382,6 @@
                  id: 'Box-list',
                  where: param,
                  contentType: 'application/json',
                  toolbar: '#toolbarDemo',
                  defaultToolbar: [], //'filter','print', 'exports'
                  headers: { ToKen: $.cookie('token') },
                  page: true,
@@ -374,7 +392,7 @@
                  done: function (res) {
                     setRight();
                     //自定义列宽
                     SetTableColW('Box-list','BllAsn/GetLabelBoxList',TotalColsSysArr);
                     SetTableColW('Box-list', 'BllAsn/GetLabelBoxList', TotalColsSysArr);
                  },
                  cols: colsJson
               });
@@ -420,7 +438,7 @@
            $(function () {
               $(".addClass").hide();
               $(".DaoRuClass").hide();
               $(".delClass").hide();
               $(".delClass").hide();
            });
            sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
               if (res.code == 0) { //成功 
@@ -437,7 +455,7 @@
                     }
                     if (res.data[k].MenuName == "删除箱支录入") {
                        $(function () {
                           $(".delClass").show();
                           $(".delClass").show();
                        });
                     }
                  }
@@ -460,13 +478,6 @@
               });
               return msg;
            }
            // if ($("#BoxNo2").val() == "") {
            //    layer.msg("请输入盒码!", {
            //       icon: 2,
            //       time: 2000 //2秒关闭(如果不配置,默认是3秒)
            //    });
            //    return msg;
            // }
            if ($("#BoxNo3").val() == "") {
               layer.msg("请输入支码!", {
                  icon: 2,
@@ -498,7 +509,6 @@
            var param = {
               BoxNo: $("#BoxNo").val(),
               // BoxNo2: $("#BoxNo2").val(),
               BoxNo3: $("#BoxNo3").val(),
               SkuNo: $("#SkuNo").val(),
               LotNo: $("#LotNo").val(),
@@ -586,17 +596,17 @@
                              doing = true
                           });
                        } else { //不成功
                           if(res.msg==undefined){
                           if (res.msg == undefined) {
                              layer.msg("后台正在导入中,请稍后查看结果", {
                                 icon: 2,
                                 time: 3000 //2秒关闭(如果不配置,默认是3秒)
                              }, function () { bindTable();doing = true });
                           }else{
                              }, function () { bindTable(); doing = true });
                           } else {
                              layer.msg(res.msg, {
                                 icon: 2,
                                 time: 2000 //2秒关闭(如果不配置,默认是3秒)
                              }, function () { bindTable();doing = true });
                           }
                              }, function () { bindTable(); doing = true });
                           }
                        }
                     });
                  });
@@ -610,18 +620,18 @@
         //#region 自定义表头
         //自定义表头         
         active = {
            customCols: function(){
            customCols: function () {
               layer.open({
                  type: 2,
                  title: '自定义列',
                  content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetLabelBoxList&ColsSysArr='+TotalColsSysArr,
                  content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetLabelBoxList&ColsSysArr=' + TotalColsSysArr,
                  maxmin: false,
                  resize: false,
                  area: ['970px', '650px']
               });
            },
         };
         $('.layui-btn').on('click', function() {
         $('.layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
         });