Sfoglia il codice sorgente

客户、供应商资模块 供应商分类修改

Z 1 anno fa
parent
commit
12a683776e

+ 28 - 13
src/views/purchasingManage/supplierManage/components/addContactDialog.vue

@@ -10,9 +10,10 @@
           <el-row>
             <el-col :span="8">
               <el-form-item label="供应商分类" prop="categoryId">
-                <ele-tree-select   multiple
-                                   filterable
-                                   :checkStrictly="true" :data="categoryTreeList" v-model="categoryIdList" valueKey="id" labelKey="name"
+                <ele-tree-select multiple
+                                 filterable
+                                 :checkStrictly="true" :data="categoryTreeList" v-model="categoryIdList" valueKey="id"
+                                 labelKey="name"
                                  placeholder="请选择" default-expand-all/>
               </el-form-item>
             </el-col>
@@ -123,7 +124,7 @@
             </el-col>
 
             <el-col :span="8">
-              <el-form-item label="级别" >
+              <el-form-item label="级别">
                 <DictSelection dictName="供应商级别" clearable v-model="form.level">
                 </DictSelection>
               </el-form-item>
@@ -297,7 +298,8 @@
       </el-tab-pane>
       <el-tab-pane label="证书资质" name="certificate">
         <headerTitle title="证书资质" style="margin-top: 30px"></headerTitle>
-        <ele-pro-table ref="certificateTable" :columns="certificateColumns" :need-page="false" :datasource="tableCertificateData"
+        <ele-pro-table ref="certificateTable" :columns="certificateColumns" :need-page="false"
+                       :datasource="tableCertificateData"
                        :toolkit="[]" height="350px">
           <!-- 表头工具栏 -->
           <template v-slot:toolbar>
@@ -714,6 +716,17 @@ export default {
       groupData: [],
     };
   },
+  watch: {
+    categoryIdList(val) {
+      if (val.length > 0) {
+        this.$refs.form.clearValidate('categoryId')
+        this.form.categoryId = this.categoryIdList.join(',')
+      } else {
+        this.form.categoryId = ''
+        this.$refs.form.validateField('categoryId')
+      }
+    }
+  },
   created() {
     this.getGroupAll();
   },
@@ -817,14 +830,14 @@ export default {
     tableCertificateData({page, limit, where}) {
       if (!this.form.id) return []
       return contactQcPackPageAPI({
-        certificationType:'2',
+        certificationType: '2',
         relationId: this.form.id
       });
     },
     /* 刷新表格 */
     reload(where) {
       where = {
-        certificationType:'2',
+        certificationType: '2',
         relationId: this.form.id
       }
       this.$refs.certificateTable.reload({...where});
@@ -872,11 +885,12 @@ export default {
     },
     //开启资质提交流程
     async submit(row) {
-      await contactQcSubmit({businessId: row.id,certificationType:'2'})
+      await contactQcSubmit({businessId: row.id, certificationType: '2'})
       this.reload()
     },
     async save() {
       try {
+
         await this.getValidate();
         // 表单验证通过,执行保存操作
         this.loading = true;
@@ -891,7 +905,7 @@ export default {
             this.form.addressName = '';
           }
         }
-        this.form.categoryId = this.categoryIdList.join(',')
+
         if (this.$refs.industry.getCheckedNodes()) {
           let node = this.$refs.industry.getCheckedNodes()[0];
           if (node) {
@@ -985,15 +999,16 @@ export default {
           this.otherForm = copyObj(this.otherFormDef),
           this.tableBankData = []
         this.tableLinkData = []
+        this.categoryIdList = []
         this.visible = false;
       })
     },
     async _getById(id) {
       const data = await contactDetail(id);
-      this.form = data.base||{};
-      this.otherForm = data.other||{};
-      this.tableBankData = data.bankList||[];
-      this.tableLinkData = data.linkList||[];
+      this.form = data.base || {};
+      this.otherForm = data.other || {};
+      this.tableBankData = data.bankList || [];
+      this.tableLinkData = data.linkList || [];
       if (data.base.businessLicenseFile && data.base.businessLicenseFile !== "") {
         this.$set(this.form, 'businessLicenseFiles', [data.base.businessLicenseFile])
       }

+ 18 - 6
src/views/saleManage/contact/components/addContactDialog.vue

@@ -25,11 +25,11 @@
             <el-col :span="8">
               <el-form-item
                 label="客户分类"
-                prop="categoryIdList"
+                prop="categoryId"
               >
                 <ele-tree-select
                   :data="categoryTreeList"
-                  v-model="form.categoryIdList"
+                  v-model="categoryIdList"
                   multiple
                   filterable
                   :checkStrictly="true"
@@ -580,7 +580,6 @@ export default {
       businessLicenseFile: {},
       businessScope: '',
       categoryId: '',
-      categoryIdList: [],
       companyCategoryId: '',
       companyCategoryName: '',
       enterpriseTypeId: '',
@@ -630,6 +629,7 @@ export default {
       // removeLinkList: [],
       tableBankData: [],
       tableLinkData: [],
+      categoryIdList: [],
       ifChiefList: [
         {
           value: 0,
@@ -824,7 +824,7 @@ export default {
       ],
       rules: {
 
-        categoryIdList: [
+        categoryId: [
           {required: true, message: '请选择客户分类', trigger: 'change'}
         ],
         simpleName: [
@@ -871,6 +871,17 @@ export default {
   created() {
     this.getGroupAll();
   },
+  watch: {
+    categoryIdList(val) {
+      if (val.length > 0) {
+        this.$refs.form.clearValidate('categoryId')
+        this.form.categoryId = this.categoryIdList.join(',')
+      } else {
+        this.form.categoryId = ''
+        this.$refs.form.validateField('categoryId')
+      }
+    }
+  },
   methods: {
     async open(type, row, contactCategoryId) {
       this.title = type;
@@ -1042,7 +1053,7 @@ export default {
             this.form.addressName = '';
           }
         }
-        this.form.categoryId = this.form.categoryIdList.join(',')
+        this.form.categoryId = this.categoryIdList.join(',')
         if (this.$refs.industry.getCheckedNodes()) {
           let node = this.$refs.industry.getCheckedNodes()[0];
           if (node) {
@@ -1142,6 +1153,7 @@ export default {
           this.otherForm = copyObj(this.otherFormDef),
           this.tableBankData = []
         this.tableLinkData = []
+        this.categoryIdList = []
         this.visible = false;
       })
     },
@@ -1154,7 +1166,7 @@ export default {
       if (data.base.businessLicenseFile && data.base.businessLicenseFile.uid) {
         this.$set(this.form, 'businessLicenseFiles', [data.base.businessLicenseFile])
       }
-      this.form.categoryIdList = this.form.categoryId ? deepClone(this.form.categoryId.split(',')) : []
+      this.categoryIdList = this.form.categoryId ? deepClone(this.form.categoryId.split(',')) : []
       if (this.tableLinkData && this.tableLinkData.length > 0) {
         this.tableLinkData.forEach(e => e.status = e.status + "");
       }