From 6e0eb5e49b8a8914c87f6b1997f39cc92b3c6777 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期五, 20 六月 2025 10:12:31 +0800
Subject: [PATCH] 隐藏列设置 添加拖拽观察者,实现拖拽时其他内容不选中

---
 WebTM/WebTM.csproj.user                          |    2 +-
 WebTM/views/基础资料/隐藏列设置/Gy_GridView_Hide_New.html |   35 ++++++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/WebTM/WebTM.csproj.user b/WebTM/WebTM.csproj.user
index cbf1153..2f7c57c 100644
--- a/WebTM/WebTM.csproj.user
+++ b/WebTM/WebTM.csproj.user
@@ -4,7 +4,7 @@
     <NameOfLastUsedPublishProfile>D:\鏅轰簯杩堟�漒MES\MES-WEB-LayUI\WebTM\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
     <NameOfLastUsedPublishProfile>D:\WorkBench\MES-WEB-LayUI\WebTM\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
     <ProjectView>ShowAllFiles</ProjectView>
-    <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
+    <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
     <UseIISExpress>true</UseIISExpress>
     <Use64BitIISExpress />
     <IISExpressSSLPort />
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide_New.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide_New.html"
index 5fe9ac1..067f331 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide_New.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide_New.html"
@@ -12,6 +12,7 @@
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script src="../../../layuiadmin/PubCustom.js"></script>
     <script src="../../../layuiadmin/soulTable.slim.js"></script>
+    <script src="../../../layuiadmin/zy_DragObserver.js"></script>
     <style>
         /* 闃叉涓嬫媺妗嗙殑涓嬫媺鍒楄〃琚殣钘�---蹇呴』璁剧疆--- */
         /*.layui-table-cell {
@@ -377,6 +378,8 @@
                         }
                         form.render('checkbox');
                         form.render('select');
+
+                        registerDragObserver()
                         layer.close(ajaxLoad);
                     } else {
                         var colTitleNames = colTitleName.split(',');
@@ -435,7 +438,8 @@
                         console.log(table.cache["mainTable"]) // 鏀瑰姩鍚庢暟鎹储寮�
                     }
                 }
-                , done: function () {
+                , done: function (res, curr, count) {
+
                     soulTable.render(this)
                 }
             };
@@ -530,10 +534,35 @@
             })
         }
 
+        //// 娉ㄥ唽鎷栨嫿瑙傚療鑰咃紝鐩戝惉琛ㄦ牸鎷栨嫿鍙樺寲
+        function registerDragObserver() {
+
+            // 濡傛灉涓嶆敮鎸侊紝鍒欎粈涔堥兘涓嶆墽琛�
+            if (typeof window.MutationObserver === 'undefined'
+                && typeof window.WebKitMutationObserver === 'undefined') {
+                console.warn('observer not supported')
+                return
+            }
+            let targetEl = $(".layui-table-box")[0];
+            let config = { attributes: true, childList: true, subtree: true };
+            let observer = new MutationObserver(mutations => {
+                mutations.forEach(function (mutation) {
+                    if (mutation.attributeName === 'class') {
+                        // 鐩戝惉class涓唴瀹圭殑鍙樺寲
+                        if ($(mutation.target).hasClass('noselect')) {
+                            document.documentElement.style.userSelect = 'none';
+                            document.documentElement.style.webkitUserSelect = 'none';
+                        } else {
+                            document.documentElement.style.userSelect = '';
+                            document.documentElement.style.webkitUserSelect = '';
+                        }
+                    }
+                })
+            })
+            observer.observe(targetEl, config);
+        }
 
         //#endregion
 
     });
-
-
 </script>
\ No newline at end of file

--
Gitblit v1.9.1