Skip to content

Commit a64d424

Browse files
author
puhui999
committed
CRM-联系人:完善联系人转移、数据权限
1 parent 5adf75d commit a64d424

File tree

3 files changed

+46
-18
lines changed

3 files changed

+46
-18
lines changed

src/api/crm/contact/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import request from '@/config/axios'
2+
import { TransferReqVO } from '@/api/crm/customer'
23

34
export interface ContactVO {
45
name: string
@@ -85,3 +86,8 @@ export const createContactBusinessList = async (data: ContactBusinessReqVO) => {
8586
export const deleteContactBusinessList = async (data: ContactBusinessReqVO) => {
8687
return await request.delete({ url: `/crm/contact/delete-business-list`, data })
8788
}
89+
90+
// 联系人转移
91+
export const transfer = async (data: TransferReqVO) => {
92+
return await request.put({ url: '/crm/contact/transfer', data })
93+
}

src/views/crm/contact/detail/ContactDetailsHeader.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
</div>
1111
<div>
1212
<!-- 右上:按钮 -->
13-
<el-button @click="openForm('update', contact.id)" v-hasPermi="['crm:contact:update']">
14-
编辑
15-
</el-button>
13+
<slot></slot>
1614
</div>
1715
</div>
1816
</div>
@@ -32,18 +30,10 @@
3230
</el-descriptions-item>
3331
</el-descriptions>
3432
</ContentWrap>
35-
<!-- 表单弹窗:添加/修改 -->
36-
<ContactForm ref="formRef" @success="emit('refresh')" />
3733
</template>
38-
<script setup lang="ts">
34+
<script lang="ts" setup>
3935
import * as ContactApi from '@/api/crm/contact'
40-
import ContactForm from '@/views/crm/contact/ContactForm.vue'
4136
import { formatDate } from '@/utils/formatTime'
42-
//操作修改
43-
const formRef = ref()
44-
const openForm = (type: string, id?: number) => {
45-
formRef.value.open(type, id)
46-
}
37+
4738
const { contact } = defineProps<{ contact: ContactApi.ContactVO }>()
48-
const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
4939
</script>

src/views/crm/contact/detail/index.vue

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<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>
310
<el-col>
411
<el-tabs>
512
<el-tab-pane label="详细资料">
@@ -8,8 +15,14 @@
815
<el-tab-pane label="操作日志">
916
<OperateLogV2 :log-list="logList" />
1017
</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+
/>
1326
</el-tab-pane>
1427
<el-tab-pane label="商机" lazy>
1528
<BusinessList
@@ -20,6 +33,9 @@
2033
</el-tab-pane>
2134
</el-tabs>
2235
</el-col>
36+
<!-- 表单弹窗:添加/修改 -->
37+
<ContactForm ref="formRef" @success="getContactData" />
38+
<CrmTransferForm ref="crmTransferFormRef" @success="close" />
2339
</template>
2440
<script lang="ts" setup>
2541
import { useTagsViewStore } from '@/store/modules/tagsView'
@@ -31,6 +47,8 @@ import PermissionList from '@/views/crm/permission/components/PermissionList.vue
3147
import { BizTypeEnum } from '@/api/crm/permission'
3248
import { OperateLogV2VO } from '@/api/system/operatelog'
3349
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'
3452
3553
defineOptions({ name: 'CrmContactDetail' })
3654
@@ -49,6 +67,18 @@ const getContactData = async (id: number) => {
4967
loading.value = false
5068
}
5169
}
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
5282
5383
/**
5484
* 获取操作日志
@@ -64,14 +94,16 @@ const getOperateLog = async (contactId: number) => {
6494
})
6595
logList.value = data.list
6696
}
67-
97+
const close = () => {
98+
delView(unref(currentRoute))
99+
}
68100
/** 初始化 */
69101
const { delView } = useTagsViewStore() // 视图操作
70102
const { currentRoute } = useRouter() // 路由
71103
onMounted(async () => {
72104
if (!id) {
73105
ElMessage.warning('参数错误,联系人不能为空!')
74-
delView(unref(currentRoute))
106+
close()
75107
return
76108
}
77109
await getContactData(id)

0 commit comments

Comments
 (0)