From f2138817fdd6e9141c5911514280b8d0b6ca08f1 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期三, 20 十一月 2024 14:48:49 +0800
Subject: [PATCH] 子组件刷新父组件不刷新页面,表单验证,upload组件预览图片,弹窗放在组件内部,bug修复

---
 src/views/fysp/check/components/CompProblemCard.vue |  144 ++++++++++++++++++-----------------------------
 1 files changed, 56 insertions(+), 88 deletions(-)

diff --git a/src/views/fysp/check/components/CompProblemCard.vue b/src/views/fysp/check/components/CompProblemCard.vue
index 9ab31b5..e599f5c 100644
--- a/src/views/fysp/check/components/CompProblemCard.vue
+++ b/src/views/fysp/check/components/CompProblemCard.vue
@@ -93,13 +93,15 @@
             >鍒犻櫎</el-button
           >
           <el-button
+            v-if="proStatus.name.indexOf('涓嶉�氳繃') != -1"
             type="danger"
             size="small"
-            @click="beforePro"
+            @click="revokePro"
             :disabled="proStatus.checkable"
-            >鎾ら攢</el-button
+            >鎾ら攢椹冲洖</el-button
           >
           <el-button
+            v-else
             type="warning"
             size="small"
             @click="rejectPro"
@@ -107,6 +109,18 @@
             >椹冲洖</el-button
           >
           <el-button
+            v-if="
+              proStatus.name.indexOf('涓嶉�氳繃') == -1 &&
+              proStatus.name.indexOf('閫氳繃') != -1
+            "
+            type="danger"
+            size="small"
+            @click="revokePro"
+            :disabled="proStatus.checkable"
+            >鎾ら攢閫氳繃</el-button
+          >
+          <el-button
+            v-else
             type="success"
             size="small"
             @click="passPro"
@@ -117,63 +131,37 @@
       </el-col>
     </el-row>
   </el-card>
-  <div class="dialog-wrapper">
-    <el-dialog
-      title="闂鏇存"
-      width="50%"
-      v-model="proAddOrUpdDialogVisible"
-      :before-close="proAddOrUpdDialogClose"
-    >
-      <CompProblemAddOrUpd
-        v-if="proAddOrUpdDialogVisible"
-        :problem="deepCopyPro"
-        :subtask="deepCopySubtask"
-        :topTask="deepCopyTopTask"
-        ref="compProblemAddOrUpdRef"
-        @submited="onProSubmited"
-      />
-    </el-dialog>
-  </div>
-  <el-dialog width="80%" title="鏁存敼鎻愪氦" v-model="addChangeDialogVisible">
-    <ComChangeEdit
-      :changeType="0"
-      v-if="addChangeDialogVisible"
-      :problemId="problem.guid"
-      :subtask="subtask"
-      :month="month"
-      @submited="onAddChangeSubmited"
-    />
-  </el-dialog>
-  <el-dialog
-    width="50%"
-    title="鏁存敼妫�楠�"
-    v-model="changeEditDialogVisible"
-    :before-close="changeEditDialogClose"
-  >
-    <ComChangeEdit
-      :changeType="1"
-      v-if="changeEditDialogVisible"
-      :problemId="problem.guid"
-      :oldChangeFileList="problem.mediafileList"
-      :subtask="subtask"
-      :month="month"
-      @submited="onChangeSubmited"
-    />
-  </el-dialog>
+  <CompProblemAddOrUpd
+    title="闂鏇存"
+    v-if="proAddOrUpdDialogVisible"
+    v-model:visible="proAddOrUpdDialogVisible"
+    :problem="deepCopyPro"
+    :subtask="subtask"
+    :topTask="topTask"
+    ref="compProblemAddOrUpdRef"
+    @submit="onProSubmited"
+  />
+  <!-- 鏁存敼 -->
+  <ComChangeEdit
+    :title="changeType == 1 ? '鏁存敼妫�楠�' : '鏁存敼鎻愪氦'"
+    v-if="changeDialogVisible"
+    v-model:visible="changeDialogVisible"
+    :changeType="changeType"
+    :problemId="problem.guid"
+    :subtask="subtask"
+    :month="month"
+    :oldChangeFileList="problem.mediafileList"
+    @submit="onChangeSubmited"
+  />
   <!-- 闂澶嶇幇 -->
-  <el-dialog
-    width="50%"
+  <CompProRecent
     title="闂澶嶇幇"
-    v-model="proRecentDialogVisible"
-    :before-close="proRecentDialogClose"
-  >
-    <CompProRecent
-      v-if="proRecentDialogVisible"
-      :subtask="subtask"
-      :topTask="topTask"
-      :problem="problem"
-    />
-  </el-dialog>
+    v-if="proRecentDialogVisible"
+    v-model:visible="proRecentDialogVisible"
+    :subtask="subtask"
+    :topTask="topTask"
+    :problem="problem"
+  />
 </template>
 
 <script>
@@ -185,6 +173,7 @@
 import CompProRecent from './CompProRecent.vue';
 import { useCloned } from '@vueuse/core';
 export default {
+  emits: ['submmit'],
   components: {
     CompProblemAddOrUpd,
     ComChangeEdit,
@@ -221,9 +210,11 @@
       default: 1
     }
   },
-  emits: ['submit'],
+  emits: ['submit', 'updated'],
   data() {
     return {
+      changeDialogVisible: false,
+      changeType: -1,
       addChangeDialogVisible: false,
       // 杩戞湡鎯呭喌
       proRecentDialogVisible: false,
@@ -291,30 +282,13 @@
     }
   },
   methods: {
-    onAddChangeSubmited() {
-      this.$emit('updated', true);
-      this.addChangeDialogVisible = false;
-    },
-    // 杩戞湡鎯呭喌寮圭獥鍏抽棴
-    proRecentDialogClose() {
-      this.proRecentDialogVisible = false;
-    },
-    newProblem() {
-      this.proAddOrUpdDialogVisible = true;
-    },
     onProSubmited(isOk) {
-      this.$emit('updated', isOk);
+      this.$emit('submit', isOk);
       this.proAddOrUpdDialogVisible = false;
     },
     onChangeSubmited(isOk) {
-      this.$emit('updated', isOk);
-      this.changeEditDialogVisible = false;
-    },
-    proAddOrUpdDialogClose() {
-      this.proAddOrUpdDialogVisible = false;
-    },
-    changeEditDialogClose() {
-      this.changeEditDialogVisible = false;
+      this.$emit('submit', isOk);
+      this.changeDialogVisible = false;
     },
     deletePro() {
       useMessageBoxTip({
@@ -339,7 +313,7 @@
     passPro() {
       this.checkPro(true);
     },
-    beforePro() {
+    revokePro() {
       const pro = this.problem;
       let status = this.proStatus;
       let doneMsg;
@@ -359,7 +333,6 @@
             .checkProblem({ pId: pro.guid, action: action })
             .then((res) => {
               if (res.success) {
-                pro.extension3 = status;
                 this.$emit('submit', false);
               }
             });
@@ -381,20 +354,14 @@
             .checkProblem({ pId: pro.guid, action: action })
             .then((res) => {
               if (res.success) {
-                pro.extension3 = status;
                 this.$emit('submit', false);
               }
             });
         }
       });
     },
-    addChange() {
-      this.addChangeDialogVisible = true;
-    },
     updatePro() {
       this.deepCopyPro = useCloned(this.problem).cloned.value;
-      this.deepCopySubtask = useCloned(this.subtask).cloned.value;
-      this.deepCopyTopTask = useCloned(this.topTask).cloned.value;
       this.$nextTick(() => {
         this.proAddOrUpdDialogVisible = true;
       });
@@ -414,10 +381,11 @@
     updateChange() {
       this.getCurrentMouth();
       if (!this.problem.ischanged) {
-        this.addChange();
+        this.changeType = 0;
       } else {
-        this.changeEditDialogVisible = true;
+        this.changeType = 1;
       }
+      this.changeDialogVisible = true;
     },
     currProRecent() {
       this.proRecentDialogVisible = true;

--
Gitblit v1.9.3