From c3a4b9f7e3087df4feb897042e563b8d402497fc Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期一, 30 十二月 2024 09:25:45 +0800
Subject: [PATCH] 首巡末增加导出功能,修复出站单无法选着班次问题,报工台操作按钮动态化

---
 WebTM/views/IpadIndex.html |  203 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 191 insertions(+), 12 deletions(-)

diff --git a/WebTM/views/IpadIndex.html b/WebTM/views/IpadIndex.html
index 08080c2..bfb7897 100644
--- a/WebTM/views/IpadIndex.html
+++ b/WebTM/views/IpadIndex.html
@@ -72,6 +72,7 @@
             })
 
             TSLoad();
+            fetchButtonsData();
         });
         function TSLoad() {
             $("#topleft").html("");
@@ -162,7 +163,7 @@
                         html1 += '<span class="layui-icon layui-icon-addition imgicon0" onclick="Add(event,this,1)"></span>';
                         html1 += '</div>';
                         html1 += '</div>';
-                        $("#topleft").append(html1);
+                        $("#topleft").append(html1);                     
                     }
                 },
                 error: function (err) {
@@ -173,6 +174,187 @@
         }
         var HManagerID = 0;
         var HGroupID = 0;
+
+        //鍔犺浇褰撳墠鐢ㄦ埛鎸夐挳
+        function fetchButtonsData() {
+            $.ajax({
+                url: GetWEBURL() + '/ReportPlatForm/getButtonlist',
+                type: "GET",
+                data: { "user": sessionStorage["HUserName"] },
+                success: function (data1) {
+                    if (data1.data && data1.data.length > 0) {
+                        // 娓呯┖鐜版湁鍐呭
+                        $("#button-container").empty();
+                        var colClass = ''; // 鍔ㄦ�佽缃垪鐨勬牱寮�
+                        let largestColClass = 'layui-col-md4';  // 榛樿鏂板鎸夐挳澶у皬锛堝亣璁炬渶澶氭槸 3 涓寜閽竴鎺掞級
+                    
+                        // 閬嶅巻姣忎釜鎸夐挳鏁版嵁骞剁敓鎴愬搴旂殑 HTML
+                        data1.data.forEach(function (buttonData, index) {
+                            // 鏍规嵁 defaultSize 瀛楁閫夋嫨鍚堥�傜殑鍒楀 
+                            switch (buttonData.鎸夐挳澶у皬) {
+                                case '灏�':
+                                    colClass = 'layui-col-md3'; // 涓�鎺�4涓�
+                                    break;
+                                case '涓�':
+                                    colClass = 'layui-col-md4'; // 涓�鎺�3涓�
+                                    break;
+                                case '澶�':
+                                    colClass = 'layui-col-md6'; // 涓�鎺�2涓�
+                                    break;
+                                default:
+                                    colClass = 'layui-col-md4'; // 榛樿璁剧疆涓轰腑绛夊ぇ灏忥紙3涓竴鎺掞級
+                            }
+
+                            // 鏇存柊鏈�澶у垪瀹斤細鍙栨渶澶у垪瀹�
+                            if (colClass === 'layui-col-md6') {
+                                largestColClass = colClass; // 濡傛灉褰撳墠鍒楀鏄� 'layui-col-md6'锛岃鏄庢槸鏈�瀹界殑
+                            } else if (colClass === 'layui-col-md4' && largestColClass !== 'layui-col-md6') {
+                                largestColClass = colClass; // 榛樿鍒楀涓� 'layui-col-md4'锛屽皬浜� 'layui-col-md6'
+                            } else if (colClass === 'layui-col-md3' && largestColClass === 'layui-col-md4') {
+                                largestColClass = colClass; // 濡傛灉褰撳墠鍒楀鏄� 'layui-col-md3'锛屽皬浜� 'layui-col-md4'
+                            }
+
+                            var html = '';
+                            html += '<div class="' + colClass + '" id="btn' + index + '">';
+                            html += '    <div class="cnt bottomright" id="button' + index + '" onclick="' + buttonData.浜嬩欢鍚嶇О + '(event, this)">';
+                            html += '        <span class="layui-icon ' + buttonData.鍥炬爣 + ' imgicon"></span>';
+                            html += '        <span class="imgtitle">' + buttonData.鍚嶇О + '</span>';
+                            html += '    </div>';
+                            html += '    <span class="layui-icon layui-icon-delete delete" onclick="deleteButton(event, \'' + buttonData.HItemID + '\')"></span>'; // 淇敼鍒犻櫎鎸夐挳浜嬩欢锛屼紶閫� id1 鍜� id2
+                            html += '</div>';
+                            // 灏嗙敓鎴愮殑 HTML 杩藉姞鍒� #button-container
+                            $("#button-container").append(html);
+                        });
+
+                        // 娣诲姞涓�涓柊澧炴寜閽�
+                        var html1 = '';
+                        html1 += '<div class="layui-col-sm12 ' + largestColClass + '">';
+                        html1 += '    <div class="cnt bottomright">';
+                        html1 += '        <span class="layui-icon layui-icon-addition imgtitle" onclick="Add_Buttton(event,this,1)"></span>';
+                        html1 += '    </div>';
+                        html1 += '</div>';
+                      
+                        $("#button-container").append(html1);
+                    } else {
+                        // 濡傛灉娌℃湁鎸夐挳鏁版嵁锛屽睍绀洪粯璁ょ殑绌虹櫧鏂板鎸夐挳
+                        var html1 = '';
+                        html1 += '<div class="layui-col-sm12 layui-col-md4">';
+                        html1 += '    <div class="cnt bottomright">';
+                        html1 += '        <span class="layui-icon layui-icon-addition imgtitle" onclick="Add_Buttton(event,this,1)"></span>';
+                        html1 += '    </div>';
+                        html1 += '</div>';
+                        $("#button-container").append(html1);
+                    }
+                },
+                error: function (error) {
+                    console.log('鑾峰彇鎸夐挳鏁版嵁澶辫触', error);
+                }
+            });
+        }
+
+        // 鍒犻櫎鎸夐挳鐨勪簨浠跺鐞嗗嚱鏁�
+        function deleteButton(event, HItemID) {
+            event.stopPropagation(); // 闃叉浜嬩欢鍐掓场锛岄伩鍏嶈Е鍙戞寜閽殑鐐瑰嚮浜嬩欢
+            //閫昏緫鍒犻櫎鏂规硶
+            layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
+                $.ajax({
+                    url: GetWEBURL() + "/ReportPlatForm/DeleteButtonlist",
+                    type: "GET",
+                    data: { "HItemID": HItemID },
+                    dataType: "json",//鏁版嵁绫诲瀷鍙互涓� text xml json  script  jsonp
+                    success: function (data) {
+                        if (data.count > 0) {
+                            fetchButtonsData(); //鎵ц鏌ヨ杩囩▼
+                            layer.close(index);
+                            layer.msg(data.Message, { time: 1 * 2000, icon: 1 });
+                            return false;
+                        }
+                        else {
+                            layer.alert(data.Message, { time: 1 * 2000, icon: 5 });
+                            return false;
+                        }
+                    },
+                    error: function (err) {
+                        layer.alert(err.Message, { time: 1 * 2000, icon: 5 });
+                        return false;
+                    }
+                });
+            })
+        }
+
+        //娣诲姞鎸夐挳
+        function Add_Buttton(event, obj, i) {
+            event.stopPropagation();  //闃绘鍐掓场
+            //椤甸潰灞�-鑷畾涔�
+            layer.open({
+                type: 2 //姝ゅ浠frame涓句緥
+                , title: '鎸夐挳缁戝畾'
+                , area: ['90%', '90%']
+                , shadeClose: false //寮�鍚伄缃╁叧闂�
+                , shade: 0.5
+                , maxmin: true
+                , content: ['鐢熶骇绠$悊/鎶ュ伐骞冲彴鍔熻兘椤�/LineBind_Button.html', 'yes']
+                , btn: ['纭畾', '鍙栨秷']
+                , btn1: function (index, layero, e) {
+
+                    //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                    var body = layer.getChildFrame('body', index); //寰楀埌iframe椤电殑body鍐呭
+                    
+                    var HUserName = sessionStorage["HUserName"];
+                    var HButtonID = body.find("#HButtonID").val();
+                    var HButtonName = body.find("#HName").val();
+                    var HButtonSize = body.find("#HButtonSize").val();
+                    var HButtonOrder = body.find("#HButtonOrder").val();
+                    $.ajax(
+                        {
+                            url: GetWEBURL() + "/ReportPlatForm/AddButtonlist", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                            dataType: "json",
+                            type: "Get",
+                            async: false,
+                            data: {
+                                "HUserName": HUserName,
+                                "HButtonID": HButtonID,
+                                "HButtonName": HButtonName,
+                                "HButtonSize": HButtonSize,
+                                "HButtonOrder": HButtonOrder
+
+                            },
+                            success: function (data) {
+                                if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                    fetchButtonsData(); //鎵ц鏌ヨ杩囩▼
+                                    layer.close(index);
+                                    layer.msg(data.Message, { time: 1 * 2000, icon: 1 });
+                                    return false;
+                                }
+                                else {
+                                    layer.close(index);
+                                    layer.alert(data.Message, { icon: 5 });
+                                    return false;
+
+                                }
+                            },
+                            error: function (err) {
+                                layer.alert(err.Message, { time: 1 * 2000, icon: 5 });
+                                return false;
+                            }
+                        });
+                }
+                , btn2: function (index, layero) {
+                    //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                    //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                }
+
+                , zIndex: layer.zIndex //閲嶇偣1
+                , success: function (layero, index) {
+
+                }
+                , end: function () {
+
+                }
+            });
+
+        }
+
         //閫変腑璧勬簮
         function Check(obj, i) {
             wktag = 0;
@@ -428,9 +610,8 @@
 
                 }
             });
-
-        }
-
+        }       
+   
         //鍒犻櫎璧勬簮
         function Delete(event, obj, i) {
             event.stopPropagation();  //闃绘鍐掓场
@@ -580,10 +761,6 @@
         //闈炵┖楠岃瘉
         function AllowLoadData(body) {  //闈炵┖楠岃瘉
             var Result = true;
-            //if (body.find("#HUserName").val() == '' || body.find("#HUserName").val() == null) {
-            //    layer.msg("鐢ㄦ埛鍚嶄笉鑳戒负绌�!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-            //    return Result = false;
-            //}
             if (body.find("#HSourceID").val() == '' || body.find("#HSourceID").val() == null) {
                 layer.msg("鐢熶骇璧勬簮涓嶈兘涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                 return Result = false;
@@ -1487,8 +1664,8 @@
             <div class="layui-col-sm12 layui-col-md4">
                 <fieldset style="border: 1px solid #eee;box-shadow: 0 2px 5px 0 rgb(0 0 0 / 10%);">
                     <legend style="color: #5FB878">鎿嶄綔鍙�</legend>
-                    <div class="content4">
-                        <div class="layui-row layui-col-space10">
+                    <div class="content4" >
+                        <!--<div class="layui-row layui-col-space10">
                             <div class="layui-col-sm12 layui-col-md4" onclick="OpenWork(event,this)">
                                 <div class="cnt bottomright">
                                     <span class="layui-icon layui-icon-play imgicon"></span>
@@ -1635,9 +1812,11 @@
                                     <span class="layui-icon layui-icon-layer imgicon"></span>
                                     <span class="imgtitle">寮傚父楠屾敹</span>
                                 </div>
-                            </div>                          
-                        </div>
+                            </div>
+                        </div>-->
+                        <div class="layui-row layui-col-space10" id="button-container">
 
+                        </div>
                     </div>
                 </fieldset>
             </div>

--
Gitblit v1.9.1