Преглед изворни кода

科室质控申诉弹窗必填校验失败修复

liyanyan пре 1 недеља
родитељ
комит
917d446202
1 измењених фајлова са 65 додато и 48 уклоњено
  1. 65 48
      src/components/appealModal/index.vue

+ 65 - 48
src/components/appealModal/index.vue

@@ -52,8 +52,8 @@ export default {
         phone: '',
         phone: '',
       },
       },
       appealRules: {
       appealRules: {
-        doctor: [{ required: true, message: '请输入', trigger: 'blur' }],
-        reason: [{ required: true, message: '请输入', trigger: 'blur' }],
+        doctor: [{ required: true, message: '请输入' }],
+        reason: [{ required: true, message: '请输入' }],
       },
       },
       currentId: '',
       currentId: '',
       MEDRECID: '',
       MEDRECID: '',
@@ -120,55 +120,65 @@ export default {
       this.getBaseInfo()
       this.getBaseInfo()
     },
     },
     submitAppeal() {
     submitAppeal() {
-      if (this.dialogType === 'appeal') {
-        // 申诉逻辑
-        const pramse = {
-          id: this.currentId,
-          zyh: this.MEDRECID,
-          type: 2,
-          quality_type: this.qualityType,
-          defect_content: this.appealForm.reason, // 使用 appealForm 中的原因
-          appeal_docter: this.appealForm.doctor, // 使用 appealForm 中的医师
-        };
-        console.log(pramse, 'pramse');
+      this.$refs.appealFormRef.validate((valid) => {
+        if (valid) {
+          if (this.dialogType === 'appeal') {
+            // 申诉逻辑
+            const pramse = {
+              id: this.currentId,
+              zyh: this.MEDRECID,
+              type: 2,
+              quality_type: this.qualityType,
+              defect_content: this.appealForm.reason, // 使用 appealForm 中的原因
+              appeal_docter: this.appealForm.doctor, // 使用 appealForm 中的医师
+            };
+            console.log(pramse, 'pramse');
 
 
-        examineAppeal(pramse).then(res => {
-          this.$message({
-            message: '提交申诉成功',
-            type: 'success',
-          });
-          // 提交后关闭弹框
-          this.dialogVisible = false;
-          this.$emit('onUpdate')
-        });
-      }
-      // 申诉审核通过和驳回逻辑
-      if (this.dialogType === 'appeal_in_yes' || this.dialogType === 'appeal_in_no') {
-        const params = {
-          id: this.currentId,
-          type: this.activeName == 'first' ? 1 : this.activeName == 'second' ? 2 : 3,
-          status: this.dialogType === 'appeal_in_yes' ? 1 : 2,
-          reject_content: this.appealForm.reason, // 使用 appealForm 中的原因
-          case_docter: this.appealForm.doctor, // 使用 appealForm 中的医师
-        };
-        console.log(params, 'params');
-        this.$axios.post('/examineCaseAppeal', params).then(res => {
-          if (res.code == 200) {
-            this.$message({
-              message: `申诉${this.getDialogTitle()}成功`,
-              type: 'success',
-            });
-            // 提交后关闭弹框
-            this.dialogVisible = false;
-            this.$emit('onUpdate')
-          } else {
-            this.$message({
-              message: res.msg,
-              type: 'error',
+            examineAppeal(pramse).then(res => {
+              if(res.code == 200) {
+                this.$message({
+                  message: '提交申诉成功',
+                  type: 'success',
+                });
+                // 提交后关闭弹框
+                this.dialogVisible = false;
+                this.$emit('onUpdate')
+              }
             });
             });
           }
           }
-        })
-      }
+          // 申诉审核通过和驳回逻辑
+          if (this.dialogType === 'appeal_in_yes' || this.dialogType === 'appeal_in_no') {
+            const params = {
+              id: this.currentId,
+              type: this.qualityType,
+              status: this.dialogType === 'appeal_in_yes' ? 1 : 2,
+              reject_content: this.appealForm.reason, // 使用 appealForm 中的原因
+              case_docter: this.appealForm.doctor, // 使用 appealForm 中的医师
+            };
+            console.log(params, 'params');
+            this.$axios.post('/examineCaseAppeal', params).then(res => {
+              if (res.code == 200) {
+                this.$message({
+                  message: `申诉${this.getDialogTitle()}成功`,
+                  type: 'success',
+                });
+                // 提交后关闭弹框
+                this.dialogVisible = false;
+                this.$emit('onUpdate')
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: 'error',
+                });
+              }
+            })
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+      
     },
     },
     handleIgnore(items, quality_type) {
     handleIgnore(items, quality_type) {
       const pramse = {
       const pramse = {
@@ -189,6 +199,13 @@ export default {
     },
     },
 
 
   },
   },
+  watch: {
+    dialogVisible(val) {
+      if(!val) {
+        this.$refs.appealFormRef && this.$refs.appealFormRef.resetFields()
+      }
+    }
+  }
 };
 };
 </script>
 </script>