78 lines
2.4 KiB
Vue
Raw Normal View History

2023-11-11 23:35:18 +08:00
<template>
2023-12-03 19:56:46 +08:00
<ContactDetailsHeader :contact="contact" :loading="loading" @refresh="getContactData(id)" />
<el-col>
2023-11-11 23:35:18 +08:00
<el-tabs>
2023-12-03 19:56:46 +08:00
<el-tab-pane label="详细资料">
<ContactDetailsInfo :contact="contact" />
2023-11-11 23:35:18 +08:00
</el-tab-pane>
2024-01-06 21:04:58 +08:00
<el-tab-pane label="操作日志">
<OperateLogV2 :log-list="logList" />
</el-tab-pane>
2023-12-03 19:56:46 +08:00
<el-tab-pane label="团队成员" lazy>
<PermissionList :biz-id="contact.id!" :biz-type="BizTypeEnum.CRM_CONTACT" />
</el-tab-pane>
<el-tab-pane label="商机" lazy>
2024-01-02 18:48:47 +08:00
<BusinessList
:biz-id="contact.id!"
:biz-type="BizTypeEnum.CRM_CONTACT"
:customer-id="contact.customerId"
/>
2023-11-11 23:35:18 +08:00
</el-tab-pane>
</el-tabs>
</el-col>
</template>
<script setup lang="ts">
import { useTagsViewStore } from '@/store/modules/tagsView'
import * as ContactApi from '@/api/crm/contact'
2023-12-03 19:56:46 +08:00
import ContactDetailsHeader from '@/views/crm/contact/detail/ContactDetailsHeader.vue'
import ContactDetailsInfo from '@/views/crm/contact/detail/ContactDetailsInfo.vue'
2024-01-02 18:48:47 +08:00
import BusinessList from '@/views/crm/business/components/BusinessList.vue' // 商机列表
2023-12-03 19:56:46 +08:00
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' // 团队成员列表(权限)
import { BizTypeEnum } from '@/api/crm/permission'
2024-01-06 21:04:58 +08:00
import { OperateLogV2VO } from '@/api/system/operatelog'
2023-11-11 23:35:18 +08:00
2023-11-30 13:42:49 +08:00
defineOptions({ name: 'CrmContactDetail' })
2023-11-11 23:35:18 +08:00
const route = useRoute()
const id = Number(route.params.id) // 联系人编号
2023-11-11 23:35:18 +08:00
const loading = ref(true) // 加载中
const contact = ref<ContactApi.ContactVO>({} as ContactApi.ContactVO) // 联系人详情
/** 获取详情 */
2023-11-11 23:35:18 +08:00
const getContactData = async (id: number) => {
loading.value = true
try {
contact.value = await ContactApi.getContact(id)
2024-01-06 21:04:58 +08:00
await getOperateLog(id)
2023-11-11 23:35:18 +08:00
} finally {
loading.value = false
}
}
2024-01-06 21:04:58 +08:00
/**
* 获取操作日志
*/
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
2024-01-06 21:04:58 +08:00
const getOperateLog = async (contactId: number) => {
if (!contactId) {
return
}
const data = await ContactApi.getOperateLogPage({
bizId: contactId
})
logList.value = data.list
}
/** 初始化 */
const { delView } = useTagsViewStore() // 视图操作
const { currentRoute } = useRouter() // 路由
2023-11-11 23:35:18 +08:00
onMounted(async () => {
if (!id) {
ElMessage.warning('参数错误,联系人不能为空!')
delView(unref(currentRoute))
return
}
await getContactData(id)
})
</script>