📖 CRM:code review crm 客户列表
This commit is contained in:
parent
4eb3c8a2f9
commit
ec87c1b61d
@ -80,6 +80,7 @@ export const lockCustomer = async (id: number, lockStatus: boolean) => {
|
|||||||
return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
|
return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:方法名,改成和后端一致哈
|
||||||
// 领取公海客户
|
// 领取公海客户
|
||||||
export const receive = async (ids: any[]) => {
|
export const receive = async (ids: any[]) => {
|
||||||
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })
|
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<!-- TODO @puhui999:左边不用有空隙哈 -->
|
||||||
<div class="p-20px">
|
<div class="p-20px">
|
||||||
<el-timeline>
|
<el-timeline>
|
||||||
<el-timeline-item
|
<el-timeline-item
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<CustomerDetailsHeader :customer="customer" :loading="loading">
|
<CustomerDetailsHeader :customer="customer" :loading="loading">
|
||||||
|
<!-- @puhui999:返回是不是可以去掉哈,貌似用途可能不大 -->
|
||||||
<el-button @click="close">返回</el-button>
|
<el-button @click="close">返回</el-button>
|
||||||
<!-- TODO puhui999: 按钮数据权限收尾统一完善,需要按权限分级和客户状态来动态显示匹配的按钮 -->
|
<!-- TODO puhui999: 按钮数据权限收尾统一完善,需要按权限分级和客户状态来动态显示匹配的按钮 -->
|
||||||
<el-button v-hasPermi="['crm:customer:update']" type="primary" @click="openForm">
|
<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="handleUnlock">解锁</el-button>
|
||||||
<el-button v-if="!customer.lockStatus" @click="handleLock">锁定</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="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>
|
</CustomerDetailsHeader>
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-tabs>
|
<el-tabs>
|
||||||
@ -67,6 +68,7 @@ const loading = ref(true) // 加载中
|
|||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { delView } = useTagsViewStore() // 视图操作
|
const { delView } = useTagsViewStore() // 视图操作
|
||||||
const { currentRoute, push } = useRouter() // 路由
|
const { currentRoute, push } = useRouter() // 路由
|
||||||
|
|
||||||
/** 获取详情 */
|
/** 获取详情 */
|
||||||
const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // 客户详情
|
const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // 客户详情
|
||||||
const getCustomer = async () => {
|
const getCustomer = async () => {
|
||||||
@ -78,45 +80,51 @@ const getCustomer = async () => {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 编辑客户 */
|
||||||
const formRef = ref<InstanceType<typeof CustomerForm>>() // 客户表单 Ref
|
const formRef = ref<InstanceType<typeof CustomerForm>>() // 客户表单 Ref
|
||||||
// 编辑客户
|
|
||||||
const openForm = () => {
|
const openForm = () => {
|
||||||
formRef.value?.open('update', customerId.value)
|
formRef.value?.open('update', customerId.value)
|
||||||
}
|
}
|
||||||
// 客户转移
|
|
||||||
|
/** 客户转移 */
|
||||||
const transfer = () => {}
|
const transfer = () => {}
|
||||||
// 锁定客户
|
|
||||||
|
/** 锁定客户 */
|
||||||
const handleLock = async () => {
|
const handleLock = async () => {
|
||||||
await message.confirm(`确定锁定客户【${customer.value.name}】 吗?`)
|
await message.confirm(`确定锁定客户【${customer.value.name}】 吗?`)
|
||||||
await CustomerApi.lockCustomer(unref(customerId.value), true)
|
await CustomerApi.lockCustomer(unref(customerId.value), true)
|
||||||
message.success(`锁定客户【${customer.value.name}】成功`)
|
message.success(`锁定客户【${customer.value.name}】成功`)
|
||||||
await getCustomer()
|
await getCustomer()
|
||||||
}
|
}
|
||||||
// 解锁客户
|
|
||||||
|
/** 解锁客户 */
|
||||||
const handleUnlock = async () => {
|
const handleUnlock = async () => {
|
||||||
await message.confirm(`确定解锁客户【${customer.value.name}】 吗?`)
|
await message.confirm(`确定解锁客户【${customer.value.name}】 吗?`)
|
||||||
await CustomerApi.lockCustomer(unref(customerId.value), false)
|
await CustomerApi.lockCustomer(unref(customerId.value), false)
|
||||||
message.success(`解锁客户【${customer.value.name}】成功`)
|
message.success(`解锁客户【${customer.value.name}】成功`)
|
||||||
await getCustomer()
|
await getCustomer()
|
||||||
}
|
}
|
||||||
// 领取客户
|
|
||||||
|
// TODO @puhui999:下面两个方法的命名,也用 handleXXX 风格哈
|
||||||
|
/** 领取客户 */
|
||||||
const receive = async () => {
|
const receive = async () => {
|
||||||
await message.confirm(`确定领取客户【${customer.value.name}】 吗?`)
|
await message.confirm(`确定领取客户【${customer.value.name}】 吗?`)
|
||||||
await CustomerApi.receive([unref(customerId.value)])
|
await CustomerApi.receive([unref(customerId.value)])
|
||||||
message.success(`领取客户【${customer.value.name}】成功`)
|
message.success(`领取客户【${customer.value.name}】成功`)
|
||||||
await getCustomer()
|
await getCustomer()
|
||||||
}
|
}
|
||||||
// 客户放入公海
|
|
||||||
|
/** 客户放入公海 */
|
||||||
const putPool = async () => {
|
const putPool = async () => {
|
||||||
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)
|
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)
|
||||||
await CustomerApi.putPool(unref(customerId.value))
|
await CustomerApi.putPool(unref(customerId.value))
|
||||||
message.success(`客户【${customer.value.name}】放入公海成功`)
|
message.success(`客户【${customer.value.name}】放入公海成功`)
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取操作日志 */
|
||||||
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
|
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
|
||||||
/**
|
|
||||||
* 获取操作日志
|
|
||||||
*/
|
|
||||||
const getOperateLog = async () => {
|
const getOperateLog = async () => {
|
||||||
if (!customerId.value) {
|
if (!customerId.value) {
|
||||||
return
|
return
|
||||||
@ -124,11 +132,13 @@ const getOperateLog = async () => {
|
|||||||
const data = await CustomerApi.getOperateLogPage(customerId.value)
|
const data = await CustomerApi.getOperateLogPage(customerId.value)
|
||||||
logList.value = data.list
|
logList.value = data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
delView(unref(currentRoute))
|
delView(unref(currentRoute))
|
||||||
// TODO 先返回到客户列表
|
// TODO 先返回到客户列表
|
||||||
push({ name: 'CrmCustomer' })
|
push({ name: 'CrmCustomer' })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
const { params } = useRoute()
|
const { params } = useRoute()
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -100,9 +100,10 @@
|
|||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
|
<!-- TODO @puhui999:是不是就 3 重呀,我负责的,我参与的,我下属的 -->
|
||||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||||
<el-tab-pane label="客户列表" name="1" />
|
<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="3" />
|
||||||
<el-tab-pane label="我参与的" name="4" />
|
<el-tab-pane label="我参与的" name="4" />
|
||||||
<el-tab-pane label="下属负责的" name="5" />
|
<el-tab-pane label="下属负责的" name="5" />
|
||||||
@ -270,6 +271,7 @@ const handleClick = (tab: TabsPaneContext) => {
|
|||||||
queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW
|
queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
// TODO @puhui999:这个貌似报错?
|
||||||
case '4':
|
case '4':
|
||||||
resetQuery(() => {
|
resetQuery(() => {
|
||||||
queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED
|
queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED
|
||||||
@ -280,6 +282,7 @@ const handleClick = (tab: TabsPaneContext) => {
|
|||||||
queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE
|
queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
// TODO @puhui999:公海单独一个菜单哈。
|
||||||
case '6':
|
case '6':
|
||||||
resetQuery(() => {
|
resetQuery(() => {
|
||||||
queryParams.value.pool = true
|
queryParams.value.pool = true
|
||||||
@ -287,6 +290,7 @@ const handleClick = (tab: TabsPaneContext) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -362,13 +366,15 @@ const handleExport = async () => {
|
|||||||
exportLoading.value = false
|
exportLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 监听路由变化更新列表
|
|
||||||
|
/** 监听路由变化更新列表 */
|
||||||
watch(
|
watch(
|
||||||
() => currentRoute.value,
|
() => currentRoute.value,
|
||||||
() => {
|
() => {
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
|
Loading…
Reference in New Issue
Block a user