crm联系人商机修改

This commit is contained in:
zyna 2023-12-17 17:34:32 +08:00
parent df1c565cd9
commit a1fd3afc32
9 changed files with 75 additions and 107 deletions

View File

@ -1,3 +1,10 @@
/*
* @Author: zyna
* @Date: 2023-12-02 13:08:56
* @LastEditTime: 2023-12-17 16:28:20
* @FilePath: \yudao-ui-admin-vue3\src\api\crm\business\index.ts
* @Description:
*/
import request from '@/config/axios'
export interface BusinessVO {
@ -55,3 +62,8 @@ export const deleteBusiness = async (id: number) => {
export const exportBusiness = async (params) => {
return await request.download({ url: `/crm/business/export-excel`, params })
}
//联系人关联商机列表
export const getBusinessPageByContact = async (params) => {
return await request.get({ url: `/crm/business/page-by-contact`, params })
}

View File

@ -25,7 +25,11 @@ export interface ContactVO {
areaName: string
ownerUserName: string
}
export interface ContactBusinessLinkVO {
id: number
contactId: number
businessId: number
}
// 查询 CRM 联系人列表
export const getContactPage = async (params) => {
return await request.get({ url: `/crm/contact/page`, params })
@ -65,3 +69,13 @@ export const exportContact = async (params) => {
export const getSimpleContactList = async () => {
return await request.get({ url: `/crm/contact/simple-all-list` })
}
//批量新增联系人商机关联
export const createContactBusinessLinkBatch = async (data: ContactBusinessLinkVO[]) => {
return await request.post({ url: `/crm/contact/create-batch-business`, data })
}
//解除联系人商机关联
export const deleteContactBusinessLink = async (data: ContactBusinessLinkVO) => {
return await request.delete({ url: `/crm/contact/delete-batch-business`, data })
}

View File

@ -1,47 +0,0 @@
import request from '@/config/axios'
export interface ContactBusinessLinkVO {
id: number
contactId: number
businessId: number
}
// 查询联系人商机关联分页
export const getContactBusinessLinkPage = async (params) => {
return await request.get({ url: `/crm/contact-business-link/page`, params })
}
// 查询联系人商机关联详情
export const getContactBusinessLink = async (id: number) => {
return await request.get({ url: `/crm/contact-business-link/get?id=` + id })
}
// 新增联系人商机关联
export const createContactBusinessLink = async (data: ContactBusinessLinkVO) => {
return await request.post({ url: `/crm/contact-business-link/create`, data })
}
// 修改联系人商机关联
export const updateContactBusinessLink = async (data: ContactBusinessLinkVO) => {
return await request.put({ url: `/crm/contact-business-link/update`, data })
}
// 删除联系人商机关联
export const deleteContactBusinessLink = async (data: ContactBusinessLinkVO) => {
return await request.delete({ url: `/crm/contact-business-link/delete-batch`, data })
}
// 导出联系人商机关联 Excel
export const exportContactBusinessLink = async (params) => {
return await request.download({ url: `/crm/contact-business-link/export-excel`, params })
}
//批量新增联系人商机关联
export const createContactBusinessLinkBatch = async (data: ContactBusinessLinkVO[]) => {
return await request.post({ url: `/crm/contact-business-link/create-batch`, data })
}
// 查询联系人关联商机列表
export const getBusinessByContactPage = async (params) => {
return await request.get({ url: `/crm/contact-business-link/page-by-contact`, params })
}
// TODO @zyna根据后端调整下请求

View File

@ -242,7 +242,8 @@ const queryParams = reactive({
mobile: null,
industryId: null,
level: null,
source: null
source: null,
pool:false
})
//
const showCustomer = ref(false)

View File

@ -29,7 +29,6 @@
</ContentWrap>
<!-- 列表 -->
<!-- TODO @zyna字段按照他们对齐下 -->
<ContentWrap class="mt-10px">
<el-table
v-loading="loading"
@ -75,12 +74,14 @@
</template>
<script setup lang="ts">
import * as BusinessApi from '@/api/crm/business'
import BusinessForm from '../../business/BusinessForm.vue'
import BusinessForm from '../BusinessForm.vue'
import { fenToYuanFormat } from '@/utils/formatter'
// TODO @zyna
import * as ContactbusinesslinkApi from '@/api/crm/contactbusinesslink'
const message = useMessage() //
import * as ContactApi from '@/api/crm/contact'
const message = useMessage() //
const props = defineProps<{
customerId: number
}>()
defineOptions({ name: 'CrmBusinessLinkContactList' })
const dialogVisible = ref(false) //
@ -93,8 +94,8 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
// TODO @zyna customerId
name: undefined
name: undefined,
customerId: props.customerId
})
const contactIdProp = ref(0) //
@ -102,8 +103,7 @@ const contactIdProp = ref(0) // 联系人编号
const open = async (contactId: number) => {
dialogVisible.value = true
contactIdProp.value = contactId
// TODO @zyna await idea
getList()
await getList()
}
defineExpose({ open }) // open
@ -111,7 +111,8 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const getList = async () => {
loading.value = true
try {
const data = await BusinessApi.getBusinessPage(queryParams)
console.log(queryParams)
const data = await BusinessApi.getBusinessPageByCustomer(queryParams)
list.value = data.list
total.value = data.total
} finally {
@ -141,26 +142,20 @@ const openForm = () => {
const emit = defineEmits(['success']) // success
const businessRef = ref()
const submitForm = async () => {
// TODO @zyna if return
if (businessRef.value.getSelectionRows().length === 0) {
message.success('未选择商机')
} else {
// TODO @zyna postData ref
const postData = ref<ContactbusinesslinkApi.ContactBusinessLinkVO[]>([])
return message.success('未选择商机')
}
const postData = []
businessRef.value.getSelectionRows().forEach((element) => {
// TODO @zyna push data
let data = {
id: undefined,
postData.push({
businessId: element.id,
contactId: contactIdProp.value
}
postData.value.push(data)
})
await ContactbusinesslinkApi.createContactBusinessLinkBatch(postData.value)
})
await ContactApi.createContactBusinessLinkBatch(postData)
dialogVisible.value = false
emit('success')
}
}
/** 打开联系人详情 */
const { push } = useRouter()

View File

@ -39,6 +39,7 @@ import * as BusinessApi from '@/api/crm/business'
import BusinessForm from './../BusinessForm.vue'
import { BizTypeEnum } from '@/api/crm/permission'
import { fenToYuanFormat } from '@/utils/formatter'
import * as ContactApi from '@/api/crm/contact'
defineOptions({ name: 'CrmBusinessList' })
const props = defineProps<{
@ -67,12 +68,15 @@ const getList = async () => {
case BizTypeEnum.CRM_CUSTOMER:
queryParams.customerId = props.bizId
data = await BusinessApi.getBusinessPageByCustomer(queryParams)
console.log(data)
break
default:
return
}
list.value = data.list
total.value = data.total
console.log(list.value)
} finally {
loading.value = false
}

View File

@ -5,8 +5,8 @@
<Icon class="mr-5px" icon="ep:opportunity" />
创建商机
</el-button>
<el-button @click="openBusinessLink"> 关联 </el-button>
<el-button @click="deleteBusinessLink"> 解除关联 </el-button>
<el-button @click="openBusinessLink"> <Icon class="mr-5px" icon="ep:remove" />关联 </el-button>
<el-button @click="deleteBusinessLink"> <Icon class="mr-5px" icon="ep:circle-plus" />解除关联 </el-button>
</el-row>
<!-- 列表 -->
@ -42,21 +42,24 @@
<!-- 表单弹窗添加 -->
<BusinessForm ref="formRef" @success="getList"/>
<!---->
<BusinessLink ref="businessLinkRef" @success="getList" />
<!--关联商机选择弹框-->
<BusinessLink ref="businessLinkRef" @success="getList" :customer-id="props.customerId"/>
</template>
<script setup lang="ts">
import * as ContactBusinessLinkApi from '@/api/crm/contactbusinesslink'
import BusinessForm from '../../business/BusinessForm.vue'
import * as BusinessApi from '@/api/crm/business'
import BusinessForm from '../BusinessForm.vue'
import { BizTypeEnum } from '@/api/crm/permission'
import { fenToYuanFormat } from '@/utils/formatter'
import BusinessLink from './BusinessLinkContactList.vue'
import BusinessLink from './BusinessForContactLink.vue'
import * as ContactApi from '@/api/crm/contact'
import { el } from 'element-plus/es/locale'
const message = useMessage() //
// TODO @zyna BusinessList
defineOptions({ name: 'CrmBusinessContactList' })
const props = defineProps<{
bizType: number //
bizId: number //
customerId: number
}>()
const loading = ref(true) //
@ -72,6 +75,7 @@ const queryParams = reactive({
const getList = async () => {
loading.value = true
try {
console.log(props.customerId)
//
queryParams.contactId = undefined
//
@ -79,7 +83,7 @@ const getList = async () => {
switch (props.bizType) {
case BizTypeEnum.CRM_CONTACT:
queryParams.contactId = props.bizId
data = await ContactBusinessLinkApi.getBusinessByContactPage(queryParams)
data = await BusinessApi.getBusinessPageByContact(queryParams)
break
default:
return
@ -113,16 +117,11 @@ const deleteBusinessLink = async () => {
if (businessRef.value.getSelectionRows().length === 0) {
message.success('未选择商机')
} else {
const postData = ref<ContactBusinessLinkApi.ContactBusinessLinkVO[]>([])
const postData = []
businessRef.value.getSelectionRows().forEach((element) => {
let data = {
id: undefined,
businessId: element.id,
contactId: props.bizId
}
postData.value.push(data)
postData.push(element.businessContactId)
})
await ContactBusinessLinkApi.deleteContactBusinessLink(postData.value)
await ContactApi.deleteContactBusinessLink(postData)
handleQuery()
}
}

View File

@ -1,14 +1,5 @@
<!--
* @Author: zyna
* @Date: 2023-12-02 13:08:57
* @LastEditTime: 2023-12-03 13:47:16
* @FilePath: \yudao-ui-admin-vue3\src\views\crm\contact\detail\ContactDetailsHeader.vue
* @Description:
-->
<!-- TODO @zyna上面这个不加哈 -->
<template>
<!-- TODO @zynaloading 缺了 -->
<div v-loading="loading">
<div>
<div class="flex items-start justify-between">
<div>
<el-col>
@ -48,7 +39,6 @@
import * as ContactApi from '@/api/crm/contact'
import ContactForm from '@/views/crm/contact/ContactForm.vue'
import { formatDate } from '@/utils/formatTime'
//
const formRef = ref()
const openForm = (type: string, id?: number) => {

View File

@ -10,7 +10,7 @@
<PermissionList :biz-id="contact.id!" :biz-type="BizTypeEnum.CRM_CONTACT" />
</el-tab-pane>
<el-tab-pane label="商机" lazy>
<BusinessList :biz-id="contact.id!" :biz-type="BizTypeEnum.CRM_CONTACT" />
<BusinessList :biz-id="contact.id!" :biz-type="BizTypeEnum.CRM_CONTACT" :customer-id="contact.customerId" />
</el-tab-pane>
</el-tabs>
</el-col>
@ -21,7 +21,7 @@ import { useTagsViewStore } from '@/store/modules/tagsView'
import * as ContactApi from '@/api/crm/contact'
import ContactDetailsHeader from '@/views/crm/contact/detail/ContactDetailsHeader.vue'
import ContactDetailsInfo from '@/views/crm/contact/detail/ContactDetailsInfo.vue'
import BusinessList from '@/views/crm/contactBusinessLink/components/BusinessListByContact.vue' //
import BusinessList from '@/views/crm/business/components/BusinessListByContact.vue' //
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' //
import { BizTypeEnum } from '@/api/crm/permission'