From 3bd61bd433fb39fedecd33f8f7e8e0d4d059ce1d Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 19 八月 2025 18:11:28 +0800
Subject: [PATCH] 华远:报表折线图

---
 WebTM/views/车间管理/报表分析/Mes_OrderProcFlowAllReport.html |  272 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 211 insertions(+), 61 deletions(-)

diff --git "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/Mes_OrderProcFlowAllReport.html" "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/Mes_OrderProcFlowAllReport.html"
index cbc9e0b..3751d26 100644
--- "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/Mes_OrderProcFlowAllReport.html"
+++ "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/Mes_OrderProcFlowAllReport.html"
@@ -49,6 +49,12 @@
                                     </div>
                                 </div>
                                 <div class="layui-inline">
+                                    <label class="layui-form-label">閮ㄩ棬鍚嶇О</label>
+                                    <div class="layui-input-block">
+                                        <input type="text" class="layui-input" id="txtHDeptName" style="width:190px;">
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
                                     <div class="layui-input-block">
                                         <input type="checkbox" name="chkHShowUnFinish" id="chkHShowUnFinish" lay-skin="primary" lay-filter="chkHShowUnFinish" title="鍙樉绀烘湭瀹屽伐">
                                     </div>
@@ -58,6 +64,7 @@
                                 </button>
                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">閲嶇疆</button>
                                 <div class="layui-colla-content" style="padding: 0px; margin-left: 6%;">
+
                                 </div>
                             </div>
                         </div>
@@ -65,7 +72,8 @@
                         <script type="text/html" id="toolbarDemo">
                             <div class="layui-btn-container">
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>閫�鍑�</button>
-                                <!--<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="set_HideColumn" id="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>
@@ -95,6 +103,7 @@
             var sWhere = "";
             var option = [];
             var HModName = "Mes_OrderProcFlowAllReport";
+            var ins;
             //#endregion
 
             //#region 杩涘叆椤甸潰鏃㈠姞杞�
@@ -112,8 +121,24 @@
                     case 'btn-exit': Pub_Close(2);
                         break;
                     //闅愯棌鍒楄缃�
-                    case 'HideColumn':
+                    case 'set_HideColumn':
                         get_HideColumn();
+                        break;
+                    //瀵煎嚭excel
+                    case '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, '').replaceAll(',','锛�');  // 灏嗘崲琛岀鏇挎崲涓虹┖瀛楃涓�
+                                }
+                            }
+                        });
+
+                        table.exportFile(ins.config.id, option.data, "xls");
                         break;
                 };
             });
@@ -143,6 +168,8 @@
                 //鍔犺浇鏁版嵁鍒扮綉鏍�
                 get_FastQuery();
                 //DisPlay_HideColumn();
+
+                //ColFilter();
             }
 
             //鍒濆鍖栬〃鏍�
@@ -194,7 +221,8 @@
                             }
                             option.cols = [col];
                             option.data = data1.data;
-                            table.render(option);
+                            ins = table.render(option);
+                            DisPlay_HideColumn();
                             layer.close(wait);
                         } else {
                             layer.close(wait);
@@ -211,12 +239,87 @@
             function get_FastQuery() {
                 var txtHOrderProcNo = $("#txtHOrderProcNo").val();//璁㈠崟璺熻釜鍙�
                 var txtHMaterNumber = $("#txtHMaterNumber").val(); //鐗╂枡
+                var txtHDeptName = $("#txtHDeptName").val(); //鐗╂枡
                 var chkHShowUnFinish = $("input[name='chkHShowUnFinish']").prop("checked");//澶嶉�夋
                 var check = "";
                 if (chkHShowUnFinish) {
                     check = "Y";
                 }
-                sWhere = "'" + txtHOrderProcNo + "','" + txtHMaterNumber + "','" + check + "'";
+                var ColName = $("#ColName").val();//澶嶉�夋
+                var Comparator = $("#Comparator").val()
+                var ColContent = $("#ColContent").val();
+                var ColName1 = $("#ColName1").val();//澶嶉�夋
+                var Comparator1 = $("#Comparator1").val()
+                var ColContent1 = $("#ColContent1").val();
+                var ColName2 = $("#ColName2").val();//澶嶉�夋
+                var Comparator2 = $("#Comparator2").val()
+                var ColContent2 = $("#ColContent2").val();
+
+                if (ColName != 0 && Comparator != 0) {
+                    var com = "";
+                    switch (Comparator) {
+                        case "7":
+                            com = "like'%" + ColContent + "%'";
+                            break;
+                        case "8":
+                            com = "like'%" + ColContent + "'";
+                            break;
+                        case "9":
+                            com = "like'" + ColContent + "%'";
+                            break;
+                        case "10":
+                            com = "not like'%" + ColContent + "%'";
+                            break;
+                        default:
+                            com = "" + Comparator + "'" + ColContent + "'";
+                            break;
+                    }
+                    sWhere += " and " + ColName + " " + com;
+                }
+
+                if (ColName1 != 0 && Comparator1 != 0) {
+                    var com1 = "";
+                    switch (Comparator1) {
+                        case "7":
+                            com1 = "like'%" + ColContent1 + "%'";
+                            break;
+                        case "8":
+                            com1 = "like'%" + ColContent1 + "'";
+                            break;
+                        case "9":
+                            com1 = "like'" + ColContent1 + "%'";
+                            break;
+                        case "10":
+                            com1 = "not like'%" + ColContent1 + "%'";
+                            break;
+                        default:
+                            com1 = "" + Comparator1 + "'" + ColContent1 + "'";
+                            break;
+                    }
+                    sWhere += " and " + ColName1 + " " + com1;
+                }
+                if (ColName2 != 0 && Comparator2 != 0) {
+                    var com2 = "";
+                    switch (Comparator2) {
+                        case "7":
+                            com2 = "like'%" + ColContent2 + "%'";
+                            break;
+                        case "8":
+                            com2 = "like'%" + ColContent2 + "'";
+                            break;
+                        case "9":
+                            com2 = "like'" + ColContent2 + "%'";
+                            break;
+                        case "10":
+                            com2 = "not like'%" + ColContent2 + "%'";
+                            break;
+                        default:
+                            com2 = "" + Comparator + "'" + ColContent + "'";
+                            break;
+                    }
+                    sWhere += " and " + ColName2 + " " + com2;
+                }
+                sWhere = "'" + txtHOrderProcNo + "','" + txtHMaterNumber + "','" + check + "'" + ",'" + txtHDeptName + "'";
                 get_Display(sWhere);
                 //璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
                 sWhere = "";
@@ -226,12 +329,38 @@
             function set_ClearQuery() {
                 $("#txtHOrderProcNo").val("");
                 $("#txtHMaterNumber").val("");
+                $("#txtHDeptName").val("");
                 $("input[type='checkbox'][name='chkHShowUnFinish']").prop("checked", false);
-                form.render();
+                $("#ColContent").val("");
+                $("#ColName").val("0");
+                $("#Comparator").val("0");
+                $("#ColContent1").val("");
+                $("#ColName1").val("0");
+                $("#Comparator1").val("0");
+                $("#ColContent2").val("");
+                $("#ColName2").val("0");
+                $("#Comparator2").val("0");
+                form.render('select');
+               
                 sWhere = " ";
                 get_FastQuery();
             }
 
+            //鍒楁槑鏄剧ず涓嬫媺妗�
+            function ColFilter() {
+                var Organization = '<option  value="0" selected="selected" ></option>';
+                for (var i = 1; i < option.cols[0].length; i++) {
+                    if (option.cols[0][i].hide != true) {
+                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].title + '</option>';
+                    }
+                }
+                $("#ColName").empty();
+                $("#ColName").append(Organization); $("#ColName1").empty();
+                $("#ColName1").append(Organization); $("#ColName2").empty();
+                $("#ColName2").append(Organization);
+                form.render('select');
+            }
+            //#endregion
             //鐗╂枡
             function get_btnHMaterID() {
                 layer.open({
@@ -260,8 +389,8 @@
             //闅愯棌鍒楄缃�
             function get_HideColumn() {
                 var colName = "";
-                for (var i = 1; i < option.cols[0].length - 1; i++) {
-                    colName += option.cols[0][i]["title"] + ",";
+                for (var i = 1; i < option.cols[0].length; i++) {
+                    colName += option.cols[0][i]["field"] + ",";
                 }
 
                 colName = encodeURI(colName.substring(0, colName.length - 1));//瀵� URI 杩涜缂栫爜
@@ -273,7 +402,7 @@
                     , shift: 2 //寮瑰嚭鍔ㄧ敾
                     , area: ["50%", "90%"] //绐椾綋澶у皬
                     , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                    , content: ['../../鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
+                    , content: ['../../鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_GridView_Hide_New.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                     , btn: ["纭畾", "鍙栨秷"]
                     , btn1: function (index, laero) {
                         //鍒锋柊琛ㄦ牸鏁版嵁
@@ -309,65 +438,86 @@
                 $.ajax({
                     url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                     type: "GET",
+                    async: false,
                     data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                     success: function (data1) {
                         if (data1.data.length != 0) {
-
+                            titleData = [];
                             var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
-                            var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
-
+                            var newCols = [[]];//瀵瑰簲鏁版嵁搴撳垪椤哄簭col
+                            newCols[0].push(option.cols[0][0]);//鏀惧叆绗竴涓猚heckbox
                             dataCol = data1.data[0].HGridString.split(',');
-
-                            for (var i = 0; i < option.cols[0].length - 2; i++) {
-                                var dataCols = dataCol[i].split('|');
-                                //闅愯棌鍒�
-                                if (dataCols[1] == 1) {
-                                    option.cols[0][i + 1]["hide"] = true;
-                                }
-                                //璁剧疆鍐呭瀛椾綋澶у皬
-                                if (data1.data[0].HFontSize != 0) {
-                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
-                                } else {
-                                    option.cols[0][i + 1]["style"] = "font-size:100%";
-                                }
-                                //璁剧疆鍒楀
-                                if (dataCols[3] > 0) {
-                                    option.cols[0][i + 1]["width"] = dataCols[3];
-                                }
-                                //鏄剧ず鍒�
-                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
-                                    option.cols[0][i + 1]["hide"] = false;
-                                }
-                                //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�)
-                                switch (dataCols[2]) {
-                                    case "L":
-                                        option.cols[0][i + 1]["align"] = "left";
-                                        break;
-                                    case "M":
-                                        option.cols[0][i + 1]["align"] = "center";
-                                        break;
-                                    case "R":
-                                        option.cols[0][i + 1]["align"] = "right";
-                                        break;
-                                }
-                            }
-
-                            //鍙栨秷鍐荤粨鍒�
-                            for (var i = 1; i < option.cols[0].length - 1; i++) {
-                                if (option.cols[0][i]["fixed"] != null) {
-                                    option.cols[0][i]["fixed"] = null;
-                                }
-                                else {
-                                    break;
-                                }
-                            }
-                            //鍐荤粨鍒�
-                            if (data1.data[0].HFixCols != 0) {
-                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
-                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
-                                        data1.data[0].HFixCols += 1;
+                            //鍒楄缃垪鏁颁笌椤甸潰鍒楁暟鏄惁涓�鑷�
+                            if (dataCol.length == option.cols[0].length - 1) {
+                                //閬嶅巻瀵绘壘鍒楄缃搴斿垪鎸夐『搴忔彃鍏�
+                                for (var j = 0; j < option.cols[0].length - 1; j++) {
+                                    for (var i = 0; i < option.cols[0].length - 1; i++) {
+                                        var dataCols = dataCol[j].split('|');
+                                        //閫夋嫨涓巇atacols鐩稿簲鍒楄繘琛屼慨鏀�
+                                        if (option.cols[0][i + 1]["field"] == dataCols[5]) {
+                                            //闅愯棌鍒�
+                                            if (dataCols[1] == 1) {
+                                                option.cols[0][i + 1]["hide"] = true;
+                                            }
+                                            //璁剧疆鍒楀
+                                            if (dataCols[3] > 0) {
+                                                option.cols[0][i + 1]["width"] = dataCols[3];
+                                            }
+                                            //璁剧疆鍐呭瀛椾綋澶у皬
+                                            if (data1.data[0].HFontSize != 0) {
+                                                option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
+                                            } else {
+                                                option.cols[0][i + 1]["style"] = "font-size:100%";
+                                            }
+                                            //鏄剧ず鍒�
+                                            if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
+                                                option.cols[0][i + 1]["hide"] = false;
+                                            }
+                                            //缁熻鍒�
+                                            if (dataCols[6] == 1) {
+                                                option.cols[0][i + 1]["totalRow"] = true;
+                                            }
+                                            //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�)
+                                            switch (dataCols[2]) {
+                                                case "L":
+                                                    option.cols[0][i + 1]["align"] = "left";
+                                                    break;
+                                                case "M":
+                                                    option.cols[0][i + 1]["align"] = "center";
+                                                    break;
+                                                case "R":
+                                                    option.cols[0][i + 1]["align"] = "right";
+                                                    break;
+                                            }
+                                            //璁剧疆琛ㄦ牸title灞炴�ф樉绀哄埆鍚�
+                                            if (dataCols[4] != null && dataCols[4] != "") {
+                                                option.cols[0][i + 1]["title"] = dataCols[4];
+                                            }
+                                            newCols[0].push(option.cols[0][i + 1]);
+                                        }
                                     }
-                                    option.cols[0][i + 1]["fixed"] = "left";
+                                }
+                                //閬嶅巻寰幆鍚庡垽鏂搴斿垪鏁版槸鍚︿竴鑷�
+                                if (dataCol.length == newCols[0].length - 1) {
+                                    option.cols = newCols;
+                                    //鍙栨秷鍐荤粨鍒�
+                                    for (var i = 1; i < option.cols[0].length - 1; i++) {
+                                        if (option.cols[0][i]["fixed"] != null) {
+                                            option.cols[0][i]["fixed"] = null;
+                                        }
+                                        else {
+                                            break;
+                                        }
+                                    }
+                                    //鍐荤粨鍒�
+                                    if (data1.data[0].HFixCols != 0) {
+                                        for (var i = 0; i < data1.data[0].HFixCols; i++) {
+                                            if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
+                                                data1.data[0].HFixCols += 1;
+                                            }
+                                            option.cols[0][i + 1]["fixed"] = "left";
+                                        }
+                                    }
                                 }
                             }
                             table.render(option);

--
Gitblit v1.9.1