From d7932d42a9c4a08376d542dbff8301e7d985b787 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期三, 20 十一月 2024 17:38:11 +0800
Subject: [PATCH] 问题新增与修改页面初始化逻辑修改

---
 src/views/fysp/check/components/CompProblemAddOrUpd.vue |   52 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue
index 6fe60eb..940347a 100644
--- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue
+++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue
@@ -80,12 +80,6 @@
             </el-select>
           </el-form-item>
           <el-form-item
-            v-show="
-              problem &&
-              problem.guid &&
-              deepCopyProblem.advice &&
-              deepCopyProblem.advice != ''
-            "
             label="闂寤鸿淇"
             prop="_adviseEdit"
             :disabled="false"
@@ -173,7 +167,7 @@
             <el-button type="primary" @click="onSubmit" v-show="!readonly"
               >淇濆瓨</el-button
             >
-            <el-button @click="$emit('submit', false)" v-show="!readonly"
+            <el-button @click="onCancel" v-show="!readonly"
               >鍙栨秷</el-button
             >
           </el-form-item>
@@ -233,7 +227,7 @@
 import deviceApi from '@/api/fysp/deviceApi';
 import { useFormConfirm } from '@/composables/formConfirm';
 export default {
-  emits: ['submit'],
+  emits: ['submit', 'cancel'],
   components: {
     ArbitraryPhoto,
     CompDevicePhoto,
@@ -269,6 +263,7 @@
   },
   data() {
     return {
+      initPropsCount: 0,
       // 鍒濆棰勮鍥剧墖index
       initialIndex: -1,
       // 鍥剧墖閫夋嫨鏈�澶ф暟閲�
@@ -332,6 +327,38 @@
         this.pictureValidate();
       },
       deep: true
+    },
+    initPropsCount: {
+      handler(nv, ov) {
+        if (nv >= 3) {
+          this.initOptions();
+        }
+      },
+      immediate: true
+    },
+    problem: {
+      handler(nv, ov) {
+        if (nv != null && nv != undefined) {
+          this.initPropsCount++;
+        }
+      },
+      immediate: true
+    },
+    topTask: {
+      handler(nv, ov) {
+        if (nv != null && nv != undefined) {
+          this.initPropsCount++;
+        }
+      },
+      immediate: true
+    },
+    subtask: {
+      handler(nv, ov) {
+        if (nv != null && nv != undefined) {
+          this.initPropsCount++;
+        }
+      },
+      immediate: true
     }
   },
   computed: {
@@ -363,15 +390,13 @@
       return array;
     }
   },
-  mounted() {
-    this.initOptions();
-  },
+  mounted() {},
   methods: {
     onProAdviseChange(value) {
       this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
     },
     handlePictureCardPreview(uploadFile) {
-      this.initialIndex = this.fileList.indexOf(uploadFile)
+      this.initialIndex = this.fileList.indexOf(uploadFile);
       this.previewDialogVisible = true;
       this.previewDialogImageUrl = uploadFile.url;
     },
@@ -561,6 +586,9 @@
       }
       return true;
     },
+    onCancel() {
+      this.$emit("cancel")
+    },
     onSubmit() {
       this.$refs.formRef.validate((valid) => {
         if (valid && this.pictureValidate()) {

--
Gitblit v1.9.3