From 43c633b50bc7dca4d78855e57546fe16e2e44562 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期一, 01 七月 2024 17:24:18 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/车间管理/报表分析/Kf_ProdProcessSumReport_DyeColor.html |  135 ++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 120 insertions(+), 15 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/Kf_ProdProcessSumReport_DyeColor.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/Kf_ProdProcessSumReport_DyeColor.html"
index 21e800a..498443b 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/Kf_ProdProcessSumReport_DyeColor.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/Kf_ProdProcessSumReport_DyeColor.html"
@@ -2,7 +2,7 @@
 <html>
 <head>
     <meta http-equiv="Content-Type" content="text/html; 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" content="width=device-width, initial-scale=1, maximum-scale=1">
@@ -59,19 +59,19 @@
                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                 </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-inline">
+                                <div class="layui-inline" style="display:none;">
                                     <label class="layui-form-label">鐧藉澂鍙戝竷鍚堣鍏枻鏁�</label>
                                     <div class="layui-input-block" style="margin-left: 120px;">
                                         <input type="text" class="layui-input" name="SumHMaterOutQty" id="SumHMaterOutQty" disabled="disabled">
                                     </div>
                                 </div>
-                                <div class="layui-inline">
+                                <div class="layui-inline" style="display:none;">
                                     <label class="layui-form-label">鏌撳巶鍑虹珯鍚堣鍏枻鏁�</label>
                                     <div class="layui-input-block" style="margin-left: 120px;">
                                         <input type="text" class="layui-input" name="SumDyeColorOut" id="SumDyeColorOut" disabled="disabled">
                                     </div>
                                 </div>
-                                <div class="layui-inline">
+                                <div class="layui-inline" style="display:none;">
                                     <label class="layui-form-label">宸</label>
                                     <div class="layui-input-block" style="margin-left: 120px;">
                                         <input type="text" class="layui-input" name="SumCompare" id="SumCompare" disabled="disabled">
@@ -143,6 +143,7 @@
                         <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="get_export" id="get_export"><i class="layui-icon layui-icon-export"></i>瀵煎嚭</button>
                                 <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="btn-detail"><i class="layui-icon layui-icon-return"></i>鏄庣粏鎶ヨ〃</button>
@@ -175,6 +176,10 @@
             var sWhere = "";
             var option = [];
             var HModName = "ProdProcessSumReport_DyeColor";
+
+            var titleData = ["HCusID"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+
+            var ins;                        //鐢ㄤ簬瀵煎嚭excel
             //#endregion
 
             //#region 杩涘叆椤甸潰鏃㈠姞杞�
@@ -188,6 +193,10 @@
             //澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
                 switch (obj.event) {
+                    //瀵煎嚭excel
+                    case 'get_export':
+                        get_Export();
+                        break;
                     //閫�鍑�
                     case 'btn-exit': Pub_Close(2);
                         break;
@@ -228,6 +237,42 @@
                 });
             });
 
+            //琛岀洃鍚簨浠�-鍙屽嚮
+            table.on('rowDouble(mainTable)', function (obj) {
+                //閫変腑楂樹寒 鍙屽嚮琛�
+                obj.tr.find(':checkbox').prop('checked', true);
+                obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //璁剧疆澶嶉�夋閫変腑鏍峰紡
+                $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//鏀瑰彉褰撳墠tr鑳屾櫙棰滆壊鍜屽瓧浣撻鑹�
+                //mainTable 涓鸿〃鏍糏D   娉ㄦ剰姝ゅ濡傛灉ID涓嶆纭皢瀵艰嚧浣犲湪鐩戝惉澶嶉�夋鏃惰幏鍙栦笉鍒颁綘閫夋嫨鐨勬暟鎹紝鍓嶉潰鐨勫彧鏄坊鍔犳垨鍒犻櫎閫変腑鏈�変腑鏍峰紡浠ュ強璁剧疆鑳屾櫙鑹诧紝瀛椾綋棰滆壊
+                layui.each(table.cache.mainTable, function (i, l) {
+                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
+                        l.LAY_CHECKED = true;
+                    }
+                });
+
+                //涓嬫帹
+                var sBillNo = obj.data["鐢熶骇璁㈠崟鍙�"];
+                layer.open({
+                    type: 2
+                    , area: ['90%', '90%']
+                    , title: '鏌撳巶鏄庣粏鎶ヨ〃'
+                    , closeBtn: 1
+                    , shade: 0.6 //閬僵閫忔槑搴�
+                    , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                    , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                    , content: 'Kf_ProdProcessEntryReport_DyeColor.html?sBillNo=' + sBillNo
+                    , resize: false
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , end: function () {
+                        //鍒锋柊椤甸潰,
+                        //location.reload();
+                    }
+                    , cancel: function () {
+                        //$(".layui-btn").removeClass("layui-btn-disabled");
+                    }
+                })
+
+            });
 
             //#endregion
 
@@ -283,6 +328,10 @@
                     com = " and (" + ColName + " " + com + ")";
                 }
 
+                //鏍规嵁鐢ㄦ埛杩囨护鐢ㄦ埛鍏宠仈瀹㈡埛鐨勮褰�
+                var OtherSearch = getSWhereByHUser();
+
+
                 sWhere = {
                     HBeginDate: HBeginDate
                     , HEndDate: HEndDate
@@ -291,6 +340,7 @@
                     , HProductName: HProductName
                     , HProductModel: HProductModel
                     , RandomSearch: com
+                    , OtherSearch: (OtherSearch == null || OtherSearch == "undefine") ? " and 1=1 " : OtherSearch
                 }
                 sWhere = JSON.stringify(sWhere);
 
@@ -299,12 +349,12 @@
                     url: GetWEBURL() + "/ProdProcessSumReport/ProdProcessSumReport_DyeColor",
                     type: "GET",
                     async: false,
-                    data: { "sWhere": sWhere },
+                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]  },
                     //async: false,
                     success: function (data1) {
 
                         if (data1.count == 1) {
-
+                            var totalArray = ["鐢熶骇浠诲姟鍗曟暟閲�", "鐧藉澂鍙戝竷"];
                             var data = [];
                             var col = [];
                             //缁欑┖鐨勬暟缁勮祴鍊�
@@ -315,8 +365,11 @@
                             //鍦ㄥ垪琛ㄥ乏杈规坊鍔犲嬀閫夋
                             col.push({ type: 'checkbox', fixed: 'left' });
                             for (var i = 0; i < data.length; i++) {
-                                if ($.inArray(data[i].name, "") > -1) {
+                                if ($.inArray(data[i].name, titleData) > -1) {
                                     col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //闅愯棌id鍒�
+                                }
+                                else if ($.inArray(data[i].name, totalArray) > -1) {
+                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                 }
                                 else if (data[i].ColName == '鐧藉澂鍙戝竷') {
                                     col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
@@ -342,7 +395,7 @@
                                 , cols: [col]
                                 , data: data1.data
                             };
-                            table.render(option);
+                            ins = table.render(option);
                         } else {
                             option = {
                                 elem: '#mainTable'
@@ -360,14 +413,14 @@
                                     , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 160 }
                                     , { field: '涓氬姟鍛�', title: '涓氬姟鍛�', width: 160 }
                                     , { field: '瀹㈡埛', title: '瀹㈡埛', width: 160 }
-                                    , { field: '鐢熶骇浠诲姟鍗曟暟閲�', title: '鐢熶骇浠诲姟鍗曟暟閲�', width: 200 }
+                                    , { field: '鐢熶骇浠诲姟鍗曟暟閲�', title: '鐢熶骇浠诲姟鍗曟暟閲�', totalRow: true, width: 200 }
                                     , { field: '鐧藉澂鍙戝竷', title: '鐧藉澂鍙戝竷', width: 160, totalRow: true }
                                     , { field: '鏄惁涓嬫帹鐢熸垚娴佽浆鍗�', title: '鏄惁涓嬫帹鐢熸垚娴佽浆鍗�', width: 160 }
                                 ]]
                                 , done: function (res) {
                                 }
                             };
-                            table.render(option);
+                            ins = table.render(option);
                         }
                     },
                     error: function (err) {
@@ -401,7 +454,7 @@
                 $.ajax({
                     url: GetWEBURL() + '/ProdProcessSumReport/ProdProcessSumReport_DyeColor',
                     type: "GET",
-                    data: { "sWhere": sWhere },
+                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]  },
                     success: function (data1) {
                         if (data1.count == 1) {
                             //璋冩暣鏃ユ湡鏍煎紡锛氭樉绀� 骞存湀鏃� 鍜� 鏃�
@@ -424,7 +477,7 @@
                             //        }
                             //    }
                             //}
-                            table.render(option);
+                            ins = table.render(option);
 
                             //璁$畻鐧藉澂鍙戝竷鍚堣鍏枻鏁�
                             var sumHMaterOutQty = 0;
@@ -496,14 +549,19 @@
                     com = " and (" + ColName + " " + com + ")";
                 }
 
+                //鏍规嵁鐢ㄦ埛杩囨护鐢ㄦ埛鍏宠仈瀹㈡埛鐨勮褰�
+                var OtherSearch = getSWhereByHUser();
+
+
                 sWhere = {
                     HBeginDate: HBeginDate
                     , HEndDate: HEndDate
-                    ,HMaterNumber: HMaterNumber
+                    , HMaterNumber: HMaterNumber
                     , HBillNo: HBillNo
                     , HProductName: HProductName
                     , HProductModel: HProductModel
-                    , RandomSearch:com
+                    , RandomSearch: com
+                    , OtherSearch: (OtherSearch == null || OtherSearch == "undefine") ? " and 1=1 " : OtherSearch
                 }
                 //set_InitGrid(JSON.stringify(sWhere));
                 get_Display(JSON.stringify(sWhere));
@@ -527,6 +585,27 @@
                 sWhere = "";
             }
 
+            //#region 瀵煎嚭Execel
+            function get_Export() {
+                var ModRightNameCheck = "Kf_ProdProcessSumReport_DyeColor_ExportExcel";
+
+                //閫昏緫瀹℃牳鏂规硶
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/LMES/getReportByModRightNameCheck", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "ModRightNameCheck": ModRightNameCheck, "user": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            table.exportFile(ins.config.id, option.data, "xls");
+                        } else {
+                            layer.alert("褰撳墠妯″潡娌℃湁瀵煎嚭鏉冮檺!", { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
 
             //闅愯棌鍒楄缃�
             function get_HideColumn() {
@@ -566,7 +645,7 @@
                         if (data1.data.length != 0) {
 
                             var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
-                            var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+                            /*var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�*/
 
                             dataCol = data1.data[0].HGridString.split(',');
 
@@ -664,6 +743,32 @@
                     layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒');
                 }
             }
+
+
+            //#region 鏍规嵁鐢ㄦ埛鑾峰彇鐢ㄦ埛鍏宠仈瀹㈡埛鐨勮繃婊ゆ潯浠�
+            function getSWhereByHUser() {
+                var res = "";
+                $.ajax({
+                    type: "GET",
+                    async: false,
+                    url: GetWEBURL() + "/Xs_SeOrderBill/getCusIDListByUser", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "CurUserID": sessionStorage["Czybm"], "CurUserName": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            res = result.data;
+                        } else {
+                            res = result.data;
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function (err) {
+                        res = " and 1 = 0";
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+                res = res.replaceAll("'", "''");
+                return res;
+            }
+            //#endregion
             //#endregion
         });
     </script>

--
Gitblit v1.9.1