Skip to content

Commit 13e925e

Browse files
author
puhui999
committed
CRM:完善数据权限,实现数据权限同时添加、同时转移
1 parent 3660cd2 commit 13e925e

File tree

15 files changed

+158
-110
lines changed

15 files changed

+158
-110
lines changed

src/api/crm/business/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import request from '@/config/axios'
2-
import { TransferReqVO } from '@/api/crm/customer'
2+
import { TransferReqVO } from '@/api/crm/permission'
33

44
export interface BusinessVO {
55
id: number

src/api/crm/clue/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import request from '@/config/axios'
2-
import { TransferReqVO } from '@/api/crm/customer'
2+
import { TransferReqVO } from '@/api/crm/permission'
33

44
export interface ClueVO {
55
id: number // 编号

src/api/crm/contact/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import request from '@/config/axios'
2-
import { TransferReqVO } from '@/api/crm/customer'
2+
import { TransferReqVO } from '@/api/crm/permission'
33

44
export interface ContactVO {
55
id: number // 编号

src/api/crm/contract/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import request from '@/config/axios'
2-
import { TransferReqVO } from '@/api/crm/customer'
2+
import { TransferReqVO } from '@/api/crm/permission'
33

44
export interface ContractVO {
55
id: number

src/api/crm/customer/index.ts

Lines changed: 1 addition & 6 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/permission'
23

34
export interface CustomerVO {
45
id: number // 编号
@@ -102,12 +103,6 @@ export const getCustomerSimpleList = async () => {
102103

103104
// ======================= 业务操作 =======================
104105

105-
export interface TransferReqVO {
106-
id: number | undefined // 客户编号
107-
newOwnerUserId: number | undefined // 新负责人的用户编号
108-
oldOwnerPermissionLevel: number | undefined // 老负责人加入团队后的权限级别
109-
}
110-
111106
// 客户转移
112107
export const transferCustomer = async (data: TransferReqVO) => {
113108
return await request.put({ url: '/crm/customer/transfer', data })

src/api/crm/permission/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,21 @@ export interface PermissionVO {
66
bizType: number // Crm 类型
77
bizId: number // Crm 类型数据编号
88
level: number // 权限级别
9+
toBizTypes?: number[] // 同时添加至
910
deptName?: string // 部门名称
1011
nickname?: string // 用户昵称
1112
postNames?: string[] // 岗位名称数组
1213
createTime?: Date
1314
ids?: number[]
1415
}
1516

17+
export interface TransferReqVO {
18+
bizId: number // 模块编号
19+
newOwnerUserId: number // 新负责人的用户编号
20+
oldOwnerPermissionLevel: number // 老负责人加入团队后的权限级别
21+
toBizTypes?: number[] // 转移客户时,需要额外有【联系人】【商机】【合同】的 checkbox 选择
22+
}
23+
1624
/**
1725
* CRM 业务类型枚举
1826
*

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
编辑
55
</el-button>
66
<el-button
7-
:disabled="business.endStatus"
87
v-if="permissionListRef?.validateWrite"
8+
:disabled="business.endStatus"
99
type="success"
1010
@click="openStatusForm()"
1111
>
@@ -53,13 +53,12 @@
5353
</el-col>
5454

5555
<!-- 表单弹窗:添加/修改 -->
56-
<BusinessForm ref="formRef" @success="getBusiness(business.id)" />
57-
<BusinessUpdateStatusForm ref="statusFormRef" @success="getBusiness(business.id)" />
58-
<CrmTransferForm ref="transferFormRef" @success="close" />
56+
<BusinessForm ref="formRef" @success="getBusiness" />
57+
<BusinessUpdateStatusForm ref="statusFormRef" @success="getBusiness" />
58+
<CrmTransferForm ref="transferFormRef" :biz-type="BizTypeEnum.CRM_BUSINESS" @success="close" />
5959
</template>
6060
<script lang="ts" setup>
6161
import { useTagsViewStore } from '@/store/modules/tagsView'
62-
import * as ContactApi from '@/api/crm/contact'
6362
import * as BusinessApi from '@/api/crm/business'
6463
import BusinessDetailsHeader from './BusinessDetailsHeader.vue'
6564
import BusinessDetailsInfo from './BusinessDetailsInfo.vue'
@@ -73,22 +72,23 @@ import FollowUpList from '@/views/crm/followup/index.vue'
7372
import ContactList from '@/views/crm/contact/components/ContactList.vue'
7473
import BusinessUpdateStatusForm from '@/views/crm/business/BusinessUpdateStatusForm.vue'
7574
import ContractList from '@/views/crm/contract/components/ContractList.vue'
75+
import BusinessProductList from '@/views/crm/business/detail/BusinessProductList.vue'
7676
7777
defineOptions({ name: 'CrmBusinessDetail' })
7878
7979
const message = useMessage()
8080
8181
const businessId = ref(0) // 线索编号
8282
const loading = ref(true) // 加载中
83-
const business = ref<ContactApi.ContactVO>({} as ContactApi.ContactVO) // 联系人详情
83+
const business = ref<BusinessApi.BusinessVO>({} as BusinessApi.BusinessVO) // 商机详情
8484
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // 团队成员列表 Ref
8585
8686
/** 获取详情 */
87-
const getBusiness = async (id: number) => {
87+
const getBusiness = async () => {
8888
loading.value = true
8989
try {
90-
business.value = await BusinessApi.getBusiness(id)
91-
await getOperateLog(id)
90+
business.value = await BusinessApi.getBusiness(businessId.value)
91+
await getOperateLog(businessId.value)
9292
} finally {
9393
loading.value = false
9494
}
@@ -109,7 +109,7 @@ const openStatusForm = () => {
109109
/** 联系人转移 */
110110
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 联系人转移表单 ref
111111
const transfer = () => {
112-
transferFormRef.value?.open('商机转移', business.value.id, BusinessApi.transferBusiness)
112+
transferFormRef.value?.open(business.value.id)
113113
}
114114
115115
/** 获取操作日志 */
@@ -141,6 +141,6 @@ onMounted(async () => {
141141
return
142142
}
143143
businessId.value = params.id as unknown as number
144-
await getBusiness(businessId.value)
144+
await getBusiness()
145145
})
146146
</script>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
>
1919
转化为客户
2020
</el-button>
21-
<el-button v-else type="success" disabled>已转化客户</el-button>
21+
<el-button v-else disabled type="success">已转化客户</el-button>
2222
</ClueDetailsHeader>
2323
<el-col>
2424
<el-tabs>
@@ -45,7 +45,7 @@
4545

4646
<!-- 表单弹窗:添加/修改 -->
4747
<ClueForm ref="formRef" @success="getClue" />
48-
<CrmTransferForm ref="transferFormRef" @success="close" />
48+
<CrmTransferForm ref="transferFormRef" :biz-type="BizTypeEnum.CRM_CLUE" @success="close" />
4949
</template>
5050
<script lang="ts" setup>
5151
import { useTagsViewStore } from '@/store/modules/tagsView'
@@ -91,7 +91,7 @@ const openForm = () => {
9191
/** 线索转移 */
9292
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 线索转移表单 ref
9393
const transfer = () => {
94-
transferFormRef.value?.open('线索转移', clueId.value, ClueApi.transferClue)
94+
transferFormRef.value?.open(clueId.value)
9595
}
9696
9797
/** 转化为客户 */

src/views/crm/contact/components/ContactList.vue

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66
创建联系人
77
</el-button>
88
<el-button
9-
@click="openBusinessModal"
10-
v-hasPermi="['crm:contact:create-business']"
119
v-if="queryParams.businessId"
10+
v-hasPermi="['crm:contact:create-business']"
11+
@click="openBusinessModal"
1212
>
13-
<Icon class="mr-5px" icon="ep:circle-plus" />关联
13+
<Icon class="mr-5px" icon="ep:circle-plus" />
14+
关联
1415
</el-button>
1516
<el-button
16-
@click="deleteContactBusinessList"
17-
v-hasPermi="['crm:contact:delete-business']"
1817
v-if="queryParams.businessId"
18+
v-hasPermi="['crm:contact:delete-business']"
19+
@click="deleteContactBusinessList"
1920
>
20-
<Icon class="mr-5px" icon="ep:remove" />解除关联
21+
<Icon class="mr-5px" icon="ep:remove" />
22+
解除关联
2123
</el-button>
2224
</el-row>
2325

@@ -27,31 +29,31 @@
2729
ref="contactRef"
2830
v-loading="loading"
2931
:data="list"
30-
:stripe="true"
3132
:show-overflow-tooltip="true"
33+
:stripe="true"
3234
>
33-
<el-table-column type="selection" width="55" v-if="queryParams.businessId" />
34-
<el-table-column label="姓名" fixed="left" align="center" prop="name">
35+
<el-table-column v-if="queryParams.businessId" type="selection" width="55" />
36+
<el-table-column align="center" fixed="left" label="姓名" prop="name">
3537
<template #default="scope">
36-
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
38+
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
3739
{{ scope.row.name }}
3840
</el-link>
3941
</template>
4042
</el-table-column>
41-
<el-table-column label="手机号" align="center" prop="mobile" />
42-
<el-table-column label="职位" align="center" prop="post" />
43-
<el-table-column label="直属上级" align="center" prop="parentName" />
44-
<el-table-column label="是否关键决策人" align="center" prop="master" min-width="100">
43+
<el-table-column align="center" label="手机号" prop="mobile" />
44+
<el-table-column align="center" label="职位" prop="post" />
45+
<el-table-column align="center" label="直属上级" prop="parentName" />
46+
<el-table-column align="center" label="是否关键决策人" min-width="100" prop="master">
4547
<template #default="scope">
4648
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
4749
</template>
4850
</el-table-column>
4951
</el-table>
5052
<!-- 分页 -->
5153
<Pagination
52-
:total="total"
53-
v-model:page="queryParams.pageNo"
5454
v-model:limit="queryParams.pageSize"
55+
v-model:page="queryParams.pageNo"
56+
:total="total"
5557
@pagination="getList"
5658
/>
5759
</ContentWrap>
@@ -60,12 +62,13 @@
6062
<ContactForm ref="formRef" @success="getList" />
6163
<!-- 关联商机选择弹框 -->
6264
<ContactListModal
65+
v-if="customerId"
6366
ref="contactModalRef"
64-
:customer-id="props.customerId"
67+
:customer-id="customerId"
6568
@success="createContactBusinessList"
6669
/>
6770
</template>
68-
<script setup lang="ts">
71+
<script lang="ts" setup>
6972
import * as ContactApi from '@/api/crm/contact'
7073
import ContactForm from './../ContactForm.vue'
7174
import { DICT_TYPE } from '@/utils/dict'
@@ -76,8 +79,8 @@ defineOptions({ name: 'CrmContactList' })
7679
const props = defineProps<{
7780
bizType: number // 业务类型
7881
bizId: number // 业务编号
79-
customerId: number // 特殊:客户编号;在【商机】详情中,可以传递客户编号,默认新建的联系人关联到该客户
80-
businessId: number // 特殊:商机编号;在【商机】详情中,可以传递商机编号,默认新建的联系人关联到该商机
82+
customerId?: number // 特殊:客户编号;在【商机】详情中,可以传递客户编号,默认新建的联系人关联到该客户
83+
businessId?: number // 特殊:商机编号;在【商机】详情中,可以传递商机编号,默认新建的联系人关联到该商机
8184
}>()
8285
8386
const loading = ref(true) // 列表的加载中
@@ -147,7 +150,7 @@ const createContactBusinessList = async (contactIds: number[]) => {
147150
contactIds: contactIds
148151
} as ContactApi.ContactBusiness2ReqVO
149152
contactRef.value.getSelectionRows().forEach((row: ContactApi.ContactVO) => {
150-
data.businessIds.push(row.id)
153+
data.contactIds.push(row.id)
151154
})
152155
await ContactApi.createContactBusinessList2(data)
153156
// 刷新列表

src/views/crm/contact/components/ContactListModal.vue

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
<template>
2-
<Dialog title="关联联系人" v-model="dialogVisible">
2+
<Dialog v-model="dialogVisible" title="关联联系人">
33
<!-- 搜索工作栏 -->
44
<ContentWrap>
55
<el-form
6-
class="-mb-15px"
7-
:model="queryParams"
86
ref="queryFormRef"
97
:inline="true"
8+
:model="queryParams"
9+
class="-mb-15px"
1010
label-width="90px"
1111
>
1212
<el-form-item label="联系人名称" prop="name">
1313
<el-input
1414
v-model="queryParams.name"
15-
placeholder="请输入联系人名称"
15+
class="!w-240px"
1616
clearable
17+
placeholder="请输入联系人名称"
1718
@keyup.enter="handleQuery"
18-
class="!w-240px"
1919
/>
2020
</el-form-item>
2121
<el-form-item>
22-
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
23-
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
24-
<el-button type="primary" @click="openForm()" v-hasPermi="['crm:business:create']">
25-
<Icon icon="ep:plus" class="mr-5px" /> 新增
22+
<el-button @click="handleQuery">
23+
<Icon class="mr-5px" icon="ep:search" />
24+
搜索
25+
</el-button>
26+
<el-button @click="resetQuery">
27+
<Icon class="mr-5px" icon="ep:refresh" />
28+
重置
29+
</el-button>
30+
<el-button v-hasPermi="['crm:business:create']" type="primary" @click="openForm()">
31+
<Icon class="mr-5px" icon="ep:plus" />
32+
新增
2633
</el-button>
2734
</el-form-item>
2835
</el-form>
@@ -31,50 +38,49 @@
3138
<!-- 列表 -->
3239
<ContentWrap class="mt-10px">
3340
<el-table
34-
v-loading="loading"
3541
ref="contactRef"
42+
v-loading="loading"
3643
:data="list"
37-
:stripe="true"
3844
:show-overflow-tooltip="true"
45+
:stripe="true"
3946
>
4047
<el-table-column type="selection" width="55" />
41-
<el-table-column label="姓名" fixed="left" align="center" prop="name">
48+
<el-table-column align="center" fixed="left" label="姓名" prop="name">
4249
<template #default="scope">
43-
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
50+
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
4451
{{ scope.row.name }}
4552
</el-link>
4653
</template>
4754
</el-table-column>
48-
<el-table-column label="手机号" align="center" prop="mobile" />
49-
<el-table-column label="职位" align="center" prop="post" />
50-
<el-table-column label="直属上级" align="center" prop="parentName" />
51-
<el-table-column label="是否关键决策人" align="center" prop="master" min-width="100">
55+
<el-table-column align="center" label="手机号" prop="mobile" />
56+
<el-table-column align="center" label="职位" prop="post" />
57+
<el-table-column align="center" label="直属上级" prop="parentName" />
58+
<el-table-column align="center" label="是否关键决策人" min-width="100" prop="master">
5259
<template #default="scope">
5360
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
5461
</template>
5562
</el-table-column>
5663
</el-table>
5764
<!-- 分页 -->
5865
<Pagination
59-
:total="total"
60-
v-model:page="queryParams.pageNo"
6166
v-model:limit="queryParams.pageSize"
67+
v-model:page="queryParams.pageNo"
68+
:total="total"
6269
@pagination="getList"
6370
/>
6471
</ContentWrap>
6572
<template #footer>
66-
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
73+
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
6774
<el-button @click="dialogVisible = false">取 消</el-button>
6875
</template>
6976

7077
<!-- 表单弹窗:添加 -->
7178
<ContactForm ref="formRef" @success="getList" />
7279
</Dialog>
7380
</template>
74-
<script setup lang="ts">
81+
<script lang="ts" setup>
7582
import * as ContactApi from '@/api/crm/contact'
7683
import ContactForm from '../ContactForm.vue'
77-
import { erpPriceTableColumnFormatter } from '@/utils'
7884
import { DICT_TYPE } from '@/utils/dict'
7985
8086
const message = useMessage() // 消息弹窗

0 commit comments

Comments
 (0)