From b5b6e591e419b5af414c5c97df2f842314e086a0 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 27 十一月 2024 11:57:39 +0800
Subject: [PATCH] 项目变更流程回显bug

---
 src/views/projectProcess/components/RunProcess.vue |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/src/views/projectProcess/components/RunProcess.vue b/src/views/projectProcess/components/RunProcess.vue
index 24e17a8..94d5327 100644
--- a/src/views/projectProcess/components/RunProcess.vue
+++ b/src/views/projectProcess/components/RunProcess.vue
@@ -10,7 +10,7 @@
       <div>
         <div style="display: flex; flex-direction: row; justify-content: center; align-items: center;font-size: 24px">
           <div>褰撳墠娴佺▼锛�</div>
-          <div v-if="nowProcessId">{{nowProcessName}}</div>
+          <div v-if="nowProcessId">{{selectProcessName}}</div>
           <div v-else>鏈粦瀹氭祦绋�</div>
         </div>
       </div>
@@ -103,43 +103,47 @@
     nowProcessId: {  // 褰撳墠椤圭洰缁戝畾鐨勬祦绋媔d
       required: true,
       type: String
-    },
-    nowProcessName: {
-      required: true,
-      type: String
     }
   },
   watch: {
     // 鐩戝惉鍥炴樉鍊�
-    nowProcessId(newVal, oldVal) {
-      console.log("浼犲叆鍊硷細", newVal, this.processList)
-      this.processList.forEach((item,index) => {
-        console.log(item.id, newVal, item.id === newVal)
-        if(item.id === newVal){
-          console.log("wwwwwww")
-          this.selectProcessId = newVal
-          this.$nextTick(() => {
-            this.$refs.myTable.toggleRowSelection(item);
-          })
-        }
-      })
+    projectInfo: {
+      handler(newVal, oldVal) {
+        console.log("浼犲叆鍊硷細", newVal, this.processList)
+        this.setSelect(this.nowProcessId)
+      },
+      deep: true
     }
   },
   data() {
     return {
       selectProcessId: '',  // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d
+      selectProcessName: '',  // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d
     }
   },
   methods: {
+    setSelect(value) {
+      console.log("璋冪敤鍊硷細", value)
+      this.processList.forEach((item,index) => {
+        console.log(item.id, value, item.id === value)
+        if(item.id === value){
+          this.selectProcessName = item.name
+          this.$nextTick(() => {
+            this.$refs.myTable.toggleRowSelection(item);
+          })
+        }
+      })
+    },
     // 瀹炵幇el-table鍗曢��
     handleSelectionChange(val) {
       console.log(val, "閫変腑")
       if (val.length > 1) {
         this.$refs.myTable.clearSelection();
-        this.$refs.myTable.toggleRowSelection(val.pop());
+        this.$refs.myTable.toggleRowSelection(val[val.length - 1]);
       }
       if(val.length != 0){
         this.selectProcessId = val[val.length - 1].id;
+        console.log("閫変腑id锛�", this.selectProcessId)
       }
     },
     // 鍚姩娴佺▼
@@ -162,6 +166,8 @@
       })
     },
     handleClose() {
+      this.selectProcessId = ""
+      this.selectProcessName = ""
       this.$emit("close")
     }
   }

--
Gitblit v1.8.0