From 570872d8ad64e8330399819cda7cb7643bf49cfb Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 29 四月 2025 15:45:17 +0800
Subject: [PATCH] 三升排产要料报表添加导出列设置功能

---
 WebTM/views/生产管理/三升排产/JIT_DayPlanPlatForm.html           |   46 ++++++++++++++++++++--
 WebTM/views/生产管理/日计划报表/ReportWorkDemandPlanBillList.html |   44 +++++++++++++++++++++-
 2 files changed, 83 insertions(+), 7 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\211\345\215\207\346\216\222\344\272\247/JIT_DayPlanPlatForm.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\211\345\215\207\346\216\222\344\272\247/JIT_DayPlanPlatForm.html"
index 3d0a844..440d099 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\211\345\215\207\346\216\222\344\272\247/JIT_DayPlanPlatForm.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\211\345\215\207\346\216\222\344\272\247/JIT_DayPlanPlatForm.html"
@@ -36,6 +36,7 @@
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnLockOrder" id="btnLockOrder">閿佸畾宸ュ崟</button>
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnUnlockOrder" id="btnUnlockOrder">瑙i攣宸ュ崟</button>
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnCompleteSetAnalysis" id="btnCompleteSetAnalysis">榻愬鍒嗘瀽</button>
+                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnYLYS" id="btnYLYS">瑕佹枡杩愮畻</button>
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnTLYS" id="btnTLYS">鎻愭枡杩愮畻</button>
                             <!--<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btn_Calculate" id="btn_Calculate">娆犳枡杩愮畻</button>-->
                             <!--<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnRoutEdit" id="btnRoutEdit">宸ヨ壓璺嚎</button>-->
@@ -725,7 +726,16 @@
                 })
             }
         })
-
+        //瑕佹枡杩愮畻
+        form.on('submit(btnYLYS)', function (data) {
+            layer.confirm('浣犵‘瀹氳鎵ц鎿嶄綔鍚楋紝璇峰厛纭繚鎺掍骇鏁版嵁宸蹭繚瀛橈紵', {
+                btn: ['纭畾', '鍙栨秷'] //鎸夐挳
+                , btn1: function (index, layero) {
+                    get_btnYLYS();
+                    layer.close(index);
+                }
+            })
+        })
         //鎻愭枡杩愮畻
         form.on('submit(btnTLYS)', function (data) {
             if (set_ModCheck("Sc_WorkBillSortBill_tlys") == true) {
@@ -2364,7 +2374,33 @@
                 }
             });
         }
-
+        //瑕佹枡杩愮畻
+        function get_btnYLYS() {
+            sWhere = {
+                HProdORGID: $("#HProdORGID").val()
+                , HWorkShopID: $("#HWorkShopID").val()
+            }
+            sWhere = JSON.stringify(sWhere);
+            var ajaxLoad = layer.load();
+            $.ajax({
+                url: GetWEBURL() + '/JIT_DayPlanPlatFormBill/JIT_YLYS',
+                type: "GET",
+                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        get_FastQuery(2);
+                        layer.msg(data1.Message);
+                        layer.close(ajaxLoad);
+                    } else {
+                        layer.close(ajaxLoad);
+                        layer.alert(data1.Message, { icon: 5 });
+                    }
+                }, error: function () {
+                    layer.close(ajaxLoad);
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            });
+        }
         //鎻愭枡杩愮畻
         function get_btnTLYS() {
             if ($("#HWorkShopID").val() == 0) {
@@ -4133,7 +4169,6 @@
                             , limit: 200
                             , cellMinWidth: 90
                         }
-                        table.render(option2);
 
                         //鍒锋柊琛ㄦ牸鏁版嵁
                         DisPlay_HideColumn_ICMO();
@@ -4382,6 +4417,7 @@
             $.ajax({
                 url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                 type: "GET",
+                async: false,
                 data: { "HModName": HModName + "Main", "user": sessionStorage["HUserName"] },
                 success: function (data1) {
                     if (data1.data.length != 0) {
@@ -4452,9 +4488,9 @@
                                 option2.cols[0][i + 1]["fixed"] = "left";
                             }
                         }
-                        table.render(option2);
+                        /*table.render(option2);*/
                     } else {
-                        table.render(option2);
+                        /*table.render(option2);*/
                     }
                 }, error: function () {
                     layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\346\212\245\350\241\250/ReportWorkDemandPlanBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\346\212\245\350\241\250/ReportWorkDemandPlanBillList.html"
index dce7ecf..753bb1f 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\346\212\245\350\241\250/ReportWorkDemandPlanBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\346\212\245\350\241\250/ReportWorkDemandPlanBillList.html"
@@ -12,6 +12,7 @@
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script src="../../../layuiadmin/PubCustom.js"></script>
     <script src="../../../layuiadmin/soulTable.slim.js"></script>
+    <script src="../../../layuiadmin/SetColumn.js"></script>
 </head>
 <body>
     <div class="layui-fluid">
@@ -159,6 +160,12 @@
                             </div>
                         </div>
                         <table class="" id="mainTable" lay-filter="mainTable"></table>
+                        <script type="text/html" id="toolbarDemo">
+                            <div class="layui-btn-container">
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="HideColumn"><i class="layui-icon layui-icon-form"></i>闅愯棌鍒楄缃�</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_export" id="get_export"><i class="layui-icon layui-icon-export"></i>瀵煎嚭</button>
+                            </div>
+                        </script>
                     </form>
                 </div>
             </div>
@@ -190,6 +197,8 @@
             , soulTable = layui.soulTable
         var sWhere = "";
         var option = [];
+        var HModName = "ReportWorkDemandPlanBill";
+        var ins = [];
         //#endregion
 
         //#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -200,6 +209,20 @@
         //#endregion
 
         //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
+
+        //澶村伐鍏锋爮浜嬩欢
+        table.on('toolbar(mainTable)', function (obj) {
+            switch (obj.event) {
+                //闅愯棌鍒楄缃�
+                case 'HideColumn':
+                    get_HideColumnNoPageForPlan(HModName, option, get_FastQuery);
+                    break;
+                //瀵煎嚭excel
+                case 'get_export':
+                    get_Export();
+                    break;
+            };
+        });
 
         //#region 浜у搧缂栫爜
         form.on('submit(btnHMATERIALID)', function (data) {
@@ -291,7 +314,7 @@
                     j = 0;
                 }
             }
-            columns.push({ field: '', title: '璁″垝鏄庣粏_鍚堣' });
+            columns.push({ field: '璁″垝鏄庣粏_鍚堣', title: '璁″垝鏄庣粏_鍚堣' });
 
             option = {
                 elem: '#mainTable'
@@ -333,6 +356,21 @@
             })
         }
 
+        function get_Export() {
+            var data = option.data;
+            data.forEach((item) => {
+                for (let itemobj in item) {
+                    if (item[itemobj] == null) {
+                        item[itemobj] = "";
+                    }
+                    if (item[itemobj].length > 0) {  // 鍋囪瀛楁鍚嶄负field
+                        item[itemobj] = item[itemobj].toString().replaceAll(/[\r\n]+/g, '');  // 灏嗘崲琛岀鏇挎崲涓虹┖瀛楃涓�
+                    }
+                }
+            });
+            table.exportFile(ins.config.id, data, "xls");
+        }
+
         //#region 鏌ヨ
         function get_Display(sWhere) {
             var ajaxLoad = layer.load();
@@ -343,7 +381,9 @@
                 success: function (result) {
                     if (result.count == 1) {
                         option.data = result.data;
-                        table.render(option);
+                        //鍒楄缃�
+                        DisPlay_HideColumnForPlan(HModName, sessionStorage["HUserName"], option);
+                        ins = table.render(option);
                         layer.close(ajaxLoad);
                         //layer.alert("鏌ヨ鎴愬姛", { icon: 1 });
                     } else {

--
Gitblit v1.9.1