Pārlūkot izejas kodu

修改用户信息采集展示

wjj 1 nedēļu atpakaļ
vecāks
revīzija
ea8c83092e
1 mainītis faili ar 34 papildinājumiem un 19 dzēšanām
  1. 34 19
      src/views/collection/index.vue

+ 34 - 19
src/views/collection/index.vue

@@ -56,7 +56,7 @@
                         <span style="font-size: 15px;font-weight: bold;    margin-left: 31px">{{ answer.title }}</span>
                     </div>
                     <div style="margin-left: 31px;">
-                        <el-checkbox-group :disabled="true" v-model="collectionForm.answers[index].value" size="mini" >
+                        <el-checkbox-group  v-model="collectionForm.answers[index].value" size="mini" >
                         <el-checkbox v-for="dict in answer.options" :label="dict.value" >{{ dict.name }}</el-checkbox>
                     </el-checkbox-group>
                     </div>
@@ -74,7 +74,7 @@
                 </el-form-item>
             </el-form>
             <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 认</el-button>
+                <el-button type="primary" :disabled="isLoading"  @click="submitForm">确 认</el-button>
                 <el-button @click="cancelAdvice">关 闭</el-button>
             </div>
         </el-dialog>
@@ -91,6 +91,7 @@ export default {
                 pageNum: 1,
                 pageSize: 10,
             },
+            isLoading: false,
             // 遮罩层
             loading: true,
             // 导出遮罩层
@@ -133,34 +134,48 @@ export default {
     },
 
     methods: {
-        submitForm() {
-            this.$refs["form"].validate(valid => {
-                if (valid) {
-                    // fill(this.form).then(res => {
-                    //     this.msgSuccess("填写成功");
-                    //     this.open = false;
-                    //     this.getList();
-                    // })
-                }
-            });
-        },
+        // submitForm() {
+        //     this.$refs["form"].validate(valid => {
+        //         if (valid) {
+        //             // fill(this.form).then(res => {
+        //             //     this.msgSuccess("填写成功");
+        //             //     this.open = false;
+        //             //     this.getList();
+        //             // })
+        //         }
+        //     });
+        // },
         handleAdvice(row){
             this.form={};
             this.open = true;
             this.form.id = row.id;
+            this.form.doctorAdvice = row.doctorAdvice;
         },
         cancelAdvice(){
             this.open = false;
             this.reset();
         },
-        submitForm(){
+        async submitForm(){
             this.$refs["form"].validate(valid => {
                 if (valid) {
-                    doctorConfirm(this.form).then(res => {
+                    if (this.isLoading) return;
+                    this.isLoading = true;
+                    try {
+                        // 执行异步操作,比如API请求
+                        doctorConfirm(this.form).then(res => {
                         this.msgSuccess("填写成功");
                         this.open = false;
                         this.getList();
+                        this.isLoading = false;
                     })
+                    } catch (error) {
+                        // 处理错误
+                        console.error(error);
+                    } finally {
+                        // 无论成功或失败,都恢复按钮状态
+                        this.isLoading = false;
+                    }
+                    
                 }
             });
         },
@@ -237,13 +252,13 @@ export default {
   background-color: #1890ff !important;
   border-color: #1890ff !important;
 } */
-::v-deep .el-checkbox__input.is-disabled + span.el-checkbox__label {
+/* ::v-deep .el-checkbox__input.is-disabled + span.el-checkbox__label {
     color: #1890ff;
-}
-::v-deep .el-checkbox-button.is-disabled.is-checked .el-checkbox-button__inner {
+} */
+/* ::v-deep .el-checkbox-button.is-disabled.is-checked .el-checkbox-button__inner {
     color: #1890ff;
 }
 ::v-deep .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after {
     border-color: #1890ff;
-}
+} */
 </style>