Browse Source

提交代码

Lijy 4 tháng trước cách đây
mục cha
commit
7e6ea0478d

+ 60 - 13
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/businessInfo.vue

@@ -1,30 +1,32 @@
 <template>
   <div class="flex flex-col h-full">
     <div class="bg-white info flex-1 overflow-y-auto cellnormall">
-      <van-cell title="商机名称" :value="info.name" />
-      <van-cell title="客户名称" :value="info.customerName" />
-      <van-cell title="联系人姓名" :value="info.contactsName" />
+      <van-cell title="商机名称" :value="infoData.name" />
+      <van-cell title="客户名称" :value="infoData.customerName" />
+      <van-cell title="联系人姓名" :value="infoData.contactsName" />
       <van-cell title="商机金额">
         <template #default>
-          <span class="text-[#FF8B32]" v-if="info.amountOfMoney">¥ {{ info.amountOfMoney }}</span>
+          <span class="text-[#FF8B32]" v-if="infoData.amountOfMoney">¥ {{ infoData.amountOfMoney }}</span>
         </template>
       </van-cell>
-      <van-cell title="预计成交" :value="info.expectedTransactionDate" />
-      <van-cell title="商机阶段" :value="info.stageValue" />
+      <van-cell title="预计成交" :value="infoData.expectedTransactionDate" />
+      <van-cell title="商机阶段" :value="infoData.stageValue" />
       <van-cell title="负责人">
         <template #default>
-          <TranslationComponent :openId="info.inchargerName" />
+          <TranslationComponent :openId="infoData.inchargerName" />
         </template>
       </van-cell>
-      <van-cell title="备注" :value="info.remark" />
+      <van-cell title="备注" :value="infoData.remark" />
     </div>
     <div class="bottomButton">
-      <van-button type="primary" class="w-full block" v-if="!info.contactsName"
+      <van-button type="primary" class="w-full block" v-if="!infoData.contactsName"
         @click="shoContactDialag()">关联联系人</van-button>
-      <van-button type="warning" class="w-full block" v-if="info.inchargerName"
+      <van-button type="warning" class="w-full block" v-if="infoData.inchargerName"
         @click="showDialogCli()">转移商机</van-button>
-      <van-button type="primary" class="w-full block" v-if="!info.inchargerName"
+      <van-button type="primary" class="w-full block" v-if="!infoData.inchargerName"
         @click="claimAndClaim()">认领商机</van-button>
+      <van-button type="default" class="w-full block" v-permission="[routingInformation.jurisdiction.edit]" @click="jumpEdit()">编辑商机</van-button>
+      <van-button type="danger" class="w-full block" v-permission="[routingInformation.jurisdiction.delete]" @click="deleteBusinessOpportunity()">删除商机</van-button>
     </div>
 
     <!-- 转移弹窗 -->
@@ -59,16 +61,20 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
 import { showConfirmDialog } from 'vant';
 import { useLifecycle } from '@hooks/useCommon.js';
 import { BUSINESS_OPPORTUNITY_TRANSFER, GET_CONTACTS_WITH_MORE_I_DS, CONTACT_PERSON_ASSOCIATED_WITH_BUSINESS_OPPORTUNITY } from '@hooks/useApi'
+import { resetListData, getListFieldKey } from '@components/common/formForm/formCorrespondenceProcessing'
 import requests from "@common/requests";
 import useShowToast from '@hooks/useToast'
 import useInfoStore from '@store/useInfoStore'
+import useFixedData from "@store/useFixedData.js"
 import useRouterStore from "@store/useRouterStore.js";
-const router = useRouterStore()
+import { routingInfos } from "@utility/generalVariables"
 
+const router = useRouterStore()
+const fixedData = useFixedData()
 const userInfo = useInfoStore()
 const { toastSuccess, toastFail, toastText } = useShowToast()
 const props = defineProps({
@@ -78,6 +84,13 @@ const props = defineProps({
     default: () => ({})
   }
 })
+const infoData = ref(props.info)
+const routingInformation = routingInfos['business']
+
+watch(() => props.info, (newValue) => {
+  infoData.value = newValue
+  getAllContactsList()
+})
 
 const showDialog = ref(false);
 const showSelect = ref(false);
@@ -86,6 +99,40 @@ const showContactDialog = ref(false)
 const dialogSelection = ref({});
 const allContactsList = ref([]);
 
+function deleteBusinessOpportunity() {
+  const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
+  const row = infoData.value
+  const foemVal = { [routingInformation.key == 'tasks' ? 'taskIds' : 'ids']: row.id }
+  showConfirmDialog({
+    title: `删除${name}`,
+    message: `确定删除【${row[searchFiled?.search]}】${name}吗?`,
+  }).then(() => {
+    requests.post(deteleFiled, { ...foemVal }).then((res) => {
+      toastSuccess('删除成功')
+      router.navigateBack()
+    }).catch((err) => {
+      toastFail(err.msg ? err.msg : '删除失败')
+    })
+  })
+}
+
+function jumpEdit() {
+  const formJson = fixedData.formJson[routingInformation.key] || []
+  const formList = resetListData(formJson?.list)
+  const filedObj = getListFieldKey(formList, infoData.value)
+  const formVal = { ...filedObj, id: infoData.value.id }
+
+  router.navigateTo({
+    pathName: 'addEditor',
+    success: () => {
+      router.emit('addEditorParameter', {
+        routerInfo: JSON.stringify(routingInformation),
+        filedValue: JSON.stringify(formVal)
+      })
+    }
+  })
+}
+
 function shoContactDialag() {
   dialogSelection.value = {}
   showContactDialog.value = true

+ 3 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/businessOpportunityStage.vue

@@ -38,6 +38,7 @@ import useRouterStore from "@store/useRouterStore.js";
 
 const { toastSuccess, toastFail, toastText, toastLoading } = useShowToast()
 
+const emit = defineEmits();
 const props = defineProps({
   info: {
     type: Object,
@@ -91,6 +92,7 @@ function stageCompletion(flag = true) {
     if(flag) {
       enterReason()
     } else {
+      emit('chnage');
       getBusinessOpportunityDetails(id)
     }
   }).catch((err) => {
@@ -107,6 +109,7 @@ function promotionStage() {
     stageValue: item.name
   }).then((res) => {
     toastSuccess('推进成功')
+    emit('chnage');
     getBusinessOpportunityDetails(infoData.value.id)
   }).catch((err) => {
     toastFail(err.msg)

+ 6 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/detail.vue

@@ -2,7 +2,7 @@
   <div class="w-full h-full">
     <van-tabs v-model:active="tabActive">
       <van-tab title="商机阶段" name="商机阶段">
-        <BusinessOpportunityStage :info="infoData" />
+        <BusinessOpportunityStage :info="infoData" @chnage="refreshData()" />
       </van-tab>
       <van-tab title="商机信息" name="商机信息">
         <BusinessInfo :info="infoData" />
@@ -37,13 +37,17 @@ const props = defineProps({
 const tabActive = ref('商机信息');
 const relatedProductsList = ref([]);
 const relatedTasksList = ref([]);
-const infoData = ref({});
+const infoData = ref(props.info);
 
 watch(() => props.info, (newValue) => {
   tabActive.value = '商机信息';
   processingData(newValue.id)
 })
 
+function refreshData() {
+  processingData(infoData.value.id)
+}
+
 function getBusinessOpportunityDetails(id) {
   requests.post(GET_BUSINESS_OPPORTUNITY_DETAILS, { id }).then(({ data }) => {
     infoData.value = data

+ 9 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/relatedBusinessOpportunities.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="flex flex-col h-full overflow-y-auto">
-    <div class="info h-full cellnormall" v-if="infoList.length">
-      <div v-for="(item, index) in infoList">
+    <div class="info h-full cellnormall" v-if="infoListData.length">
+      <div v-for="(item, index) in infoListData">
         <FoldingPanel :title="`相关商机(${item.name})`">
           <template #foldContainer>
             <div class="p-5 bg-white ">
@@ -32,7 +32,7 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
 import { useLifecycle } from '@hooks/useCommon.js';
 import { fixedFieldPriority, fixedFieldTaskStatus } from "@utility/defaultData.js"
 import FoldingPanel from '@components/common/foldingPanel.vue';
@@ -45,6 +45,12 @@ const props = defineProps({
   }
 })
 
+const infoListData = ref(props.infoList);
+
+watch(() => props.infoList, (newValue) => {
+  infoListData.value = newValue;
+})
+
 useLifecycle({
   load: () => {
     // 添加加载逻辑