Просмотр исходного кода

客户管理-增加校验方式和提示;改变客户联系人查询逻辑。

DongZ 1 год назад
Родитель
Сommit
efa9d930e6
2 измененных файлов с 34 добавлено и 10 удалено
  1. 3 3
      src/api/business/spd/cm/customers.js
  2. 31 7
      src/views/business/spd/cm/customers/index.vue

+ 3 - 3
src/api/business/spd/cm/customers.js

@@ -45,9 +45,9 @@ export function delCustomers(ids) {
 }
 
 // 查询客户联系人信息
-export function getContactInfo() {
+export function getContactInfo(id) {
   return request({
-    url: '/cm/customers/getContactInfo',
-    method: 'get'
+    url: '/cm/customers/getContactInfo/' + id,
+    method: 'get',
   })
 }

+ 31 - 7
src/views/business/spd/cm/customers/index.vue

@@ -602,6 +602,11 @@
         form: {},
         // 表单校验
         rules: {
+          orgName: [{
+            required: true,
+            message: '销售组织不能为空',
+            trigger: 'blur'
+          }],
           name: [{
             required: true,
             message: '客户名称不能为空',
@@ -733,7 +738,7 @@
           this.mkCmCustomersDepartmentList = response.data.mkCmCustomersDepartmentList;
           this.openState = 'check';
         });
-        getContactInfo().then(response => {
+        getContactInfo(id1).then(response => {
           this.mkCmCustomersContactList = response.data;
         });
       },
@@ -784,18 +789,20 @@
             if (this.form.id != null) {
               updateCustomers(this.form).then(response => {
                 this.$modal.msgSuccess("修改成功");
+                this.reset();
+                this.getList();
+                this.isList = true;
               });
-              this.reset();
-              this.getList();
-              this.isList = true;
             } else {
               addCustomers(this.form).then(response => {
                 this.$modal.msgSuccess("新增成功");
+                this.reset();
+                this.getList();
+                this.isList = true;
               });
-              this.reset();
-              this.getList();
-              this.isList = true;
             }
+          } else {
+            this.checkout();
           }
         });
       },
@@ -928,6 +935,23 @@
           })
           .catch(_ => {});
       },
+      /** 必填项校验 */
+      checkout() {
+        if (!(this.form.orgName != null && this.form.orgName != '' && this.form.orgName != undefined &&
+            this.form.name != null && this.form.name != '' && this.form.name != undefined &&
+            this.form.classification != null && this.form.classification != '' && this.form.classification !=
+            undefined &&
+            this.form.taxType != null && this.form.taxType != '' && this.form.taxType != undefined &&
+            this.form.licenseNumber != null && this.form.licenseNumber != '' && this.form.licenseNumber != undefined)) {
+          return this.$modal.msgError("基本信息中存在必填项未填!");
+        }
+        if (!(this.form.enterpriseType != null && this.form.enterpriseType != '' && this.form.enterpriseType !=
+            undefined &&
+            this.form.enterpriseName != null && this.form.enterpriseName != '' && this.form.enterpriseName != undefined
+          )) {
+          return this.$modal.msgError("资质信息中存在必填项未填!");
+        }
+      },
     }
   };