From 525f81fcd55370add2d607d1ffbfc390fa6298bb Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期日, 03 三月 2024 18:34:09 +0800
Subject: [PATCH] 根据用户关联客户显示数据:优化

---
 WebTM/views/车间管理/报表分析/Kf_ProdProcessSumReport_DyeColor.html |   99 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 88 insertions(+), 11 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..a0e15dd 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"
@@ -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">
@@ -175,6 +175,8 @@
             var sWhere = "";
             var option = [];
             var HModName = "ProdProcessSumReport_DyeColor";
+
+            var titleData = ["HCusID"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
             //#endregion
 
             //#region 杩涘叆椤甸潰鏃㈠姞杞�
@@ -228,6 +230,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 +321,10 @@
                     com = " and (" + ColName + " " + com + ")";
                 }
 
+                //鏍规嵁鐢ㄦ埛杩囨护鐢ㄦ埛鍏宠仈瀹㈡埛鐨勮褰�
+                var OtherSearch = getSWhereByHUser();
+
+
                 sWhere = {
                     HBeginDate: HBeginDate
                     , HEndDate: HEndDate
@@ -291,6 +333,7 @@
                     , HProductName: HProductName
                     , HProductModel: HProductModel
                     , RandomSearch: com
+                    , OtherSearch: (OtherSearch == null || OtherSearch == "undefine") ? " and 1=1 " : OtherSearch
                 }
                 sWhere = JSON.stringify(sWhere);
 
@@ -299,12 +342,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 +358,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 });
@@ -360,7 +406,7 @@
                                     , { 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 }
                                 ]]
@@ -401,7 +447,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) {
                             //璋冩暣鏃ユ湡鏍煎紡锛氭樉绀� 骞存湀鏃� 鍜� 鏃�
@@ -496,14 +542,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));
@@ -566,7 +617,7 @@
                         if (data1.data.length != 0) {
 
                             var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
-                            var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+                            /*var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�*/
 
                             dataCol = data1.data[0].HGridString.split(',');
 
@@ -664,6 +715,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