From 55bd7fb6365909a0cbcf0957333c7876bd791bb9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 21 十一月 2024 16:35:12 +0800
Subject: [PATCH] 问题整改界面 1. 优化各项状态展示效果 2. 新增左侧关键字筛选功能

---
 src/views/fysp/check/components/CompProblemCard.vue |  267 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 180 insertions(+), 87 deletions(-)

diff --git a/src/views/fysp/check/components/CompProblemCard.vue b/src/views/fysp/check/components/CompProblemCard.vue
index 04947c6..aabc5b4 100644
--- a/src/views/fysp/check/components/CompProblemCard.vue
+++ b/src/views/fysp/check/components/CompProblemCard.vue
@@ -1,6 +1,11 @@
 <template>
   <el-card class="layout" shadow="hover">
-    <el-steps :active="proStatus.index" finish-status="success" style="" align-center>
+    <el-steps
+      :active="proStatus.index"
+      finish-status="success"
+      style=""
+      align-center
+    >
       <el-step v-for="(s, i) in getSteps" :key="i" :title="s" />
     </el-steps>
 
@@ -30,12 +35,20 @@
     </el-descriptions>
 
     <el-scrollbar>
-      <el-descriptions title=" " :column="2" direction="vertical" size="small" border>
+      <el-descriptions
+        title=" "
+        :column="2"
+        direction="vertical"
+        size="small"
+        border
+      >
         <template v-for="(pic, t) in pics" :key="t">
           <template v-if="pic.path.length > 0">
             <el-descriptions-item
               :label="pic.title"
-              :label-class-name="t == 0 ? 'descriptions-label-1' : 'descriptions-label-2'"
+              :label-class-name="
+                t == 0 ? 'descriptions-label-1' : 'descriptions-label-2'
+              "
             >
               <el-space>
                 <el-image
@@ -59,71 +72,109 @@
     <el-row v-if="true" style="margin-top: 16px">
       <el-col :span="12">
         <el-row justify="start" class="btn-group">
-          <el-button type="success" size="small" @click="updatePro" plain>闂鏇存</el-button>
-          <el-button
-            type="primary"
-            size="small"
-            @click="updateChange"
-            plain
-            :disabled="!proStatus.changeable"
+          <el-button type="success" size="small" @click="updatePro" plain
+            >闂鏇存</el-button
+          >
+          <el-button type="primary" size="small" @click="updateChange" plain
             >鏁存敼妫�楠�</el-button
           >
-          <el-button type="info" size="small" @click="currProRecent" plain>闂澶嶇幇</el-button>
+          <el-button type="info" size="small" @click="currProRecent" plain
+            >闂澶嶇幇</el-button
+          >
         </el-row>
       </el-col>
       <el-col :span="12">
         <el-row justify="end" class="btn-group">
-          <el-button type="danger" size="small" @click="deletePro" :disabled="!proStatus.deletable"
+          <el-button
+            type="danger"
+            size="small"
+            @click="deletePro"
+            disabled
             >鍒犻櫎</el-button
           >
-          <el-button type="warning" size="small" @click="rejectPro" :disabled="!proStatus.checkable"
-            >椹冲洖</el-button
+          <!-- <el-button
+            type="danger"
+            size="small"
+            @click="deletePro"
+            :disabled="!proStatus.deletable"
+            >鍒犻櫎</el-button
+          > -->
+          <!-- 瀹℃牳椹冲洖鎿嶄綔 -->
+          <!-- <el-button
+            v-if="
+              this.problem.extension3 == 'fail' ||
+              this.problem.extension3 == 'change_fail'
+            "
+            type="danger"
+            size="small"
+            @click="revokePro"
+            :disabled="proStatus.checkable"
+            >鎾ら攢椹冲洖</el-button
           >
-          <el-button type="success" size="small" @click="passPro" :disabled="!proStatus.checkable"
-            >閫氳繃</el-button
+          <el-button
+            v-else
+            type="warning"
+            size="small"
+            @click="rejectPro"
+            :disabled="!proStatus.checkable"
+            >瀹℃牳椹冲洖</el-button
+          > -->
+          <el-button
+            v-if="
+              this.problem.extension3 == 'pass' ||
+              this.problem.extension3 == 'change_pass'
+            "
+            type="danger"
+            size="small"
+            @click="revokePro"
+            :disabled="proStatus.checkable"
+            >鎾ら攢閫氳繃</el-button
+          >
+          <el-button
+            v-else
+            type="success"
+            size="small"
+            @click="passPro"
+            :disabled="!proStatus.checkable"
+            >瀹℃牳閫氳繃</el-button
           >
         </el-row>
       </el-col>
     </el-row>
   </el-card>
-  <el-dialog v-model="proAddOrUpdDialogVisible" :before-close="proAddOrUpdDialogClose" width="80%">
-    <CompProblemAddOrUpd
-      v-if="proAddOrUpdDialogVisible"
-      :problem="deepCopyPro"
-      :subtask="deepCopySubtask"
-      :topTask="deepCopyTopTask"
-      ref="compProblemAddOrUpdRef"
-      @submited="onProSubmited"
-    />
-  </el-dialog>
-  <el-dialog
-    width="80%"
-    title="鏁存敼妫�楠�"
-    v-model="changeEditDialogVisible"
-    :before-close="changeEditDialogClose"
-  >
-    <ComChangeEdit
-      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"
+    @cancel="onProCanceled"
+    @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"
+    @cancel="onChangeCanceled"
+    @submit="onChangeSubmited"
+  />
   <!-- 闂澶嶇幇 -->
-  <el-dialog
-    width="80%"
+  <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>
@@ -135,6 +186,7 @@
 import CompProRecent from './CompProRecent.vue';
 import { useCloned } from '@vueuse/core';
 export default {
+  emits: ['check', 'submit', 'cancel'],
   components: {
     CompProblemAddOrUpd,
     ComChangeEdit,
@@ -171,9 +223,11 @@
       default: 1
     }
   },
-  emits: ['submit'],
   data() {
     return {
+      changeDialogVisible: false,
+      changeType: -1,
+      addChangeDialogVisible: false,
       // 杩戞湡鎯呭喌
       proRecentDialogVisible: false,
       month: -1,
@@ -199,10 +253,7 @@
       ]
     };
   },
-  mounted() {
-    console.log(this.topTask);
-    
-  },
+  mounted() {},
   computed: {
     // 闂鍚嶇О
     title() {
@@ -243,35 +294,68 @@
     }
   },
   methods: {
-    // 杩戞湡鎯呭喌寮圭獥鍏抽棴
-    proRecentDialogClose() {
-      this.proRecentDialogVisible = false;
-    },
-    newProblem() {
-      this.proAddOrUpdDialogVisible = true;
+    onProCanceled() {
+      this.proAddOrUpdDialogVisible = false;
     },
     onProSubmited(isOk) {
-      this.$emit('updated', isOk);
+      this.$emit('submit', isOk);
       this.proAddOrUpdDialogVisible = false;
+    },
+    onChangeCanceled() {
     },
     onChangeSubmited(isOk) {
-      console.log("zhenggaisubmit");
-      
-      this.$emit('updated', isOk);
-      this.changeEditDialogVisible = false;
+      this.$emit('submit', isOk);
+      this.changeDialogVisible = false;
     },
-    proAddOrUpdDialogClose() {
-      this.proAddOrUpdDialogVisible = false;
+    deletePro() {
+      useMessageBoxTip({
+        confirmMsg: '鏄惁鍒犻櫎闂',
+        confirmTitle: '纭畾',
+        onConfirm: () => {
+          return problemApi
+            .deleteProblem({
+              pid: this.problem.guid
+            })
+            .then((res) => {
+              if (res.success) {
+                this.$emit('submit');
+              }
+            });
+        }
+      });
     },
-    changeEditDialogClose() {
-      this.changeEditDialogVisible = false;
-    },
-    deletePro() {},
     rejectPro() {
       this.checkPro(false);
     },
     passPro() {
       this.checkPro(true);
+    },
+    revokePro() {
+      const pro = this.problem;
+      let status = this.proStatus;
+      let doneMsg;
+      if (status.index <= 2) {
+        doneMsg = '闂鏈鏍�';
+      } else if (status.index <= 3) {
+        doneMsg = '鏁存敼鏈鏍�';
+      }
+      useMessageBoxTip({
+        confirmMsg: `纭鎾ゅ洖鍒�${doneMsg}锛焋,
+        confirmTitle: '瀹℃牳鎾ゅ洖',
+        onConfirm: () => {
+          const { status, action } = ProCheckProxy.proBeforeStatus(
+            pro.extension3
+          );
+          return problemApi
+            .checkProblem({ pId: pro.guid, action: action })
+            .then((res) => {
+              if (res.success) {
+                pro.extension3 = status
+                this.$emit('check');
+              }
+            });
+        }
+      });
     },
     checkPro(pass) {
       const pro = this.problem;
@@ -280,27 +364,28 @@
         confirmMsg: `纭鏄惁${doneMsg}璇ラ棶棰橈紵`,
         confirmTitle: '闂瀹℃牳',
         onConfirm: () => {
-          const { status, action } = ProCheckProxy.proNextStatus(pro.extension3, pass);
-          return problemApi.checkProblem({ pId: pro.guid, action: action }).then((res) => {
-            if (res.success) {
-              pro.extension3 = status;
-              this.$emit('submit');
-            }
-          });
+          const { status, action } = ProCheckProxy.proNextStatus(
+            pro.extension3,
+            pass
+          );
+          return problemApi
+            .checkProblem({ pId: pro.guid, action: action })
+            .then((res) => {
+              if (res.success) {
+                pro.extension3 = status
+                this.$emit('check');
+              }
+            });
         }
       });
     },
     updatePro() {
-      console.log("clone", this.topTask);
-      
       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;
       });
     },
-    updateChange() {
+    getCurrentMouth() {
       // 浣跨敤Date瀵硅薄瑙f瀽鏃ユ湡瀛楃涓�
       var date = new Date(this.subtask.subtask.planstarttime);
       // 鑾峰彇鏈堜唤淇℃伅锛屾湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ラ渶瑕佸姞1
@@ -311,7 +396,15 @@
       // 鑾峰彇骞翠唤
       var year = date.getFullYear();
       this.month = `${year}-${this.month}`;
-      this.changeEditDialogVisible = true;
+    },
+    updateChange() {
+      this.getCurrentMouth();
+      if (!this.problem.ischanged) {
+        this.changeType = 0;
+      } else {
+        this.changeType = 1;
+      }
+      this.changeDialogVisible = true;
     },
     currProRecent() {
       this.proRecentDialogVisible = true;

--
Gitblit v1.9.3