Эх сурвалжийг харах

修复审核页面中,动态组件一直保活,点击另一条审核页面只会出现第一次点击时的图片

Sanmu8 1 жил өмнө
parent
commit
d173ee65b4

+ 1 - 1
src/views/news/index.vue

@@ -252,7 +252,7 @@
             type="text"
             @click="handleDownOrUp(scope.row)"
             v-hasPermi="['business:NEWS:remove']"
-            >发布{{ scope.row.status }}</el-button
+            >发布</el-button
           >
           <el-button
             v-if="scope.row.status == 6"

+ 29 - 10
src/views/news/task/index.vue

@@ -1,7 +1,6 @@
 <template>
   <div>
     <el-tabs v-model="activeName">
-    
       <el-tab-pane label="详细信息" name="详细信息">
         <el-descriptions border>
           <el-descriptions-item label="活动名称">{{
@@ -28,7 +27,7 @@
             taskList.comments ? taskList.comments : "无"
           }}</el-descriptions-item>
         </el-descriptions>
-        
+
         <el-form
           ref="form"
           :model="taskList"
@@ -58,7 +57,6 @@
               </el-option>
             </el-select>
           </el-form-item>
-
           <el-form-item label="封面图" prop="picture" disabled>
             <el-upload
               action="#"
@@ -105,13 +103,18 @@
       </el-tab-pane>
       <el-tab-pane label="审批记录" name="审批记录">
         <el-timeline>
-
-          <el-timeline-item v-for="(item,index) in taskList.taskHisAction" :timestamp="item.createTime" placement="top" :key="index+'taskHisAction'">
+          <el-timeline-item
+            v-for="(item, index) in taskList.taskHisAction"
+            :timestamp="item.createTime"
+            placement="top"
+            :key="index + 'taskHisAction'"
+          >
             <el-card>
-              <p>{{item.execId}} {{item.acname}} 于 {{ item.createTime}}</p>
+              <p>
+                {{ item.execId }} {{ item.acname }} 于 {{ item.createTime }}
+              </p>
             </el-card>
           </el-timeline-item>
-
         </el-timeline>
       </el-tab-pane>
     </el-tabs>
@@ -129,16 +132,32 @@ export default {
         { label: "通知公告", value: "3" },
         { label: "政策解读", value: "4" },
       ],
-      fileList: [],
+      fileList: [{ name: "", url: "" }],
       BigImgVisible: false,
     };
   },
   props: ["taskList"],
   created() {
     if (this.taskList.formobj.picture) {
-      this.fileList.push({ name: "xxx", url: this.taskList.formobj.picture });
-    }
+          this.fileList[0] = {
+            name: "xxx",
+            url: this.taskList.formobj.picture,
+          };
+        }
+  },
+  watch: {
+    taskList(curVal, oldVal) {
+      if (curVal) {
+        if (this.taskList.formobj.picture) {
+          this.fileList[0] = {
+            name: "xxx",
+            url: this.taskList.formobj.picture,
+          };
+        }
+      }
+    },
   },
+
   methods: {
     handlePictureCardPreview(file) {
       this.taskList.formobj.picture = file.url;

+ 7 - 2
src/views/task/index.vue

@@ -111,8 +111,9 @@
       </el-table-column>
     </el-table>
 
-    <el-dialog :visible.sync="dialogVisible" width="80%" center>
-      <component :is="componentUrl" :taskList="taskList"></component>
+    <el-dialog :visible.sync="dialogVisible" width="80%" center @close="closeDia">
+
+      <component :is="componentUrl" :taskList="taskList" ref="componentSH"></component>
 
       <el-dialog
         width="60%"
@@ -298,6 +299,9 @@ export default {
 
   },
   methods: {
+    closeDia(){
+      // console.log('关闭');
+    },
     extask() {
       this.$refs["extaskform"].validate((valid) => {
         if (valid) {
@@ -347,6 +351,7 @@ export default {
         this.taskList = res.data;
         this.dialogVisible = true;
         this.componentUrl = res.data.infoUrl
+        console.log(this.taskList.formobj.picture);
       });
     },
     //点击查看详细