Explorar el Código

1.修复客户管理界面的bug

jzp hace 9 horas
padre
commit
8e4c517517

+ 45 - 0
src/views/crm/components/addRemark.vue

@@ -16,6 +16,16 @@
                     show-word-limit
                 />
             </el-form-item>
+            <el-form-item>
+                <div class="form-footer">
+                    <el-button type="primary" :loading="loading" @click="submitForm">
+                        <i class="el-icon-check"></i> 保 存
+                    </el-button>
+                    <el-button @click="clearAndSave">
+                        <i class="el-icon-delete"></i> 清空备注并保存
+                    </el-button>
+                </div>
+            </el-form-item>
         </el-form>
     </div>
 </template>
@@ -26,6 +36,7 @@
         name: "AddRemark",
         data() {
             return {
+                loading: false,
                 form: {
                     customerId:null,
                     remark:null,
@@ -51,15 +62,38 @@
             submitForm() {
                 this.$refs["form"].validate(valid => {
                     if (valid) {
+                        this.loading = true;
                         updateCustomer(this.form).then(response => {
+                            this.loading = false;
                             if (response.code === 200) {
                                 this.$message.success("操作成功");
                                 this.$emit('close');
                             }
+                        }).catch(() => {
+                            this.loading = false;
                         });
                     }
                 });
             },
+            clearAndSave() {
+                this.$confirm('确定要清空备注内容并保存吗?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    this.loading = true;
+                    this.form.remark = '';
+                    updateCustomer(this.form).then(response => {
+                        this.loading = false;
+                        if (response.code === 200) {
+                            this.$message.success("备注已清空");
+                            this.$emit('close');
+                        }
+                    }).catch(() => {
+                        this.loading = false;
+                    });
+                }).catch(() => {});
+            },
         }
     };
 </script>
@@ -84,5 +118,16 @@
             color: #303133;
         }
     }
+    
+    .form-footer {
+        display: flex;
+        justify-content: center;
+        gap: 12px;
+        padding-top: 10px;
+        
+        .el-button {
+            min-width: 100px;
+        }
+    }
 }
 </style>

+ 1 - 1
src/views/crm/components/assignUser.vue

@@ -32,7 +32,7 @@
                             <el-button
                             size="mini"
                             type="text"
-                            @click="handleRemoveUser(scope.row.$index)"
+                            @click="handleRemoveUser(scope.$index)"
                             >删除</el-button>
                         </template>
                     </el-table-column>