Browse Source

fix:968【客户管理】逻辑优化

mlchen 13 hours ago
parent
commit
b3ea14beef

+ 13 - 0
src/api/saleManage/contact.js

@@ -21,6 +21,19 @@ export async function contactPageUsages(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
+/**
+ * 校验客户证书资质是否可用于业务单据
+ */
+export async function assertContactQualification(id) {
+  const res = await request.get(`/eom/contact/qualification/assert/${id}`, {
+    showErrorToast: false
+  });
+  if (res.data.code == 0) {
+    return true;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 获取客户信息详情
  */

+ 14 - 0
src/views/financialManage/components/customerListDialog.vue

@@ -91,6 +91,13 @@ export default {
             showOverflowTooltip: true,
             minWidth: 200
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+          },
           {
             prop: 'serialNo',
             label: '客户代号',
@@ -191,6 +198,13 @@ export default {
             showOverflowTooltip: true,
             minWidth: 200
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+          },
           {
             prop: 'serialNo',
             label: '供应商代号',

+ 7 - 0
src/views/purchasingManage/producerManage/components/parentList.vue

@@ -87,6 +87,13 @@ export default {
           showOverflowTooltip: true,
           minWidth: 200
         },
+        {
+          prop: 'version',
+          label: '版本号',
+          align: 'center',
+          width: 80,
+          formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+        },
         {
           prop: 'serialNo',
           label: '代号',

+ 7 - 0
src/views/purchasingManage/producerManage/index.vue

@@ -198,6 +198,13 @@
             showOverflowTooltip: true,
             minWidth: 200
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+          },
           {
             prop: 'serialNo',
             label: '代号',

+ 7 - 0
src/views/purchasingManage/supplierManage/components/parentList.vue

@@ -106,6 +106,13 @@
             showOverflowTooltip: true,
             minWidth: 200
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+          },
           {
             prop: 'serialNo',
             label: '供应商代号',

+ 7 - 0
src/views/purchasingManage/supplierManage/index.vue

@@ -225,6 +225,13 @@
             showOverflowTooltip: true,
             minWidth: 200
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+          },
           {
             prop: 'serialNo',
             label: '代号',

+ 9 - 1
src/views/saleManage/contact/components/addContactDialog.vue

@@ -956,6 +956,7 @@
         row: {},
         activeName: '1',
         formDef,
+        editVersion: null,
         supplyList: [],
         otherFormDef,
         form: copyObj(formDef),
@@ -1395,6 +1396,7 @@
     methods: {
       async open(type, row, contactCategoryId, pageType) {
         this.resetForm()
+        this.editVersion = null;
         // return
         this.form.type = pageType || 1;
         this.title = type;
@@ -1720,7 +1722,7 @@
             this.form.type != 1 ? (this.getLabel == '供货列表' ? '2' : '3') : 1;
             console.log(this.form, 'this.form~~~~~~~~');
           const data = {
-            base: this.form,
+            base: this.isUpdate ? { ...this.form, version: this.editVersion } : this.form,
             other: this.otherForm,
             bankList: this.tableBankData,
             linkList: this.tableLinkData,
@@ -1728,6 +1730,11 @@
           };
           this.tableCertificateDataList = this.$refs.certificateManagementRef.getTableValue();
           if (this.isUpdate) {
+            if (this.editVersion == null) {
+              this.loading = false;
+              this.$message.error('客户版本缺失,请刷新后重试');
+              return;
+            }
             contactUpdate(data)
               .then((res) => {
                 this.loading = false;
@@ -1805,6 +1812,7 @@
       async _getById(id) {
         const data = await contactDetail(id);
         this.form = data.base;
+        this.editVersion = data.base.version;
         this.otherForm = data.other;
         this.tableBankData = data.bankList;
         this.tableLinkData = data.linkList;

+ 3 - 3
src/views/saleManage/contact/components/contactDetailDialog.vue

@@ -841,7 +841,7 @@ export default {
       versionList: [],
       versionMode: false,
       versionColumns: [
-        { prop: 'version', label: '版本号', align: 'center' },
+        { prop: 'version', label: '版本号', align: 'center', formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0` },
         { prop: 'createTime', label: '修改时间', align: 'center' },
         { prop: 'approvalStatus', label: '审批状态', align: 'center' },
         { action: 'action', slot: 'action', label: '操作', align: 'center' }
@@ -1539,7 +1539,7 @@ export default {
     },
     async openSnapshot(data, version) {
       this.versionMode = true;
-      this.title = `客户历史版本 ${version}`;
+      this.title = `客户历史版本 V${version || 1}.0`;
       this.visible = true;
       await this._applyData(data);
     },
@@ -1551,7 +1551,7 @@ export default {
     async openVersion(version) {
       const data = await contactVersionDetail(this.form.id, version.version);
       this.visible = true;
-      this.title = `客户历史版本 ${version.version}`;
+      this.title = `客户历史版本 V${version.version || 1}.0`;
       await this._applyData(data);
       this.activeName = 'base';
     },

+ 1 - 1
src/views/saleManage/contact/components/drawer.vue

@@ -321,7 +321,7 @@
         pageName: 'myList',
         versionList: [],
         versionColumns: [
-          { prop: 'version', label: '版本号', align: 'center' },
+          { prop: 'version', label: '版本号', align: 'center', formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0` },
           { prop: 'createTime', label: '修改时间', align: 'center' },
           { prop: 'approvalStatus', label: '审批状态', align: 'center' },
           { action: 'action', slot: 'action', label: '操作', align: 'center' }

+ 19 - 4
src/views/saleManage/contact/components/parentList.vue

@@ -57,7 +57,10 @@
 </template>
 
 <script>
-  import { contactPageUsages } from '@/api/saleManage/contact';
+  import {
+    assertContactQualification,
+    contactPageUsages
+  } from '@/api/saleManage/contact';
   import ContactSearch from './contactSearch.vue';
   import AssetTree from '@/components/AssetTree';
 
@@ -108,6 +111,13 @@
             showOverflowTooltip: true,
             minWidth: 200
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
+          },
           {
             prop: 'serialNo',
             label: '客户代号',
@@ -223,12 +233,17 @@
         this.radio = '';
       },
 
-      selected() {
+      async selected() {
         if (!this.current) {
           return this.$message.warning('请选择客户');
         }
-        this.$emit('changeParent', this.current);
-        this.handleClose();
+        try {
+          await assertContactQualification(this.current.id);
+          this.$emit('changeParent', this.current);
+          this.handleClose();
+        } catch (error) {
+          this.$message.error(error.message || '客户资质校验失败');
+        }
       }
     }
   };

+ 4 - 3
src/views/saleManage/contact/contactList.vue

@@ -102,7 +102,7 @@
             <el-link
               type="primary"
               v-if="
-                    [0, 3].includes(row.approvalStatus)
+                    row.assignStatus !== 1 && [0, 2, 3].includes(row.approvalStatus)
               "
               :underline="false"
               icon="el-icon-edit"
@@ -112,7 +112,7 @@
             </el-link>
             <el-link
               type="primary"
-              v-if="[0, 3].includes(row.approvalStatus)"
+              v-if="contactApprovalEnabled && [0, 3].includes(row.approvalStatus)"
               :underline="false"
               @click="sub(row)"
             >提交</el-link>
@@ -244,7 +244,8 @@
             prop: 'version',
             label: '版本号',
             align: 'center',
-            width: 80
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
           },
           {
             prop: 'name',

+ 13 - 4
src/views/saleManage/contact/contactListAdmin.vue

@@ -61,7 +61,7 @@
               type="primary"
               class="el-icon-icon"
               @click="assign('all')"
-              :disabled="selection?.length === 0"
+              :disabled="selection?.length === 0 || selection.some(item => item.approvalStatus !== 2)"
               v-if="$hasPermission('eom:contact:assign')"
             >
               批量指派
@@ -128,14 +128,14 @@
             </el-link>
             <el-link
               type="primary"
-              v-if="[0, 3].includes(row.approvalStatus)"
+              v-if="contactApprovalEnabled && [0, 3].includes(row.approvalStatus)"
               :underline="false"
               @click="sub(row)"
             >提交</el-link>
             <el-link
               type="primary"
               v-if="
-                row.assignStatus === 0 && $hasPermission('eom:contact:assign')
+                row.assignStatus === 0 && row.approvalStatus === 2 && $hasPermission('eom:contact:assign')
               "
               :underline="false"
               @click="assign('', row)"
@@ -311,7 +311,8 @@
             prop: 'version',
             label: '版本号',
             align: 'center',
-            width: 80
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
           },
           {
             prop: 'name',
@@ -623,12 +624,20 @@
         if (type == 'all') {
           contactIds = this.selection.map((item) => item.id);
           contactNames = this.selection.map((item) => item.name);
+          if (this.selection.some((item) => item.approvalStatus !== 2)) {
+            this.$message.warning('未审批通过客户不能指派!');
+            return;
+          }
           this.selection.forEach((item) => {
             if (item.assignStatus === 1) {
               isAssign = true;
             }
           });
         } else {
+          if (row.approvalStatus !== 2) {
+            this.$message.warning('未审批通过客户不能指派!');
+            return;
+          }
           contactIds = [row.id];
           contactNames = [row.name];
         }

+ 2 - 1
src/views/saleManage/contact/index.vue

@@ -310,7 +310,8 @@
             prop: 'version',
             label: '版本号',
             align: 'center',
-            width: 80
+            width: 80,
+            formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
           },
           {
             prop: 'name',

+ 1 - 1
vue.config.js

@@ -2,7 +2,7 @@
  * @Author: mlchen 374826075@qq.com
  * @Date: 2026-07-22 15:43:30
  * @LastEditors: mlchen 374826075@qq.com
- * @LastEditTime: 2026-08-11 10:52:40
+ * @LastEditTime: 2026-10-13 10:07:46
  * @FilePath: /kd-aiot-frontend-eom/vue.config.js
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */