From 3d240d150e6e1a4e2df1a9f87d00ddd03ace4ee5 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 17 一月 2025 10:06:37 +0800
Subject: [PATCH] 增加 BOM层级展开报表,修复全程追溯报表 黑白标页签导出失败,工艺路线的表头查询优化页面排序

---
 WebTM/views/质量管理/工序检验单/QC_ProcessCheckBillList2.html |  131 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 124 insertions(+), 7 deletions(-)

diff --git "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\345\267\245\345\272\217\346\243\200\351\252\214\345\215\225/QC_ProcessCheckBillList2.html" "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\345\267\245\345\272\217\346\243\200\351\252\214\345\215\225/QC_ProcessCheckBillList2.html"
index d87af26..e96d123 100644
--- "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\345\267\245\345\272\217\346\243\200\351\252\214\345\215\225/QC_ProcessCheckBillList2.html"
+++ "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\345\267\245\345\272\217\346\243\200\351\252\214\345\215\225/QC_ProcessCheckBillList2.html"
@@ -221,8 +221,10 @@
                             </div>
                         </div>
                         <table class="" id="mainTable" lay-filter="mainTable"></table>
+                        <div id="page" style="position: relative; bottom: 0;"></div>
                         <script type="text/html" id="toolbarDemo">
                             <div class="layui-btn-container">
+                                <button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="btn_Export" id="btn_Export"><i class="layui-icon layui-icon-export"></i>瀵煎嚭</button>
                                 <button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="set_AddNew" lay-event="set_AddNew"><i class="layui-icon layui-icon-file-b"></i>鏂板</button>
                                 <button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="set_ShowBill" lay-event="set_ShowBill"><i class="layui-icon layui-icon-form"></i>缂栬緫</button>
                                 <button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="set_DeleteBill" lay-event="set_DeleteBill"><i class="layui-icon layui-icon-delete"></i>鍒犻櫎</button>
@@ -265,6 +267,9 @@
 
             var option = [];
             var sWhere = "";
+            var ins;                //鐢ㄤ簬瀵煎嚭excel
+            var page = 1;//鍒嗛〉鏁版嵁
+            var size = 50;
             var HModName = "QC_ProcessCheckBillList";
 
             //#region 銆愬姩鎬佽幏鍙栨ā鍧楀悕绉般��
@@ -274,7 +279,7 @@
             //#endregion
 
             //涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
-            var titleData = ["hmainid", "hentryid", "HEntryID", "HSourceID", "HMaterID", "HFirstCheckEmp", "HQCCheckItemID", "HUnitID", "HSampleSchemeID"];
+            var titleData = ["hmainid", "hentryid", "HEntryID", "HSourceID", "HMaterID", "HFirstCheckEmp", "HQCCheckItemID", "HUnitID", "HSampleSchemeID", "sorderid"];
 
             var sql = " ";
             //#endregion
@@ -305,6 +310,9 @@
 
             table.on('toolbar(mainTable)', function (obj) {
                 switch (obj.event) {
+                    //瀵煎嚭鎸夐挳
+                    case 'btn_Export': btn_Export();
+                        break;
                     //鏂板
                     case 'set_AddNew': set_AddNew();
                         break;
@@ -408,9 +416,17 @@
             //#region 鏌ヨ鎸夐挳
             form.on('submit(btnSearch)', function (data) {
                 if ($("#HProject").val() == 0) {
-                    get_FastQuery();
+                    if (page != 1) {
+                        $("#page a:eq(1)").get(0).click();//鐐瑰嚮鍒嗛〉鏍忕涓�椤�
+                    } else {
+                        get_FastQuery();
+                    }
                 } else {
-                    get_FastQuery(2);
+                    if (page != 1) {
+                        $("#page a:eq(1)").get(0).click();//鐐瑰嚮鍒嗛〉鏍忕涓�椤�
+                    } else {
+                        get_FastQuery(2);
+                    }
                 }
             });
             //#endregion
@@ -475,7 +491,7 @@
                     elem: '#mainTable'
                     , toolbar: '#toolbarDemo'
                     , height: 'full-50'
-                    , page: true
+                    , page: false
                     , sort: true  //閲嶇偣1锛氳繖閲岀殑sort琛ㄧず table琛ㄥ湪鍙栧緱鎺ュ彛鏁版嵁鍚庯紝瀵归〉闈㈡覆鏌撳悗鐨則able鏁版嵁杩涜鎺掑簭銆傚悓鏃讹紝杩欓噷鐨則rue 浼氬奖鍝嶉〉闈ort 涓婁笅灏忕澶寸殑 鏄剧ず鏁堟灉
                     , totalRow: true
                     //, cellMinWidth: 90
@@ -485,6 +501,24 @@
                         soulTable.render(this);
                     }
                 };
+                optionPage = {
+                    elem: 'page', //娉ㄦ剰锛岃繖閲岀殑 page 鏄� ID锛屼笉鐢ㄥ姞 # 鍙�
+                    count: 10000, //鏁版嵁鎬绘暟锛屼粠鏈嶅姟绔緱鍒�
+                    limit: 50,
+                    limits: [50, 500, 5000, 50000],
+                    layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
+                    jump: function (obj, first) {
+
+                        //棣栨涓嶆墽琛�
+                        if (!first) {
+                            //do something
+                            page = obj.curr;
+                            size = obj.limit;
+                            get_FastQuery();
+                        }
+                    }
+                }
+                laypage.render(optionPage);
             }
             //#endregion
             //#endregion  鐩戝惉缃戞牸琛ㄤ綋浜嬩欢
@@ -569,8 +603,8 @@
                                 , totalRow: true
                                 , height: 'full-50'
                                 , page: true //寮�鍚垎椤�
-                                , limit: 500
-                                , limits: [500, 2000, 5000, 20000]
+                                , limit: 50
+                                , limits: [50, 2000, 5000 ]
                                 , cols: [col]
                                 , data: data1.data
                                 , done: function (res, curr, count) {
@@ -580,6 +614,7 @@
                             //鍒濆鍖栬〃鏍�
                             DisPlay_HideColumn();
                             table.render(option);
+                            ins = table.render(option);
 
                             ColFilter();
                            
@@ -600,6 +635,78 @@
             }
             //#endregion
 
+            //#region 鍒嗛〉鏌ヨ
+            function get_DisplayPage(sqlWhere) {
+                var ajaxLoad = layer.load();
+                $.ajax({
+                    url: GetWEBURL() + '/QC_ProcessCheckMainBill/QC_ProcessCheckMainBillListPage',
+                    type: "GET",
+                    data: { "sWhere": sqlWhere, "user": sessionStorage["HUserName"], "page": page, "size": size },
+                    success: function (data1) {
+                        option.limit = size;//鏀瑰彉琛ㄦ牸椤靛ぇ灏�
+                        if (data1.code == 1) {
+                            optionPage.count = data1.count;//鏀瑰彉鍒楄〃鏁版嵁鎬绘暟
+                            var data = [];
+                            var col = [];
+                            //缁欑┖鐨勬暟缁勮祴鍊�
+                            for (var key in data1.list) {
+                                //鍔ㄦ�佽幏鍙栧垪琛ㄦ墍鏈夊垪鍚�
+                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
+                                //鑾峰彇涓嶉渶瑕佹樉绀虹殑鍒楋紙H寮�澶寸殑鍒椾笉鏄剧ず锛�
+                                var patrn = new RegExp(/^h/i);
+                                if (patrn.test(data1.list[key].ColmCols)) {
+                                    titleData[key] = data1.list[key].ColmCols;
+                                }
+                            }
+                            //鍦ㄥ垪琛ㄥ乏杈规坊鍔犲嬀閫夋
+                            col.push({ type: 'checkbox', fixed: 'left', totalRowText: '鍚堣' });
+                            for (var i = 0; i < data.length; i++) {
+                                if ($.inArray(data[i].name, titleData) > -1) {
+                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //闅愯棌id鍒�
+                                }
+                                else {
+                                    switch (data[i].Type) {
+                                        //int
+                                        case 'DateTime':
+                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 160 });
+                                            break;
+                                        case 'Decimal':
+                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140, totalRow: true });
+                                            break;
+                                        case 'Int32':
+                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140, totalRow: true });
+                                            break;
+                                        default:
+                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140 });
+                                    }
+                                }
+                            }
+
+                            columns = col;
+                            option.cols = [col];
+                            option.data = data1.data;
+                            option.totalRow = true;
+                            laypage.render(optionPage);
+                            ins = table.render(option);
+                            //鍒锋柊琛ㄦ牸鏁版嵁
+                            DisPlay_HideColumn();
+
+                            layer.close(ajaxLoad);
+                            if ($("#ColName option").length < 1) {
+                                ColFilter();
+                            }
+
+                        } else {
+                            layer.close(ajaxLoad);
+                            layer.alert(data1.code + data1.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.close(ajaxLoad);
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
 
             //#region 蹇�熻繃婊�
             function get_FastQuery(number) {
@@ -719,7 +826,9 @@
                         sqlWhere += " and 椤圭洰鍙� like '%" + HProject + "%'";
                     }
                 }
-                get_Display(sqlWhere);
+                //get_Display(sqlWhere);
+                //鏁版嵁搴撳垎椤垫煡璇�
+                get_DisplayPage(sqlWhere);
             }
             //#endregion
 
@@ -756,6 +865,14 @@
             }
             //#endregion
 
+
+            //#region 瀵煎嚭Execel
+            function btn_Export() {
+                table.exportFile(ins.config.id, option.data, "xls");
+            }
+            //#endregion
+
+
             //#region 鏂板
             function set_AddNew() {
                 layer.open({

--
Gitblit v1.9.1