📖 CRM:code review crm 客户列表

This commit is contained in:
YunaiV 2024-01-07 21:20:00 +08:00
parent 4eb3c8a2f9
commit ec87c1b61d
4 changed files with 31 additions and 13 deletions

View File

@ -73,13 +73,14 @@ export const getOperateLogPage = async (id: number) => {
return await request.get({ url: '/crm/customer/operate-log-page?id=' + id })
}
//======================= 业务操作 =======================
// ======================= 业务操作 =======================
// 锁定/解锁客户
export const lockCustomer = async (id: number, lockStatus: boolean) => {
return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
}
// TODO @puhui999方法名改成和后端一致哈
// 领取公海客户
export const receive = async (ids: any[]) => {
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })

View File

@ -1,4 +1,5 @@
<template>
<!-- TODO @puhui999左边不用有空隙哈 -->
<div class="p-20px">
<el-timeline>
<el-timeline-item

View File

@ -1,5 +1,6 @@
<template>
<CustomerDetailsHeader :customer="customer" :loading="loading">
<!-- @puhui999返回是不是可以去掉哈貌似用途可能不大 -->
<el-button @click="close">返回</el-button>
<!-- TODO puhui999: 按钮数据权限收尾统一完善需要按权限分级和客户状态来动态显示匹配的按钮 -->
<el-button v-hasPermi="['crm:customer:update']" type="primary" @click="openForm">
@ -12,7 +13,7 @@
<el-button v-if="customer.lockStatus" @click="handleUnlock">解锁</el-button>
<el-button v-if="!customer.lockStatus" @click="handleLock">锁定</el-button>
<el-button v-if="!customer.ownerUserId" type="primary" @click="receive">领取客户</el-button>
<el-button v-if="customer.ownerUserId" type="primary" @click="putPool">客户放入公海</el-button>
<el-button v-if="customer.ownerUserId" @click="putPool">客户放入公海</el-button>
</CustomerDetailsHeader>
<el-col>
<el-tabs>
@ -67,6 +68,7 @@ const loading = ref(true) // 加载中
const message = useMessage() //
const { delView } = useTagsViewStore() //
const { currentRoute, push } = useRouter() //
/** 获取详情 */
const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) //
const getCustomer = async () => {
@ -78,45 +80,51 @@ const getCustomer = async () => {
loading.value = false
}
}
/** 编辑客户 */
const formRef = ref<InstanceType<typeof CustomerForm>>() // Ref
//
const openForm = () => {
formRef.value?.open('update', customerId.value)
}
//
/** 客户转移 */
const transfer = () => {}
//
/** 锁定客户 */
const handleLock = async () => {
await message.confirm(`确定锁定客户【${customer.value.name}】 吗?`)
await CustomerApi.lockCustomer(unref(customerId.value), true)
message.success(`锁定客户【${customer.value.name}】成功`)
await getCustomer()
}
//
/** 解锁客户 */
const handleUnlock = async () => {
await message.confirm(`确定解锁客户【${customer.value.name}】 吗?`)
await CustomerApi.lockCustomer(unref(customerId.value), false)
message.success(`解锁客户【${customer.value.name}】成功`)
await getCustomer()
}
//
// TODO @puhui999 handleXXX
/** 领取客户 */
const receive = async () => {
await message.confirm(`确定领取客户【${customer.value.name}】 吗?`)
await CustomerApi.receive([unref(customerId.value)])
message.success(`领取客户【${customer.value.name}】成功`)
await getCustomer()
}
//
/** 客户放入公海 */
const putPool = async () => {
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)
await CustomerApi.putPool(unref(customerId.value))
message.success(`客户【${customer.value.name}】放入公海成功`)
close()
}
/** 获取操作日志 */
const logList = ref<OperateLogV2VO[]>([]) //
/**
* 获取操作日志
*/
const getOperateLog = async () => {
if (!customerId.value) {
return
@ -124,11 +132,13 @@ const getOperateLog = async () => {
const data = await CustomerApi.getOperateLogPage(customerId.value)
logList.value = data.list
}
const close = () => {
delView(unref(currentRoute))
// TODO
push({ name: 'CrmCustomer' })
}
/** 初始化 */
const { params } = useRoute()
onMounted(() => {

View File

@ -100,9 +100,10 @@
<!-- 列表 -->
<ContentWrap>
<!-- TODO @puhui999是不是就 3 重呀我负责的我参与的我下属的 -->
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="客户列表" name="1" />
<el-tab-pane label="我负责的" name="2" />
<el-tab-pane label="我负责的" name="2" />
<el-tab-pane label="我关注的" name="3" />
<el-tab-pane label="我参与的" name="4" />
<el-tab-pane label="下属负责的" name="5" />
@ -270,6 +271,7 @@ const handleClick = (tab: TabsPaneContext) => {
queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW
})
break
// TODO @puhui999
case '4':
resetQuery(() => {
queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED
@ -280,6 +282,7 @@ const handleClick = (tab: TabsPaneContext) => {
queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE
})
break
// TODO @puhui999
case '6':
resetQuery(() => {
queryParams.value.pool = true
@ -287,6 +290,7 @@ const handleClick = (tab: TabsPaneContext) => {
break
}
}
/** 查询列表 */
const getList = async () => {
loading.value = true
@ -362,13 +366,15 @@ const handleExport = async () => {
exportLoading.value = false
}
}
//
/** 监听路由变化更新列表 */
watch(
() => currentRoute.value,
() => {
getList()
}
)
/** 初始化 **/
onMounted(() => {
getList()