From eb676ae326e4e4de2ce09c1e26e2f2fd20724498 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 06 六月 2024 15:00:37 +0800
Subject: [PATCH] 修改密码界面调整

---
 north-glass-erp/northglass-erp/src/hook/mouseMove.ts |  126 ++++++++++++++++++++++++++++++++---------
 1 files changed, 97 insertions(+), 29 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/hook/mouseMove.ts b/north-glass-erp/northglass-erp/src/hook/mouseMove.ts
index 7701139..ed86577 100644
--- a/north-glass-erp/northglass-erp/src/hook/mouseMove.ts
+++ b/north-glass-erp/northglass-erp/src/hook/mouseMove.ts
@@ -11,7 +11,12 @@
 //鑾峰彇椤甸潰ref鑺傜偣
 //鑾峰彇vxetable琛ㄦ牸鑺傜偣
 let xGrid = ref()
-let cellarea = ref()
+let cellarea = ref(`
+    <div class="vxe-table--cell-area"  >
+      <span  class="vxe-table--cell-main-area"  ></span>
+      <span class="vxe-table--cell-active-area"  ></span>
+    </div>
+`)
 let leftfixedcellarea = ref()
 let rightfixedcellarea = ref()
 const getTablexGrid = () => {
@@ -19,12 +24,19 @@
 }
 
 //娣诲姞浜嬩欢
-const addListener = (xGrids,gridOption,cellareas) => {
+const addListener = (xGrids,gridOption) => {
     xGrid.value = xGrids
     gridOptions = gridOption
-    cellarea.value = cellareas
+    let newElement = document.createElement('div')
+    const parser = new DOMParser();
+    const htmlDoc = parser.parseFromString(cellarea.value, 'text/html')
+    newElement.innerHTML = htmlDoc.body.innerHTML
+    //cellarea.value = newElement
     //娣诲姞澶氶�夊垪
     nextTick(() => {
+        window.addEventListener("keypress", ()=>{
+            destroyAreaBox()
+        })
         window.addEventListener("mousedown", tableOutDestroyAreaBox)//缁檞indow娣诲姞榧犳爣鎸変笅浜嬩欢,鍒ゆ柇鏄惁鍦ㄨ〃鏍煎,鏄攢姣�
         window.addEventListener("mouseup", tbodymouseup)//缁檞indow娣诲姞榧犳爣鏉惧紑浜嬩欢
         let tbody = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper table tbody")//鑾峰彇tbody鍖哄煙
@@ -39,7 +51,7 @@
         let bodyWrapper = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper .vxe-table--body-wrapper")//鑾峰彇姝e父鍖哄煙鐨刡ody
         if (bodyWrapper) {
             //娉ㄦ剰杩欓噷鐨剅ef鍚嶇О锛岃繖閲屾槸闈瀎ixed鍖哄煙鐨勬鐨勫悕绉�
-            bodyWrapper.appendChild(cellarea.value)//娣诲姞鑼冨洿妗嗗厓绱�
+            bodyWrapper.appendChild(newElement)//娣诲姞鑼冨洿妗嗗厓绱�
             // let geticon = document.getElementById("getIcon")
             // geticon.addEventListener("click", ()=>{
             //     alert(2)
@@ -299,6 +311,7 @@
     }
 }
 
+
 //琛ㄦ牸澶栭攢姣佽寖鍥存
 const tableOutDestroyAreaBox = (event: MouseEvent) => {
     var element = getTablexGrid().$el.querySelector(".vxe-table--render-wrapper")
@@ -390,17 +403,17 @@
 
 
             // //杩欓噷闇�瑕佹槸visibleData
-            // let tableData = getTablexGrid().getTableData().visibleData//鑾峰彇澶勭悊鏉′欢涔嬪悗鐨勫叏閲忚〃浣撴暟鎹�
-            // let rowStart = selectionStart.rowIndex//鑾峰彇閫変腑璧峰琛岀储寮�
-            // let rowEnd = selectionEnd.rowIndex//鑾峰彇閫変腑缁撴潫琛岀储寮�
-            // let selectRows = tableData.filter((col, index: number) => {//col鍙傛暟涓嶈兘鏀瑰惁鍒欎細鑾峰彇涓嶅埌鏁版嵁
-            //     //杩欓噷淇敼浠庡彸涓嬪線宸︿笂鎷栧姩鐨勬暟鎹樉绀�
-            //     if (rowStart <= rowEnd) {
-            //         return rowStart <= index && rowEnd >= index
-            //     } else {
-            //         return rowStart >= index && rowEnd <= index
-            //     }
-            // })
+            let tableData = getTablexGrid().getTableData().visibleData//鑾峰彇澶勭悊鏉′欢涔嬪悗鐨勫叏閲忚〃浣撴暟鎹�
+            let rowStart = selectionStart.rowIndex//鑾峰彇閫変腑璧峰琛岀储寮�
+            let rowEnd = selectionEnd.rowIndex//鑾峰彇閫変腑缁撴潫琛岀储寮�
+            let selectRows = tableData.filter((col, index: number) => {//col鍙傛暟涓嶈兘鏀瑰惁鍒欎細鑾峰彇涓嶅埌鏁版嵁
+                //杩欓噷淇敼浠庡彸涓嬪線宸︿笂鎷栧姩鐨勬暟鎹樉绀�
+                if (rowStart <= rowEnd) {
+                    return rowStart <= index && rowEnd >= index
+                } else {
+                    return rowStart >= index && rowEnd <= index
+                }
+            })
             // console.log("榧犳爣閫変腑琛�:", JSON.stringify(selectRows))
 
             //杩欓噷闇�瑕佹槸visibleColumn
@@ -414,29 +427,84 @@
                 } else {
                     return colStart >= index && colEnd <= index
                 }
-
             })
-            return  {
-                start:selectionStart.rowIndex,
-                end : selectionEnd.rowIndex,
-                cell:selectCols[0].field
+
+
+            let result=null
+            if(selectRows.length===0){
+                return false
             }
+            result =  {
+                start:selectionStart.rowIndex,//寮�濮嬭
+                end: selectionEnd.rowIndex,//缁撴潫琛�
+                cell:selectCols[0].field,//閫変腑鍒楋紝
+                row:selectRows
+            }
+
+            selectionStart.rowIndex=-1
+            selectionStart.cellIndex=-1
+            selectionEnd.rowIndex=-1
+            selectionEnd.cellIndex=-1
+
+            return  result
             //console.log("榧犳爣閫変腑鍒�:", JSON.stringify(selectCols))
 
 
 }
+const exportData = () => {
+    // //杩欓噷闇�瑕佹槸visibleData
+    let tableData = getTablexGrid().getTableData().visibleData//鑾峰彇澶勭悊鏉′欢涔嬪悗鐨勫叏閲忚〃浣撴暟鎹�
+    let rowStart = selectionStart.rowIndex//鑾峰彇閫変腑璧峰琛岀储寮�
+    let rowEnd = selectionEnd.rowIndex//鑾峰彇閫変腑缁撴潫琛岀储寮�
+    let selectRows = tableData.filter((col, index: number) => {//col鍙傛暟涓嶈兘鏀瑰惁鍒欎細鑾峰彇涓嶅埌鏁版嵁
+        //杩欓噷淇敼浠庡彸涓嬪線宸︿笂鎷栧姩鐨勬暟鎹樉绀�
+        if (rowStart <= rowEnd) {
+            return rowStart <= index && rowEnd >= index
+        } else {
+            return rowStart >= index && rowEnd <= index
+        }
+    })
 
+    //杩欓噷闇�瑕佹槸visibleColumn
+    let colStart = selectionStart.cellIndex//鑾峰彇閫変腑璧峰鍒楃储寮�
+    let colEnd = selectionEnd.cellIndex//鑾峰彇閫変腑缁撴潫鍒楃储寮�
+    let tableColumn = getTablexGrid().getTableColumn().visibleColumn//鑾峰彇澶勭悊鏉′欢涔嬪悗鐨勫叏閲忚〃澶村垪
+    let selectCols = tableColumn.filter((col, index: number) => {//col鍙傛暟涓嶈兘鏀瑰惁鍒欎細鑾峰彇涓嶅埌鏁版嵁
+        //杩欓噷淇敼浠庡彸涓嬪線宸︿笂鎷栧姩鐨勬暟鎹樉绀�
+        if (colStart <= colEnd) {
+            return colStart <= index && colEnd >= index
+        } else {
+            return colStart >= index && colEnd <= index
+        }
+    })
+    let data = []
+    let title = []
+    selectCols.forEach((col, index) => {
+        title.push(col['title'])
+    })
+    data.push(title)
 
+    selectRows.forEach((row, index) => {
+        let rowData = []
+        selectCols.forEach((col, index) => {
+            const parts = col['property'].split('.')
+            let result = row
+            for (const part of parts) {
+                if (result && result[part] !== undefined) {
+                    result = result[part];
+                } else {
+                    return null;
+                }
+            }
+            rowData.push(result)
+        })
+        data.push(rowData)
+    })
+    return  data
 
-
-
-
-
-
-
-
-
+}
 export {
     addListener,
-    toolbarButtonClickEvent
+    toolbarButtonClickEvent,
+    exportData
 }
\ No newline at end of file

--
Gitblit v1.8.0