Browse Source

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

mlchen 4 days ago
parent
commit
2dcb25e378

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

@@ -32,6 +32,18 @@ export async function contactDetail(id) {
   return Promise.reject(new Error(res.data.message));
 }
 
+export async function contactVersionList(contactId) {
+  const res = await request.get('/eom/contact/version/list', { params: { contactId } });
+  if (res.data.code == 0) return res.data.data;
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function contactVersionDetail(contactId, version) {
+  const res = await request.get(`/eom/contact/version/getById/${contactId}/${version}`);
+  if (res.data.code == 0) return res.data.data;
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 更新客户信息
  */
@@ -358,4 +370,4 @@ export async function customerAdd(data) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 1 - 1
src/components/upload/import-dialog.vue

@@ -135,7 +135,7 @@
             this.$message.success('操作成功!');
             this.dialogVisible = false;
             this.isProgress = false;
-            this.$emit('success');
+            this.$emit('success', res.data);
           })
           .catch(() => {
             this.isProgress = false;

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

@@ -802,7 +802,7 @@
         v-if="
           form.type == 1 &&
           activeName == '5' &&
-          form.qualificationCensorship == '1'
+          contactApprovalEnabled
         "
         @click="save('sub')"
         v-click-once
@@ -947,6 +947,7 @@
       };
       return {
         enableStatus: '2',
+        contactApprovalEnabled: false,
         fullscreen: false,
         visible: false,
         certificateQualificationsDialogFlag: false,
@@ -1387,6 +1388,9 @@
     created() {
       this.getGroupAll();
       this.requestDict('生产类型');
+      parameterGetByCode({ code: 'contact_is_approval' }).then((res) => {
+        this.contactApprovalEnabled = String(res.value) === '1';
+      });
     },
     methods: {
       async open(type, row, contactCategoryId, pageType) {

+ 73 - 7
src/views/saleManage/contact/components/contactDetailDialog.vue

@@ -323,6 +323,10 @@
             </el-col>
           </el-row>
         </el-form>
+        <template v-if="versionMode">
+          <headerTitle title="关联产品" style="margin-top: 30px"></headerTitle>
+          <ele-pro-table :columns="productColumns" :datasource="productList" :need-page="false" :toolkit="[]" height="300px"></ele-pro-table>
+        </template>
       </el-tab-pane>
 <!--      <el-tab-pane label="银行信息" name="bank">-->
 <!--       -->
@@ -340,7 +344,7 @@
           <!-- 操作栏 -->
           <template v-slot:action="scope">
             <el-link
-              v-if="[1,2].includes(scope.row.approvalStatus)"
+              v-if="!versionMode && [1,2].includes(scope.row.approvalStatus)"
               type="primary"
               :underline="false"
               icon="el-icon-edit"
@@ -350,7 +354,7 @@
           </template>
         </ele-pro-table>
       </el-tab-pane>
-      <el-tab-pane label="订单记录"  name="order">
+      <el-tab-pane v-if="!versionMode" label="订单记录"  name="order">
         <headerTitle title="订单记录" style="margin-top: 30px"></headerTitle>
         <div class="ele-border-lighter form-content">
           <!-- 数据表格 -->
@@ -387,7 +391,7 @@
           </ele-pro-table>
         </div>
       </el-tab-pane>
-      <el-tab-pane label="发货记录" name="send">
+      <el-tab-pane v-if="!versionMode" label="发货记录" name="send">
         <headerTitle title="发货记录" style="margin-top: 30px"></headerTitle>
         <div class="ele-border-lighter form-content" >
           <!-- 数据表格 -->
@@ -469,7 +473,7 @@
           </ele-pro-table>
         </div>
       </el-tab-pane>
-      <el-tab-pane label="退货记录" name="return">
+      <el-tab-pane v-if="!versionMode" label="退货记录" name="return">
         <headerTitle title="退货记录" style="margin-top: 30px"></headerTitle>
         <div class="ele-border-lighter form-content">
           <!-- 数据表格 -->
@@ -567,7 +571,7 @@
         </div>
 
       </el-tab-pane>
-      <el-tab-pane label="对账记录" name="reconciliation">
+      <el-tab-pane v-if="!versionMode" label="对账记录" name="reconciliation">
         <headerTitle title="对账记录" style="margin-top: 30px"></headerTitle>
         <div class="ele-border-lighter form-content">
           <!-- 数据表格 -->
@@ -658,7 +662,7 @@
           </ele-pro-table>
         </div>
       </el-tab-pane>
-      <el-tab-pane label="开票记录" name="invoice">
+      <el-tab-pane v-if="!versionMode" label="开票记录" name="invoice">
         <headerTitle title="开票记录" style="margin-top: 30px"></headerTitle>
         <el-card shadow="never" >
           <!-- 数据表格 -->
@@ -693,6 +697,14 @@
           </ele-pro-table>
         </el-card>
       </el-tab-pane>
+      <el-tab-pane label="版本历史" name="versions">
+        <el-alert v-if="versionMode" title="当前正在查看历史快照,内容只读。" type="info" :closable="false" />
+        <ele-pro-table :columns="versionColumns" :datasource="versionList" :need-page="false" height="420px">
+          <template v-slot:action="{ row }">
+            <el-link type="primary" :underline="false" @click="openVersion(row)">查看</el-link>
+          </template>
+        </ele-pro-table>
+      </el-tab-pane>
       <el-tab-pane label="审批流程" name="bpm">
         <bpmDetail
           v-if="activeName === 'bpm' && form.processInstanceId"
@@ -702,6 +714,8 @@
     </el-tabs>
 
     <div slot="footer" class="footer">
+      <span v-if="versionMode" class="ele-text-info">历史版本只读</span>
+      <el-button v-if="versionMode" type="primary" @click="returnCurrent">返回当前版本</el-button>
       <el-button @click="cancel">返回</el-button>
     </div>
     <!-- 资质证书弹窗   -->
@@ -717,7 +731,7 @@
 </template>
 
 <script>
-import {contactDetail, contactQcPackPageAPI} from '@/api/saleManage/contact';
+import {contactDetail, contactQcPackPageAPI, contactVersionList, contactVersionDetail} from '@/api/saleManage/contact';
 import {getFile} from '@/api/system/file';
 import {getInfoById as getCategoryInfo, getInfoByIds} from '@/api/classifyManage/index';
 import fileUpload from '@/components/upload/fileUpload';
@@ -807,6 +821,31 @@ export default {
       otherForm: copyObj(otherFormDef),
       tableBankData: [],
       tableLinkData: [],
+      productList: [],
+      productColumns: [
+        { prop: 'productCode', label: '产品编码', minWidth: 130 },
+        { prop: 'productName', label: '产品名称', minWidth: 150 },
+        { prop: 'purchasingCycle', label: '采购周期', minWidth: 100 },
+        { prop: 'purchaseMultiplier', label: '采购倍数', minWidth: 100 },
+        { prop: 'minimumOrderQuantity', label: '最低订购数量', minWidth: 120 },
+        { prop: 'provenance', label: '产地', minWidth: 130 },
+        { prop: 'manufacturer', label: '生产厂家', minWidth: 130 },
+        { prop: 'imgCode', label: '图号/件号', minWidth: 120 },
+        { prop: 'packingSpecification', label: '包装规格', minWidth: 110 },
+        { prop: 'brandNum', label: '牌号', minWidth: 100 },
+        { prop: 'modelType', label: '型号', minWidth: 100 },
+        { prop: 'specification', label: '规格', minWidth: 100 },
+        { prop: 'measuringUnit', label: '计量单位', minWidth: 100 }
+      ],
+      certificateList: [],
+      versionList: [],
+      versionMode: false,
+      versionColumns: [
+        { prop: 'version', label: '版本号', align: 'center' },
+        { prop: 'createTime', label: '修改时间', align: 'center' },
+        { prop: 'approvalStatus', label: '审批状态', align: 'center' },
+        { action: 'action', slot: 'action', label: '操作', align: 'center' }
+      ],
       ifChiefList: [
         {
           value: 0,
@@ -1495,8 +1534,27 @@ export default {
     async open(row) {
       this.row = row;
       this.visible = true;
+      this.versionMode = false;
       await this._getById(row.id);
     },
+    async openSnapshot(data, version) {
+      this.versionMode = true;
+      this.title = `客户历史版本 ${version}`;
+      this.visible = true;
+      await this._applyData(data);
+    },
+    async returnCurrent() {
+      this.versionMode = false;
+      this.title = '客户详情';
+      await this._getById(this.form.id);
+    },
+    async openVersion(version) {
+      const data = await contactVersionDetail(this.form.id, version.version);
+      this.visible = true;
+      this.title = `客户历史版本 ${version.version}`;
+      await this._applyData(data);
+      this.activeName = 'base';
+    },
     /* 订单记录表格数据源 */
     orderDatasource({page, limit, where, order}) {
       return  getTableList({
@@ -1551,15 +1609,22 @@ export default {
           this.tableBankData = []
         this.tableLinkData = []
         this.visible = false;
+        this.versionMode = false;
       })
     },
 
     async _getById(id) {
       const data = await contactDetail(id);
+      this._applyData(data);
+      this.versionList = await contactVersionList(id);
+    },
+    async _applyData(data) {
       this.form = data.base;
       this.otherForm = data.other;
       this.tableBankData = data.bankList;
       this.tableLinkData = data.linkList;
+      this.productList = data.productList || [];
+      this.certificateList = data.certificateList || [];
       if (this.tableLinkData && this.tableLinkData.length > 0) {
         this.tableLinkData.forEach(e => e.status = e.status + "");
       }
@@ -1586,6 +1651,7 @@ export default {
     /* 证书资质表格数据源 */
     tableCertificateData({page, limit, where}) {
       if (!this.form.id) return []
+      if (this.versionMode) return this.certificateList;
       return contactQcPackPageAPI({
         pageNum: page,
         size: limit,

+ 27 - 3
src/views/saleManage/contact/components/drawer.vue

@@ -151,6 +151,13 @@
               :id="row.base?.processInstanceId"
             ></bpmDetail>
           </el-tab-pane>
+          <el-tab-pane label="版本历史" name="版本历史">
+            <ele-pro-table :columns="versionColumns" :datasource="versionList" :need-page="false" height="420px">
+              <template v-slot:action="{ row }">
+                <el-link type="primary" :underline="false" @click="openVersion(row)">查看</el-link>
+              </template>
+            </ele-pro-table>
+          </el-tab-pane>
           <el-tab-pane label="售后工单" name="售后工单">
             
           <saleOderAftersalesList
@@ -203,6 +210,7 @@
           <el-button type="primary" @click="commitComment">发布</el-button>
         </div>
       </ele-modal>
+      <contact-detail-dialog ref="versionDetailRef"></contact-detail-dialog>
     </div>
   </el-drawer>
 </template>
@@ -211,7 +219,9 @@
   import {
     contactDetail,
     updateContactDynamics,
-    queryContactIdCount
+    queryContactIdCount,
+    contactVersionList,
+    contactVersionDetail
   } from '@/api/saleManage/contact';
   import dictMixins from '@/mixins/dictMixins';
   import contactInfo from './darwerComponents/contactInfo.vue';
@@ -261,6 +271,7 @@
   import { mapGetters } from 'vuex';
   import bpmDetail from '@/views/bpm/processInstance/detail.vue';
   import certificateManagement from '@/views/saleManage/contact/components/certificateManagement/index.vue';
+  import contactDetailDialog from './contactDetailDialog.vue';
   export default {
     mixins: [dictMixins],
 
@@ -288,7 +299,8 @@
       applyList,
       supplyList,
       saleOderAftersalesList,
-      entrustedReceive
+      entrustedReceive,
+      contactDetailDialog
     },
     data() {
       return {
@@ -306,7 +318,14 @@
           totalAmountSaleOrder: '', //销售订单总额
           totalAmountReturn: '' //回款总额
         },
-        pageName: 'myList'
+        pageName: 'myList',
+        versionList: [],
+        versionColumns: [
+          { prop: 'version', label: '版本号', align: 'center' },
+          { prop: 'createTime', label: '修改时间', align: 'center' },
+          { prop: 'approvalStatus', label: '审批状态', align: 'center' },
+          { action: 'action', slot: 'action', label: '操作', align: 'center' }
+        ]
       };
     },
     created() {
@@ -321,6 +340,7 @@
         this.activeName = '详细信息';
 
         this.row = await contactDetail(row.id);
+        this.versionList = await contactVersionList(row.id);
         if (this.row?.listApply) {
           this.row?.listApply.forEach((item, index) => {
             this.$set(
@@ -352,6 +372,10 @@
           this.$refs.saleOderAftersalesListRef.init();
         });
       },
+      async openVersion(version) {
+        const data = await contactVersionDetail(this.row.base.id, version.version);
+        this.$refs.versionDetailRef.openSnapshot(data, version.version);
+      },
       async commitComment() {
         await updateContactDynamics({
           id: this.row.base.id,

+ 24 - 12
src/views/saleManage/contact/contactList.vue

@@ -102,9 +102,7 @@
             <el-link
               type="primary"
               v-if="
-                [0, 3].includes(row.approvalStatus) ||
-                ([2].includes(row.approvalStatus) &&
-                  contact_approval_afterupdate == 1)
+                    [0, 3].includes(row.approvalStatus)
               "
               :underline="false"
               icon="el-icon-edit"
@@ -112,6 +110,12 @@
             >
               修改
             </el-link>
+            <el-link
+              type="primary"
+              v-if="[0, 3].includes(row.approvalStatus)"
+              :underline="false"
+              @click="sub(row)"
+            >提交</el-link>
 
             <el-popconfirm
               class="ele-action"
@@ -121,9 +125,7 @@
               <template v-slot:reference>
                 <el-link
                   v-if="
-                    [0, 3].includes(row.approvalStatus) ||
-                    ([2].includes(row.approvalStatus) &&
-                      contact_approval_afterupdate == 1)
+                    row.assignStatus !== 1 && [0, 3].includes(row.approvalStatus)
                   "
                   type="danger"
                   :underline="false"
@@ -153,7 +155,7 @@
     ></process-submit-dialog>
     <importDialog
       ref="importDialogRef"
-      @success="reload"
+      @success="handleImportSuccess"
       :fileUrl="'/eos/importTemplate/客户信息导入模板.xlsx'"
       fileName="客户信息导入模板"
       apiUrl="/eom/contact/importFile"
@@ -206,8 +208,8 @@
     data() {
       return {
         selection: [],
+        contactApprovalEnabled: null,
         defaultExpandedKeys: [],
-        contact_approval_afterupdate: 0,
         params: {},
         delVisible: false,
         // 加载状态
@@ -238,6 +240,12 @@
             minWidth: 140,
             fixed: 'left'
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80
+          },
           {
             prop: 'name',
             label: '名称',
@@ -394,10 +402,8 @@
     created() {
       this.requestDict('状态');
       this.getTreeData();
-      parameterGetByCode({
-        code: 'contact_approval_afterupdate'
-      }).then((res) => {
-        this.contact_approval_afterupdate = res.value;
+      parameterGetByCode({ code: 'contact_is_approval' }).then((res) => {
+        this.contactApprovalEnabled = String(res.value) === '1';
       });
     },
     methods: {
@@ -561,6 +567,12 @@
       uploadFile() {
         this.$refs.importDialogRef.open();
       },
+      handleImportSuccess(data) {
+        this.reload();
+        if (this.contactApprovalEnabled === true && data && data.successList && data.successList.length) {
+          this.$message.info(`导入成功 ${data.successList.length} 条,请提交审批`);
+        }
+      },
       openDetail(row) {
         this.$refs.drawerRef.open(row);
       }

+ 24 - 12
src/views/saleManage/contact/contactListAdmin.vue

@@ -121,13 +121,17 @@
               v-if="
                 row.assignStatus !== 1 &&
                 $hasPermission('eom:contact:update') &&
-                (([2].includes(row.approvalStatus) &&
-                  contact_approval_afterupdate == 1) ||
-                  [0, 3].includes(row.approvalStatus))
+                [0, 2, 3].includes(row.approvalStatus)
               "
             >
               修改
             </el-link>
+            <el-link
+              type="primary"
+              v-if="[0, 3].includes(row.approvalStatus)"
+              :underline="false"
+              @click="sub(row)"
+            >提交</el-link>
             <el-link
               type="primary"
               v-if="
@@ -181,9 +185,7 @@
               v-if="
                 row.assignStatus !== 1 &&
                 $hasPermission('eom:contact:delete') &&
-                (([2].includes(row.approvalStatus) &&
-                  contact_approval_afterupdate == 1) ||
-                  [0, 3].includes(row.approvalStatus))
+                [0, 3].includes(row.approvalStatus)
               "
               @confirm="remove(row)"
             >
@@ -222,7 +224,7 @@
     <myqsCode ref="qsCodeRef"></myqsCode>
     <importDialog
       ref="importDialogRef"
-      @success="reload"
+      @success="handleImportSuccess"
       :fileUrl="'/eos/importTemplate/客户信息导入模板.xlsx'"
       fileName="客户信息导入模板"
       apiUrl="/eom/contact/importFile"
@@ -274,10 +276,10 @@
     data() {
       return {
         selection: [],
+        contactApprovalEnabled: null,
         defaultExpandedKeys: [],
         delVisible: false,
         processSubmitDialogFlag: false,
-        contact_approval_afterupdate: 0,
         params: {},
         // 加载状态
         loading: false,
@@ -305,6 +307,12 @@
             minWidth: 140,
             fixed: 'left'
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80
+          },
           {
             prop: 'name',
             label: '名称',
@@ -473,10 +481,8 @@
     created() {
       this.requestDict('状态');
       this.getTreeData();
-      parameterGetByCode({
-        code: 'contact_approval_afterupdate'
-      }).then((res) => {
-        this.contact_approval_afterupdate = res.value;
+      parameterGetByCode({ code: 'contact_is_approval' }).then((res) => {
+        this.contactApprovalEnabled = String(res.value) === '1';
       });
     },
     methods: {
@@ -654,6 +660,12 @@
       uploadFile() {
         this.$refs.importDialogRef.open();
       },
+      handleImportSuccess(data) {
+        this.reload();
+        if (this.contactApprovalEnabled === true && data && data.successList && data.successList.length) {
+          this.$message.info(`导入成功 ${data.successList.length} 条,请提交审批`);
+        }
+      },
       openDetail(row) {
         // this.$refs.contactDetailDialogRef.open(row);
         this.$refs.drawerRef.open(row, 'allList');

+ 6 - 0
src/views/saleManage/contact/index.vue

@@ -306,6 +306,12 @@
             minWidth: 140,
             fixed: 'left'
           },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            width: 80
+          },
           {
             prop: 'name',
             label: '名称',