yyk
2024-08-22 1310b47a24f0cc70f0128c820bd490dca6a1a921
HTML/views/ASNSetting/ProcurePlanNotice.html
@@ -17,13 +17,16 @@
         height: auto;
         line-height: 23px;
      }
      .layui-table-tool-panel{
      .layui-table-tool-panel {
         top: auto;
         bottom: 29px;
      }
      .layui-table-tool{
      .layui-table-tool {
         padding-left: 5px;
      }
      /* 表格下拉小箭头隐藏 */
      .layui-table-grid-down {
         display: none;
@@ -31,14 +34,14 @@
   </style>
   <script>
      // 这里是需要在页面渲染之前执行的代码
      document.addEventListener("DOMContentLoaded", function() {
      document.addEventListener("DOMContentLoaded", function () {
         //获取table默认显示数
         pageCntFirst();
         console.log(pageCnt)
         //判断是否开启table列表列宽调整功能。
         GetIsSetColW();
      });
     </script>
   </script>
</head>
<body id="body">
@@ -46,18 +49,6 @@
      <div class="layui-card">
         <div class="layui-form layui-card-header layuiadmin-card-header-auto" id="top">
            <div class="layui-form-item">
               <div class="layui-inline">
                  <label class="layui-form-label">执行状态</label>
                  <div class="layui-input-inline">
                     <select name="Status" id="Status" lay-filter="Status" lay-search>
                        <option value=""></option>
                        <option value="0">等待执行</option>
                        <option value="1">正在执行</option>
                        <option value="2">执行完成</option>
                        <option value="3">订单关闭</option>
                     </select>
                  </div>
               </div>
               <div class="layui-inline">
                  <label class="layui-form-label">物料编码</label>
                  <div class="layui-input-inline">
@@ -71,14 +62,27 @@
                     <input type="text" id="SkuName" name="SkuName" placeholder="物料名称" autocomplete="off"
                        class="layui-input">
                  </div>
               </div>
                    <div class="layui-inline">
               </div>
               <div class="layui-inline">
                  <label class="layui-form-label">客户名称</label>
                  <div class="layui-input-inline">
                     <input type="text" id="CustomerName" name="CustomerName" placeholder="客户名称" autocomplete="off"
                     class="layui-input">
                     <input type="text" id="CustomerName" name="CustomerName" placeholder="客户名称"
                        autocomplete="off" class="layui-input">
                  </div>
               </div>
               </div>
               <div class="layui-inline">
                  <label class="layui-form-label">执行状态</label>
                  <div class="layui-input-inline">
                     <select name="Status" id="Status" lay-filter="Status" lay-search>
                        <option value=""></option>
                        <option value="0">等待执行</option>
                        <option value="1">正在执行</option>
                        <option value="2">执行完成</option>
                        <option value="3">订单关闭</option>
                     </select>
                  </div>
               </div>
               <div class="layui-inline">
                  <label class="layui-form-label">开始日期</label>
                  <div class="layui-input-inline">
@@ -103,7 +107,7 @@
            </div>
         </div>
         <div id="center">
         <div id="center">
         </div>
         <div class="layui-card-body">
@@ -251,14 +255,14 @@
      }).extend({
         index: 'lib/index' //主入口模块
      }).use(['index', 'table', 'laypage', 'layer', 'laydate'], function () {
         var doing = true;
         var table = layui.table,
            form = layui.form,
            laypage = layui.laypage,
            layer = layui.layer;
         laydate = layui.laydate;
         laydate.render({
@@ -269,44 +273,45 @@
            elem: '#EndTime'
            , format: 'yyyy-MM-dd' //可任意组合
         });
         var h1 = GetTableTopHeight();
         var h2 = GetTableBottomHeight();
         refreshTable();
         refreshTablemx(0);
         refreshTablemx(0);
         //渲染总单   
         //#region 自定义表头
         var TotalColsArr = [[
                  {field: '',title: '序号',type:'numbers',width: 50,align: 'center',fixed: 'left', "disabled": true},
                  {field: 'OrderCode',title: '采购单号',align: 'center'},
                  {field: 'Status',title: '执行状态',align: 'center',templet: '#buttonTpl'},
                  {field: 'CompleteTime',title: '完成时间',align: 'center',templet: '#templetCompleteTime'},
                  {field: 'CreateUserName',title: '创建人',align: 'center',width: 110},
                  {field: 'CreateTime',title: '创建时间',align: 'center',templet: '#templetCreateTime'},
                  {field: 'UpdateUserName',title: '修改人',align: 'center',width: 110},
                  {field: 'UpdateTime',title: '修改时间',align: 'center',templet: '#templetUpdateTime'},
                  {field: 'caozuo',title: '操作',fixed: 'right',width: 280,align: 'center',toolbar: '#toolbarDemo1', "disabled": true}
               ]];
         var TotalColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
            { field: '', title: '序号', type: 'numbers', width: 50, align: 'center', fixed: 'left', "disabled": true },
            { field: 'OrderCode', title: '采购单号', align: 'center' },
            { field: 'Status', title: '执行状态', align: 'center', templet: '#buttonTpl' },
            { field: 'CompleteTime', title: '完成时间', align: 'center', templet: '#templetCompleteTime' },
            { field: 'UserName', title: '制单人', align: 'center', width: 110 },
            { field: 'CreateUserName', title: '创建人', align: 'center', width: 110 },
            { field: 'CreateTime', title: '下发时间', align: 'center', templet: '#templetCreateTime' },
            { field: 'UpdateUserName', title: '修改人', align: 'center', width: 110 },
            { field: 'UpdateTime', title: '修改时间', align: 'center', templet: '#templetUpdateTime' },
            //{ field: 'caozuo', title: '操作', fixed: 'right', width: 280, align: 'center', toolbar: '#toolbarDemo1', "disabled": true }
         ]];
         var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
         //#endregion
         function refreshTable() {
            //#region 自定义表头
            var colsJson
            var param1={
               Href:'BllAsn/GetProcurePlanNoticeList'
            var param1 = {
               Href: 'BllAsn/GetProcurePlanNoticeList'
            };
            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 = {
                  ASNNo: $("#ASNNo").val(),
@@ -316,7 +321,7 @@
                  LotNo: $("#LotNo").val(),
                  SkuNo: $("#SkuNo").val(),
                  SkuName: $("#SkuName").val(),
                  StartTime:$("#StartTime").val(),
                  StartTime: $("#StartTime").val(),
                  EndTime: $("#EndTime").val()
               };
               table.render({
@@ -326,17 +331,19 @@
                  height: h1,
                  id: 'LAY-app-content-list',
                  where: param,
                  contentType: 'application/json',
                  headers:{ToKen:$.cookie('token')},
                  headers: { ToKen: $.cookie('token') },
                  page: true,
                  even: true,
                  limit: pageCnt,
                  limits: pageLimits,
                  cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                  done: function(res) {
                     setRight();
                  done: function (res) {
                     console.log(res);
                     setRight();
                     //自定义列宽
                     SetTableColW('LAY-app-content-list','BllAsn/GetProcurePlanNoticeList',TotalColsSysArr);
                     SetTableColW('LAY-app-content-list', 'BllAsn/GetProcurePlanNoticeList', TotalColsSysArr);
                  },
                  cols: colsJson
               });
@@ -345,52 +352,52 @@
         }
         // 入库单table单机事件
         table.on('row(LAY-app-content-list)', function(obj) {
         table.on('row(LAY-app-content-list)', function (obj) {
            refreshTablemx(obj.data.Id);
         });
            //渲染明细
         //渲染明细
         //#region 自定义表头
         var DetailColsArr = [[
                  {field: '',title: '序号',type:'numbers',width: 50,align: 'center',fixed: 'left', "disabled": true},
                  {field: 'OrderDetailCode',title: '采购单行号',align: 'center',width: 100},
                  {field: 'CustomerName',title: '供应商名称',align: 'center'},
                  {field: 'SkuNo',title: '物料编码',align: 'center',width: 100},
                  {field: 'SkuName',title: '物料名称',align: 'center',width: 200},
                  {field: 'Standard',title: '物料规格',align: 'center',width: 130},
                  {field: 'Qty',title: '数量',align: 'center',width: 70},
                  {field: 'CompleteQty',title: '完成数量',align: 'center',width: 90},
                  {field: 'CompleteTime',title: '完成时间',align: 'center', width: 160,templet: '#templetCompleteTime2'},
                  {field: 'UnitName',title: '计量单位',align: 'center',width: 90},
                  {field: 'Price',title: '单价',align: 'center',width: 65},
                  {field: 'Money',title: '金额',align: 'center',width: 65},
                  {field: 'PackagName',title: '包装名称',align: 'center',width: 110,},
                  {field: 'CreateUserName',title: '创建人',align: 'center',width: 100},
                  {field: 'CreateTime',title: '创建时间',align: 'center',width: 160,templet: '#templetCreateTime2'},
                  {field: 'UpdateUserName',title: '修改人',align: 'center',width: 150,},
                  {field: 'UpdateTime',title: '修改时间',align: 'center',width: 150,templet: '#templetUpdateTime3'},
                  {field: 'caozuo',title: '操作',fixed: 'right',align: 'center',toolbar: '#toolbarDemoList', "disabled": true}
               ]];
         var DetailColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(DetailColsArr)))//将表头数据进行url编码
            { field: '', title: '序号', type: 'numbers', width: 50, align: 'center', fixed: 'left', "disabled": true },
            { field: 'OrderDetailCode', title: '采购单行号', align: 'center', width: 100 },
            { field: 'CustomerName', title: '供应商名称', align: 'center' },
            { field: 'SkuNo', title: '物料编码', align: 'center', width: 100 },
            { field: 'SkuName', title: '物料名称', align: 'center', width: 200 },
            { field: 'Standard', title: '物料规格', align: 'center', width: 130 },
            { field: 'Qty', title: '数量', align: 'center', width: 70 },
            { field: 'CompleteQty', title: '完成数量', align: 'center', width: 90 },
            { field: 'CompleteTime', title: '完成时间', align: 'center', width: 160, templet: '#templetCompleteTime2' },
            //{ field: 'UnitName', title: '计量单位', align: 'center', width: 90 },
            //{ field: 'Price', title: '单价', align: 'center', width: 65 },
            //{ field: 'Money', title: '金额', align: 'center', width: 65 },
            { field: 'PackagName', title: '包装名称', align: 'center', width: 110, },
            { field: 'CreateUserName', title: '创建人', align: 'center', width: 100 },
            { field: 'CreateTime', title: '创建时间', align: 'center', width: 160, templet: '#templetCreateTime2' },
            { field: 'UpdateUserName', title: '修改人', align: 'center', width: 150, },
            { field: 'UpdateTime', title: '修改时间', align: 'center', width: 150, templet: '#templetUpdateTime3' },
            //{ field: 'caozuo', title: '操作', fixed: 'right', align: 'center', toolbar: '#toolbarDemoList', "disabled": true }
         ]];
         var DetailColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(DetailColsArr)))//将表头数据进行url编码
         //#endregion
         function refreshTablemx(parentId) {
            //#region 自定义表头
            var colsJson2
            var param1={
               Href:'BllAsn/GetProcurePlanNoticeDetailList'
            var param1 = {
               Href: 'BllAsn/GetProcurePlanNoticeDetailList'
            };
            sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function(res) {
               if (res.code == 0){
                  if(res.data=='' || res.data==undefined || res.data==null){
                     colsJson2=DetailColsArr
                  }else{
                     colsJson2= eval(res.data);
            sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function (res) {
               if (res.code == 0) {
                  if (res.data == '' || res.data == undefined || res.data == null) {
                     colsJson2 = DetailColsArr
                  } else {
                     colsJson2 = eval(res.data);
                  }
               }else{
                  colsJson2=DetailColsArr
               }
               } else {
                  colsJson2 = DetailColsArr
               }
               var param = {
                  ParentId:parentId
                  ParentId: parentId
               };
               table.render({
                  elem: '#LAY-app-content-list2',
@@ -401,41 +408,40 @@
                  where: param,
                  contentType: 'application/json',
                  //toolbar:'#toolbarDemo',
                  defaultToolbar:  [], //'filter','print', 'exports'
                  headers:{ToKen:$.cookie('token')},
                  defaultToolbar: [], //'filter','print', 'exports'
                  headers: { ToKen: $.cookie('token') },
                  page: true,
                  limit: pageCnt,
                  limits: pageLimits,
                  cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                  done: function() {
                  done: function () {
                     setRight()
                     //自定义列宽
                     SetTableColW('LAY-app-content-list2','BllAsn/GetProcurePlanNoticeDetailList',DetailColsSysArr);
                  },
                     SetTableColW('LAY-app-content-list2', 'BllAsn/GetProcurePlanNoticeDetailList', DetailColsSysArr);
                  },
                  cols: colsJson2
               });
            });
            //#endregion
         }
         function setRight()
         {
            $(function() {
         function setRight() {
            $(function () {
               $(".clossClass").hide();//关单
               $(".createClass").hide();//生成入库单
            });
            sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function(res) {
               if (res.code == 200) { //成功
            sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
               if (res.code == 0) { //成功
                  for (var k = 0; k < res.data.length; k++) {
                     if (res.data[k].MenuName == "生成入库单") {
                        $(function() {
                        $(function () {
                           $(".createClass").show();
                        });
                     }
                     if (res.data[k].MenuName == "关闭采购单") {
                        $(function() {
                           $(".clossClass").show();
                        $(function () {
                           $(".clossClass").show();
                        });
                     }
                  }
@@ -443,7 +449,7 @@
                  layer.msg('获取权限信息失败', {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  }, function() {});
                  }, function () { });
               }
            });
         }
@@ -451,21 +457,20 @@
         // 页面监控,点击查询加载入库总单
         form.on('submit(LAY-app-contlist-search)', function (data) {
            refreshTable();
            refreshTablemx();
            refreshTablemx();
         });
         var ImportId = 0;
         table.on('tool(LAY-app-content-list)', function (obj) {
            var data = obj.data;
            switch(obj.event)
            {
               case "closs" :
            switch (obj.event) {
               case "closs":
                  // 代码区域
                  layer.confirm('确定关闭此单据吗?', function(index) {
                  layer.confirm('确定关闭此单据吗?', function (index) {
                     // 代码区域
                     var param = {
                        Id:data.Id,
                        Id: data.Id,
                     };
                     sendData(IP + "/BllAsn/CloseProcurePlan", param, 'post', function (res) {
                        if (res.code == 0) { //成功
@@ -485,22 +490,21 @@
                     });
                  });
                  break;
               default:break;
                  break;
               default: break;
            }
         });
         //明细表操作栏事件
         table.on('tool(LAY-app-content-list2)', function (obj) {
            var data = obj.data;
            var id = data.Id;
            switch(obj.event)
            {
               case "createOrd" :
            switch (obj.event) {
               case "createOrd":
                  // 代码区域
                  layer.confirm('确定生成入库单据吗?', function(index) {
                  layer.confirm('确定生成入库单据吗?', function (index) {
                     // 代码区域
                     var param = {
                        Id:data.Id,
                        Id: data.Id,
                     };
                     sendData(IP + "/BllAsn/CreateAsnByProcurePlan", param, 'post', function (res) {
                        if (res.code == 0) { //成功
@@ -521,28 +525,28 @@
                  });
                  break;
               default:break;
               default: break;
            }
         });
         //#region 自定义表头
         //自定义表头         
         active = {
            customCols: function(){
            customCols: function () {
               layer.open({
                  type: 2,
                  title: '自定义列',
                  content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetProcurePlanNoticeList&ColsSysArr='+TotalColsSysArr,
                  content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetProcurePlanNoticeList&ColsSysArr=' + TotalColsSysArr,
                  maxmin: false,
                  resize: false,
                  area: ['970px', '650px']
               });
            },
            customCols2: function(){
            customCols2: function () {
               layer.open({
                  type: 2,
                  title: '自定义列',
                  content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetProcurePlanNoticeDetailList&ColsSysArr='+DetailColsSysArr,
                  content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetProcurePlanNoticeDetailList&ColsSysArr=' + DetailColsSysArr,
                  maxmin: false,
                  resize: false,
                  area: ['970px', '650px']
@@ -550,7 +554,7 @@
            }
         };
         $('.layui-btn').on('click', function() {
         $('.layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
         });