From 2fe7eb79670f8d9a64a501596b18c4e098278c89 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 17 三月 2025 11:50:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/components/VisibilityToolbar/index.vue |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/components/VisibilityToolbar/index.vue b/src/components/VisibilityToolbar/index.vue
index 871a291..9471870 100644
--- a/src/components/VisibilityToolbar/index.vue
+++ b/src/components/VisibilityToolbar/index.vue
@@ -39,7 +39,7 @@
           </el-table-column>
           <el-table-column prop="date" label="鎺掑簭">
             <template slot-scope="scope">
-              <el-input-number v-model="scope.row.serialNumber" :min="0" style="width: 120px" @change="sortChange(scope.row, $event)"></el-input-number>
+              <el-input-number v-model="scope.row.sort" :min="0" style="width: 120px" @change="sortChange(scope.row, $event)"></el-input-number>
             </template>
           </el-table-column>
         </el-table>
@@ -129,7 +129,6 @@
       this.table = true;
     },
     switchChange(row) {
-      row.sort = row.serialNumber;
       if (row.visible === true){
         row.display = "1"
       }else {
@@ -139,17 +138,16 @@
         this.saveList.push(row)
       }else {
         let have = true;
-        this.saveList.forEach((item ,index)=>{
-          if (item.id === row.id){
-              item[index] =item;
+        let index = this.saveList.findIndex(item => item.id === row.id);
+        if (index !== -1){
+            this.saveList[index] = row;
             have =false;
-          }
-        })
+        }
+
         if (have){
           this.saveList.push(row)
         }
       }
-      console.log(this.saveList)
       this.$emit('update:columns', row);
     },
     handlePageChange(page) {
@@ -185,11 +183,12 @@
       if (this.saveList.length !== 0){
         saveHiddenList(CircularJSON.stringify(this.saveList)).then(res =>{
           this.$modal.msgSuccess("淇濆瓨鎴愬姛");
+          //鍒锋柊椤甸潰
+          this.$emit('update:resetSort');
         });
       }
     },
     sortChange(row, val) {
-      row.sort = row.serialNumber;
       if (row.visible === true){
         row.display = "1"
       }else {
@@ -199,12 +198,11 @@
         this.saveList.push(row)
       }else {
         let have = true;
-        this.saveList.forEach((item ,index)=>{
-          if (item.id === row.id){
-            item[index] =item;
-            have =false;
-          }
-        })
+        let index = this.saveList.findIndex(item => item.id === row.id);
+        if (index !== -1){
+          this.saveList[index] = row;
+          have =false;
+        }
         if (have){
           this.saveList.push(row)
         }
@@ -221,7 +219,6 @@
       //
       // // 鏍规嵁serialNumber瀵筺ewColumns杩涜鎺掑簭
       // this.cpList = this.cpList.sort((a, b) => a.serialNumber - b.serialNumber);
-      //
       // // 瑙﹀彂浜嬩欢閫氱煡鐖剁粍浠禼olumns宸叉洿鏂帮紙濡傛灉鐖剁粍浠堕渶瑕佺煡閬撹繖涓彉鍖栵級
       // this.$emit('update:sort', this.cpList);
       this.$emit('update:sort', row);

--
Gitblit v1.8.0