Skip to content

Commit 163613e

Browse files
YunaiVgitee-org
authored andcommitted
!363 crm:新增跟进组件、转移表单组件封装,完善按钮数据权限控制、客户公海抽离
Merge pull request !363 from puhui999/dev-crm
2 parents 1e70a1d + 2a55d88 commit 163613e

File tree

20 files changed

+1290
-195
lines changed

20 files changed

+1290
-195
lines changed

src/api/crm/business/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* @Author: zyna
3-
* @Date: 2023-12-02 13:08:56
4-
* @LastEditTime: 2023-12-17 16:28:20
5-
* @FilePath: \yudao-ui-admin-vue3\src\api\crm\business\index.ts
6-
* @Description:
7-
*/
81
import request from '@/config/axios'
92

103
export interface BusinessVO {
@@ -43,6 +36,11 @@ export const getBusiness = async (id: number) => {
4336
return await request.get({ url: `/crm/business/get?id=` + id })
4437
}
4538

39+
// 获得 CRM 商机列表(精简)
40+
export const getSimpleBusinessList = async () => {
41+
return await request.get({ url: `/crm/business/simple-all-list` })
42+
}
43+
4644
// 新增 CRM 商机
4745
export const createBusiness = async (data: BusinessVO) => {
4846
return await request.post({ url: `/crm/business/create`, data })
@@ -67,3 +65,8 @@ export const exportBusiness = async (params) => {
6765
export const getBusinessPageByContact = async (params) => {
6866
return await request.get({ url: `/crm/business/page-by-contact`, params })
6967
}
68+
69+
// 获得 CRM 商机列表
70+
export const getBusinessListByIds = async (val: number[]) => {
71+
return await request.get({ url: '/crm/business/list-by-ids', params: { ids: val.join(',') } })
72+
}

src/api/crm/contact/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export const getSimpleContactList = async () => {
7171
return await request.get({ url: `/crm/contact/simple-all-list` })
7272
}
7373

74+
// 获得 CRM 联系人列表
75+
export const getContactListByIds = async (val: number[]) => {
76+
return await request.get({ url: '/crm/contact/list-by-ids', params: { ids: val.join(',') } })
77+
}
78+
7479
// 批量新增联系人商机关联
7580
export const createContactBusinessList = async (data: ContactBusinessReqVO) => {
7681
return await request.post({ url: `/crm/contact/create-business-list`, data })
@@ -84,4 +89,4 @@ export const deleteContactBusinessList = async (data: ContactBusinessReqVO) => {
8489
// 查询联系人操作日志
8590
export const getOperateLogPage = async (params: any) => {
8691
return await request.get({ url: '/crm/contact/operate-log-page', params })
87-
}
92+
}

src/api/crm/customer/index.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export const exportCustomer = async (params: any) => {
6464
}
6565

6666
// 客户列表
67-
export const queryAllList = async () => {
68-
return await request.get({ url: `/crm/customer/query-all-list` })
67+
export const getSimpleCustomerList = async () => {
68+
return await request.get({ url: `/crm/customer/list-all-simple` })
6969
}
7070

7171
// 查询客户操作日志
@@ -75,18 +75,28 @@ export const getOperateLogPage = async (id: number) => {
7575

7676
// ======================= 业务操作 =======================
7777

78+
export interface TransferReqVO {
79+
id: number | undefined // 客户编号
80+
newOwnerUserId: number | undefined // 新负责人的用户编号
81+
oldOwnerPermissionLevel: number | undefined // 老负责人加入团队后的权限级别
82+
}
83+
84+
// 客户转移
85+
export const transfer = async (data: TransferReqVO) => {
86+
return await request.put({ url: '/crm/customer/transfer', data })
87+
}
88+
7889
// 锁定/解锁客户
7990
export const lockCustomer = async (id: number, lockStatus: boolean) => {
8091
return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
8192
}
8293

83-
// TODO @puhui999:方法名,改成和后端一致哈
8494
// 领取公海客户
85-
export const receive = async (ids: any[]) => {
95+
export const receiveCustomer = async (ids: any[]) => {
8696
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })
8797
}
8898

8999
// 客户放入公海
90-
export const putPool = async (id: number) => {
100+
export const putCustomerPool = async (id: number) => {
91101
return await request.put({ url: `/crm/customer/put-pool?id=${id}` })
92102
}

src/api/crm/followup/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import request from '@/config/axios'
2+
3+
// 跟进记录 VO
4+
export interface FollowUpRecordVO {
5+
// 编号
6+
id: number
7+
// 数据类型
8+
bizType: number
9+
// 数据编号
10+
bizId: number
11+
// 跟进类型
12+
type: number
13+
// 跟进内容
14+
content: string
15+
// 下次联系时间
16+
nextTime: Date
17+
// 关联的商机编号数组
18+
businessIds: number[]
19+
// 关联的联系人编号数组
20+
contactIds: number[]
21+
}
22+
23+
// 跟进记录 API
24+
export const FollowUpRecordApi = {
25+
// 查询跟进记录分页
26+
getFollowUpRecordPage: async (params: any) => {
27+
return await request.get({ url: `/crm/follow-up-record/page`, params })
28+
},
29+
30+
// 查询跟进记录详情
31+
getFollowUpRecord: async (id: number) => {
32+
return await request.get({ url: `/crm/follow-up-record/get?id=` + id })
33+
},
34+
35+
// 新增跟进记录
36+
createFollowUpRecord: async (data: FollowUpRecordVO) => {
37+
return await request.post({ url: `/crm/follow-up-record/create`, data })
38+
},
39+
40+
// 修改跟进记录
41+
updateFollowUpRecord: async (data: FollowUpRecordVO) => {
42+
return await request.put({ url: `/crm/follow-up-record/update`, data })
43+
},
44+
45+
// 删除跟进记录
46+
deleteFollowUpRecord: async (id: number) => {
47+
return await request.delete({ url: `/crm/follow-up-record/delete?id=` + id })
48+
},
49+
50+
// 导出跟进记录 Excel
51+
exportFollowUpRecord: async (params) => {
52+
return await request.download({ url: `/crm/follow-up-record/export-excel`, params })
53+
}
54+
}

src/components/OperateLogV2/src/OperateLogV2.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<!-- TODO @puhui999:左边不用有空隙哈 -->
3-
<div class="p-20px">
3+
<div class="pt-20px">
44
<el-timeline>
55
<el-timeline-item
66
v-for="(log, index) in logList"
@@ -58,7 +58,7 @@ const getUserTypeColor = (type: number) => {
5858
<style lang="scss" scoped>
5959
// 时间线样式调整
6060
:deep(.el-timeline) {
61-
margin: 10px 0 0 160px;
61+
margin: 10px 0 0 110px;
6262
6363
.el-timeline-item__wrapper {
6464
position: relative;

src/router/modules/remaining.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
503503
title: '客户详情',
504504
noCache: true,
505505
hidden: true,
506-
activeMenu: '/crm/customer'
506+
activeMenu: '/crm/customer/index'
507507
},
508508
component: () => import('@/views/crm/customer/detail/index.vue')
509509
},

src/utils/dict.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* 数据字典工具类
33
*/
4-
import { useDictStoreWithOut } from '@/store/modules/dict'
5-
import { ElementPlusInfoType } from '@/types/elementPlus'
4+
import {useDictStoreWithOut} from '@/store/modules/dict'
5+
import {ElementPlusInfoType} from '@/types/elementPlus'
66

77
const dictStore = useDictStoreWithOut()
88

@@ -204,5 +204,6 @@ export enum DICT_TYPE {
204204
CRM_CUSTOMER_SOURCE = 'crm_customer_source',
205205
CRM_PRODUCT_STATUS = 'crm_product_status',
206206
CRM_PERMISSION_LEVEL = 'crm_permission_level', // CRM 数据权限的级别
207-
CRM_PRODUCT_UNIT = 'crm_product_unit' // 产品单位
207+
CRM_PRODUCT_UNIT = 'crm_product_unit', // 产品单位
208+
CRM_FOLLOW_UP_TYPE = 'crm_follow_up_type' // 跟进方式
208209
}

src/views/crm/contact/ContactForm.vue

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<template>
2-
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="820">
2+
<Dialog v-model="dialogVisible" :title="dialogTitle" :width="820">
33
<el-form
44
ref="formRef"
5+
v-loading="formLoading"
56
:model="formData"
67
:rules="formRules"
78
label-width="110px"
8-
v-loading="formLoading"
99
>
1010
<el-row :gutter="20">
1111
<el-col :span="12">
1212
<el-form-item label="姓名" prop="name">
13-
<el-input input-style="width:190px;" v-model="formData.name" placeholder="请输入姓名" />
13+
<el-input v-model="formData.name" input-style="width:190px;" placeholder="请输入姓名" />
1414
</el-form-item>
1515
</el-col>
1616
<el-col :span="12">
1717
<el-form-item label="负责人" prop="ownerUserId">
1818
<el-select
1919
v-model="formData.ownerUserId"
20+
lable-key="nickname"
2021
placeholder="请选择负责人"
2122
value-key="id"
22-
lable-key="nickname"
2323
>
2424
<el-option
2525
v-for="item in userList"
@@ -36,9 +36,9 @@
3636
<el-form-item label="客户名称" prop="customerName">
3737
<el-select
3838
v-model="formData.customerId"
39+
lable-key="name"
3940
placeholder="请选择客户"
4041
value-key="id"
41-
lable-key="name"
4242
>
4343
<el-option
4444
v-for="item in customerList"
@@ -66,8 +66,8 @@
6666
<el-col :span="12">
6767
<el-form-item label="手机号" prop="mobile">
6868
<el-input
69-
input-style="width:190px;"
7069
v-model="formData.mobile"
70+
input-style="width:190px;"
7171
placeholder="请输入手机号"
7272
/>
7373
</el-form-item>
@@ -82,8 +82,8 @@
8282
<el-col :span="12">
8383
<el-form-item label="邮箱" prop="email">
8484
<el-input
85-
input-style="width:190px;"
8685
v-model="formData.email"
86+
input-style="width:190px;"
8787
placeholder="请输入邮箱"
8888
/>
8989
</el-form-item>
@@ -98,8 +98,8 @@
9898
<el-col :span="12">
9999
<el-form-item label="微信" prop="wechat">
100100
<el-input
101-
input-style="width:190px;"
102101
v-model="formData.wechat"
102+
input-style="width:190px;"
103103
placeholder="请输入微信"
104104
/>
105105
</el-form-item>
@@ -108,9 +108,9 @@
108108
<el-form-item label="下次联系时间" prop="contactNextTime">
109109
<el-date-picker
110110
v-model="formData.contactNextTime"
111+
placeholder="选择下次联系时间"
111112
type="datetime"
112113
value-format="x"
113-
placeholder="选择下次联系时间"
114114
/>
115115
</el-form-item>
116116
</el-col>
@@ -129,8 +129,8 @@
129129
<el-col :span="12">
130130
<el-form-item label="地址" prop="detailAddress">
131131
<el-input
132-
input-style="width:190px;"
133132
v-model="formData.detailAddress"
133+
input-style="width:190px;"
134134
placeholder="请输入地址"
135135
/>
136136
</el-form-item>
@@ -143,16 +143,16 @@
143143
<el-option
144144
v-for="item in allContactList"
145145
:key="item.id"
146+
:disabled="item.id == formData.id"
146147
:label="item.name"
147148
:value="item.id"
148-
:disabled="item.id == formData.id"
149149
/>
150150
</el-select>
151151
</el-form-item>
152152
</el-col>
153153
<el-col :span="12">
154154
<el-form-item label="职位" prop="post">
155-
<el-input input-style="width:190px;" v-model="formData.post" placeholder="请输入职位" />
155+
<el-input v-model="formData.post" input-style="width:190px;" placeholder="请输入职位" />
156156
</el-form-item>
157157
</el-col>
158158
</el-row>
@@ -180,14 +180,14 @@
180180
</el-row>
181181
</el-form>
182182
<template #footer>
183-
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
183+
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
184184
<el-button @click="dialogVisible = false">取 消</el-button>
185185
</template>
186186
</Dialog>
187187
</template>
188-
<script setup lang="ts">
188+
<script lang="ts" setup>
189189
import * as ContactApi from '@/api/crm/contact'
190-
import { DICT_TYPE, getIntDictOptions, getBoolDictOptions } from '@/utils/dict'
190+
import { DICT_TYPE, getBoolDictOptions, getIntDictOptions } from '@/utils/dict'
191191
import * as UserApi from '@/api/system/user'
192192
import * as CustomerApi from '@/api/crm/customer'
193193
import * as AreaApi from '@/api/system/area'
@@ -242,7 +242,7 @@ const open = async (type: string, id?: number) => {
242242
resetForm()
243243
allContactList.value = await ContactApi.getSimpleContactList()
244244
userList.value = await UserApi.getSimpleUserList()
245-
customerList.value = await CustomerApi.queryAllList()
245+
customerList.value = await CustomerApi.getSimpleCustomerList()
246246
areaList.value = await AreaApi.getAreaTree()
247247
// 修改时,设置数据
248248
if (id) {

0 commit comments

Comments
 (0)