Selaa lähdekoodia

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 11 kuukautta sitten
vanhempi
commit
d76ef3a249

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/api.ts

@@ -56,8 +56,8 @@ export const TASK_TYPE_FIELD: {
   {
     type: "2",
     field: "orderId",
-    valueIndex: "value",
-    labelIndex: "label",
+    valueIndex: "id",
+    labelIndex: "orderName",
   },
   {
     type: "3",

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/index.vue

@@ -178,7 +178,7 @@ watch(() => props.editForm, (val) => {
   post(ALL_ORDERS, { pageIndex: -1, pageSize: -1 }).then(({ data }) => {
     orderData.value = data.record;//销售订单
     if (taskType == 2) {
-      taskTypeValueData.value = data;
+      taskTypeValueData.value = data.record;
     }
   })
   get(ALL_CLUE, {}).then(({ data }) => {

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/api.ts

@@ -20,6 +20,7 @@ export const REFIENAMEFILE = `/business-opportunity/reFileName`
 export const UPLOADFILEFILE = `/business-opportunity/uploadFile`
 export const URL_IMPOERBUSINESS = `/business-opportunity/importData`
 export const URL_DETELESTAGE = `/business-opportunity/deleteStage`
+export const URL_SAVECONTACT = `/business-opportunity/saveContactsId`
 
 
 export const stageStatus = [

+ 61 - 8
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/information.vue

@@ -3,9 +3,10 @@
         <div class="flex justify-between">
             <div class="title">基本信息</div>
             <div>
-                <el-button type="primary">关联联系人</el-button>
+                <el-button type="primary" @click="associateContact()" v-if="!information.cuntactsId">关联联系人</el-button>
                 <el-button type="primary" @click="claimBusiness()" v-if="!information.customerId">认领</el-button>
-                <el-button type="primary" @click="showVisible('transferBusinessVisible')" v-else>转移</el-button>
+                <el-button type="primary" @click="showVisible('transferBusinessVisible')"
+                    v-if="information.customerId">转移</el-button>
                 <el-button type="primary" @click="showVisible('editBusinessVisible')">编辑</el-button>
             </div>
         </div>
@@ -69,7 +70,8 @@
                 <div class="flex justify-between items-center border-b pb-3 dialog-header">
                     <h4 :id="titleId">{{ '转移商机' }}</h4>
                     <div>
-                        <el-button type="primary" :loading="allLoading.transferBusinessLoading" @click="transferBusiness()">转移</el-button>
+                        <el-button type="primary" :loading="allLoading.transferBusinessLoading"
+                            @click="transferBusiness()">转移</el-button>
                         <el-button @click="allVisible.transferBusinessVisible = false">取消</el-button>
                     </div>
                 </div>
@@ -84,16 +86,39 @@
                 <div class="pl-3 text-[#e94a4a]">转移后,将看不到此商机</div>
             </div>
         </el-dialog>
+
+        <!-- 关联 -->
+        <el-dialog v-model="allVisible.saveContactVisible" width="600" :show-close="false" top="10vh">
+            <template #header="{ close, titleId, titleClass }">
+                <div class="flex justify-between items-center border-b pb-3 dialog-header">
+                    <h4 :id="titleId">{{ '关联联系人' }}</h4>
+                    <div>
+                        <el-button type="primary" :loading="allLoading.saveContactLoading"
+                            @click="saveAssociateContact()">关联</el-button>
+                        <el-button @click="allVisible.saveContactVisible = false">取消</el-button>
+                    </div>
+                </div>
+            </template>
+            <div class="scroll-bar m-6">
+                <div class="flex mb-4">
+                    <div class="w-20 flex items-center justify-end pr-4">联系人:</div>
+                    <el-select v-model="contactsId" placeholder="请选择" class="flex1">
+                        <el-option v-for="item in contactsList" :key="item.value" :label="item.label" :value="item.value" />
+                    </el-select>
+                </div>
+            </div>
+        </el-dialog>
     </div>
 </template>
 <script lang="ts" setup>
 import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffect } from 'vue'
 import { GenerateForm } from '@zmjs/form-design';
 import { get, post } from '@/utils/request';
-import { BATCHTRANSFER, GETGENERATEFOEM, GETPERSONNEL, UPDATEINSET } from '../api';
+import { BATCHTRANSFER, GETGENERATEFOEM, GETPERSONNEL, UPDATEINSET, URL_SAVECONTACT } from '../api';
 import { formatDateTime } from '@/utils/times';
 import { confirmAction } from '@/utils/tools';
 import { useStore } from '@/store/index'
+import { URL_GETALL } from '@/pages/contacts/api';
 
 const { userInfo } = useStore()
 const globalPopup = inject<GlobalPopup>('globalPopup')
@@ -107,20 +132,49 @@ const transferValue = ref('')
 const transferOptions = ref<personnelInterface[]>([])
 const generateFormValue = ref({})
 const generateForm = ref<typeof GenerateForm>() // 自定义表单dom
+const contactsId = ref('')
+const contactsList = ref<optionType[]>([])
 const allVisible = reactive({
     editBusinessVisible: false,
-    transferBusinessVisible: false
+    transferBusinessVisible: false,
+    saveContactVisible: false
 })
 const allLoading = reactive({
     editBusinessLoading: false,
     businessSaveLading: false,
-    transferBusinessLoading: false
+    transferBusinessLoading: false,
+    saveContactLoading: false
 })
 const generateFormData = ref({
     config: {},
     list: []
 }) // 自定义表单数据
 
+function associateContact() {
+    contactsId.value = ''
+    getContactList()
+    showVisible('saveContactVisible')
+}
+
+function getContactList() {
+    post(URL_GETALL, { customerId: information.value.customerId }).then(({ data }) => {
+        contactsList.value = data.map((item: any) => {
+            return { value: item.id, label: item.name }
+        })
+    })
+}
+
+function saveAssociateContact() {
+    allLoading.saveContactLoading = false
+    post(URL_SAVECONTACT, { id: information.value.id, contactsId: contactsId.value }).then(() => {
+        globalPopup?.showSuccess('关联成功')
+        closeVisible('saveContactVisible')
+        emits('refreshData')
+    }).finally(() => {
+        allLoading.saveContactLoading = false
+    })
+}
+
 function transferBusiness() {
     const ids = information.value?.id
     const inchargerId = information.value?.inchargerName ? transferValue.value : userInfo.id
@@ -222,5 +276,4 @@ onMounted(() => {
             line-height: 1.5;
         }
     }
-}
-</style>
+}</style>

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

@@ -60,16 +60,17 @@
           <el-table ref="businessTableRef" :data="businessTable" border v-loading="allLoading.businessTableLading"
             @selection-change="changeBatch" style="width: 100%;height: 100%;">
             <el-table-column type="selection" width="55" />
-            <el-table-column v-for="(item, index) in tableColumn" :prop="item.prop" :label="item.label" :key="index" :width="item.width">
+            <el-table-column v-for="(item, index) in tableColumn" :prop="item.prop" :label="item.label" :key="index"
+              :width="item.width">
               <template #default="scope">
-                <el-button link type="primary" size="large" @click="dealWithTableColumn(scope.row, item.eventName)" v-if="item.eventName">{{scope.row[item.prop]}}</el-button>
-                <template v-else>{{scope.row[item.prop]}}</template>
+                <el-button link type="primary" size="large" @click="dealWithTableColumn(scope.row, item.eventName)"
+                  v-if="item.eventName">{{ scope.row[item.prop] }}</el-button>
+                <template v-else>{{ scope.row[item.prop] }}</template>
               </template>
             </el-table-column>
             <el-table-column label="操作" fixed="right" width="200">
               <template #default="scope">
-                <el-button link type="primary" size="large"
-                  @click="editNewBusiness(scope.row)">编辑</el-button>
+                <el-button link type="primary" size="large" @click="editNewBusiness(scope.row)">编辑</el-button>
                 <el-button link type="primary" size="large" @click="newTask(scope.row)">新建任务</el-button>
                 <el-button link type="danger" size="large"
                   @click="businessDeteleItem(scope.row.id, scope.row.name)">删除</el-button>
@@ -99,9 +100,11 @@
         </div>
       </template>
       <div class="h-[60vh] overflow-y-auto scroll-bar pt-3" v-loading="allLoading.generateFormLading">
-        <GenerateForm ref="businessTemplateRef" :data="businessTemplate" :value="businessTemplateValue" :key="businessTemplateKey" />
+        <GenerateForm ref="businessTemplateRef" :data="businessTemplate" :value="businessTemplateValue"
+          :key="businessTemplateKey" />
         <div>相关产品</div>
-        <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
+        <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList"
+          :productTableListValue="productTableListValue" />
       </div>
     </el-dialog>
 
@@ -133,7 +136,8 @@
         <div class="flex justify-between items-center border-b pb-3 dialog-header">
           <h4 :id="titleId">导入产品</h4>
           <div class="flex">
-            <el-upload class="upload-demo mr-3" :limit="1" :show-file-list="false" accept=".xlsx" :http-request="importBusiness">
+            <el-upload class="upload-demo mr-3" :limit="1" :show-file-list="false" accept=".xlsx"
+              :http-request="importBusiness">
               <el-button type="primary" :loading="allLoading.importLoading">导入</el-button>
             </el-upload>
             <el-button @click="allVisible.importVisible = false">取消</el-button>
@@ -142,7 +146,8 @@
       </template>
       <div class="p-8">
         <div class="ml-4 mr-4">
-          <div class="flex items-center">1、点击下载 <el-link type="primary" @click="downloadTemplate(MODURL, '商机导入模板.xlsx')">商机导入模板.xlsx</el-link></div>
+          <div class="flex items-center">1、点击下载 <el-link type="primary"
+              @click="downloadTemplate(MODURL, '商机导入模板.xlsx')">商机导入模板.xlsx</el-link></div>
           <div class="mt-4">2、填写excel文件、商机名称、商机金额、商机阶段必填</div>
         </div>
       </div>
@@ -236,6 +241,7 @@ const fixedData = reactive({
   Personnel: [] as personnelInterface[]
 })
 const productTableList = ref([])
+const productTableListValue = ref([])
 
 
 function editBusiness(visibles: boolean) {
@@ -265,11 +271,13 @@ function editNewBusiness(item: any) {
   showVisible('newBusinessisible')
   allLoading.generateFormLading = true
   if (item) {
+    editProduct(item)
     businessTemplateValue.value = item
     allText.newBusinessisibleText = '编辑商机'
   }
   if (!item) {
     businessTemplateValue.value = {}
+    productTableListValue.value = []
     allText.newBusinessisibleText = '新建商机'
   }
   setTimeout(() => {
@@ -353,7 +361,7 @@ async function importBusiness(param: UploadRequestOptions) {
 function exportBusinessTableList() {
   allLoading.exoprtLoading = true
   let valueForm = getFromValue(businessOpportunityForm)
-  post('接口名称', {...valueForm}).then((res) => {
+  post('接口名称', { ...valueForm }).then((res) => {
     downloadFile(res.data, '商机表导出.xlsx')
   }).finally(() => {
     allLoading.exoprtLoading = false
@@ -369,6 +377,17 @@ function changeBatch(flag: boolean = true) {
   }
 }
 
+function editProduct(row: any) {
+  const list = row.businessItemProductList.map((item: any) => {
+    const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, orderProductDetail, num, discount, sealPrice, totalPrice } = item
+    return {
+      id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory,
+      num, discount, sealPrice, totalPrice 
+    }
+  })
+  productTableListValue.value = list
+}
+
 function showVisible(type: keyof typeof allVisible) { // 显示弹窗
   allVisible[type] = true
 }
@@ -425,7 +444,7 @@ async function getSystemField() {
   fixedData.BusinessStage = (row.data || []).map((item: any) => {
     const { name, id, seq } = item
     return { name, id, seq }
-  }).sort(function (a: any, b: any) {return a.seq - b.seq;});
+  }).sort(function (a: any, b: any) { return a.seq - b.seq; });
 
   const { data } = await post(GETPERSONNEL, {})
   fixedData.Personnel = data.map((item: any) => {
@@ -447,7 +466,7 @@ function toBusinessTableDetail(row: any) {
 }
 
 function dealWithTableColumn(row: any, eventName: string) {
-  if(eventName == 'toClueTableDetail') {
+  if (eventName == 'toClueTableDetail') {
     toBusinessTableDetail(row)
   }
 }
@@ -491,5 +510,4 @@ onMounted(() => {
     font-size: 18px;
     line-height: 24px;
   }
-}
-</style>
+}</style>