Quellcode durchsuchen

提交相关代码

Lijy vor 11 Monaten
Ursprung
Commit
66cf4ca168

+ 3 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/products.vue

@@ -58,6 +58,7 @@ import { post } from '@/utils/request';
 import RelatedProducts from '@/components/relatedProducts/relatedProducts.vue'
 import { UPDATEINSET } from '../api';
 import { all } from 'axios';
+import { judgmentaAmounteEqual } from '@/utils/tools';
 
 const emits = defineEmits(['refreshData']);
 const props = defineProps<{
@@ -78,13 +79,13 @@ const allLoading = reactive({
 
 function editProduct() {
     let productTableListData = relatedProductsRef?.value?.returnData()
-    if(!productTableListData) {
+    const { id, name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark } = information.value
+    if(!productTableListData || judgmentaAmounteEqual({ amountOfMoney }, productTableListData)) {
       return
     }
     productTableListData.forEach((item: any) => {
         delete item.id
     })
-    const { id, name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark } = information.value
     const formData = { id, name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark }
     allLoading.editProductLoading = true
     post(UPDATEINSET, { ...formData, businessItemProductList: JSON.stringify(productTableListData) }).then((_res) => {

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue

@@ -179,7 +179,7 @@ import { useRouter, useRoute } from "vue-router";
 import { GETSYSFILED, MOD, GETPERSONNEL, GETGENERATEFOEM, GETBUSINESSLIST, UPDATEINSET, BUSINESSDETELE, BATCHTRANSFER, MODURL, tableColumn, BUSIESS_GETSATE, URL_IMPOERBUSINESS, BUSIESS_INFO, URL_EXPORTBUSINESS } from './api'
 import { GETTABLELIST } from '@/pages/product/api'
 import { post, get, uploadFile } from "@/utils/request";
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, createTaskFromType, formatDate, confirmAction, downloadTemplate, downloadFile } from '@/utils/tools'
+import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, createTaskFromType, formatDate, confirmAction, downloadTemplate, downloadFile, judgmentaAmounteEqual } from '@/utils/tools'
 import { createTask } from '@/components/TaskModal/taskFunction'
 import { formatDateTime } from '@/utils/times'
 import { GenerateForm } from '@zmjs/form-design';
@@ -253,7 +253,7 @@ const productTableListValue = ref([])
 function editBusiness(visibles: boolean) {
   businessTemplateRef.value?.getData().then((res: any) => {
     let productTableListData = relatedProductsRef?.value?.returnData()
-    if(!productTableListData) {
+    if(!productTableListData || judgmentaAmounteEqual({...businessTemplateValue.value, ...res}, productTableListData)) {
       return
     }
     productTableListData.forEach((item: any) => {

+ 2 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/contacts/component/relatedBusiness.vue

@@ -57,6 +57,7 @@ import RelatedProducts from '@/components/relatedProducts/relatedProducts.vue'
 import { formatDateTime } from '@/utils/times';
 import { GETGENERATEFOEM, UPDATEINSET } from '@/pages/business/api';
 import { GETTABLELIST } from '@/pages/product/api';
+import { judgmentaAmounteEqual } from '@/utils/tools';
 
 const router = useRouter()
 const globalPopup = inject<GlobalPopup>('globalPopup')
@@ -95,7 +96,7 @@ function toBusDetal(row: any) {
 function editBusiness() {
     businessTemplateRef.value?.getData().then((res: any) => {
         let productTableListData = relatedProductsRef?.value?.returnData()
-        if(!productTableListData) {
+        if(!productTableListData || judgmentaAmounteEqual({ ...businessTemplateValue.value, ...res }, productTableListData)) {
             return
         }
         let newForm = {

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/component/relatedBusiness.vue

@@ -54,7 +54,7 @@ import { GenerateForm } from '@zmjs/form-design';
 import RelatedProducts from '@/components/relatedProducts/relatedProducts.vue'
 import { GETTABLELIST } from '@/pages/product/api';
 import { GETGENERATEFOEM, UPDATEINSET } from '@/pages/business/api';
-import { setTemplateDataDisable } from '@/utils/tools';
+import { judgmentaAmounteEqual, setTemplateDataDisable } from '@/utils/tools';
 import { formatDateTime } from '@/utils/times';
 
 const emits = defineEmits(['refreshData']);
@@ -87,7 +87,7 @@ const allLoading = reactive({
 function editBusiness(visibles: boolean) {
     businessTemplateRef.value?.getData().then((res: any) => {
         let productTableListData = relatedProductsRef?.value?.returnData()
-        if(!productTableListData) {
+        if(!productTableListData || judgmentaAmounteEqual({ ...businessTemplateValue.value, ...res }, productTableListData)) {
             return
         }
         productTableListData.forEach((item: any) => {

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/detail/components/information.vue

@@ -138,7 +138,7 @@
 <script lang="ts" setup>
 import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffect } from 'vue'
 import { GenerateForm } from '@zmjs/form-design';
-import { formatDate, confirmAction, backPath } from '@/utils/tools'
+import { formatDate, confirmAction, backPath, judgmentaAmounteEqual } from '@/utils/tools'
 import { GETTEMPLATE, UNDATEFORM, GETPERSONNEL, UNDATECLAIM, GETTEMPLATETWO } from '../../constant'
 import { get, post } from '@/utils/request'
 import { useStore } from '@/store/index'
@@ -202,7 +202,7 @@ const transferOptions = ref<personnelInterface[]>([]) // 转移人员列表
 function transferBusiness() {
     generateFormDataRef.value?.getData().then((res: any) => {
         let productTableListData = relatedProductsRef?.value?.returnData()
-        if(!productTableListData) {
+        if(!productTableListData || judgmentaAmounteEqual({ ...res }, productTableListData)) {
             return
         }
         let newForm = {

+ 25 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/tools.ts

@@ -1,4 +1,5 @@
 import { defalutModalForm } from "@/components/TaskModal/api";
+import { ElNotification } from "element-plus";
 import { ElMessageBox } from "element-plus";
 import { IMPORTTIMELIST } from '../pages/api'
 import { get, post } from "./request";
@@ -263,3 +264,27 @@ export function setTemplateDataDisable(list: Array<any>, fieldList: Array<any>)
   })
   return result;
 } 
+
+/**
+ * 新建商机指定方法,用来判断商机金额需与产品总金额是否相等
+ * @param mob 商机表单
+ * @param arr 相关产品
+ * @returns Boolean
+ */
+export function judgmentaAmounteEqual(mob: any, arr: any[] = []) {
+  let flag = true;
+  const amounte = mob.amountOfMoney || 0;
+  const totalAmounte = arr.reduce((pre: number, cur: any) => pre + (cur.totalPrice || 0), 0);
+
+  if (amounte !== totalAmounte) {
+    ElNotification.closeAll();
+    ElNotification({
+      title: '提示',
+      message: `商机金额${amounte > totalAmounte ? '大于' : '小于'}产品总金额,请修改`,
+      type: 'warning',
+    });
+    flag = false;
+  }
+
+  return flag;
+}