Skip to content

Commit a5f8c3d

Browse files
YunaiVgitee-org
authored andcommitted
!376 完善客户导入,统一日志获取接口
Merge pull request !376 from puhui999/dev-crm
2 parents 4271788 + 41195d5 commit a5f8c3d

File tree

26 files changed

+1183
-207
lines changed

26 files changed

+1183
-207
lines changed

src/api/bpm/model/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export const getModelPage = async (params) => {
3232
export const getModel = async (id: number) => {
3333
return await request.get({ url: '/bpm/model/get?id=' + id })
3434
}
35-
35+
export const getModelByKey = async (key: string) => {
36+
return await request.get({ url: '/bpm/model/get-by-key?key=' + key })
37+
}
3638
export const updateModel = async (data: ModelVO) => {
3739
return await request.put({ url: '/bpm/model/update', data: data })
3840
}

src/api/crm/business/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 BusinessVO {
45
id: number
@@ -70,3 +71,8 @@ export const getBusinessPageByContact = async (params) => {
7071
export const getBusinessListByIds = async (val: number[]) => {
7172
return await request.get({ url: '/crm/business/list-by-ids', params: { ids: val.join(',') } })
7273
}
74+
75+
// 商机转移
76+
export const transfer = async (data: TransferReqVO) => {
77+
return await request.put({ url: '/crm/business/transfer', data })
78+
}

src/api/crm/contact/index.ts

Lines changed: 4 additions & 3 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
@@ -86,7 +87,7 @@ export const deleteContactBusinessList = async (data: ContactBusinessReqVO) => {
8687
return await request.delete({ url: `/crm/contact/delete-business-list`, data })
8788
}
8889

89-
// 查询联系人操作日志
90-
export const getOperateLogPage = async (params: any) => {
91-
return await request.get({ url: '/crm/contact/operate-log-page', params })
90+
// 联系人转移
91+
export const transfer = async (data: TransferReqVO) => {
92+
return await request.put({ url: '/crm/contact/transfer', data })
9293
}

src/api/crm/contract/index.ts

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

35
export interface ContractVO {
46
id: number
@@ -14,12 +16,18 @@ export interface ContractVO {
1416
price: number
1517
discountPercent: number
1618
productPrice: number
17-
roUserIds: string
18-
rwUserIds: string
1919
contactId: number
2020
signUserId: number
2121
contactLastTime: Date
22+
status: number
2223
remark: string
24+
productItems: ProductExpandVO[]
25+
creatorName: string
26+
updateTime?: Date
27+
createTime?: Date
28+
customerName: string
29+
contactName: string
30+
ownerUserName: string
2331
}
2432

2533
// 查询 CRM 合同列表
@@ -56,3 +64,13 @@ export const deleteContract = async (id: number) => {
5664
export const exportContract = async (params) => {
5765
return await request.download({ url: `/crm/contract/export-excel`, params })
5866
}
67+
68+
// 提交审核
69+
export const handleApprove = async (id: number) => {
70+
return await request.put({ url: `/crm/contract/approve?id=${id}` })
71+
}
72+
73+
// 合同转移
74+
export const transfer = async (data: TransferReqVO) => {
75+
return await request.put({ url: '/crm/contract/transfer', data })
76+
}

src/api/crm/customer/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ export const exportCustomer = async (params: any) => {
6363
return await request.download({ url: `/crm/customer/export-excel`, params })
6464
}
6565

66+
// 下载客户导入模板
67+
export const importCustomerTemplate = () => {
68+
return request.download({ url: '/crm/customer/get-import-template' })
69+
}
70+
6671
// 客户列表
6772
export const getSimpleCustomerList = async () => {
6873
return await request.get({ url: `/crm/customer/list-all-simple` })
6974
}
7075

71-
// 查询客户操作日志
72-
export const getOperateLogPage = async (id: number) => {
73-
return await request.get({ url: '/crm/customer/operate-log-page?id=' + id })
74-
}
75-
7676
// ======================= 业务操作 =======================
7777

7878
export interface TransferReqVO {

src/api/crm/operateLog/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import request from '@/config/axios'
2+
3+
export interface OperateLogVO extends PageParam {
4+
bizType: number
5+
bizId: number
6+
}
7+
8+
// 获得操作日志
9+
export const getOperateLogPage = async (params: OperateLogVO) => {
10+
return await request.get({ url: `/crm/operate-log/page`, params })
11+
}

src/api/crm/permission/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ export enum BizTypeEnum {
2222
CRM_LEADS = 1, // 线索
2323
CRM_CUSTOMER = 2, // 客户
2424
CRM_CONTACT = 3, // 联系人
25-
CRM_BUSINESS = 5, // 商机
26-
CRM_CONTRACT = 6 // 合同
25+
CRM_BUSINESS = 4, // 商机
26+
CRM_CONTRACT = 5, // 合同
27+
CRM_PRODUCT = 6, // 产品
28+
CRM_RECEIVABLE = 7, // 回款
29+
CRM_RECEIVABLE_PLAN = 8 // 回款计划
2730
}
2831

2932
/**

src/api/crm/product/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export interface ProductVO {
1212
ownerUserId: number
1313
}
1414

15+
export interface ProductExpandVO extends ProductVO {
16+
count: number
17+
discountPercent: number
18+
totalPrice: number
19+
}
20+
1521
// 查询产品列表
1622
export const getProductPage = async (params) => {
1723
return await request.get({ url: `/crm/product/page`, params })
@@ -41,8 +47,3 @@ export const deleteProduct = async (id: number) => {
4147
export const exportProduct = async (params) => {
4248
return await request.download({ url: `/crm/product/export-excel`, params })
4349
}
44-
45-
// 查询产品操作日志
46-
export const getOperateLogPage = async (params: any) => {
47-
return await request.get({ url: '/crm/product/operate-log-page', params })
48-
}

src/components/Table/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Table from './src/Table.vue'
22
import { ElTable } from 'element-plus'
33
import { TableSetPropsType } from '@/types/table'
4+
import TableSelectForm from './src/TableSelectForm.vue'
45

56
export interface TableExpose {
67
setProps: (props: Recordable) => void
@@ -9,4 +10,4 @@ export interface TableExpose {
910
elTableRef: ComponentRef<typeof ElTable>
1011
}
1112

12-
export { Table }
13+
export { Table, TableSelectForm }
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<template>
2+
<Dialog v-model="dialogVisible" :appendToBody="true" :scroll="true" :title="title" width="60%">
3+
<el-table
4+
ref="multipleTableRef"
5+
v-loading="loading"
6+
:data="list"
7+
:show-overflow-tooltip="true"
8+
:stripe="true"
9+
@selection-change="handleSelectionChange"
10+
>
11+
<el-table-column type="selection" width="55" />
12+
<slot></slot>
13+
</el-table>
14+
<!-- 分页 -->
15+
<Pagination
16+
v-model:limit="queryParams.pageSize"
17+
v-model:page="queryParams.pageNo"
18+
:total="total"
19+
@pagination="getList"
20+
/>
21+
<template #footer>
22+
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
23+
<el-button @click="dialogVisible = false">取 消</el-button>
24+
</template>
25+
</Dialog>
26+
</template>
27+
28+
<script lang="ts" setup>
29+
import { ElTable } from 'element-plus'
30+
31+
defineOptions({ name: 'TableSelectForm' })
32+
withDefaults(
33+
defineProps<{
34+
modelValue: any[]
35+
title: string
36+
}>(),
37+
{ modelValue: () => [], title: '选择' }
38+
)
39+
const list = ref([]) // 列表的数据
40+
const total = ref(0) // 列表的总页数
41+
const loading = ref(false) // 列表的加载中
42+
const dialogVisible = ref(false) // 弹窗的是否展示
43+
const formLoading = ref(false)
44+
const queryParams = reactive({
45+
pageNo: 1,
46+
pageSize: 10
47+
})
48+
// 确认选择时的触发事件
49+
const emits = defineEmits<{
50+
(e: 'update:modelValue', v: number[]): void
51+
}>()
52+
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
53+
const multipleSelection = ref<any[]>([])
54+
const handleSelectionChange = (val: any[]) => {
55+
multipleSelection.value = val
56+
}
57+
/** 触发 */
58+
const submitForm = () => {
59+
formLoading.value = true
60+
try {
61+
emits('update:modelValue', multipleSelection.value) // 返回选择的原始数据由使用方处理
62+
} finally {
63+
formLoading.value = false
64+
// 关闭弹窗
65+
dialogVisible.value = false
66+
}
67+
}
68+
69+
const getList = async (getListFunc: Function) => {
70+
loading.value = true
71+
try {
72+
const data = await getListFunc(queryParams)
73+
list.value = data.list
74+
total.value = data.total
75+
} finally {
76+
loading.value = false
77+
}
78+
}
79+
80+
/** 打开弹窗 */
81+
const open = async (getListFunc: Function) => {
82+
dialogVisible.value = true
83+
await nextTick()
84+
if (multipleSelection.value.length > 0) {
85+
multipleTableRef.value!.clearSelection()
86+
}
87+
await getList(getListFunc)
88+
}
89+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
90+
</script>

0 commit comments

Comments
 (0)