1
1
<template >
2
- <ContactDetailsHeader :contact =" contact" :loading =" loading" @refresh =" getContactData(id)" />
2
+ <ContactDetailsHeader v-loading =" loading" :contact =" contact" >
3
+ <el-button v-if =" permissionListRef?.validateWrite" @click =" openForm('update', contact.id)" >
4
+ 编辑
5
+ </el-button >
6
+ <el-button v-if =" permissionListRef?.validateOwnerUser" type =" primary" @click =" transfer" >
7
+ 转移
8
+ </el-button >
9
+ </ContactDetailsHeader >
3
10
<el-col >
4
11
<el-tabs >
5
12
<el-tab-pane label =" 详细资料" >
8
15
<el-tab-pane label =" 操作日志" >
9
16
<OperateLogV2 :log-list =" logList" />
10
17
</el-tab-pane >
11
- <el-tab-pane label =" 团队成员" lazy >
12
- <PermissionList :biz-id =" contact.id!" :biz-type =" BizTypeEnum.CRM_CONTACT" />
18
+ <el-tab-pane label =" 团队成员" >
19
+ <PermissionList
20
+ ref =" permissionListRef"
21
+ :biz-id =" contact.id!"
22
+ :biz-type =" BizTypeEnum.CRM_CONTACT"
23
+ :show-action =" !permissionListRef?.isPool || false"
24
+ @quit-team =" close"
25
+ />
13
26
</el-tab-pane >
14
27
<el-tab-pane label =" 商机" lazy >
15
28
<BusinessList
20
33
</el-tab-pane >
21
34
</el-tabs >
22
35
</el-col >
36
+ <!-- 表单弹窗:添加/修改 -->
37
+ <ContactForm ref =" formRef" @success =" getContactData" />
38
+ <CrmTransferForm ref =" crmTransferFormRef" @success =" close" />
23
39
</template >
24
40
<script lang="ts" setup>
25
41
import { useTagsViewStore } from ' @/store/modules/tagsView'
@@ -31,6 +47,8 @@ import PermissionList from '@/views/crm/permission/components/PermissionList.vue
31
47
import { BizTypeEnum } from ' @/api/crm/permission'
32
48
import { OperateLogV2VO } from ' @/api/system/operatelog'
33
49
import { getOperateLogPage } from ' @/api/crm/operateLog'
50
+ import ContactForm from ' @/views/crm/contact/ContactForm.vue'
51
+ import CrmTransferForm from ' @/views/crm/permission/components/TransferForm.vue'
34
52
35
53
defineOptions ({ name: ' CrmContactDetail' })
36
54
@@ -49,6 +67,18 @@ const getContactData = async (id: number) => {
49
67
loading .value = false
50
68
}
51
69
}
70
+ /** 编辑 */
71
+ const formRef = ref ()
72
+ const openForm = (type : string , id ? : number ) => {
73
+ formRef .value .open (type , id )
74
+ }
75
+ /** 联系人转移 */
76
+ const crmTransferFormRef = ref <InstanceType <typeof CrmTransferForm >>() // 联系人转移表单 ref
77
+ const transfer = () => {
78
+ crmTransferFormRef .value ?.open (' 联系人转移' , contact .value .id , ContactApi .transfer )
79
+ }
80
+
81
+ const permissionListRef = ref <InstanceType <typeof PermissionList >>() // 团队成员列表 Ref
52
82
53
83
/**
54
84
* 获取操作日志
@@ -64,14 +94,16 @@ const getOperateLog = async (contactId: number) => {
64
94
})
65
95
logList .value = data .list
66
96
}
67
-
97
+ const close = () => {
98
+ delView (unref (currentRoute ))
99
+ }
68
100
/** 初始化 */
69
101
const { delView } = useTagsViewStore () // 视图操作
70
102
const { currentRoute } = useRouter () // 路由
71
103
onMounted (async () => {
72
104
if (! id ) {
73
105
ElMessage .warning (' 参数错误,联系人不能为空!' )
74
- delView ( unref ( currentRoute ) )
106
+ close ( )
75
107
return
76
108
}
77
109
await getContactData (id )
0 commit comments