mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-06-19 23:02:00 +08:00
commit
ea68da9d8e
2
.env.dev
2
.env.dev
@ -7,6 +7,8 @@ VITE_DEV=true
|
||||
VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
|
||||
# VITE_BASE_URL='http://dofast.demo.huizhizao.vip:20001'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 上传路径
|
||||
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
|
||||
|
||||
|
@ -6,6 +6,8 @@ VITE_DEV=true
|
||||
# 请求路径
|
||||
VITE_BASE_URL='http://localhost:48080'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 上传路径
|
||||
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
|
||||
|
||||
|
@ -6,6 +6,8 @@ VITE_DEV=false
|
||||
# 请求路径
|
||||
VITE_BASE_URL='http://localhost:48080'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 上传路径
|
||||
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
|
||||
|
||||
|
@ -6,6 +6,8 @@ VITE_DEV=false
|
||||
# 请求路径
|
||||
VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 上传路径
|
||||
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
|
||||
|
||||
|
@ -6,6 +6,8 @@ VITE_DEV=false
|
||||
# 请求路径
|
||||
VITE_BASE_URL='http://localhost:48080'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
# 上传路径
|
||||
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
|
||||
|
||||
|
BIN
.image/common/erp-feature.png
Normal file
BIN
.image/common/erp-feature.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
@ -90,6 +90,8 @@
|
||||
* 数据报表
|
||||
* 商城系统
|
||||
* 微信公众号
|
||||
* ERP 系统
|
||||
* CRM 系统
|
||||
|
||||
### 系统功能
|
||||
|
||||
@ -194,6 +196,12 @@ _前端基于 crmeb uniapp 经过授权重构,优化代码实现,接入芋
|
||||
|
||||
演示地址:<https://doc.iocoder.cn/mall-preview/>
|
||||
|
||||
### ERP 系统
|
||||
|
||||

|
||||
|
||||
演示地址:<https://doc.iocoder.cn/erp-preview/>
|
||||
|
||||
## 🐷 演示图
|
||||
|
||||
### 系统功能
|
||||
@ -238,6 +246,7 @@ _前端基于 crmeb uniapp 经过授权重构,优化代码实现,接入芋
|
||||
|---------|---------------------------|---------------------------------|---------------------------------|
|
||||
| 商家 & 应用 |  |  |  |
|
||||
| 支付 & 退款 |  |  | --- |
|
||||
|
||||
### 数据报表
|
||||
|
||||
| 模块 | biu | biu | biu |
|
||||
|
17
src/api/crm/backlog/index.ts
Normal file
17
src/api/crm/backlog/index.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
import { type CustomerVO } from '../customer'
|
||||
import { type ClueVO } from '../clue'
|
||||
|
||||
// 查询客户列表
|
||||
// TODO @芋艿:看看是不是后续融合到 getCustomerPage 里;
|
||||
export const getTodayCustomerPage = async (params) => {
|
||||
return await request.get({ url: `/crm/backlog/today-customer-page`, params })
|
||||
}
|
||||
|
||||
// 查询线索列表
|
||||
export const getFollowLeadsPage = async (params) => {
|
||||
return await request.get({ url: `/crm/backlog/page`, params })
|
||||
}
|
||||
|
||||
export { type CustomerVO, type ClueVO }
|
67
src/api/crm/bi/rank.ts
Normal file
67
src/api/crm/bi/rank.ts
Normal file
@ -0,0 +1,67 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface BiRankRespVO {
|
||||
count: number
|
||||
nickname: string
|
||||
deptName: string
|
||||
}
|
||||
|
||||
// 排行 API
|
||||
export const RankApi = {
|
||||
// 获得合同排行榜
|
||||
getContractPriceRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-contract-price-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 获得回款排行榜
|
||||
getReceivablePriceRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-receivable-price-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 签约合同排行
|
||||
getContractCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-contract-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 产品销量排行
|
||||
getProductSalesRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-product-sales-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 新增客户数排行
|
||||
getCustomerCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-customer-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 新增联系人数排行
|
||||
getContactsCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-contacts-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 跟进次数排行
|
||||
getFollowCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-follow-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 跟进客户数排行
|
||||
getFollowCustomerCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-follow-customer-count-rank',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import request from '@/config/axios'
|
||||
import { TransferReqVO } from '@/api/crm/customer'
|
||||
|
||||
export interface BusinessVO {
|
||||
id: number
|
||||
@ -70,3 +71,8 @@ export const getBusinessPageByContact = async (params) => {
|
||||
export const getBusinessListByIds = async (val: number[]) => {
|
||||
return await request.get({ url: '/crm/business/list-by-ids', params: { ids: val.join(',') } })
|
||||
}
|
||||
|
||||
// 商机转移
|
||||
export const transferBusiness = async (data: TransferReqVO) => {
|
||||
return await request.put({ url: '/crm/business/transfer', data })
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import request from '@/config/axios'
|
||||
import { TransferReqVO } from '@/api/crm/customer'
|
||||
|
||||
export interface ClueVO {
|
||||
id: number
|
||||
@ -44,3 +45,8 @@ export const deleteClue = async (id: number) => {
|
||||
export const exportClue = async (params) => {
|
||||
return await request.download({ url: `/crm/clue/export-excel`, params })
|
||||
}
|
||||
|
||||
// 线索转移
|
||||
export const transferClue = async (data: TransferReqVO) => {
|
||||
return await request.put({ url: '/crm/clue/transfer', data })
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import request from '@/config/axios'
|
||||
import { TransferReqVO } from '@/api/crm/customer'
|
||||
|
||||
export interface ContactVO {
|
||||
name: string
|
||||
@ -86,7 +87,7 @@ export const deleteContactBusinessList = async (data: ContactBusinessReqVO) => {
|
||||
return await request.delete({ url: `/crm/contact/delete-business-list`, data })
|
||||
}
|
||||
|
||||
// 查询联系人操作日志
|
||||
export const getOperateLogPage = async (params: any) => {
|
||||
return await request.get({ url: '/crm/contact/operate-log-page', params })
|
||||
// 联系人转移
|
||||
export const transferContact = async (data: TransferReqVO) => {
|
||||
return await request.put({ url: '/crm/contact/transfer', data })
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
import request from '@/config/axios'
|
||||
import { ProductExpandVO } from '@/api/crm/product'
|
||||
import { TransferReqVO } from '@/api/crm/customer'
|
||||
|
||||
export interface ContractVO {
|
||||
id: number
|
||||
name: string
|
||||
customerId: number
|
||||
businessId: number
|
||||
businessName: string
|
||||
processInstanceId: number
|
||||
orderDate: Date
|
||||
ownerUserId: number
|
||||
@ -14,12 +17,19 @@ export interface ContractVO {
|
||||
price: number
|
||||
discountPercent: number
|
||||
productPrice: number
|
||||
roUserIds: string
|
||||
rwUserIds: string
|
||||
contactId: number
|
||||
signUserId: number
|
||||
signUserName: string
|
||||
contactLastTime: Date
|
||||
auditStatus: number
|
||||
remark: string
|
||||
productItems: ProductExpandVO[]
|
||||
creatorName: string
|
||||
updateTime?: Date
|
||||
createTime?: Date
|
||||
customerName: string
|
||||
contactName: string
|
||||
ownerUserName: string
|
||||
}
|
||||
|
||||
// 查询 CRM 合同列表
|
||||
@ -56,3 +66,13 @@ export const deleteContract = async (id: number) => {
|
||||
export const exportContract = async (params) => {
|
||||
return await request.download({ url: `/crm/contract/export-excel`, params })
|
||||
}
|
||||
|
||||
// 提交审核
|
||||
export const submitContract = async (id: number) => {
|
||||
return await request.put({ url: `/crm/contract/submit?id=${id}` })
|
||||
}
|
||||
|
||||
// 合同转移
|
||||
export const transferContract = async (data: TransferReqVO) => {
|
||||
return await request.put({ url: '/crm/contract/transfer', data })
|
||||
}
|
||||
|
@ -63,16 +63,16 @@ export const exportCustomer = async (params: any) => {
|
||||
return await request.download({ url: `/crm/customer/export-excel`, params })
|
||||
}
|
||||
|
||||
// 下载客户导入模板
|
||||
export const importCustomerTemplate = () => {
|
||||
return request.download({ url: '/crm/customer/get-import-template' })
|
||||
}
|
||||
|
||||
// 客户列表
|
||||
export const getSimpleCustomerList = async () => {
|
||||
return await request.get({ url: `/crm/customer/list-all-simple` })
|
||||
}
|
||||
|
||||
// 查询客户操作日志
|
||||
export const getOperateLogPage = async (id: number) => {
|
||||
return await request.get({ url: '/crm/customer/operate-log-page?id=' + id })
|
||||
}
|
||||
|
||||
// ======================= 业务操作 =======================
|
||||
|
||||
export interface TransferReqVO {
|
||||
@ -82,7 +82,7 @@ export interface TransferReqVO {
|
||||
}
|
||||
|
||||
// 客户转移
|
||||
export const transfer = async (data: TransferReqVO) => {
|
||||
export const transferCustomer = async (data: TransferReqVO) => {
|
||||
return await request.put({ url: '/crm/customer/transfer', data })
|
||||
}
|
||||
|
||||
@ -100,3 +100,8 @@ export const receiveCustomer = async (ids: any[]) => {
|
||||
export const putCustomerPool = async (id: number) => {
|
||||
return await request.put({ url: `/crm/customer/put-pool?id=${id}` })
|
||||
}
|
||||
|
||||
// 进入公海客户提醒
|
||||
export const getPutInPoolRemindCustomerPage = async (params) => {
|
||||
return await request.get({ url: `/crm/customer/put-in-pool-remind-page`, params })
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ export interface FollowUpRecordVO {
|
||||
bizId: number // 数据编号
|
||||
type: number // 跟进类型
|
||||
content: string // 跟进内容
|
||||
picUrls: string[] // 图片
|
||||
fileUrls: string[] // 附件
|
||||
nextTime: Date // 下次联系时间
|
||||
businessIds: number[] // 关联的商机编号数组
|
||||
contactIds: number[] // 关联的联系人编号数组
|
||||
|
@ -1,40 +0,0 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface CustomerVO {
|
||||
id?: number
|
||||
name: string
|
||||
industryId: number
|
||||
level: number
|
||||
source: number
|
||||
followUpStatus?: boolean
|
||||
lockStatus?: boolean
|
||||
dealStatus?: boolean
|
||||
mobile: string
|
||||
telephone: string
|
||||
website: string
|
||||
qq: string
|
||||
wechat: string
|
||||
email: string
|
||||
description: string
|
||||
remark: string
|
||||
ownerUserId?: number
|
||||
ownerUserName?: string
|
||||
ownerUserDept?: string
|
||||
roUserIds?: string
|
||||
rwUserIds?: string
|
||||
areaId?: number
|
||||
areaName?: string
|
||||
detailAddress: string
|
||||
contactLastTime?: Date
|
||||
contactNextTime: Date
|
||||
createTime?: Date
|
||||
updateTime?: Date
|
||||
creator?: string
|
||||
creatorName?: string
|
||||
}
|
||||
|
||||
// 查询客户列表
|
||||
// TODO @芋艿:看看是不是后续融合到 getCustomerPage 里;
|
||||
export const getTodayCustomerPage = async (params) => {
|
||||
return await request.get({ url: `/crm/message/todayCustomer`, params })
|
||||
}
|
11
src/api/crm/operateLog/index.ts
Normal file
11
src/api/crm/operateLog/index.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface OperateLogVO extends PageParam {
|
||||
bizType: number
|
||||
bizId: number
|
||||
}
|
||||
|
||||
// 获得操作日志
|
||||
export const getOperateLogPage = async (params: OperateLogVO) => {
|
||||
return await request.get({ url: `/crm/operate-log/page`, params })
|
||||
}
|
@ -2,14 +2,15 @@ import request from '@/config/axios'
|
||||
|
||||
export interface PermissionVO {
|
||||
id?: number // 数据权限编号
|
||||
userId: number | undefined // 用户编号
|
||||
bizType: number | undefined // Crm 类型
|
||||
bizId: number | undefined // Crm 类型数据编号
|
||||
level: number | undefined // 权限级别
|
||||
userId: number // 用户编号
|
||||
bizType: number // Crm 类型
|
||||
bizId: number // Crm 类型数据编号
|
||||
level: number // 权限级别
|
||||
deptName?: string // 部门名称
|
||||
nickname?: string // 用户昵称
|
||||
postNames?: string[] // 岗位名称数组
|
||||
createTime?: Date
|
||||
ids?: number[]
|
||||
}
|
||||
|
||||
/**
|
||||
@ -21,8 +22,11 @@ export enum BizTypeEnum {
|
||||
CRM_LEADS = 1, // 线索
|
||||
CRM_CUSTOMER = 2, // 客户
|
||||
CRM_CONTACT = 3, // 联系人
|
||||
CRM_BUSINESS = 5, // 商机
|
||||
CRM_CONTRACT = 6 // 合同
|
||||
CRM_BUSINESS = 4, // 商机
|
||||
CRM_CONTRACT = 5, // 合同
|
||||
CRM_PRODUCT = 6, // 产品
|
||||
CRM_RECEIVABLE = 7, // 回款
|
||||
CRM_RECEIVABLE_PLAN = 8 // 回款计划
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,11 +54,11 @@ export const updatePermission = async (data) => {
|
||||
}
|
||||
|
||||
// 删除数据权限(删除团队成员)
|
||||
export const deletePermissionBatch = async (params) => {
|
||||
return await request.delete({ url: '/crm/permission/delete', params })
|
||||
export const deletePermissionBatch = async (val: number[]) => {
|
||||
return await request.delete({ url: '/crm/permission/delete?ids=' + val.join(',') })
|
||||
}
|
||||
|
||||
// 删除自己的数据权限(退出团队)
|
||||
export const deleteSelfPermission = async (id) => {
|
||||
return await request.delete({ url: '/crm/permission/quit-team?id=' + id })
|
||||
export const deleteSelfPermission = async (id: number) => {
|
||||
return await request.delete({ url: '/crm/permission/delete-self?id=' + id })
|
||||
}
|
||||
|
@ -12,6 +12,12 @@ export interface ProductVO {
|
||||
ownerUserId: number
|
||||
}
|
||||
|
||||
export interface ProductExpandVO extends ProductVO {
|
||||
count: number
|
||||
discountPercent: number
|
||||
totalPrice: number
|
||||
}
|
||||
|
||||
// 查询产品列表
|
||||
export const getProductPage = async (params) => {
|
||||
return await request.get({ url: `/crm/product/page`, params })
|
||||
@ -41,8 +47,3 @@ export const deleteProduct = async (id: number) => {
|
||||
export const exportProduct = async (params) => {
|
||||
return await request.download({ url: `/crm/product/export-excel`, params })
|
||||
}
|
||||
|
||||
// 查询产品操作日志
|
||||
export const getOperateLogPage = async (params: any) => {
|
||||
return await request.get({ url: '/crm/product/operate-log-page', params })
|
||||
}
|
||||
|
61
src/api/erp/finance/account/index.ts
Normal file
61
src/api/erp/finance/account/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 结算账户 VO
|
||||
export interface AccountVO {
|
||||
id: number // 结算账户编号
|
||||
no: string // 账户编码
|
||||
remark: string // 备注
|
||||
status: number // 开启状态
|
||||
sort: number // 排序
|
||||
defaultStatus: boolean // 是否默认
|
||||
name: string // 账户名称
|
||||
}
|
||||
|
||||
// ERP 结算账户 API
|
||||
export const AccountApi = {
|
||||
// 查询结算账户分页
|
||||
getAccountPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/account/page`, params })
|
||||
},
|
||||
|
||||
// 查询结算账户精简列表
|
||||
getAccountSimpleList: async () => {
|
||||
return await request.get({ url: `/erp/account/simple-list` })
|
||||
},
|
||||
|
||||
// 查询结算账户详情
|
||||
getAccount: async (id: number) => {
|
||||
return await request.get({ url: `/erp/account/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增结算账户
|
||||
createAccount: async (data: AccountVO) => {
|
||||
return await request.post({ url: `/erp/account/create`, data })
|
||||
},
|
||||
|
||||
// 修改结算账户
|
||||
updateAccount: async (data: AccountVO) => {
|
||||
return await request.put({ url: `/erp/account/update`, data })
|
||||
},
|
||||
|
||||
// 修改结算账户默认状态
|
||||
updateAccountDefaultStatus: async (id: number, defaultStatus: boolean) => {
|
||||
return await request.put({
|
||||
url: `/erp/account/update-default-status`,
|
||||
params: {
|
||||
id,
|
||||
defaultStatus
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除结算账户
|
||||
deleteAccount: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/account/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出结算账户 Excel
|
||||
exportAccount: async (params: any) => {
|
||||
return await request.download({ url: `/erp/account/export-excel`, params })
|
||||
}
|
||||
}
|
61
src/api/erp/finance/payment/index.ts
Normal file
61
src/api/erp/finance/payment/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 付款单 VO
|
||||
export interface FinancePaymentVO {
|
||||
id: number // 付款单编号
|
||||
no: string // 付款单号
|
||||
supplierId: number // 供应商编号
|
||||
paymentTime: Date // 付款时间
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 付款单 API
|
||||
export const FinancePaymentApi = {
|
||||
// 查询付款单分页
|
||||
getFinancePaymentPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/finance-payment/page`, params })
|
||||
},
|
||||
|
||||
// 查询付款单详情
|
||||
getFinancePayment: async (id: number) => {
|
||||
return await request.get({ url: `/erp/finance-payment/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增付款单
|
||||
createFinancePayment: async (data: FinancePaymentVO) => {
|
||||
return await request.post({ url: `/erp/finance-payment/create`, data })
|
||||
},
|
||||
|
||||
// 修改付款单
|
||||
updateFinancePayment: async (data: FinancePaymentVO) => {
|
||||
return await request.put({ url: `/erp/finance-payment/update`, data })
|
||||
},
|
||||
|
||||
// 更新付款单的状态
|
||||
updateFinancePaymentStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/finance-payment/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除付款单
|
||||
deleteFinancePayment: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/finance-payment/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出付款单 Excel
|
||||
exportFinancePayment: async (params: any) => {
|
||||
return await request.download({ url: `/erp/finance-payment/export-excel`, params })
|
||||
}
|
||||
}
|
61
src/api/erp/finance/receipt/index.ts
Normal file
61
src/api/erp/finance/receipt/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 收款单 VO
|
||||
export interface FinanceReceiptVO {
|
||||
id: number // 收款单编号
|
||||
no: string // 收款单号
|
||||
customerId: number // 客户编号
|
||||
receiptTime: Date // 收款时间
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 收款单 API
|
||||
export const FinanceReceiptApi = {
|
||||
// 查询收款单分页
|
||||
getFinanceReceiptPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/finance-receipt/page`, params })
|
||||
},
|
||||
|
||||
// 查询收款单详情
|
||||
getFinanceReceipt: async (id: number) => {
|
||||
return await request.get({ url: `/erp/finance-receipt/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增收款单
|
||||
createFinanceReceipt: async (data: FinanceReceiptVO) => {
|
||||
return await request.post({ url: `/erp/finance-receipt/create`, data })
|
||||
},
|
||||
|
||||
// 修改收款单
|
||||
updateFinanceReceipt: async (data: FinanceReceiptVO) => {
|
||||
return await request.put({ url: `/erp/finance-receipt/update`, data })
|
||||
},
|
||||
|
||||
// 更新收款单的状态
|
||||
updateFinanceReceiptStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/finance-receipt/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除收款单
|
||||
deleteFinanceReceipt: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/finance-receipt/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出收款单 Excel
|
||||
exportFinanceReceipt: async (params: any) => {
|
||||
return await request.download({ url: `/erp/finance-receipt/export-excel`, params })
|
||||
}
|
||||
}
|
49
src/api/erp/product/category/index.ts
Normal file
49
src/api/erp/product/category/index.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 产品分类 VO
|
||||
export interface ProductCategoryVO {
|
||||
id: number // 分类编号
|
||||
parentId: number // 父分类编号
|
||||
name: string // 分类名称
|
||||
code: string // 分类编码
|
||||
sort: number // 分类排序
|
||||
status: number // 开启状态
|
||||
}
|
||||
|
||||
// ERP 产品分类 API
|
||||
export const ProductCategoryApi = {
|
||||
// 查询产品分类列表
|
||||
getProductCategoryList: async (params) => {
|
||||
return await request.get({ url: `/erp/product-category/list`, params })
|
||||
},
|
||||
|
||||
// 查询产品分类精简列表
|
||||
getProductCategorySimpleList: async () => {
|
||||
return await request.get({ url: `/erp/product-category/simple-list` })
|
||||
},
|
||||
|
||||
// 查询产品分类详情
|
||||
getProductCategory: async (id: number) => {
|
||||
return await request.get({ url: `/erp/product-category/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增产品分类
|
||||
createProductCategory: async (data: ProductCategoryVO) => {
|
||||
return await request.post({ url: `/erp/product-category/create`, data })
|
||||
},
|
||||
|
||||
// 修改产品分类
|
||||
updateProductCategory: async (data: ProductCategoryVO) => {
|
||||
return await request.put({ url: `/erp/product-category/update`, data })
|
||||
},
|
||||
|
||||
// 删除产品分类
|
||||
deleteProductCategory: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/product-category/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出产品分类 Excel
|
||||
exportProductCategory: async (params) => {
|
||||
return await request.download({ url: `/erp/product-category/export-excel`, params })
|
||||
}
|
||||
}
|
57
src/api/erp/product/product/index.ts
Normal file
57
src/api/erp/product/product/index.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 产品 VO
|
||||
export interface ProductVO {
|
||||
id: number // 产品编号
|
||||
name: string // 产品名称
|
||||
barCode: string // 产品条码
|
||||
categoryId: number // 产品类型编号
|
||||
unitId: number // 单位编号
|
||||
unitName?: string // 单位名字
|
||||
status: number // 产品状态
|
||||
standard: string // 产品规格
|
||||
remark: string // 产品备注
|
||||
expiryDay: number // 保质期天数
|
||||
weight: number // 重量(kg)
|
||||
purchasePrice: number // 采购价格,单位:元
|
||||
salePrice: number // 销售价格,单位:元
|
||||
minPrice: number // 最低价格,单位:元
|
||||
}
|
||||
|
||||
// ERP 产品 API
|
||||
export const ProductApi = {
|
||||
// 查询产品分页
|
||||
getProductPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/product/page`, params })
|
||||
},
|
||||
|
||||
// 查询产品精简列表
|
||||
getProductSimpleList: async () => {
|
||||
return await request.get({ url: `/erp/product/simple-list` })
|
||||
},
|
||||
|
||||
// 查询产品详情
|
||||
getProduct: async (id: number) => {
|
||||
return await request.get({ url: `/erp/product/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增产品
|
||||
createProduct: async (data: ProductVO) => {
|
||||
return await request.post({ url: `/erp/product/create`, data })
|
||||
},
|
||||
|
||||
// 修改产品
|
||||
updateProduct: async (data: ProductVO) => {
|
||||
return await request.put({ url: `/erp/product/update`, data })
|
||||
},
|
||||
|
||||
// 删除产品
|
||||
deleteProduct: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/product/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出产品 Excel
|
||||
exportProduct: async (params) => {
|
||||
return await request.download({ url: `/erp/product/export-excel`, params })
|
||||
}
|
||||
}
|
46
src/api/erp/product/unit/index.ts
Normal file
46
src/api/erp/product/unit/index.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 产品单位 VO
|
||||
export interface ProductUnitVO {
|
||||
id: number // 单位编号
|
||||
name: string // 单位名字
|
||||
status: number // 单位状态
|
||||
}
|
||||
|
||||
// ERP 产品单位 API
|
||||
export const ProductUnitApi = {
|
||||
// 查询产品单位分页
|
||||
getProductUnitPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/product-unit/page`, params })
|
||||
},
|
||||
|
||||
// 查询产品单位精简列表
|
||||
getProductUnitSimpleList: async () => {
|
||||
return await request.get({ url: `/erp/product-unit/simple-list` })
|
||||
},
|
||||
|
||||
// 查询产品单位详情
|
||||
getProductUnit: async (id: number) => {
|
||||
return await request.get({ url: `/erp/product-unit/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增产品单位
|
||||
createProductUnit: async (data: ProductUnitVO) => {
|
||||
return await request.post({ url: `/erp/product-unit/create`, data })
|
||||
},
|
||||
|
||||
// 修改产品单位
|
||||
updateProductUnit: async (data: ProductUnitVO) => {
|
||||
return await request.put({ url: `/erp/product-unit/update`, data })
|
||||
},
|
||||
|
||||
// 删除产品单位
|
||||
deleteProductUnit: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/product-unit/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出产品单位 Excel
|
||||
exportProductUnit: async (params) => {
|
||||
return await request.download({ url: `/erp/product-unit/export-excel`, params })
|
||||
}
|
||||
}
|
64
src/api/erp/purchase/in/index.ts
Normal file
64
src/api/erp/purchase/in/index.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 采购入库 VO
|
||||
export interface PurchaseInVO {
|
||||
id: number // 入库工单编号
|
||||
no: string // 采购入库号
|
||||
customerId: number // 客户编号
|
||||
inTime: Date // 入库时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
outCount: number // 采购出库数量
|
||||
returnCount: number // 采购退货数量
|
||||
}
|
||||
|
||||
// ERP 采购入库 API
|
||||
export const PurchaseInApi = {
|
||||
// 查询采购入库分页
|
||||
getPurchaseInPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/purchase-in/page`, params })
|
||||
},
|
||||
|
||||
// 查询采购入库详情
|
||||
getPurchaseIn: async (id: number) => {
|
||||
return await request.get({ url: `/erp/purchase-in/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增采购入库
|
||||
createPurchaseIn: async (data: PurchaseInVO) => {
|
||||
return await request.post({ url: `/erp/purchase-in/create`, data })
|
||||
},
|
||||
|
||||
// 修改采购入库
|
||||
updatePurchaseIn: async (data: PurchaseInVO) => {
|
||||
return await request.put({ url: `/erp/purchase-in/update`, data })
|
||||
},
|
||||
|
||||
// 更新采购入库的状态
|
||||
updatePurchaseInStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/purchase-in/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除采购入库
|
||||
deletePurchaseIn: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/purchase-in/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出采购入库 Excel
|
||||
exportPurchaseIn: async (params: any) => {
|
||||
return await request.download({ url: `/erp/purchase-in/export-excel`, params })
|
||||
}
|
||||
}
|
64
src/api/erp/purchase/order/index.ts
Normal file
64
src/api/erp/purchase/order/index.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 采购订单 VO
|
||||
export interface PurchaseOrderVO {
|
||||
id: number // 订单工单编号
|
||||
no: string // 采购订单号
|
||||
customerId: number // 客户编号
|
||||
orderTime: Date // 订单时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
outCount: number // 采购出库数量
|
||||
returnCount: number // 采购退货数量
|
||||
}
|
||||
|
||||
// ERP 采购订单 API
|
||||
export const PurchaseOrderApi = {
|
||||
// 查询采购订单分页
|
||||
getPurchaseOrderPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/purchase-order/page`, params })
|
||||
},
|
||||
|
||||
// 查询采购订单详情
|
||||
getPurchaseOrder: async (id: number) => {
|
||||
return await request.get({ url: `/erp/purchase-order/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增采购订单
|
||||
createPurchaseOrder: async (data: PurchaseOrderVO) => {
|
||||
return await request.post({ url: `/erp/purchase-order/create`, data })
|
||||
},
|
||||
|
||||
// 修改采购订单
|
||||
updatePurchaseOrder: async (data: PurchaseOrderVO) => {
|
||||
return await request.put({ url: `/erp/purchase-order/update`, data })
|
||||
},
|
||||
|
||||
// 更新采购订单的状态
|
||||
updatePurchaseOrderStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/purchase-order/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除采购订单
|
||||
deletePurchaseOrder: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/purchase-order/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出采购订单 Excel
|
||||
exportPurchaseOrder: async (params: any) => {
|
||||
return await request.download({ url: `/erp/purchase-order/export-excel`, params })
|
||||
}
|
||||
}
|
62
src/api/erp/purchase/return/index.ts
Normal file
62
src/api/erp/purchase/return/index.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 采购退货 VO
|
||||
export interface PurchaseReturnVO {
|
||||
id: number // 采购退货编号
|
||||
no: string // 采购退货号
|
||||
customerId: number // 客户编号
|
||||
returnTime: Date // 退货时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 采购退货 API
|
||||
export const PurchaseReturnApi = {
|
||||
// 查询采购退货分页
|
||||
getPurchaseReturnPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/purchase-return/page`, params })
|
||||
},
|
||||
|
||||
// 查询采购退货详情
|
||||
getPurchaseReturn: async (id: number) => {
|
||||
return await request.get({ url: `/erp/purchase-return/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增采购退货
|
||||
createPurchaseReturn: async (data: PurchaseReturnVO) => {
|
||||
return await request.post({ url: `/erp/purchase-return/create`, data })
|
||||
},
|
||||
|
||||
// 修改采购退货
|
||||
updatePurchaseReturn: async (data: PurchaseReturnVO) => {
|
||||
return await request.put({ url: `/erp/purchase-return/update`, data })
|
||||
},
|
||||
|
||||
// 更新采购退货的状态
|
||||
updatePurchaseReturnStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/purchase-return/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除采购退货
|
||||
deletePurchaseReturn: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/purchase-return/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出采购退货 Excel
|
||||
exportPurchaseReturn: async (params: any) => {
|
||||
return await request.download({ url: `/erp/purchase-return/export-excel`, params })
|
||||
}
|
||||
}
|
58
src/api/erp/purchase/supplier/index.ts
Normal file
58
src/api/erp/purchase/supplier/index.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 供应商 VO
|
||||
export interface SupplierVO {
|
||||
id: number // 供应商编号
|
||||
name: string // 供应商名称
|
||||
contact: string // 联系人
|
||||
mobile: string // 手机号码
|
||||
telephone: string // 联系电话
|
||||
email: string // 电子邮箱
|
||||
fax: string // 传真
|
||||
remark: string // 备注
|
||||
status: number // 开启状态
|
||||
sort: number // 排序
|
||||
taxNo: string // 纳税人识别号
|
||||
taxPercent: number // 税率
|
||||
bankName: string // 开户行
|
||||
bankAccount: string // 开户账号
|
||||
bankAddress: string // 开户地址
|
||||
}
|
||||
|
||||
// ERP 供应商 API
|
||||
export const SupplierApi = {
|
||||
// 查询供应商分页
|
||||
getSupplierPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/supplier/page`, params })
|
||||
},
|
||||
|
||||
// 获得供应商精简列表
|
||||
getSupplierSimpleList: async () => {
|
||||
return await request.get({ url: `/erp/supplier/simple-list` })
|
||||
},
|
||||
|
||||
// 查询供应商详情
|
||||
getSupplier: async (id: number) => {
|
||||
return await request.get({ url: `/erp/supplier/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增供应商
|
||||
createSupplier: async (data: SupplierVO) => {
|
||||
return await request.post({ url: `/erp/supplier/create`, data })
|
||||
},
|
||||
|
||||
// 修改供应商
|
||||
updateSupplier: async (data: SupplierVO) => {
|
||||
return await request.put({ url: `/erp/supplier/update`, data })
|
||||
},
|
||||
|
||||
// 删除供应商
|
||||
deleteSupplier: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/supplier/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出供应商 Excel
|
||||
exportSupplier: async (params) => {
|
||||
return await request.download({ url: `/erp/supplier/export-excel`, params })
|
||||
}
|
||||
}
|
58
src/api/erp/sale/customer/index.ts
Normal file
58
src/api/erp/sale/customer/index.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 客户 VO
|
||||
export interface CustomerVO {
|
||||
id: number // 客户编号
|
||||
name: string // 客户名称
|
||||
contact: string // 联系人
|
||||
mobile: string // 手机号码
|
||||
telephone: string // 联系电话
|
||||
email: string // 电子邮箱
|
||||
fax: string // 传真
|
||||
remark: string // 备注
|
||||
status: number // 开启状态
|
||||
sort: number // 排序
|
||||
taxNo: string // 纳税人识别号
|
||||
taxPercent: number // 税率
|
||||
bankName: string // 开户行
|
||||
bankAccount: string // 开户账号
|
||||
bankAddress: string // 开户地址
|
||||
}
|
||||
|
||||
// ERP 客户 API
|
||||
export const CustomerApi = {
|
||||
// 查询客户分页
|
||||
getCustomerPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/customer/page`, params })
|
||||
},
|
||||
|
||||
// 查询客户精简列表
|
||||
getCustomerSimpleList: async () => {
|
||||
return await request.get({ url: `/erp/customer/simple-list` })
|
||||
},
|
||||
|
||||
// 查询客户详情
|
||||
getCustomer: async (id: number) => {
|
||||
return await request.get({ url: `/erp/customer/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增客户
|
||||
createCustomer: async (data: CustomerVO) => {
|
||||
return await request.post({ url: `/erp/customer/create`, data })
|
||||
},
|
||||
|
||||
// 修改客户
|
||||
updateCustomer: async (data: CustomerVO) => {
|
||||
return await request.put({ url: `/erp/customer/update`, data })
|
||||
},
|
||||
|
||||
// 删除客户
|
||||
deleteCustomer: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/customer/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出客户 Excel
|
||||
exportCustomer: async (params) => {
|
||||
return await request.download({ url: `/erp/customer/export-excel`, params })
|
||||
}
|
||||
}
|
64
src/api/erp/sale/order/index.ts
Normal file
64
src/api/erp/sale/order/index.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 销售订单 VO
|
||||
export interface SaleOrderVO {
|
||||
id: number // 订单工单编号
|
||||
no: string // 销售订单号
|
||||
customerId: number // 客户编号
|
||||
orderTime: Date // 订单时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
outCount: number // 销售出库数量
|
||||
returnCount: number // 销售退货数量
|
||||
}
|
||||
|
||||
// ERP 销售订单 API
|
||||
export const SaleOrderApi = {
|
||||
// 查询销售订单分页
|
||||
getSaleOrderPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/sale-order/page`, params })
|
||||
},
|
||||
|
||||
// 查询销售订单详情
|
||||
getSaleOrder: async (id: number) => {
|
||||
return await request.get({ url: `/erp/sale-order/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增销售订单
|
||||
createSaleOrder: async (data: SaleOrderVO) => {
|
||||
return await request.post({ url: `/erp/sale-order/create`, data })
|
||||
},
|
||||
|
||||
// 修改销售订单
|
||||
updateSaleOrder: async (data: SaleOrderVO) => {
|
||||
return await request.put({ url: `/erp/sale-order/update`, data })
|
||||
},
|
||||
|
||||
// 更新销售订单的状态
|
||||
updateSaleOrderStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/sale-order/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除销售订单
|
||||
deleteSaleOrder: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/sale-order/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出销售订单 Excel
|
||||
exportSaleOrder: async (params: any) => {
|
||||
return await request.download({ url: `/erp/sale-order/export-excel`, params })
|
||||
}
|
||||
}
|
62
src/api/erp/sale/out/index.ts
Normal file
62
src/api/erp/sale/out/index.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 销售出库 VO
|
||||
export interface SaleOutVO {
|
||||
id: number // 销售出库编号
|
||||
no: string // 销售出库号
|
||||
customerId: number // 客户编号
|
||||
outTime: Date // 出库时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 销售出库 API
|
||||
export const SaleOutApi = {
|
||||
// 查询销售出库分页
|
||||
getSaleOutPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/sale-out/page`, params })
|
||||
},
|
||||
|
||||
// 查询销售出库详情
|
||||
getSaleOut: async (id: number) => {
|
||||
return await request.get({ url: `/erp/sale-out/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增销售出库
|
||||
createSaleOut: async (data: SaleOutVO) => {
|
||||
return await request.post({ url: `/erp/sale-out/create`, data })
|
||||
},
|
||||
|
||||
// 修改销售出库
|
||||
updateSaleOut: async (data: SaleOutVO) => {
|
||||
return await request.put({ url: `/erp/sale-out/update`, data })
|
||||
},
|
||||
|
||||
// 更新销售出库的状态
|
||||
updateSaleOutStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/sale-out/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除销售出库
|
||||
deleteSaleOut: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/sale-out/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出销售出库 Excel
|
||||
exportSaleOut: async (params: any) => {
|
||||
return await request.download({ url: `/erp/sale-out/export-excel`, params })
|
||||
}
|
||||
}
|
62
src/api/erp/sale/return/index.ts
Normal file
62
src/api/erp/sale/return/index.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 销售退货 VO
|
||||
export interface SaleReturnVO {
|
||||
id: number // 销售退货编号
|
||||
no: string // 销售退货号
|
||||
customerId: number // 客户编号
|
||||
returnTime: Date // 退货时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 销售退货 API
|
||||
export const SaleReturnApi = {
|
||||
// 查询销售退货分页
|
||||
getSaleReturnPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/sale-return/page`, params })
|
||||
},
|
||||
|
||||
// 查询销售退货详情
|
||||
getSaleReturn: async (id: number) => {
|
||||
return await request.get({ url: `/erp/sale-return/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增销售退货
|
||||
createSaleReturn: async (data: SaleReturnVO) => {
|
||||
return await request.post({ url: `/erp/sale-return/create`, data })
|
||||
},
|
||||
|
||||
// 修改销售退货
|
||||
updateSaleReturn: async (data: SaleReturnVO) => {
|
||||
return await request.put({ url: `/erp/sale-return/update`, data })
|
||||
},
|
||||
|
||||
// 更新销售退货的状态
|
||||
updateSaleReturnStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/sale-return/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除销售退货
|
||||
deleteSaleReturn: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/sale-return/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出销售退货 Excel
|
||||
exportSaleReturn: async (params: any) => {
|
||||
return await request.download({ url: `/erp/sale-return/export-excel`, params })
|
||||
}
|
||||
}
|
61
src/api/erp/stock/check/index.ts
Normal file
61
src/api/erp/stock/check/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 库存盘点单 VO
|
||||
export interface StockCheckVO {
|
||||
id: number // 出库编号
|
||||
no: string // 出库单号
|
||||
outTime: Date // 出库时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 库存盘点单 API
|
||||
export const StockCheckApi = {
|
||||
// 查询库存盘点单分页
|
||||
getStockCheckPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/stock-check/page`, params })
|
||||
},
|
||||
|
||||
// 查询库存盘点单详情
|
||||
getStockCheck: async (id: number) => {
|
||||
return await request.get({ url: `/erp/stock-check/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增库存盘点单
|
||||
createStockCheck: async (data: StockCheckVO) => {
|
||||
return await request.post({ url: `/erp/stock-check/create`, data })
|
||||
},
|
||||
|
||||
// 修改库存盘点单
|
||||
updateStockCheck: async (data: StockCheckVO) => {
|
||||
return await request.put({ url: `/erp/stock-check/update`, data })
|
||||
},
|
||||
|
||||
// 更新库存盘点单的状态
|
||||
updateStockCheckStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/stock-check/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除库存盘点单
|
||||
deleteStockCheck: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/stock-check/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出库存盘点单 Excel
|
||||
exportStockCheck: async (params) => {
|
||||
return await request.download({ url: `/erp/stock-check/export-excel`, params })
|
||||
}
|
||||
}
|
62
src/api/erp/stock/in/index.ts
Normal file
62
src/api/erp/stock/in/index.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 其它入库单 VO
|
||||
export interface StockInVO {
|
||||
id: number // 入库编号
|
||||
no: string // 入库单号
|
||||
supplierId: number // 供应商编号
|
||||
inTime: Date // 入库时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 其它入库单 API
|
||||
export const StockInApi = {
|
||||
// 查询其它入库单分页
|
||||
getStockInPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/stock-in/page`, params })
|
||||
},
|
||||
|
||||
// 查询其它入库单详情
|
||||
getStockIn: async (id: number) => {
|
||||
return await request.get({ url: `/erp/stock-in/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增其它入库单
|
||||
createStockIn: async (data: StockInVO) => {
|
||||
return await request.post({ url: `/erp/stock-in/create`, data })
|
||||
},
|
||||
|
||||
// 修改其它入库单
|
||||
updateStockIn: async (data: StockInVO) => {
|
||||
return await request.put({ url: `/erp/stock-in/update`, data })
|
||||
},
|
||||
|
||||
// 更新其它入库单的状态
|
||||
updateStockInStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/stock-in/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除其它入库单
|
||||
deleteStockIn: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/stock-in/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出其它入库单 Excel
|
||||
exportStockIn: async (params) => {
|
||||
return await request.download({ url: `/erp/stock-in/export-excel`, params })
|
||||
}
|
||||
}
|
61
src/api/erp/stock/move/index.ts
Normal file
61
src/api/erp/stock/move/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 库存调度单 VO
|
||||
export interface StockMoveVO {
|
||||
id: number // 出库编号
|
||||
no: string // 出库单号
|
||||
outTime: Date // 出库时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 库存调度单 API
|
||||
export const StockMoveApi = {
|
||||
// 查询库存调度单分页
|
||||
getStockMovePage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/stock-move/page`, params })
|
||||
},
|
||||
|
||||
// 查询库存调度单详情
|
||||
getStockMove: async (id: number) => {
|
||||
return await request.get({ url: `/erp/stock-move/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增库存调度单
|
||||
createStockMove: async (data: StockMoveVO) => {
|
||||
return await request.post({ url: `/erp/stock-move/create`, data })
|
||||
},
|
||||
|
||||
// 修改库存调度单
|
||||
updateStockMove: async (data: StockMoveVO) => {
|
||||
return await request.put({ url: `/erp/stock-move/update`, data })
|
||||
},
|
||||
|
||||
// 更新库存调度单的状态
|
||||
updateStockMoveStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/stock-move/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除库存调度单
|
||||
deleteStockMove: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/stock-move/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出库存调度单 Excel
|
||||
exportStockMove: async (params) => {
|
||||
return await request.download({ url: `/erp/stock-move/export-excel`, params })
|
||||
}
|
||||
}
|
62
src/api/erp/stock/out/index.ts
Normal file
62
src/api/erp/stock/out/index.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 其它出库单 VO
|
||||
export interface StockOutVO {
|
||||
id: number // 出库编号
|
||||
no: string // 出库单号
|
||||
customerId: number // 客户编号
|
||||
outTime: Date // 出库时间
|
||||
totalCount: number // 合计数量
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 其它出库单 API
|
||||
export const StockOutApi = {
|
||||
// 查询其它出库单分页
|
||||
getStockOutPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/stock-out/page`, params })
|
||||
},
|
||||
|
||||
// 查询其它出库单详情
|
||||
getStockOut: async (id: number) => {
|
||||
return await request.get({ url: `/erp/stock-out/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增其它出库单
|
||||
createStockOut: async (data: StockOutVO) => {
|
||||
return await request.post({ url: `/erp/stock-out/create`, data })
|
||||
},
|
||||
|
||||
// 修改其它出库单
|
||||
updateStockOut: async (data: StockOutVO) => {
|
||||
return await request.put({ url: `/erp/stock-out/update`, data })
|
||||
},
|
||||
|
||||
// 更新其它出库单的状态
|
||||
updateStockOutStatus: async (id: number, status: number) => {
|
||||
return await request.put({
|
||||
url: `/erp/stock-out/update-status`,
|
||||
params: {
|
||||
id,
|
||||
status
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除其它出库单
|
||||
deleteStockOut: async (ids: number[]) => {
|
||||
return await request.delete({
|
||||
url: `/erp/stock-out/delete`,
|
||||
params: {
|
||||
ids: ids.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 导出其它出库单 Excel
|
||||
exportStockOut: async (params) => {
|
||||
return await request.download({ url: `/erp/stock-out/export-excel`, params })
|
||||
}
|
||||
}
|
32
src/api/erp/stock/record/index.ts
Normal file
32
src/api/erp/stock/record/index.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 产品库存明细 VO
|
||||
export interface StockRecordVO {
|
||||
id: number // 编号
|
||||
productId: number // 产品编号
|
||||
warehouseId: number // 仓库编号
|
||||
count: number // 出入库数量
|
||||
totalCount: number // 总库存量
|
||||
bizType: number // 业务类型
|
||||
bizId: number // 业务编号
|
||||
bizItemId: number // 业务项编号
|
||||
bizNo: string // 业务单号
|
||||
}
|
||||
|
||||
// ERP 产品库存明细 API
|
||||
export const StockRecordApi = {
|
||||
// 查询产品库存明细分页
|
||||
getStockRecordPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/stock-record/page`, params })
|
||||
},
|
||||
|
||||
// 查询产品库存明细详情
|
||||
getStockRecord: async (id: number) => {
|
||||
return await request.get({ url: `/erp/stock-record/get?id=` + id })
|
||||
},
|
||||
|
||||
// 导出产品库存明细 Excel
|
||||
exportStockRecord: async (params) => {
|
||||
return await request.download({ url: `/erp/stock-record/export-excel`, params })
|
||||
}
|
||||
}
|
41
src/api/erp/stock/stock/index.ts
Normal file
41
src/api/erp/stock/stock/index.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 产品库存 VO
|
||||
export interface StockVO {
|
||||
// 编号
|
||||
id: number
|
||||
// 产品编号
|
||||
productId: number
|
||||
// 仓库编号
|
||||
warehouseId: number
|
||||
// 库存数量
|
||||
count: number
|
||||
}
|
||||
|
||||
// ERP 产品库存 API
|
||||
export const StockApi = {
|
||||
// 查询产品库存分页
|
||||
getStockPage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/stock/page`, params })
|
||||
},
|
||||
|
||||
// 查询产品库存详情
|
||||
getStock: async (id: number) => {
|
||||
return await request.get({ url: `/erp/stock/get?id=` + id })
|
||||
},
|
||||
|
||||
// 查询产品库存详情
|
||||
getStock2: async (productId: number, warehouseId: number) => {
|
||||
return await request.get({ url: `/erp/stock/get`, params: { productId, warehouseId } })
|
||||
},
|
||||
|
||||
// 获得产品库存数量
|
||||
getStockCount: async (productId: number) => {
|
||||
return await request.get({ url: `/erp/stock/get-count`, params: { productId } })
|
||||
},
|
||||
|
||||
// 导出产品库存 Excel
|
||||
exportStock: async (params) => {
|
||||
return await request.download({ url: `/erp/stock/export-excel`, params })
|
||||
}
|
||||
}
|
64
src/api/erp/stock/warehouse/index.ts
Normal file
64
src/api/erp/stock/warehouse/index.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// ERP 仓库 VO
|
||||
export interface WarehouseVO {
|
||||
id: number // 仓库编号
|
||||
name: string // 仓库名称
|
||||
address: string // 仓库地址
|
||||
sort: number // 排序
|
||||
remark: string // 备注
|
||||
principal: string // 负责人
|
||||
warehousePrice: number // 仓储费,单位:元
|
||||
truckagePrice: number // 搬运费,单位:元
|
||||
status: number // 开启状态
|
||||
defaultStatus: boolean // 是否默认
|
||||
}
|
||||
|
||||
// ERP 仓库 API
|
||||
export const WarehouseApi = {
|
||||
// 查询仓库分页
|
||||
getWarehousePage: async (params: any) => {
|
||||
return await request.get({ url: `/erp/warehouse/page`, params })
|
||||
},
|
||||
|
||||
// 查询仓库精简列表
|
||||
getWarehouseSimpleList: async () => {
|
||||
return await request.get({ url: `/erp/warehouse/simple-list` })
|
||||
},
|
||||
|
||||
// 查询仓库详情
|
||||
getWarehouse: async (id: number) => {
|
||||
return await request.get({ url: `/erp/warehouse/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增仓库
|
||||
createWarehouse: async (data: WarehouseVO) => {
|
||||
return await request.post({ url: `/erp/warehouse/create`, data })
|
||||
},
|
||||
|
||||
// 修改仓库
|
||||
updateWarehouse: async (data: WarehouseVO) => {
|
||||
return await request.put({ url: `/erp/warehouse/update`, data })
|
||||
},
|
||||
|
||||
// 修改仓库默认状态
|
||||
updateWarehouseDefaultStatus: async (id: number, defaultStatus: boolean) => {
|
||||
return await request.put({
|
||||
url: `/erp/warehouse/update-default-status`,
|
||||
params: {
|
||||
id,
|
||||
defaultStatus
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除仓库
|
||||
deleteWarehouse: async (id: number) => {
|
||||
return await request.delete({ url: `/erp/warehouse/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出仓库 Excel
|
||||
exportWarehouse: async (params) => {
|
||||
return await request.download({ url: `/erp/warehouse/export-excel`, params })
|
||||
}
|
||||
}
|
@ -6,6 +6,16 @@ export interface FilePageReqVO extends PageParam {
|
||||
createTime?: Date[]
|
||||
}
|
||||
|
||||
// 文件预签名地址 Response VO
|
||||
export interface FilePresignedUrlRespVO {
|
||||
// 文件配置编号
|
||||
configId: number
|
||||
// 文件上传 URL
|
||||
uploadUrl: string
|
||||
// 文件 URL
|
||||
url: string
|
||||
}
|
||||
|
||||
// 查询文件列表
|
||||
export const getFilePage = (params: FilePageReqVO) => {
|
||||
return request.get({ url: '/infra/file/page', params })
|
||||
@ -15,3 +25,16 @@ export const getFilePage = (params: FilePageReqVO) => {
|
||||
export const deleteFile = (id: number) => {
|
||||
return request.delete({ url: '/infra/file/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 获取文件预签名地址
|
||||
export const getFilePresignedUrl = (path: string) => {
|
||||
return request.get<FilePresignedUrlRespVO>({
|
||||
url: '/infra/file/presigned-url',
|
||||
params: { path }
|
||||
})
|
||||
}
|
||||
|
||||
// 创建文件
|
||||
export const createFile = (data: any) => {
|
||||
return request.post({ url: '/infra/file/create', data })
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
@ -18,7 +18,7 @@ import { useDesign } from '@/hooks/web/useDesign'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import CopperModal from './CopperModal.vue'
|
||||
import avatar from '@/assets/imgs/avatar.jpg'
|
||||
import avatar from '@/assets/imgs/avatar.gif'
|
||||
|
||||
defineOptions({ name: 'CropperAvatar' })
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Table from './src/Table.vue'
|
||||
import { ElTable } from 'element-plus'
|
||||
import { TableSetPropsType } from '@/types/table'
|
||||
import TableSelectForm from './src/TableSelectForm.vue'
|
||||
|
||||
export interface TableExpose {
|
||||
setProps: (props: Recordable) => void
|
||||
@ -9,4 +10,4 @@ export interface TableExpose {
|
||||
elTableRef: ComponentRef<typeof ElTable>
|
||||
}
|
||||
|
||||
export { Table }
|
||||
export { Table, TableSelectForm }
|
||||
|
91
src/components/Table/src/TableSelectForm.vue
Normal file
91
src/components/Table/src/TableSelectForm.vue
Normal file
@ -0,0 +1,91 @@
|
||||
<!-- 列表选择通用组件,参考 ProductList 组件使用 -->
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :appendToBody="true" :scroll="true" :title="title" width="60%">
|
||||
<el-table
|
||||
ref="multipleTableRef"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:show-overflow-tooltip="true"
|
||||
:stripe="true"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<slot></slot>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElTable } from 'element-plus'
|
||||
|
||||
defineOptions({ name: 'TableSelectForm' })
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
modelValue: any[]
|
||||
title: string
|
||||
}>(),
|
||||
{ modelValue: () => [], title: '选择' }
|
||||
)
|
||||
const list = ref([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false)
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
// 确认选择时的触发事件
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', v: number[]): void
|
||||
}>()
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection = ref<any[]>([])
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
/** 触发 */
|
||||
const submitForm = () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
emits('update:modelValue', multipleSelection.value) // 返回选择的原始数据由使用方处理
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getList = async (getListFunc: Function) => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await getListFunc(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (getListFunc: Function) => {
|
||||
dialogVisible.value = true
|
||||
await nextTick()
|
||||
if (multipleSelection.value.length > 0) {
|
||||
multipleTableRef.value!.clearSelection()
|
||||
}
|
||||
await getList(getListFunc)
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
</script>
|
@ -3,11 +3,10 @@
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
v-model:file-list="fileList"
|
||||
:action="updateUrl"
|
||||
:action="uploadUrl"
|
||||
:auto-upload="autoUpload"
|
||||
:before-upload="beforeUpload"
|
||||
:drag="drag"
|
||||
:headers="uploadHeaders"
|
||||
:limit="props.limit"
|
||||
:multiple="props.limit > 1"
|
||||
:on-error="excelUploadError"
|
||||
@ -16,6 +15,7 @@
|
||||
:on-remove="handleRemove"
|
||||
:on-success="handleFileSuccess"
|
||||
:show-file-list="true"
|
||||
:http-request="httpRequest"
|
||||
class="upload-file-uploader"
|
||||
name="file"
|
||||
>
|
||||
@ -36,9 +36,10 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import type { UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from 'element-plus'
|
||||
import { isString } from '@/utils/is'
|
||||
import { useUpload } from '@/components/UploadFile/src/useUpload'
|
||||
import { UploadFile } from 'element-plus/es/components/upload/src/upload'
|
||||
|
||||
defineOptions({ name: 'UploadFile' })
|
||||
|
||||
@ -48,7 +49,6 @@ const emit = defineEmits(['update:modelValue'])
|
||||
const props = defineProps({
|
||||
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
|
||||
title: propTypes.string.def('文件上传'),
|
||||
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
|
||||
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileSize: propTypes.number.def(5), // 大小限制(MB)
|
||||
limit: propTypes.number.def(5), // 数量限制
|
||||
@ -62,10 +62,8 @@ const uploadRef = ref<UploadInstance>()
|
||||
const uploadList = ref<UploadUserFile[]>([])
|
||||
const fileList = ref<UploadUserFile[]>([])
|
||||
const uploadNumber = ref<number>(0)
|
||||
const uploadHeaders = ref({
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
'tenant-id': getTenantId()
|
||||
})
|
||||
|
||||
const { uploadUrl, httpRequest } = useUpload()
|
||||
|
||||
// 文件上传之前判断
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
|
||||
@ -120,10 +118,10 @@ const excelUploadError: UploadProps['onError'] = (): void => {
|
||||
message.error('导入数据失败,请您重新上传!')
|
||||
}
|
||||
// 删除上传文件
|
||||
const handleRemove = (file) => {
|
||||
const findex = fileList.value.map((f) => f.name).indexOf(file.name)
|
||||
if (findex > -1) {
|
||||
fileList.value.splice(findex, 1)
|
||||
const handleRemove = (file: UploadFile) => {
|
||||
const index = fileList.value.map((f) => f.name).indexOf(file.name)
|
||||
if (index > -1) {
|
||||
fileList.value.splice(index, 1)
|
||||
emitUpdateModelValue()
|
||||
}
|
||||
}
|
||||
@ -160,7 +158,7 @@ const emitUpdateModelValue = () => {
|
||||
// 情况1:数组结果
|
||||
let result: string | string[] = fileList.value.map((file) => file.url!)
|
||||
// 情况2:逗号分隔的字符串
|
||||
if (isString(props.modelValue)) {
|
||||
if (props.limit === 1 || isString(props.modelValue)) {
|
||||
result = result.join(',')
|
||||
}
|
||||
emit('update:modelValue', result)
|
||||
|
@ -3,15 +3,15 @@
|
||||
<el-upload
|
||||
:id="uuid"
|
||||
:accept="fileType.join(',')"
|
||||
:action="updateUrl"
|
||||
:action="uploadUrl"
|
||||
:before-upload="beforeUpload"
|
||||
:class="['upload', drag ? 'no-border' : '']"
|
||||
:drag="drag"
|
||||
:headers="uploadHeaders"
|
||||
:multiple="false"
|
||||
:on-error="uploadError"
|
||||
:on-success="uploadSuccess"
|
||||
:show-file-list="false"
|
||||
:http-request="httpRequest"
|
||||
>
|
||||
<template v-if="modelValue">
|
||||
<img :src="modelValue" class="upload-image" />
|
||||
@ -50,8 +50,8 @@ import type { UploadProps } from 'element-plus'
|
||||
|
||||
import { generateUUID } from '@/utils'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import { createImageViewer } from '@/components/ImageViewer'
|
||||
import { useUpload } from '@/components/UploadFile/src/useUpload'
|
||||
|
||||
defineOptions({ name: 'UploadImg' })
|
||||
|
||||
@ -70,7 +70,6 @@ type FileTypes =
|
||||
// 接受父组件参数
|
||||
const props = defineProps({
|
||||
modelValue: propTypes.string.def(''),
|
||||
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
|
||||
drag: propTypes.bool.def(true), // 是否支持拖拽上传 ==> 非必传(默认为 true)
|
||||
disabled: propTypes.bool.def(false), // 是否禁用上传组件 ==> 非必传(默认为 false)
|
||||
fileSize: propTypes.number.def(5), // 图片大小限制 ==> 非必传(默认为 5M)
|
||||
@ -101,10 +100,7 @@ const deleteImg = () => {
|
||||
emit('update:modelValue', '')
|
||||
}
|
||||
|
||||
const uploadHeaders = ref({
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
'tenant-id': getTenantId()
|
||||
})
|
||||
const { uploadUrl, httpRequest } = useUpload()
|
||||
|
||||
const editImg = () => {
|
||||
const dom = document.querySelector(`#${uuid.value} .el-upload__input`)
|
||||
|
@ -3,16 +3,16 @@
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
:accept="fileType.join(',')"
|
||||
:action="updateUrl"
|
||||
:action="uploadUrl"
|
||||
:before-upload="beforeUpload"
|
||||
:class="['upload', drag ? 'no-border' : '']"
|
||||
:drag="drag"
|
||||
:headers="uploadHeaders"
|
||||
:limit="limit"
|
||||
:multiple="true"
|
||||
:on-error="uploadError"
|
||||
:on-exceed="handleExceed"
|
||||
:on-success="uploadSuccess"
|
||||
:http-request="httpRequest"
|
||||
list-type="picture-card"
|
||||
>
|
||||
<div class="upload-empty">
|
||||
@ -28,7 +28,7 @@
|
||||
<Icon icon="ep:zoom-in" />
|
||||
<span>查看</span>
|
||||
</div>
|
||||
<div class="handle-icon" @click="handleRemove(file)" v-if="!disabled">
|
||||
<div v-if="!disabled" class="handle-icon" @click="handleRemove(file)">
|
||||
<Icon icon="ep:delete" />
|
||||
<span>删除</span>
|
||||
</div>
|
||||
@ -46,12 +46,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { PropType } from 'vue'
|
||||
import type { UploadFile, UploadProps, UploadUserFile } from 'element-plus'
|
||||
import { ElNotification } from 'element-plus'
|
||||
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import { useUpload } from '@/components/UploadFile/src/useUpload'
|
||||
|
||||
defineOptions({ name: 'UploadImgs' })
|
||||
|
||||
@ -70,11 +69,7 @@ type FileTypes =
|
||||
| 'image/x-icon'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array as PropType<UploadUserFile[]>,
|
||||
required: true
|
||||
},
|
||||
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
|
||||
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
|
||||
drag: propTypes.bool.def(true), // 是否支持拖拽上传 ==> 非必传(默认为 true)
|
||||
disabled: propTypes.bool.def(false), // 是否禁用上传组件 ==> 非必传(默认为 false)
|
||||
limit: propTypes.number.def(5), // 最大图片上传数 ==> 非必传(默认为 5张)
|
||||
@ -85,24 +80,11 @@ const props = defineProps({
|
||||
borderradius: propTypes.string.def('8px') // 组件边框圆角 ==> 非必传(默认为 8px)
|
||||
})
|
||||
|
||||
const uploadHeaders = ref({
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
'tenant-id': getTenantId()
|
||||
})
|
||||
const { uploadUrl, httpRequest } = useUpload()
|
||||
|
||||
const fileList = ref<UploadUserFile[]>([])
|
||||
// fix: 改为动态监听赋值解决图片回显问题
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(data) => {
|
||||
if (!data) return
|
||||
fileList.value = data
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
const uploadNumber = ref<number>(0)
|
||||
const uploadList = ref<UploadUserFile[]>([])
|
||||
/**
|
||||
* @description 文件上传之前判断
|
||||
* @param rawFile 上传的文件
|
||||
@ -122,29 +104,60 @@ const beforeUpload: UploadProps['beforeUpload'] = (rawFile) => {
|
||||
message: `上传图片大小不能超过 ${props.fileSize}M!`,
|
||||
type: 'warning'
|
||||
})
|
||||
uploadNumber.value++
|
||||
return imgType.includes(rawFile.type as FileTypes) && imgSize
|
||||
}
|
||||
|
||||
// 图片上传成功
|
||||
interface UploadEmits {
|
||||
(e: 'update:modelValue', value: UploadUserFile[]): void
|
||||
(e: 'update:modelValue', value: string[]): void
|
||||
}
|
||||
|
||||
const emit = defineEmits<UploadEmits>()
|
||||
const uploadSuccess = (response, uploadFile: UploadFile) => {
|
||||
if (!response) return
|
||||
// TODO 多图上传组件成功后只是把保存成功后的url替换掉组件选图时的文件路径,所以返回的fileList包含的是一个包含文件信息的对象列表
|
||||
uploadFile.url = response.data
|
||||
emit('update:modelValue', fileList.value)
|
||||
const uploadSuccess: UploadProps['onSuccess'] = (res: any): void => {
|
||||
message.success('上传成功')
|
||||
// 删除自身
|
||||
const index = fileList.value.findIndex((item) => item.response?.data === res.data)
|
||||
fileList.value.splice(index, 1)
|
||||
uploadList.value.push({ name: res.data, url: res.data })
|
||||
if (uploadList.value.length == uploadNumber.value) {
|
||||
fileList.value.push(...uploadList.value)
|
||||
uploadList.value = []
|
||||
uploadNumber.value = 0
|
||||
emitUpdateModelValue()
|
||||
}
|
||||
}
|
||||
|
||||
// 监听模型绑定值变动
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val: string | string[]) => {
|
||||
if (!val) {
|
||||
fileList.value = [] // fix:处理掉缓存,表单重置后上传组件的内容并没有重置
|
||||
return
|
||||
}
|
||||
|
||||
fileList.value = [] // 保障数据为空
|
||||
fileList.value.push(
|
||||
...(val as string[]).map((url) => ({ name: url.substring(url.lastIndexOf('/') + 1), url }))
|
||||
)
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
)
|
||||
// 发送图片链接列表更新
|
||||
const emitUpdateModelValue = () => {
|
||||
let result: string[] = fileList.value.map((file) => file.url!)
|
||||
emit('update:modelValue', result)
|
||||
}
|
||||
// 删除图片
|
||||
const handleRemove = (uploadFile: UploadFile) => {
|
||||
fileList.value = fileList.value.filter(
|
||||
(item) => item.url !== uploadFile.url || item.name !== uploadFile.name
|
||||
)
|
||||
emit('update:modelValue', fileList.value)
|
||||
emit(
|
||||
'update:modelValue',
|
||||
fileList.value.map((file) => file.url!)
|
||||
)
|
||||
}
|
||||
|
||||
// 图片上传错误提示
|
||||
|
85
src/components/UploadFile/src/useUpload.ts
Normal file
85
src/components/UploadFile/src/useUpload.ts
Normal file
@ -0,0 +1,85 @@
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import * as FileApi from '@/api/infra/file'
|
||||
import CryptoJS from 'crypto-js'
|
||||
import { UploadRawFile, UploadRequestOptions } from 'element-plus/es/components/upload/src/upload'
|
||||
import { ajaxUpload } from 'element-plus/es/components/upload/src/ajax'
|
||||
import axios from 'axios'
|
||||
|
||||
export const useUpload = () => {
|
||||
// 后端上传地址
|
||||
const uploadUrl = import.meta.env.VITE_UPLOAD_URL
|
||||
// 是否使用前端直连上传
|
||||
const isClientUpload = UPLOAD_TYPE.CLIENT === import.meta.env.VITE_UPLOAD_TYPE
|
||||
// 重写ElUpload上传方法
|
||||
const httpRequest = async (options: UploadRequestOptions) => {
|
||||
// 模式一:前端上传
|
||||
if (isClientUpload) {
|
||||
// 1.1 生成文件名称
|
||||
const fileName = await generateFileName(options.file)
|
||||
// 1.2 获取文件预签名地址
|
||||
const presignedInfo = await FileApi.getFilePresignedUrl(fileName)
|
||||
// 1.3 上传文件(不能使用 ElUpload 的 ajaxUpload 方法的原因:其使用的是 FormData 上传,Minio 不支持)
|
||||
return axios.put(presignedInfo.uploadUrl, options.file).then(() => {
|
||||
// 1.4. 记录文件信息到后端(异步)
|
||||
createFile(presignedInfo, fileName, options.file)
|
||||
// 通知成功,数据格式保持与后端上传的返回结果一致
|
||||
return { data: presignedInfo.url }
|
||||
})
|
||||
} else {
|
||||
// 模式二:后端上传(需要增加后端身份认证请求头)
|
||||
options.headers['Authorization'] = 'Bearer ' + getAccessToken()
|
||||
options.headers['tenant-id'] = getTenantId()
|
||||
// 使用 ElUpload 的上传方法
|
||||
return ajaxUpload(options)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
uploadUrl,
|
||||
httpRequest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件信息
|
||||
* @param vo 文件预签名信息
|
||||
* @param name 文件名称
|
||||
* @param file 文件
|
||||
*/
|
||||
function createFile(vo: FileApi.FilePresignedUrlRespVO, name: string, file: UploadRawFile) {
|
||||
const fileVo = {
|
||||
configId: vo.configId,
|
||||
url: vo.url,
|
||||
path: name,
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
size: file.size
|
||||
}
|
||||
FileApi.createFile(fileVo)
|
||||
return fileVo
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成文件名称(使用算法SHA256)
|
||||
* @param file 要上传的文件
|
||||
*/
|
||||
async function generateFileName(file: UploadRawFile) {
|
||||
// 读取文件内容
|
||||
const data = await file.arrayBuffer()
|
||||
const wordArray = CryptoJS.lib.WordArray.create(data)
|
||||
// 计算SHA256
|
||||
const sha256 = CryptoJS.SHA256(wordArray).toString()
|
||||
// 拼接后缀
|
||||
const ext = file.name.substring(file.name.lastIndexOf('.'))
|
||||
return `${sha256}${ext}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传类型
|
||||
*/
|
||||
enum UPLOAD_TYPE {
|
||||
// 客户端直接上传(只支持S3服务)
|
||||
CLIENT = 'client',
|
||||
// 客户端发送到后端上传
|
||||
SERVER = 'server'
|
||||
}
|
@ -1,18 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
||||
import { useDesign } from '@/hooks/web/useDesign'
|
||||
import avatarImg from '@/assets/imgs/avatar.gif'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { useDesign } from '@/hooks/web/useDesign'
|
||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
defineOptions({ name: 'UserInfo' })
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const { wsCache } = useCache()
|
||||
|
||||
const { push, replace } = useRouter()
|
||||
|
||||
const userStore = useUserStore()
|
||||
@ -23,24 +20,21 @@ const { getPrefixCls } = useDesign()
|
||||
|
||||
const prefixCls = getPrefixCls('user-info')
|
||||
|
||||
const user = wsCache.get(CACHE_KEY.USER)
|
||||
const avatar = computed(() => userStore.user.avatar ?? avatarImg)
|
||||
const userName = computed(() => userStore.user.nickname ?? 'Admin')
|
||||
|
||||
const avatar = user.user.avatar ? user.user.avatar : avatarImg
|
||||
|
||||
const userName = user.user.nickname ? user.user.nickname : 'Admin'
|
||||
|
||||
const loginOut = () => {
|
||||
ElMessageBox.confirm(t('common.loginOutMessage'), t('common.reminder'), {
|
||||
confirmButtonText: t('common.ok'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await userStore.loginOut()
|
||||
tagsViewStore.delAllViews()
|
||||
replace('/login?redirect=/index')
|
||||
const loginOut = async () => {
|
||||
try {
|
||||
await ElMessageBox.confirm(t('common.loginOutMessage'), t('common.reminder'), {
|
||||
confirmButtonText: t('common.ok'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
type: 'warning'
|
||||
})
|
||||
.catch(() => {})
|
||||
await userStore.loginOut()
|
||||
tagsViewStore.delAllViews()
|
||||
replace('/login?redirect=/index')
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
const toProfile = async () => {
|
||||
push('/user/profile')
|
||||
|
@ -507,6 +507,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
},
|
||||
component: () => import('@/views/crm/customer/detail/index.vue')
|
||||
},
|
||||
{
|
||||
path: 'contract/detail/:id',
|
||||
name: 'CrmContractDetail',
|
||||
meta: {
|
||||
title: '合同详情',
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
activeMenu: '/crm/contract'
|
||||
},
|
||||
component: () => import('@/views/crm/contract/detail/index.vue')
|
||||
},
|
||||
{
|
||||
path: 'contact/detail/:id',
|
||||
name: 'CrmContactDetail',
|
||||
@ -528,17 +539,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
activeMenu: '/crm/product'
|
||||
},
|
||||
component: () => import('@/views/crm/product/detail/index.vue')
|
||||
},
|
||||
{
|
||||
path: 'message',
|
||||
name: 'CrmMessage',
|
||||
meta: {
|
||||
title: '待办事项',
|
||||
noCache: true,
|
||||
hidden: true
|
||||
},
|
||||
// TODO @db52:后面搞,搞成菜单
|
||||
component: () => import('@/views/crm/message/index.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ interface UserVO {
|
||||
id: number
|
||||
avatar: string
|
||||
nickname: string
|
||||
deptId: number
|
||||
}
|
||||
|
||||
interface UserInfoVO {
|
||||
permissions: string[]
|
||||
roles: string[]
|
||||
@ -26,7 +28,8 @@ export const useUserStore = defineStore('admin-user', {
|
||||
user: {
|
||||
id: 0,
|
||||
avatar: '',
|
||||
nickname: ''
|
||||
nickname: '',
|
||||
deptId: 0
|
||||
}
|
||||
}),
|
||||
getters: {
|
||||
@ -60,6 +63,20 @@ export const useUserStore = defineStore('admin-user', {
|
||||
wsCache.set(CACHE_KEY.USER, userInfo)
|
||||
wsCache.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus)
|
||||
},
|
||||
async setUserAvatarAction(avatar: string) {
|
||||
const userInfo = wsCache.get(CACHE_KEY.USER)
|
||||
// NOTE: 是否需要像`setUserInfoAction`一样判断`userInfo != null`
|
||||
this.user.avatar = avatar
|
||||
userInfo.user.avatar = avatar
|
||||
wsCache.set(CACHE_KEY.USER, userInfo)
|
||||
},
|
||||
async setUserNicknameAction(nickname: string) {
|
||||
const userInfo = wsCache.get(CACHE_KEY.USER)
|
||||
// NOTE: 是否需要像`setUserInfoAction`一样判断`userInfo != null`
|
||||
this.user.nickname = nickname
|
||||
userInfo.user.nickname = nickname
|
||||
wsCache.set(CACHE_KEY.USER, userInfo)
|
||||
},
|
||||
async loginOut() {
|
||||
await loginOut()
|
||||
removeToken()
|
||||
@ -73,7 +90,8 @@ export const useUserStore = defineStore('admin-user', {
|
||||
this.user = {
|
||||
id: 0,
|
||||
avatar: '',
|
||||
nickname: ''
|
||||
nickname: '',
|
||||
deptId: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -418,3 +418,14 @@ export const TradeOrderStatusEnum = {
|
||||
name: '已取消'
|
||||
}
|
||||
}
|
||||
|
||||
// ========== ERP - 企业资源计划 ==========
|
||||
|
||||
export const ErpBizType = {
|
||||
PURCHASE_ORDER: 10,
|
||||
PURCHASE_IN: 11,
|
||||
PURCHASE_RETURN: 12,
|
||||
SALE_ORDER: 20,
|
||||
SALE_OUT: 21,
|
||||
SALE_RETURN: 22
|
||||
}
|
||||
|
@ -203,5 +203,9 @@ export enum DICT_TYPE {
|
||||
CRM_PRODUCT_STATUS = 'crm_product_status',
|
||||
CRM_PERMISSION_LEVEL = 'crm_permission_level', // CRM 数据权限的级别
|
||||
CRM_PRODUCT_UNIT = 'crm_product_unit', // 产品单位
|
||||
CRM_FOLLOW_UP_TYPE = 'crm_follow_up_type' // 跟进方式
|
||||
CRM_FOLLOW_UP_TYPE = 'crm_follow_up_type', // 跟进方式
|
||||
|
||||
// ========== ERP - 企业资源计划模块 ==========
|
||||
ERP_AUDIT_STATUS = 'erp_audit_status', // ERP 审批状态
|
||||
ERP_STOCK_RECORD_BIZ_TYPE = 'erp_stock_record_biz_type' // 库存明细的业务类型
|
||||
}
|
||||
|
@ -190,6 +190,56 @@ export const copyValueToTarget = (target: any, source: any) => {
|
||||
Object.assign(target, newObj)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取链接的参数值
|
||||
* @param key 参数键名
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
*/
|
||||
export const getUrlValue = (key: string, urlStr: string = location.href): string => {
|
||||
if (!urlStr || !key) return ''
|
||||
const url = new URL(decodeURIComponent(urlStr))
|
||||
return url.searchParams.get(key) ?? ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取链接的参数值(值类型)
|
||||
* @param key 参数键名
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
*/
|
||||
export const getUrlNumberValue = (key: string, urlStr: string = location.href): number => {
|
||||
return toNumber(getUrlValue(key, urlStr))
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建排序字段
|
||||
* @param prop 字段名称
|
||||
* @param order 顺序
|
||||
*/
|
||||
export const buildSortingField = ({ prop, order }) => {
|
||||
return { field: prop, order: order === 'ascending' ? 'asc' : 'desc' }
|
||||
}
|
||||
|
||||
// ========== NumberUtils 数字方法 ==========
|
||||
|
||||
/**
|
||||
* 数组求和
|
||||
*
|
||||
* @param values 数字数组
|
||||
* @return 求和结果,默认为 0
|
||||
*/
|
||||
export const getSumValue = (values: number[]): number => {
|
||||
return values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!Number.isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
|
||||
// ========== 通用金额方法 ==========
|
||||
|
||||
/**
|
||||
* 将一个整数转换为分数保留两位小数
|
||||
* @param num
|
||||
@ -206,6 +256,7 @@ export const formatToFraction = (num: number | string | undefined): string => {
|
||||
*
|
||||
* @param num 整数
|
||||
*/
|
||||
// TODO @芋艿:看看怎么融合掉
|
||||
export const floatToFixed2 = (num: number | string | undefined): string => {
|
||||
let str = '0.00'
|
||||
if (typeof num === 'undefined') {
|
||||
@ -232,6 +283,7 @@ export const floatToFixed2 = (num: number | string | undefined): string => {
|
||||
* 将一个分数转换为整数
|
||||
* @param num
|
||||
*/
|
||||
// TODO @芋艿:看看怎么融合掉
|
||||
export const convertToInteger = (num: number | string | undefined): number => {
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
@ -266,31 +318,89 @@ export const calculateRelativeRate = (value?: number, reference?: number) => {
|
||||
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
|
||||
}
|
||||
|
||||
// ========== ERP 专属方法 ==========
|
||||
|
||||
const ERP_COUNT_DIGIT = 3
|
||||
const ERP_PRICE_DIGIT = 2
|
||||
|
||||
/**
|
||||
* 获取链接的参数值
|
||||
* @param key 参数键名
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
* 【ERP】格式化 Input 数字
|
||||
*
|
||||
* 例如说:库存数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const getUrlValue = (key: string, urlStr: string = location.href): string => {
|
||||
if (!urlStr || !key) return ''
|
||||
const url = new URL(decodeURIComponent(urlStr))
|
||||
return url.searchParams.get(key) ?? ''
|
||||
export const erpNumberFormatter = (num: number | string | undefined, digit: number) => {
|
||||
if (num === null) {
|
||||
return ''
|
||||
}
|
||||
if (typeof num === 'string') {
|
||||
num = parseFloat(num)
|
||||
}
|
||||
// 如果非 number,则直接返回空串
|
||||
if (isNaN(num)) {
|
||||
return ''
|
||||
}
|
||||
return num.toFixed(digit)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取链接的参数值(值类型)
|
||||
* @param key 参数键名
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
* 【ERP】格式化数量,保留三位小数
|
||||
*
|
||||
* 例如说:库存数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const getUrlNumberValue = (key: string, urlStr: string = location.href): number => {
|
||||
return toNumber(getUrlValue(key, urlStr))
|
||||
export const erpCountInputFormatter = (num: number | string | undefined) => {
|
||||
return erpNumberFormatter(num, ERP_COUNT_DIGIT)
|
||||
}
|
||||
|
||||
// noinspection JSCommentMatchesSignature
|
||||
/**
|
||||
* 【ERP】格式化数量,保留三位小数
|
||||
*
|
||||
* @param cellValue 数量
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpCountTableColumnFormatter = (_, __, cellValue: any, ___) => {
|
||||
return erpNumberFormatter(cellValue, ERP_COUNT_DIGIT)
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建排序字段
|
||||
* @param prop 字段名称
|
||||
* @param order 顺序
|
||||
* 【ERP】格式化金额,保留二位小数
|
||||
*
|
||||
* 例如说:库存数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const buildSortingField = ({ prop, order }) => {
|
||||
return { field: prop, order: order === 'ascending' ? 'asc' : 'desc' }
|
||||
export const erpPriceInputFormatter = (num: number | string | undefined) => {
|
||||
return erpNumberFormatter(num, ERP_PRICE_DIGIT)
|
||||
}
|
||||
|
||||
// noinspection JSCommentMatchesSignature
|
||||
/**
|
||||
* 【ERP】格式化金额,保留二位小数
|
||||
*
|
||||
* @param cellValue 数量
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpPriceTableColumnFormatter = (_, __, cellValue: any, ___) => {
|
||||
return erpNumberFormatter(cellValue, ERP_PRICE_DIGIT)
|
||||
}
|
||||
|
||||
/**
|
||||
* 【ERP】价格计算,四舍五入保留两位小数
|
||||
*
|
||||
* @param price 价格
|
||||
* @param count 数量
|
||||
* @return 总价格。如果有任一为空,则返回 undefined
|
||||
*/
|
||||
export const erpPriceMultiply = (price: number, count: number) => {
|
||||
if (price == null || count == null) {
|
||||
return undefined
|
||||
}
|
||||
return parseFloat((price * count).toFixed(ERP_PRICE_DIGIT))
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
:class="prefixCls"
|
||||
class="relative h-[100%] lt-xl:px-10px lt-md:px-10px lt-sm:px-10px lt-xl:px-10px"
|
||||
class="relative h-[100%] lt-md:px-10px lt-sm:px-10px lt-xl:px-10px lt-xl:px-10px"
|
||||
>
|
||||
<div class="relative mx-auto h-full flex">
|
||||
<div
|
||||
|
@ -21,11 +21,13 @@ import {
|
||||
updateUserProfile,
|
||||
UserProfileUpdateReqVO
|
||||
} from '@/api/system/user/profile'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
defineOptions({ name: 'BasicInfo' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage() // 消息弹窗
|
||||
const userStore = useUserStore()
|
||||
// 表单校验
|
||||
const rules = reactive<FormRules>({
|
||||
nickname: [{ required: true, message: t('profile.rules.nickname'), trigger: 'blur' }],
|
||||
@ -78,13 +80,15 @@ const submit = () => {
|
||||
const data = unref(formRef)?.formModel as UserProfileUpdateReqVO
|
||||
await updateUserProfile(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
await init()
|
||||
const profile = await init()
|
||||
userStore.setUserNicknameAction(profile.nickname)
|
||||
}
|
||||
})
|
||||
}
|
||||
const init = async () => {
|
||||
const res = await getUserProfile()
|
||||
unref(formRef)?.setValues(res)
|
||||
return res
|
||||
}
|
||||
onMounted(async () => {
|
||||
await init()
|
||||
|
@ -14,6 +14,8 @@
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { uploadAvatar } from '@/api/system/user/profile'
|
||||
import { CropperAvatar } from '@/components/Cropper'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
|
||||
defineOptions({ name: 'UserAvatar' })
|
||||
|
||||
@ -21,10 +23,14 @@ defineProps({
|
||||
img: propTypes.string.def('')
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
|
||||
const cropperRef = ref()
|
||||
const handelUpload = async ({ data }) => {
|
||||
await uploadAvatar({ avatarFile: data })
|
||||
const res = await uploadAvatar({ avatarFile: data })
|
||||
cropperRef.value.close()
|
||||
userStore.setUserAvatarAction(res.data)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -17,13 +17,25 @@
|
||||
<el-col :span="20" :xs="24">
|
||||
<TodayCustomer v-if="leftType === 'todayCustomer'" />
|
||||
<FollowLeads v-if="leftType === 'followLeads'" />
|
||||
<CheckContract v-if="leftType === 'checkContract'" />
|
||||
<CheckReceivables v-if="leftType === 'checkReceivables'" />
|
||||
<EndContract v-if="leftType === 'endContract'" />
|
||||
<FollowCustomer v-if="leftType === 'followCustomer'" />
|
||||
<PutInPoolRemind v-if="leftType === 'putInPoolRemind'" />
|
||||
<RemindReceivables v-if="leftType === 'remindReceivables'" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<!-- @dbh52:模块改成 backlog 会更合适,待办事项 -->
|
||||
|
||||
<script lang="ts" setup>
|
||||
import TodayCustomer from './tables/TodayCustomer.vue'
|
||||
import CheckContract from './tables/CheckContract.vue'
|
||||
import CheckReceivables from './tables/CheckReceivables.vue'
|
||||
import EndContract from './tables/EndContract.vue'
|
||||
import FollowCustomer from './tables/FollowCustomer.vue'
|
||||
import FollowLeads from './tables/FollowLeads.vue'
|
||||
import PutInPoolRemind from './tables/PutInPoolRemind.vue'
|
||||
import RemindReceivables from './tables/RemindReceivables.vue'
|
||||
import TodayCustomer from './tables/TodayCustomer.vue'
|
||||
|
||||
const leftType = ref('todayCustomer')
|
||||
const leftSides = ref([
|
||||
@ -59,14 +71,13 @@ const leftSides = ref([
|
||||
},
|
||||
{
|
||||
name: '待审核回款',
|
||||
crmType: 'receivables',
|
||||
infoType: 'checkReceivables',
|
||||
msgCount: 0,
|
||||
tips: ''
|
||||
},
|
||||
{
|
||||
name: '待回款提醒',
|
||||
infoType: 'remindReceivablesPlan',
|
||||
infoType: 'remindReceivables',
|
||||
msgCount: 4,
|
||||
tips: ''
|
||||
},
|
||||
@ -78,14 +89,12 @@ const leftSides = ref([
|
||||
}
|
||||
])
|
||||
|
||||
/**
|
||||
* 侧边点击
|
||||
*/
|
||||
const sideClick = (item) => {
|
||||
/** 侧边点击 */
|
||||
const sideClick = (item: any) => {
|
||||
leftType.value = item.infoType
|
||||
}
|
||||
// TODO @dhb52: 侧边栏样式,在黑暗模式下,颜色会不对。是不是可以读取主题色哈;
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.side-item-list {
|
||||
top: 0;
|
174
src/views/crm/backlog/tables/CheckContract.vue
Normal file
174
src/views/crm/backlog/tables/CheckContract.vue
Normal file
@ -0,0 +1,174 @@
|
||||
<!-- 待审核合同 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl">待审核合同</div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="合同状态" prop="auditStatus">
|
||||
<el-select
|
||||
v-model="queryParams.auditStatus"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in AUDIT_STATUS"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" fixed="left" label="合同编号" prop="no" width="130" />
|
||||
<el-table-column align="center" label="合同名称" prop="name" width="130" />
|
||||
<el-table-column align="center" label="客户名称" prop="customerName" width="120">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openCustomerDetail(scope.row.customerId)"
|
||||
>
|
||||
{{ scope.row.customerName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- TODO @puhui999:做了商机详情后,可以把这个超链接加上 -->
|
||||
<el-table-column align="center" label="商机名称" prop="businessName" width="130" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="下单时间"
|
||||
prop="orderDate"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同金额"
|
||||
prop="price"
|
||||
width="130"
|
||||
:formatter="fenToYuanFormat"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同开始时间"
|
||||
prop="startTime"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同结束时间"
|
||||
prop="endTime"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column align="center" label="客户签约人" prop="contactName" width="130">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openContactDetail(scope.row.contactId)"
|
||||
>
|
||||
{{ scope.row.contactName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="公司签约人" prop="signUserName" width="130" />
|
||||
<el-table-column align="center" label="备注" prop="remark" width="130" />
|
||||
<!-- TODO @puhui999:后续可加 【已收款金额】、【未收款金额】 -->
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="更新时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="合同状态" prop="auditStatus" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="CheckContract">
|
||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import { fenToYuanFormat } from '@/utils/formatter'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { AUDIT_STATUS } from './common'
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
auditStatus: 20
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ContractApi.getContractPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const { push } = useRouter() // 路由
|
||||
const openCustomerDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 打开联系人详情 */
|
||||
const openContactDetail = (id: number) => {
|
||||
push({ name: 'CrmContactDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
124
src/views/crm/backlog/tables/CheckReceivables.vue
Normal file
124
src/views/crm/backlog/tables/CheckReceivables.vue
Normal file
@ -0,0 +1,124 @@
|
||||
<!-- 待审核回款 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl"> 待审核回款 </div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="合同状态" prop="auditStatus">
|
||||
<el-select
|
||||
v-model="queryParams.auditStatus"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in AUDIT_STATUS"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="回款编号" align="center" prop="no" />
|
||||
<!-- <el-table-column label="回款计划ID" align="center" prop="planId" />-->
|
||||
<el-table-column label="客户" align="center" prop="customerId" />
|
||||
<el-table-column label="合同" align="center" prop="contractId" />
|
||||
<el-table-column label="审批状态" align="center" prop="checkStatus" width="130px">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.checkStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="工作流编号" align="center" prop="processInstanceId" />-->
|
||||
<el-table-column
|
||||
label="回款日期"
|
||||
align="center"
|
||||
prop="returnTime"
|
||||
:formatter="dateFormatter2"
|
||||
width="150px"
|
||||
/>
|
||||
<el-table-column label="回款方式" align="center" prop="returnType" width="130px">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="回款金额(元)" align="center" prop="price" />
|
||||
<el-table-column label="负责人" align="center" prop="ownerUserId" />
|
||||
<el-table-column label="批次" align="center" prop="batchId" />
|
||||
<!--<el-table-column label="显示顺序" align="center" prop="sort" />-->
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="CheckReceivables">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
||||
import * as ReceivableApi from '@/api/crm/receivable'
|
||||
import { AUDIT_STATUS } from './common'
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
auditStatus: 20
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ReceivableApi.getReceivablePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
175
src/views/crm/backlog/tables/EndContract.vue
Normal file
175
src/views/crm/backlog/tables/EndContract.vue
Normal file
@ -0,0 +1,175 @@
|
||||
<!-- 即将到期的合同 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl"> 即将到期的合同 </div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="到期状态" prop="expiryType">
|
||||
<el-select
|
||||
v-model="queryParams.expiryType"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in CONTRACT_EXPIRY_TYPE"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" fixed="left" label="合同编号" prop="no" width="130" />
|
||||
<el-table-column align="center" label="合同名称" prop="name" width="130" />
|
||||
<el-table-column align="center" label="客户名称" prop="customerName" width="120">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openCustomerDetail(scope.row.customerId)"
|
||||
>
|
||||
{{ scope.row.customerName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- TODO @puhui999:做了商机详情后,可以把这个超链接加上 -->
|
||||
<el-table-column align="center" label="商机名称" prop="businessName" width="130" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="下单时间"
|
||||
prop="orderDate"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同金额"
|
||||
prop="price"
|
||||
width="130"
|
||||
:formatter="fenToYuanFormat"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同开始时间"
|
||||
prop="startTime"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同结束时间"
|
||||
prop="endTime"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column align="center" label="客户签约人" prop="contactName" width="130">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openContactDetail(scope.row.contactId)"
|
||||
>
|
||||
{{ scope.row.contactName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="公司签约人" prop="signUserName" width="130" />
|
||||
<el-table-column align="center" label="备注" prop="remark" width="130" />
|
||||
<!-- TODO @puhui999:后续可加 【已收款金额】、【未收款金额】 -->
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="更新时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="合同状态" prop="auditStatus" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="EndContract">
|
||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import { fenToYuanFormat } from '@/utils/formatter'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { CONTRACT_EXPIRY_TYPE } from './common'
|
||||
|
||||
const { push } = useRouter() // 路由
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
expiryType: 1
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ContractApi.getContractPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const openCustomerDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 打开联系人详情 */
|
||||
const openContactDetail = (id: number) => {
|
||||
push({ name: 'CrmContactDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
159
src/views/crm/backlog/tables/FollowCustomer.vue
Normal file
159
src/views/crm/backlog/tables/FollowCustomer.vue
Normal file
@ -0,0 +1,159 @@
|
||||
<!-- 分配给我的客户 -->
|
||||
<!-- WHERE followUpStatus = ? -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl">分配给我的客户</div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="状态" prop="followUpStatus">
|
||||
<el-select
|
||||
v-model="queryParams.followUpStatus"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in FOLLOWUP_STATUS"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" label="编号" prop="id" />
|
||||
<el-table-column align="center" label="客户名称" prop="name" width="160">
|
||||
<template #default="scope">
|
||||
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
|
||||
{{ scope.row.name }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="手机" prop="mobile" width="120" />
|
||||
<el-table-column align="center" label="电话" prop="telephone" width="120" />
|
||||
<el-table-column align="center" label="客户来源" prop="source" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所属行业" prop="industryId" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="客户等级" prop="level" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="网址" prop="website" width="200" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="下次联系时间"
|
||||
prop="contactNextTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="备注" prop="remark" width="200" />
|
||||
<el-table-column align="center" label="成交状态" prop="dealStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="距离进入公海" prop="poolDay">
|
||||
<template #default="scope"> {{ scope.row.poolDay }} 天</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="最后跟进时间"
|
||||
prop="contactLastTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="100px" />
|
||||
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="100px" />
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="FollowCustomer">
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { FOLLOWUP_STATUS } from './common'
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
followUpStatus: false,
|
||||
sceneType: 1
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CustomerApi.getCustomerPage(queryParams.value)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
125
src/views/crm/backlog/tables/FollowLeads.vue
Normal file
125
src/views/crm/backlog/tables/FollowLeads.vue
Normal file
@ -0,0 +1,125 @@
|
||||
<!-- TODO: dhb52 待Clue页面更新后同步更新 -->
|
||||
<!-- WHERE transformStatus = 0 AND followUpStatus = ? -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl">分配给我的线索</div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="状态" prop="followUpStatus">
|
||||
<el-select
|
||||
v-model="queryParams.followUpStatus"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in FOLLOWUP_STATUS"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="转化状态" align="center" prop="transformStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.transformStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="跟进状态" align="center" prop="followUpStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.followUpStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="线索名称" align="center" prop="name" />
|
||||
<el-table-column label="客户id" align="center" prop="customerId" />
|
||||
<el-table-column
|
||||
label="下次联系时间"
|
||||
align="center"
|
||||
prop="contactNextTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="电话" align="center" prop="telephone" />
|
||||
<el-table-column label="手机号" align="center" prop="mobile" />
|
||||
<el-table-column label="地址" align="center" prop="address" />
|
||||
<el-table-column label="负责人" align="center" prop="ownerUserId" />
|
||||
<el-table-column
|
||||
label="最后跟进时间"
|
||||
align="center"
|
||||
prop="contactLastTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="FollowLeads">
|
||||
import * as ClueApi from '@/api/crm/clue'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { FOLLOWUP_STATUS } from './common'
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
followUpStatus: false,
|
||||
transformStatus: false // 固定为【未转移】
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ClueApi.getCluePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
155
src/views/crm/backlog/tables/PutInPoolRemind.vue
Normal file
155
src/views/crm/backlog/tables/PutInPoolRemind.vue
Normal file
@ -0,0 +1,155 @@
|
||||
<!-- 待进入公海的客户 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl"> 待进入公海的客户 </div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="归属" prop="sceneType">
|
||||
<el-select
|
||||
v-model="queryParams.sceneType"
|
||||
class="!w-240px"
|
||||
placeholder="归属"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in SCENE_TYPES"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" label="编号" prop="id" />
|
||||
<el-table-column align="center" label="客户名称" prop="name" width="160">
|
||||
<template #default="scope">
|
||||
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
|
||||
{{ scope.row.name }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="手机" prop="mobile" width="120" />
|
||||
<el-table-column align="center" label="电话" prop="telephone" width="120" />
|
||||
<el-table-column align="center" label="客户来源" prop="source" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所属行业" prop="industryId" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="客户等级" prop="level" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="网址" prop="website" width="200" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="下次联系时间"
|
||||
prop="contactNextTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="备注" prop="remark" width="200" />
|
||||
<el-table-column align="center" label="成交状态" prop="dealStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="距进入公海天数" prop="poolDay" width="100px" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="最后跟进时间"
|
||||
prop="contactLastTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="100px" />
|
||||
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="100px" />
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="PutInPoolRemind">
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { SCENE_TYPES } from './common'
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
sceneType: 1, // 我负责的
|
||||
pool: true // 固定 公海参数为 true
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CustomerApi.getPutInPoolRemindCustomerPage(queryParams.value)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
193
src/views/crm/backlog/tables/RemindReceivables.vue
Normal file
193
src/views/crm/backlog/tables/RemindReceivables.vue
Normal file
@ -0,0 +1,193 @@
|
||||
<!-- 待回款提醒 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl">待回款提醒</div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="合同状态" prop="remindType">
|
||||
<el-select
|
||||
v-model="queryParams.remindType"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in RECEIVABLE_REMIND_TYPE"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:key="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<!--<el-table-column label="ID" align="center" prop="id" />-->
|
||||
<el-table-column label="客户名称" align="center" prop="customerId" width="150px" />
|
||||
<el-table-column label="合同名称" align="center" prop="contractId" width="150px" />
|
||||
<el-table-column label="期数" align="center" prop="period" />
|
||||
<el-table-column label="计划回款" align="center" prop="price" />
|
||||
<el-table-column
|
||||
label="计划回款日期"
|
||||
align="center"
|
||||
prop="returnTime"
|
||||
:formatter="dateFormatter2"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="提前几天提醒" align="center" prop="remindDays" />
|
||||
<el-table-column label="完成状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批状态" align="center" prop="checkStatus" width="130px">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.checkStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column label="工作流编号" align="center" prop="processInstanceId" />-->
|
||||
<el-table-column prop="ownerUserId" label="负责人" width="120">
|
||||
<template #default="scope">
|
||||
{{ userList.find((user) => user.id === scope.row.ownerUserId)?.nickname }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示顺序" align="center" prop="sort" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" width="130px">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['crm:receivable-plan:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['crm:receivable-plan:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="RemindReceivables">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { RECEIVABLE_REMIND_TYPE } from './common'
|
||||
|
||||
defineOptions({ name: 'ReceivablePlan' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
remindType: 1
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ReceivablePlanApi.getReceivablePlanPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ReceivablePlanApi.deleteReceivablePlan(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ReceivablePlanApi.exportReceivablePlan(queryParams)
|
||||
download.excel(data, '回款计划.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
// 获取用户列表
|
||||
userList.value = await UserApi.getSimpleUserList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
@ -1,8 +1,6 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div class="pb-5 text-xl">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="pb-5 text-xl"> 今日需联系客户 </div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
@ -12,7 +10,12 @@
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="状态" prop="contactStatus">
|
||||
<el-select v-model="queryParams.contactStatus" class="!w-240px" placeholder="状态">
|
||||
<el-select
|
||||
v-model="queryParams.contactStatus"
|
||||
class="!w-240px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in CONTACT_STATUS"
|
||||
:label="option.label"
|
||||
@ -22,7 +25,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="归属" prop="sceneType">
|
||||
<el-select v-model="queryParams.sceneType" class="!w-240px" placeholder="归属">
|
||||
<el-select
|
||||
v-model="queryParams.sceneType"
|
||||
class="!w-240px"
|
||||
placeholder="归属"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in SCENE_TYPES"
|
||||
:label="option.label"
|
||||
@ -31,22 +39,12 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon class="mr-5px" icon="ep:search" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery(undefined)">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" label="编号" prop="id" />
|
||||
<el-table-column align="center" label="客户名称" prop="name" width="160">
|
||||
<el-table-column align="center" label="编号" fixed="left" prop="id" />
|
||||
<el-table-column align="center" label="客户名称" fixed="left" prop="name" width="160">
|
||||
<template #default="scope">
|
||||
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
|
||||
{{ scope.row.name }}
|
||||
@ -84,7 +82,7 @@
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- TODO @puhui999:距进入公海天数 -->
|
||||
<el-table-column align="center" label="距进入公海天数" prop="poolDay" width="130" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
@ -121,21 +119,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="TodayCustomer">
|
||||
import * as BacklogApi from '@/api/crm/backlog'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as MessageApi from '@/api/crm/message'
|
||||
import { CONTACT_STATUS, SCENE_TYPES } from './common'
|
||||
|
||||
// defineOptions({ name: 'TodayCustomer' }) TODO @dhb52:1)定义改成这种;2)命名要不要改成 CustomerTodayTable,就是 模块+形容词+表格(更容易识别),然后把 tables 目录改成 components 目录
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
const title = ref('今日需联系客户') // TODO @dbh52:这个不用枚举一个变量哈;
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref([]) // 列表的数据
|
||||
const queryParams = ref<{
|
||||
// TODO @dbh52:这个 ref 类型定义可以去掉哈。之前定义的原因,是因为 idea 报错了;默认 idea 可以推导出类型
|
||||
pageNo: number
|
||||
pageSize: number
|
||||
contactStatus: number | undefined
|
||||
sceneType: number | undefined
|
||||
}>({
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
contactStatus: 1,
|
||||
@ -143,25 +139,11 @@ const queryParams = ref<{
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
const CONTACT_STATUS = [
|
||||
{ label: '今日需联系', value: 1 },
|
||||
{ label: '已逾期', value: 2 },
|
||||
{ label: '已联系', value: 3 }
|
||||
]
|
||||
|
||||
const SCENE_TYPES = [
|
||||
// TODO 芋艿:貌似可以搞成全局枚举
|
||||
{ label: '我负责的', value: 1 },
|
||||
{ label: '我跟进的', value: 2 },
|
||||
{ label: '我参与的', value: 3 },
|
||||
{ label: '下属负责的', value: 4 }
|
||||
]
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await MessageApi.getTodayCustomerPage(queryParams.value)
|
||||
const data = await BacklogApi.getTodayCustomerPage(queryParams.value)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
@ -175,22 +157,7 @@ const handleQuery = () => {
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = (func: Function | undefined = undefined) => {
|
||||
queryFormRef.value.resetFields()
|
||||
queryParams.value = {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
contactStatus: 1,
|
||||
sceneType: 1
|
||||
}
|
||||
// TODO @dbh52:这里的 func 是不是可以去掉哈;
|
||||
func && func()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const { push } = useRouter()
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
38
src/views/crm/backlog/tables/common.ts
Normal file
38
src/views/crm/backlog/tables/common.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/** 跟进状态 */
|
||||
export const FOLLOWUP_STATUS = [
|
||||
{ label: '已跟进', value: true },
|
||||
{ label: '待跟进', value: false }
|
||||
]
|
||||
|
||||
/** 归属范围 */
|
||||
export const SCENE_TYPES = [
|
||||
{ label: '我负责的', value: 1 },
|
||||
{ label: '我参与的', value: 2 },
|
||||
{ label: '下属负责的', value: 3 }
|
||||
]
|
||||
|
||||
/** 联系状态 */
|
||||
export const CONTACT_STATUS = [
|
||||
{ label: '今日需联系', value: 1 },
|
||||
{ label: '已逾期', value: 2 },
|
||||
{ label: '已联系', value: 3 }
|
||||
]
|
||||
|
||||
/** 审批状态 */
|
||||
export const AUDIT_STATUS = [
|
||||
{ label: '已审批', value: 20 },
|
||||
{ label: '待审批', value: 10 }
|
||||
]
|
||||
|
||||
/** 回款提醒类型 */
|
||||
export const RECEIVABLE_REMIND_TYPE = [
|
||||
{ label: '待回款', value: 1 },
|
||||
{ label: '已逾期', value: 2 },
|
||||
{ label: '已回款', value: 3 }
|
||||
]
|
||||
|
||||
/** 合同过期状态 */
|
||||
export const CONTRACT_EXPIRY_TYPE = [
|
||||
{ label: '即将过期', value: 1 },
|
||||
{ label: '已过期', value: 2 }
|
||||
]
|
98
src/views/crm/bi/rank/ContactsCountRank.vue
Normal file
98
src/views/crm/bi/rank/ContactsCountRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 新增联系人数排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="创建人" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="新增联系人数(个)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'ContactsCountRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '新增联系人数排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '新增联系人数排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '新增联系人数(个)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '创建人'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取新增联系人数排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getContactsCountRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
98
src/views/crm/bi/rank/ContractCountRank.vue
Normal file
98
src/views/crm/bi/rank/ContractCountRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 签约合同排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="签订人" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="签约合同数(个)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'ContractCountRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '签约合同排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '签约合同排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '签约合同数(个)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '签订人'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取签约合同排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getContractCountRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
98
src/views/crm/bi/rank/ContractPriceRank.vue
Normal file
98
src/views/crm/bi/rank/ContractPriceRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 合同金额排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="签订人" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="合同金额(元)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'ContractPriceRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '合同金额排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '合同金额排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '合同金额(元)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '签订人'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取合同金额排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getContractPriceRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
98
src/views/crm/bi/rank/CustomerCountRank.vue
Normal file
98
src/views/crm/bi/rank/CustomerCountRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 新增客户数排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="创建人" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="新增客户数(个)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'CustomerCountRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '新增客户数排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '新增客户数排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '新增客户数(个)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '创建人'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取新增客户数排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getCustomerCountRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
98
src/views/crm/bi/rank/FollowCountRank.vue
Normal file
98
src/views/crm/bi/rank/FollowCountRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 跟进次数排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="员工" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="跟进次数(次)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'FollowCountRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '跟进次数排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '跟进次数排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '跟进次数(次)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '员工'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取跟进次数排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getFollowCountRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
98
src/views/crm/bi/rank/FollowCustomerCountRank.vue
Normal file
98
src/views/crm/bi/rank/FollowCustomerCountRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 跟进客户数排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="员工" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="跟进客户数(个)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'FollowCustomerCountRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '跟进客户数排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '跟进客户数排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '跟进客户数(个)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '员工'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取跟进客户数排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getFollowCustomerCountRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
98
src/views/crm/bi/rank/ProductSalesRank.vue
Normal file
98
src/views/crm/bi/rank/ProductSalesRank.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<!-- 产品销量排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="员工" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="产品销量" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'ProductSalesRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '产品销量排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '产品销量排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '产品销量'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '员工'
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取产品销量排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getProductSalesRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
99
src/views/crm/bi/rank/ReceivablePriceRank.vue
Normal file
99
src/views/crm/bi/rank/ReceivablePriceRank.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<!-- 回款金额排行 -->
|
||||
<template>
|
||||
<!-- 柱状图 -->
|
||||
<el-card shadow="never">
|
||||
<el-skeleton :loading="loading" animated>
|
||||
<Echart :height="500" :options="echartsOption" />
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
|
||||
<!-- 排行列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="公司排名" align="center" type="index" width="80" />
|
||||
<el-table-column label="签订人" align="center" prop="nickname" min-width="200" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" min-width="200" />
|
||||
<el-table-column label="回款金额(元)" align="center" prop="count" min-width="200" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { RankApi, BiRankRespVO } from '@/api/crm/bi/rank'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { clone } from 'unocss'
|
||||
|
||||
defineOptions({ name: 'ReceivablePriceRank' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<BiRankRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:横向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
dataset: {
|
||||
dimensions: ['nickname', 'count'],
|
||||
source: []
|
||||
},
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
top: 50
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '回款金额排行',
|
||||
type: 'bar'
|
||||
}
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false // 数据区域缩放:Y 轴不缩放
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
|
||||
},
|
||||
saveAsImage: { show: true, name: '回款金额排行' } // 保存为图片
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
name: '回款金额(元)'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
name: '签订人',
|
||||
nameGap: 30
|
||||
}
|
||||
}) as EChartsOption
|
||||
|
||||
/** 获取回款金额排行 */
|
||||
const loadData = async () => {
|
||||
// 1. 加载排行数据
|
||||
loading.value = true
|
||||
const rankingList = await RankApi.getReceivablePriceRank(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.dataset && echartsOption.dataset['source']) {
|
||||
echartsOption.dataset['source'] = clone(rankingList).reverse()
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = rankingList
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
162
src/views/crm/bi/rank/index.vue
Normal file
162
src/views/crm/bi/rank/index.vue
Normal file
@ -0,0 +1,162 @@
|
||||
<!-- BI 排行版 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="时间范围" prop="orderDate">
|
||||
<el-date-picker
|
||||
v-model="queryParams.times"
|
||||
:shortcuts="defaultShortcuts"
|
||||
class="!w-240px"
|
||||
end-placeholder="结束日期"
|
||||
start-placeholder="开始日期"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="归属部门" prop="deptId">
|
||||
<el-tree-select
|
||||
v-model="queryParams.deptId"
|
||||
:data="deptList"
|
||||
:props="defaultProps"
|
||||
check-strictly
|
||||
node-key="id"
|
||||
placeholder="请选择归属部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 排行数据 -->
|
||||
<el-col>
|
||||
<el-tabs v-model="activeTab">
|
||||
<!-- 合同金额排行 -->
|
||||
<el-tab-pane label="合同金额排行" name="contractPriceRank" lazy>
|
||||
<ContractPriceRank :query-params="queryParams" ref="contractPriceRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 回款金额排行 -->
|
||||
<el-tab-pane label="回款金额排行" name="receivablePriceRank" lazy>
|
||||
<ReceivablePriceRank :query-params="queryParams" ref="receivablePriceRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 签约合同排行 -->
|
||||
<el-tab-pane label="签约合同排行" name="contractCountRank" lazy>
|
||||
<ContractCountRank :query-params="queryParams" ref="contractCountRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 产品销量排行 -->
|
||||
<el-tab-pane label="产品销量排行" name="productSalesRank" lazy>
|
||||
<ProductSalesRank :query-params="queryParams" ref="productSalesRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 新增客户数排行 -->
|
||||
<el-tab-pane label="新增客户数排行" name="customerCountRank" lazy>
|
||||
<CustomerCountRank :query-params="queryParams" ref="customerCountRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 新增联系人数排行 -->
|
||||
<el-tab-pane label="新增联系人数排行" name="contactsCountRank" lazy>
|
||||
<ContactsCountRank :query-params="queryParams" ref="contactsCountRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 跟进次数排行 -->
|
||||
<el-tab-pane label="跟进次数排行" name="followCountRank" lazy>
|
||||
<FollowCountRank :query-params="queryParams" ref="followCountRankRef" />
|
||||
</el-tab-pane>
|
||||
<!-- 跟进客户数排行 -->
|
||||
<el-tab-pane label="跟进客户数排行" name="followCustomerCountRank" lazy>
|
||||
<FollowCustomerCountRank :query-params="queryParams" ref="followCustomerCountRankRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import ContractPriceRank from './ContractPriceRank.vue'
|
||||
import ReceivablePriceRank from './ReceivablePriceRank.vue'
|
||||
import ContractCountRank from './ContractCountRank.vue'
|
||||
import ProductSalesRank from './ProductSalesRank.vue'
|
||||
import CustomerCountRank from './CustomerCountRank.vue'
|
||||
import ContactsCountRank from './ContactsCountRank.vue'
|
||||
import FollowCountRank from './FollowCountRank.vue'
|
||||
import FollowCustomerCountRank from './FollowCustomerCountRank.vue'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
defineOptions({ name: 'CrmBiRank' })
|
||||
|
||||
const queryParams = reactive({
|
||||
deptId: useUserStore().getUser.deptId,
|
||||
times: [
|
||||
// 默认显示最近一周的数据
|
||||
formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7))),
|
||||
formatDate(endOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24)))
|
||||
]
|
||||
})
|
||||
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const deptList = ref<Tree[]>([]) // 树形结构
|
||||
const activeTab = ref('contractPriceRank')
|
||||
const contractPriceRankRef = ref() // ContractPriceRank 组件的引用
|
||||
const receivablePriceRankRef = ref() // ReceivablePriceRank 组件的引用
|
||||
const contractCountRankRef = ref() // ContractCountRank 组件的引用
|
||||
const productSalesRankRef = ref() // ProductSalesRank 组件的引用
|
||||
const customerCountRankRef = ref() // CustomerCountRank 组件的引用
|
||||
const contactsCountRankRef = ref() // ContactsCountRank 组件的引用
|
||||
const followCountRankRef = ref() // FollowCountRank 组件的引用
|
||||
const followCustomerCountRankRef = ref() // FollowCustomerCountRank 组件的引用
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
switch (activeTab.value) {
|
||||
case 'contractPriceRank':
|
||||
contractPriceRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'receivablePriceRank':
|
||||
receivablePriceRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'contractCountRank':
|
||||
contractCountRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'productSalesRank':
|
||||
productSalesRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'customerCountRank':
|
||||
customerCountRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'contactsCountRank':
|
||||
contactsCountRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'followCountRank':
|
||||
followCountRankRef.value?.loadData?.()
|
||||
break
|
||||
case 'followCustomerCountRank':
|
||||
followCustomerCountRankRef.value?.loadData?.()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 当 activeTab 改变时,刷新当前活动的 tab
|
||||
watch(activeTab, () => {
|
||||
handleQuery()
|
||||
})
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 加载部门树
|
||||
onMounted(async () => {
|
||||
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
@ -10,17 +10,6 @@
|
||||
<el-form-item label="线索名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入线索名称" />
|
||||
</el-form-item>
|
||||
<!-- TODO 芋艿:后续客户的选择 -->
|
||||
<el-form-item label="客户" prop="customerId">
|
||||
<el-select v-model="formData.customerId" clearable placeholder="请选择客户">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="下次联系时间" prop="contactNextTime">
|
||||
<el-date-picker
|
||||
v-model="formData.contactNextTime"
|
||||
@ -38,9 +27,15 @@
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="formData.address" placeholder="请输入地址" />
|
||||
</el-form-item>
|
||||
<!-- TODO wanwan 负责人选择 -->
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-input v-model="formData.ownerUserId" placeholder="请输入负责人" />
|
||||
<el-form-item v-if="formType === 'create'" label="负责人" prop="userIds" span="24">
|
||||
<el-select v-model="formData.ownerUserId">
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
@ -54,20 +49,20 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ClueApi from '@/api/crm/clue'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
|
||||
import * as UserApi from "@/api/system/user";
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formLoading = ref(false) // 表单加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const customerList = ref([]) // 客户列表
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
customerId: undefined,
|
||||
contactNextTime: undefined,
|
||||
telephone: undefined,
|
||||
mobile: undefined,
|
||||
@ -78,7 +73,7 @@ const formData = ref({
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '线索名称不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }]
|
||||
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
@ -88,12 +83,6 @@ const open = async (type: string, id?: number) => {
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
const customerData = await CustomerApi.getCustomerPage({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
pool: false
|
||||
})
|
||||
customerList.value = customerData.list
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
@ -103,6 +92,14 @@ const open = async (type: string, id?: number) => {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
// 新建时负责人默认为登录人
|
||||
if (formType.value === 'create') {
|
||||
const { wsCache } = useCache()
|
||||
const user = wsCache.get(CACHE_KEY.USER).user
|
||||
formData.value.ownerUserId = user.id
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
@ -137,7 +134,6 @@ const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
customerId: undefined,
|
||||
contactNextTime: undefined,
|
||||
telephone: undefined,
|
||||
mobile: undefined,
|
||||
|
@ -10,9 +10,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<!-- 右上:按钮 -->
|
||||
<el-button @click="openForm('update', contact.id)" v-hasPermi="['crm:contact:update']">
|
||||
编辑
|
||||
</el-button>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -32,18 +30,10 @@
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ContactForm ref="formRef" @success="emit('refresh')" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
<script lang="ts" setup>
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import ContactForm from '@/views/crm/contact/ContactForm.vue'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
//操作修改
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
const { contact } = defineProps<{ contact: ContactApi.ContactVO }>()
|
||||
const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
|
||||
</script>
|
||||
|
@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<ContactDetailsHeader :contact="contact" :loading="loading" @refresh="getContactData(id)" />
|
||||
<ContactDetailsHeader v-loading="loading" :contact="contact">
|
||||
<el-button v-if="permissionListRef?.validateWrite" @click="openForm('update', contact.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-if="permissionListRef?.validateOwnerUser" type="primary" @click="transfer">
|
||||
转移
|
||||
</el-button>
|
||||
</ContactDetailsHeader>
|
||||
<el-col>
|
||||
<el-tabs>
|
||||
<el-tab-pane label="详细资料">
|
||||
@ -8,8 +15,14 @@
|
||||
<el-tab-pane label="操作日志">
|
||||
<OperateLogV2 :log-list="logList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="团队成员" lazy>
|
||||
<PermissionList :biz-id="contact.id!" :biz-type="BizTypeEnum.CRM_CONTACT" />
|
||||
<el-tab-pane label="团队成员">
|
||||
<PermissionList
|
||||
ref="permissionListRef"
|
||||
:biz-id="contact.id!"
|
||||
:biz-type="BizTypeEnum.CRM_CONTACT"
|
||||
:show-action="!permissionListRef?.isPool || false"
|
||||
@quit-team="close"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商机" lazy>
|
||||
<BusinessList
|
||||
@ -20,8 +33,11 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ContactForm ref="formRef" @success="getContactData(contact.id)" />
|
||||
<CrmTransferForm ref="crmTransferFormRef" @success="close" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
<script lang="ts" setup>
|
||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import ContactDetailsHeader from '@/views/crm/contact/detail/ContactDetailsHeader.vue'
|
||||
@ -30,13 +46,18 @@ import BusinessList from '@/views/crm/business/components/BusinessList.vue' //
|
||||
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' // 团队成员列表(权限)
|
||||
import { BizTypeEnum } from '@/api/crm/permission'
|
||||
import { OperateLogV2VO } from '@/api/system/operatelog'
|
||||
import { getOperateLogPage } from '@/api/crm/operateLog'
|
||||
import ContactForm from '@/views/crm/contact/ContactForm.vue'
|
||||
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
||||
|
||||
defineOptions({ name: 'CrmContactDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const message = useMessage()
|
||||
const id = Number(route.params.id) // 联系人编号
|
||||
const loading = ref(true) // 加载中
|
||||
const contact = ref<ContactApi.ContactVO>({} as ContactApi.ContactVO) // 联系人详情
|
||||
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // 团队成员列表 Ref
|
||||
|
||||
/** 获取详情 */
|
||||
const getContactData = async (id: number) => {
|
||||
@ -49,27 +70,43 @@ const getContactData = async (id: number) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作日志
|
||||
*/
|
||||
/** 编辑 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 联系人转移 */
|
||||
const crmTransferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 联系人转移表单 ref
|
||||
const transfer = () => {
|
||||
crmTransferFormRef.value?.open('联系人转移', contact.value.id, ContactApi.transferContact)
|
||||
}
|
||||
|
||||
/** 获取操作日志 */
|
||||
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
|
||||
const getOperateLog = async (contactId: number) => {
|
||||
if (!contactId) {
|
||||
return
|
||||
}
|
||||
const data = await ContactApi.getOperateLogPage({
|
||||
const data = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_CONTACT,
|
||||
bizId: contactId
|
||||
})
|
||||
logList.value = data.list
|
||||
}
|
||||
|
||||
/** 关闭窗口 */
|
||||
const close = () => {
|
||||
delView(unref(currentRoute))
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
const { delView } = useTagsViewStore() // 视图操作
|
||||
const { currentRoute } = useRouter() // 路由
|
||||
onMounted(async () => {
|
||||
if (!id) {
|
||||
ElMessage.warning('参数错误,联系人不能为空!')
|
||||
delView(unref(currentRoute))
|
||||
message.warning('参数错误,联系人不能为空!')
|
||||
close()
|
||||
return
|
||||
}
|
||||
await getContactData(id)
|
||||
|
@ -22,7 +22,7 @@
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -1,54 +1,69 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="820">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
label-width="110px"
|
||||
>
|
||||
<el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同编号" prop="no">
|
||||
<el-input v-model="formData.no" placeholder="请输入合同编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入合同名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户" prop="customerId">
|
||||
<el-input v-model="formData.customerId" placeholder="请选择对应客户" />
|
||||
<el-form-item label="客户名称" prop="customerId">
|
||||
<el-select v-model="formData.customerId">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="商机名称" prop="businessId">
|
||||
<el-select v-model="formData.businessId">
|
||||
<el-option
|
||||
v-for="item in businessList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下单日期" prop="orderDate">
|
||||
<el-date-picker
|
||||
v-model="formData.orderDate"
|
||||
placeholder="选择下单日期"
|
||||
type="date"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同金额" prop="price">
|
||||
<el-input v-model="formData.price" placeholder="请输入合同金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="商机名称" prop="businessId">
|
||||
<el-input v-model="formData.businessId" placeholder="请选择对应商机" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工作流" prop="processInstanceId">
|
||||
<el-input v-model="formData.processInstanceId" placeholder="请选择工作流" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下单日期" prop="orderDate">
|
||||
<el-date-picker
|
||||
v-model="formData.orderDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择下单日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-input v-model="formData.ownerUserId" placeholder="请选择负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编号" prop="no">
|
||||
<el-input v-model="formData.no" placeholder="请输入合同编号" />
|
||||
</el-form-item>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="formData.startTime"
|
||||
placeholder="选择开始时间"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择开始时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -56,72 +71,97 @@
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="formData.endTime"
|
||||
placeholder="选择结束时间"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择结束时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同金额" prop="price">
|
||||
<el-input v-model="formData.price" placeholder="请输入合同金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="整单折扣" prop="discountPercent">
|
||||
<el-input v-model="formData.discountPercent" placeholder="请输入整单折扣" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产品总金额" prop="productPrice">
|
||||
<el-input v-model="formData.productPrice" placeholder="请输入产品总金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="只读权限的用户" prop="roUserIds">
|
||||
<el-input v-model="formData.roUserIds" placeholder="请输入只读权限的用户" />
|
||||
</el-form-item>
|
||||
<el-form-item label="读写权限的用户" prop="rwUserIds">
|
||||
<el-input v-model="formData.rwUserIds" placeholder="请输入读写权限的用户" />
|
||||
</el-form-item>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人编号" prop="contactId">
|
||||
<el-input v-model="formData.contactId" placeholder="请输入联系人编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公司签约人" prop="signUserId">
|
||||
<el-input v-model="formData.signUserId" placeholder="请输入公司签约人" />
|
||||
<el-select v-model="formData.signUserId">
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户签约人" prop="contactId">
|
||||
<el-select v-model="formData.contactId" :disabled="!formData.customerId">
|
||||
<el-option
|
||||
v-for="item in getContactOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-select v-model="formData.ownerUserId">
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
:rows="3"
|
||||
placeholder="请输入备注"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @puhui999:productItems 改成 products 会更好点;因为它不是 item 哈 -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="产品列表" prop="productList">
|
||||
<ProductList v-model="formData.productItems" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="整单折扣(%)" prop="discountPercent">
|
||||
<el-input-number
|
||||
v-model="formData.discountPercent"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="0"
|
||||
placeholder="请输入整单折扣"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品总金额(元)" prop="productPrice">
|
||||
{{ fenToYuan(formData.productPrice) }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="最后跟进时间" prop="contactLastTime">
|
||||
<el-date-picker
|
||||
v-model="formData.contactLastTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择最后跟进时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
<script lang="ts" setup>
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import ProductList from './components/ProductList.vue'
|
||||
import { fenToYuan } from '@/utils'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@ -130,32 +170,34 @@ const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
customerId: undefined,
|
||||
businessId: undefined,
|
||||
processInstanceId: undefined,
|
||||
orderDate: undefined,
|
||||
ownerUserId: undefined,
|
||||
no: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
price: undefined,
|
||||
discountPercent: undefined,
|
||||
productPrice: undefined,
|
||||
roUserIds: undefined,
|
||||
rwUserIds: undefined,
|
||||
contactId: undefined,
|
||||
signUserId: undefined,
|
||||
contactLastTime: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formData = ref<ContractApi.ContractVO>({} as ContractApi.ContractVO)
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }]
|
||||
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
||||
orderDate: [{ required: true, message: '下单日期不能为空', trigger: 'blur' }],
|
||||
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
|
||||
no: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 监听合同产品变化,计算合同产品总价 */
|
||||
watch(
|
||||
() => formData.value.productItems,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
formData.value.productPrice = 0
|
||||
return
|
||||
}
|
||||
// 使用 reduce 函数进行累加
|
||||
formData.value.productPrice = val.reduce(
|
||||
(accumulator, currentValue) =>
|
||||
isNaN(accumulator + currentValue.totalPrice) ? 0 : accumulator + currentValue.totalPrice,
|
||||
0
|
||||
)
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
@ -171,6 +213,7 @@ const open = async (type: string, id?: number) => {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
await getAllApi()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
@ -184,7 +227,7 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ContractApi.ContractVO
|
||||
const data = unref(formData.value) as unknown as ContractApi.ContractVO
|
||||
if (formType.value === 'create') {
|
||||
await ContractApi.createContract(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
@ -202,27 +245,39 @@ const submitForm = async () => {
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
customerId: undefined,
|
||||
businessId: undefined,
|
||||
processInstanceId: undefined,
|
||||
orderDate: undefined,
|
||||
ownerUserId: undefined,
|
||||
no: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
price: undefined,
|
||||
discountPercent: undefined,
|
||||
productPrice: undefined,
|
||||
roUserIds: undefined,
|
||||
rwUserIds: undefined,
|
||||
contactId: undefined,
|
||||
signUserId: undefined,
|
||||
contactLastTime: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formData.value = {} as ContractApi.ContractVO
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
/** 获取其它相关数据 */
|
||||
const getAllApi = async () => {
|
||||
await Promise.all([getCustomerList(), getUserList(), getContactListList(), getBusinessList()])
|
||||
}
|
||||
|
||||
/** 获取客户 */
|
||||
const customerList = ref<CustomerApi.CustomerVO[]>([])
|
||||
const getCustomerList = async () => {
|
||||
customerList.value = await CustomerApi.getSimpleCustomerList()
|
||||
}
|
||||
|
||||
/** 动态获取客户联系人 */
|
||||
const contactList = ref<ContactApi.ContactVO[]>([])
|
||||
const getContactOptions = computed(() =>
|
||||
contactList.value.filter((item) => item.customerId === formData.value.customerId)
|
||||
)
|
||||
const getContactListList = async () => {
|
||||
contactList.value = await ContactApi.getSimpleContactList()
|
||||
}
|
||||
|
||||
/** 获取用户列表 */
|
||||
const userList = ref<UserApi.UserVO[]>([])
|
||||
const getUserList = async () => {
|
||||
userList.value = await UserApi.getSimpleUserList()
|
||||
}
|
||||
|
||||
/** 获取商机 */
|
||||
const businessList = ref<BusinessApi.BusinessVO[]>([])
|
||||
const getBusinessList = async () => {
|
||||
businessList.value = await BusinessApi.getSimpleBusinessList()
|
||||
}
|
||||
</script>
|
||||
|
171
src/views/crm/contract/components/ProductList.vue
Normal file
171
src/views/crm/contract/components/ProductList.vue
Normal file
@ -0,0 +1,171 @@
|
||||
<!-- 合同 Form 表单下的 Product 列表 -->
|
||||
<template>
|
||||
<el-row justify="end">
|
||||
<el-button plain type="primary" @click="openForm">添加产品</el-button>
|
||||
</el-row>
|
||||
<el-table :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" label="产品名称" prop="name" width="120" />
|
||||
<el-table-column
|
||||
:formatter="fenToYuanFormat"
|
||||
align="center"
|
||||
label="价格"
|
||||
prop="price"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column align="center" label="产品类型" prop="categoryName" width="100" />
|
||||
<el-table-column align="center" label="产品单位" prop="unit">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_UNIT" :value="scope.row.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="产品编码" prop="no" />
|
||||
<el-table-column align="center" fixed="right" label="数量" prop="count" width="100">
|
||||
<template #default="{ row }: { row: ProductApi.ProductExpandVO }">
|
||||
<el-input-number
|
||||
v-model="row.count"
|
||||
controls-position="right"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
label="折扣(%)"
|
||||
prop="discountPercent"
|
||||
width="120"
|
||||
>
|
||||
<template #default="{ row }: { row: ProductApi.ProductExpandVO }">
|
||||
<el-input-number
|
||||
v-model="row.discountPercent"
|
||||
controls-position="right"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="0"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="合计" prop="totalPrice" width="100">
|
||||
<template #default="{ row }: { row: ProductApi.ProductExpandVO }">
|
||||
{{ fenToYuan(getTotalPrice(row)) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- table 选择表单 -->
|
||||
<TableSelectForm ref="tableSelectFormRef" v-model="multipleSelection" title="选择产品">
|
||||
<el-table-column align="center" label="产品名称" prop="name" width="160" />
|
||||
<el-table-column align="center" label="产品类型" prop="categoryName" width="160" />
|
||||
<el-table-column align="center" label="产品单位" prop="unit">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_UNIT" :value="scope.row.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="产品编码" prop="no" />
|
||||
<el-table-column
|
||||
:formatter="fenToYuanFormat"
|
||||
align="center"
|
||||
label="价格(元)"
|
||||
prop="price"
|
||||
width="100"
|
||||
/>
|
||||
</TableSelectForm>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as ProductApi from '@/api/crm/product'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { fenToYuanFormat } from '@/utils/formatter'
|
||||
import { TableSelectForm } from '@/components/Table/index'
|
||||
import { fenToYuan, floatToFixed2, yuanToFen } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'ProductList' })
|
||||
const props = withDefaults(defineProps<{ modelValue: ProductApi.ProductExpandVO[] }>(), {
|
||||
modelValue: () => []
|
||||
})
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', v: any[]): void
|
||||
}>()
|
||||
|
||||
const list = ref<ProductApi.ProductExpandVO[]>([]) // 已添加的产品列表
|
||||
const multipleSelection = ref<ProductApi.ProductExpandVO[]>([]) // 多选
|
||||
|
||||
/** 处理删除 */
|
||||
const handleDelete = (id: number) => {
|
||||
const index = list.value.findIndex((item) => item.id === id)
|
||||
if (index !== -1) {
|
||||
list.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开 Product 弹窗 */
|
||||
const tableSelectFormRef = ref<InstanceType<typeof TableSelectForm>>()
|
||||
const openForm = () => {
|
||||
tableSelectFormRef.value?.open(ProductApi.getProductPage)
|
||||
}
|
||||
|
||||
/** 计算 totalPrice */
|
||||
const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => {
|
||||
const totalPrice =
|
||||
(Number(row.price) / 100) * Number(row.count) * (1 - Number(row.discountPercent) / 100)
|
||||
row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice)
|
||||
return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2)
|
||||
})
|
||||
|
||||
/** 编辑时合同产品回显 */
|
||||
const isSetListValue = ref(false) // 判断是否已经给 list 赋值过,用于编辑表单产品回显
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
if (!val || val.length === 0 || isSetListValue.value) {
|
||||
return
|
||||
}
|
||||
list.value = [
|
||||
...props.modelValue.map((item) => {
|
||||
item.totalPrice = floatToFixed2(item.totalPrice) as unknown as number
|
||||
return item
|
||||
})
|
||||
]
|
||||
isSetListValue.value = true
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
)
|
||||
|
||||
/** 监听列表变化,动态更新合同产品列表 */
|
||||
watch(
|
||||
list,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
emits('update:modelValue', list.value)
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
// 监听产品选择结果动态添加产品到列表中,如果产品存在则不放入列表中
|
||||
watch(
|
||||
multipleSelection,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
// 过滤出不在列表中的产品
|
||||
const ids = list.value.map((item) => item.id)
|
||||
const productList = multipleSelection.value.filter((item) => ids.indexOf(item.id) === -1)
|
||||
if (!productList || productList.length === 0) {
|
||||
return
|
||||
}
|
||||
list.value.push(...productList)
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
</script>
|
45
src/views/crm/contract/detail/ContractDetailsHeader.vue
Normal file
45
src/views/crm/contract/detail/ContractDetailsHeader.vue
Normal file
@ -0,0 +1,45 @@
|
||||
<!-- 合同详情头部组件-->
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex items-start justify-between">
|
||||
<div>
|
||||
<el-col>
|
||||
<el-row>
|
||||
<span class="text-xl font-bold">{{ contract.name }}</span>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</div>
|
||||
<div>
|
||||
<!-- 右上:按钮 -->
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ContentWrap class="mt-10px">
|
||||
<el-descriptions :column="5" direction="vertical">
|
||||
<el-descriptions-item label="客户名称">
|
||||
{{ contract.customerName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同金额(元)">
|
||||
{{ floatToFixed2(contract.price) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="下单时间">
|
||||
{{ contract.orderDate ? formatDate(contract.orderDate) : '空' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回款金额(元)">
|
||||
{{ floatToFixed2(contract.price) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="负责人">
|
||||
{{ contract.ownerUserName }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { floatToFixed2 } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'ContractDetailsHeader' })
|
||||
defineProps<{ contract: ContractApi.ContractVO }>()
|
||||
</script>
|
81
src/views/crm/contract/detail/ContractDetailsInfo.vue
Normal file
81
src/views/crm/contract/detail/ContractDetailsInfo.vue
Normal file
@ -0,0 +1,81 @@
|
||||
<!-- 合同详情组件 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item name="contractInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">基本信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="3">
|
||||
<el-descriptions-item label="合同编号">
|
||||
{{ contract.no }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同名称">
|
||||
{{ contract.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="客户名称">
|
||||
{{ contract.customerName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商机名称">
|
||||
{{ contract.businessName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同金额(元)">
|
||||
{{ contract.price }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="下单时间">
|
||||
{{ formatDate(contract.orderDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始时间">
|
||||
{{ formatDate(contract.startTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结束时间">
|
||||
{{ formatDate(contract.endTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="客户签约人">
|
||||
{{ contract.contactName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="公司签约人">
|
||||
{{ contract.signUserName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
{{ contract.remark }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同状态">
|
||||
{{ contract.auditStatus }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="systemInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">系统信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="2">
|
||||
<el-descriptions-item label="负责人">
|
||||
{{ contract.ownerUserName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建人">
|
||||
{{ contract.creatorName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ contract.createTime ? formatDate(contract.createTime) : '空' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ contract.updateTime ? formatDate(contract.updateTime) : '空' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
defineOptions({ name: 'ContractDetailsInfo' })
|
||||
defineProps<{
|
||||
contract: ContractApi.ContractVO
|
||||
}>()
|
||||
|
||||
// 展示的折叠面板
|
||||
const activeNames = ref(['contractInfo', 'systemInfo'])
|
||||
</script>
|
67
src/views/crm/contract/detail/ContractProductList.vue
Normal file
67
src/views/crm/contract/detail/ContractProductList.vue
Normal file
@ -0,0 +1,67 @@
|
||||
<!-- 合同详情:产品列表 -->
|
||||
<template>
|
||||
<el-table :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" label="产品名称" prop="name" width="160" />
|
||||
<el-table-column align="center" label="产品类型" prop="categoryName" width="160" />
|
||||
<el-table-column align="center" label="产品单位" prop="unit">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_UNIT" :value="scope.row.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="产品编码" prop="no" />
|
||||
<el-table-column
|
||||
:formatter="fenToYuanFormat"
|
||||
align="center"
|
||||
label="价格(元)"
|
||||
prop="price"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column align="center" label="数量" prop="count" width="200" />
|
||||
<el-table-column align="center" label="折扣(%)" prop="discountPercent" width="200" />
|
||||
<el-table-column align="center" label="合计" prop="totalPrice" width="100">
|
||||
<template #default="{ row }: { row: ProductApi.ProductExpandVO }">
|
||||
{{ getTotalPrice(row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { fenToYuanFormat } from '@/utils/formatter'
|
||||
import * as ProductApi from '@/api/crm/product'
|
||||
import { floatToFixed2, yuanToFen } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'ContractProductList' })
|
||||
const props = withDefaults(defineProps<{ modelValue: ProductApi.ProductExpandVO[] }>(), {
|
||||
modelValue: () => []
|
||||
})
|
||||
const list = ref<ProductApi.ProductExpandVO[]>([]) // 产品列表
|
||||
|
||||
/** 计算 totalPrice */
|
||||
const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => {
|
||||
const totalPrice =
|
||||
(Number(row.price) / 100) * Number(row.count) * (1 - Number(row.discountPercent) / 100)
|
||||
row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice)
|
||||
return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2)
|
||||
})
|
||||
|
||||
/** 编辑时合同产品回显 */
|
||||
const isSetListValue = ref(false) // 判断是否已经给 list 赋值过,用于编辑表单产品回显
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
if (!val || val.length === 0 || isSetListValue.value) {
|
||||
return
|
||||
}
|
||||
list.value = [
|
||||
...props.modelValue.map((item) => {
|
||||
item.totalPrice = floatToFixed2(item.totalPrice) as unknown as number
|
||||
return item
|
||||
})
|
||||
]
|
||||
isSetListValue.value = true
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
)
|
||||
</script>
|
119
src/views/crm/contract/detail/index.vue
Normal file
119
src/views/crm/contract/detail/index.vue
Normal file
@ -0,0 +1,119 @@
|
||||
<!-- 合同详情页面组件-->
|
||||
<template>
|
||||
<ContractDetailsHeader v-loading="loading" :contract="contract">
|
||||
<el-button v-if="permissionListRef?.validateWrite" @click="openForm('update', contract.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-if="permissionListRef?.validateOwnerUser" type="primary" @click="transferContract">
|
||||
转移
|
||||
</el-button>
|
||||
</ContractDetailsHeader>
|
||||
<el-col>
|
||||
<el-tabs>
|
||||
<!-- TODO @puhui999:跟进记录 -->
|
||||
<el-tab-pane label="基本信息">
|
||||
<ContractDetailsInfo :contract="contract" />
|
||||
</el-tab-pane>
|
||||
<!-- TODO @puhui999:products 更合适哈 -->
|
||||
<el-tab-pane label="产品">
|
||||
<ContractProductList v-model="contract.productItems" />
|
||||
</el-tab-pane>
|
||||
<!-- TODO @puhui999:回款信息 -->
|
||||
<!-- TODO @puhui999:这里是不是不用 isPool 哈 -->
|
||||
<el-tab-pane label="团队成员">
|
||||
<PermissionList
|
||||
ref="permissionListRef"
|
||||
:biz-id="contract.id!"
|
||||
:biz-type="BizTypeEnum.CRM_CONTRACT"
|
||||
:show-action="!permissionListRef?.isPool || false"
|
||||
@quit-team="close"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="操作日志">
|
||||
<OperateLogV2 :log-list="logList" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ContractForm ref="formRef" @success="getContractData" />
|
||||
<CrmTransferForm ref="transferFormRef" @success="close" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import { OperateLogV2VO } from '@/api/system/operatelog'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import ContractDetailsHeader from './ContractDetailsHeader.vue'
|
||||
import ContractDetailsInfo from './ContractDetailsInfo.vue'
|
||||
import ContractProductList from './ContractProductList.vue'
|
||||
import { BizTypeEnum } from '@/api/crm/permission'
|
||||
import { getOperateLogPage } from '@/api/crm/operateLog'
|
||||
import ContractForm from '@/views/crm/contract/ContractForm.vue'
|
||||
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
||||
import PermissionList from '@/views/crm/permission/components/PermissionList.vue'
|
||||
|
||||
defineOptions({ name: 'CrmContractDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const message = useMessage()
|
||||
const contractId = ref(0) // 编号
|
||||
const loading = ref(true) // 加载中
|
||||
const contract = ref<ContractApi.ContractVO>({} as ContractApi.ContractVO) // 详情
|
||||
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // 团队成员列表 Ref
|
||||
|
||||
/** 编辑 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 获取详情 */
|
||||
const getContractData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
await getOperateLog(contractId.value)
|
||||
contract.value = await ContractApi.getContract(contractId.value)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取操作日志 */
|
||||
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
|
||||
const getOperateLog = async (contractId: number) => {
|
||||
if (!contractId) {
|
||||
return
|
||||
}
|
||||
const data = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_CONTRACT,
|
||||
bizId: contractId
|
||||
})
|
||||
logList.value = data.list
|
||||
}
|
||||
|
||||
/** 转移 */
|
||||
// TODO @puhui999:这个组件,要不传递业务类型,然后组件里判断 title 和 api 能调用哪个;整体治理掉;
|
||||
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 合同转移表单 ref
|
||||
const transferContract = () => {
|
||||
transferFormRef.value?.open('合同转移', contract.value.id, ContractApi.transferContract)
|
||||
}
|
||||
|
||||
/** 关闭 */
|
||||
const { delView } = useTagsViewStore() // 视图操作
|
||||
const { currentRoute } = useRouter() // 路由
|
||||
const close = () => {
|
||||
delView(unref(currentRoute))
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
const id = route.params.id
|
||||
if (!id) {
|
||||
message.warning('参数错误,合同不能为空!')
|
||||
close()
|
||||
return
|
||||
}
|
||||
contractId.value = id as unknown as number
|
||||
await getContractData()
|
||||
})
|
||||
</script>
|
@ -2,116 +2,170 @@
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="合同编号" prop="no">
|
||||
<el-input
|
||||
v-model="queryParams.no"
|
||||
placeholder="请输入合同编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入合同编号"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入合同名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入合同名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button type="primary" @click="openForm('create')" v-hasPermi="['crm:contract:create']">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
<el-button @click="handleQuery">
|
||||
<Icon class="mr-5px" icon="ep:search" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['crm:contract:create']" type="primary" @click="openForm('create')">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['crm:contract:export']"
|
||||
:loading="exportLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExport"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<!-- TODO 芋艿:各种字段要调整 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="合同编号" align="center" prop="id" />
|
||||
<el-table-column label="合同名称" align="center" prop="name" />
|
||||
<el-table-column label="客户名称" align="center" prop="customerId" />
|
||||
<el-table-column label="商机名称" align="center" prop="businessId" />
|
||||
<el-table-column label="工作流名称" align="center" prop="processInstanceId" />
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" fixed="left" label="合同编号" prop="no" width="130" />
|
||||
<el-table-column align="center" label="合同名称" prop="name" width="130" />
|
||||
<el-table-column align="center" label="客户名称" prop="customerName" width="120">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openCustomerDetail(scope.row.customerId)"
|
||||
>
|
||||
{{ scope.row.customerName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- TODO @puhui999:做了商机详情后,可以把这个超链接加上 -->
|
||||
<el-table-column align="center" label="商机名称" prop="businessName" width="130" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="下单时间"
|
||||
align="center"
|
||||
prop="orderDate"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column label="负责人" align="center" prop="ownerUserId" />
|
||||
<el-table-column label="合同编号" align="center" prop="no" />
|
||||
<el-table-column
|
||||
label="开始时间"
|
||||
align="center"
|
||||
label="合同金额"
|
||||
prop="price"
|
||||
width="130"
|
||||
:formatter="fenToYuanFormat"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="合同开始时间"
|
||||
prop="startTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column
|
||||
label="结束时间"
|
||||
align="center"
|
||||
label="合同结束时间"
|
||||
prop="endTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column label="合同金额" align="center" prop="price" />
|
||||
<el-table-column label="整单折扣" align="center" prop="discountPercent" />
|
||||
<el-table-column label="产品总金额" align="center" prop="productPrice" />
|
||||
<el-table-column label="联系人" align="center" prop="contactId" />
|
||||
<el-table-column label="公司签约人" align="center" prop="signUserId" />
|
||||
<el-table-column align="center" label="客户签约人" prop="contactName" width="130">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openContactDetail(scope.row.contactId)"
|
||||
>
|
||||
{{ scope.row.contactName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="公司签约人" prop="signUserName" width="130" />
|
||||
<el-table-column align="center" label="备注" prop="remark" width="130" />
|
||||
<!-- TODO @puhui999:后续可加 【已收款金额】、【未收款金额】 -->
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
|
||||
<el-table-column
|
||||
label="最后跟进时间"
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
prop="contactLastTime"
|
||||
:formatter="dateFormatter"
|
||||
label="更新时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" width="120px">
|
||||
<el-table-column align="center" fixed="right" label="合同状态" prop="auditStatus" width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="250">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['crm:contract:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['crm:contract:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<!-- TODO @puhui999:可以加下判断,什么情况下,可以审批;然后加个【查看审批】按钮 -->
|
||||
<el-button
|
||||
v-hasPermi="['crm:contract:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleSubmit(scope.row)"
|
||||
>
|
||||
提交审核
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['crm:contract:query']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openDetail(scope.row.id)"
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['crm:contract:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['crm:contract:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
@ -120,9 +174,9 @@
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
@ -130,11 +184,13 @@
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ContractForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import ContractForm from './ContractForm.vue'
|
||||
import { fenToYuanFormat } from '@/utils/formatter'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
defineOptions({ name: 'CrmContract' })
|
||||
|
||||
@ -216,6 +272,30 @@ const handleExport = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交审核 **/
|
||||
const handleSubmit = async (row: ContractApi.ContractVO) => {
|
||||
await message.confirm(`您确定提交【${row.name}】审核吗?`)
|
||||
await ContractApi.submitContract(row.id)
|
||||
message.success('提交审核成功!')
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 打开合同详情 */
|
||||
const { push } = useRouter()
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'CrmContractDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const openCustomerDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 打开联系人详情 */
|
||||
const openContactDetail = (id: number) => {
|
||||
push({ name: 'CrmContactDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
221
src/views/crm/contract/oa/ContractDetail/index.vue
Normal file
221
src/views/crm/contract/oa/ContractDetail/index.vue
Normal file
@ -0,0 +1,221 @@
|
||||
<!-- TODO @puhui999:这个好像和 detail 重复了???能不能复用 detail 哈? -->
|
||||
<template>
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" label-width="110px">
|
||||
<el-row>
|
||||
<el-col :span="24" class="mb-10px">
|
||||
<CardTitle title="基本信息" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入合同名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同编号" prop="no">
|
||||
<el-input v-model="formData.no" placeholder="请输入合同编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户" prop="customerId">
|
||||
<el-select v-model="formData.customerId">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户签约人" prop="contactId">
|
||||
<el-select v-model="formData.contactId" :disabled="!formData.customerId">
|
||||
<el-option
|
||||
v-for="item in getContactOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公司签约人" prop="signUserId">
|
||||
<el-select v-model="formData.signUserId">
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-select v-model="formData.ownerUserId">
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="商机名称" prop="businessId">
|
||||
<el-select v-model="formData.businessId">
|
||||
<el-option
|
||||
v-for="item in businessList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同金额(元)" prop="price">
|
||||
<el-input v-model="formData.price" placeholder="请输入合同金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下单日期" prop="orderDate">
|
||||
<el-date-picker
|
||||
v-model="formData.orderDate"
|
||||
placeholder="选择下单日期"
|
||||
type="date"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="formData.startTime"
|
||||
placeholder="选择开始时间"
|
||||
type="date"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="formData.endTime"
|
||||
placeholder="选择结束时间"
|
||||
type="date"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" :rows="3" placeholder="请输入备注" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="产品列表" prop="productList">
|
||||
<ProductList v-model="formData.productItems" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="整单折扣(%)" prop="discountPercent">
|
||||
<el-input v-model="formData.discountPercent" placeholder="请输入整单折扣" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品总金额(元)" prop="productPrice">
|
||||
<el-input v-model="formData.productPrice" placeholder="请输入产品总金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<CardTitle class="mb-10px" title="审批信息" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button
|
||||
class="m-20px"
|
||||
link
|
||||
type="primary"
|
||||
@click="BPMLModelRef?.handleBpmnDetail('contract-approve')"
|
||||
>
|
||||
查看工作流
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<BPMLModel ref="BPMLModelRef" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import ProductList from '@/views/crm/contract/components/ProductList.vue'
|
||||
import BPMLModel from '@/views/crm/contract/components/BPMLModel.vue'
|
||||
|
||||
defineOptions({ name: 'ContractDetailOA' })
|
||||
const props = defineProps<{ id?: number }>()
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = ref<ContractApi.ContractVO>({} as ContractApi.ContractVO)
|
||||
const formRef = ref() // 表单 Ref
|
||||
const BPMLModelRef = ref<InstanceType<typeof BPMLModel>>()
|
||||
watch(
|
||||
() => formData.value.productItems,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
formData.value.productPrice = 0
|
||||
return
|
||||
}
|
||||
// 使用reduce函数进行累加
|
||||
formData.value.productPrice = val.reduce(
|
||||
(accumulator, currentValue) =>
|
||||
isNaN(accumulator + currentValue.totalPrice) ? 0 : accumulator + currentValue.totalPrice,
|
||||
0
|
||||
)
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
/** 打开弹窗 */
|
||||
const getFormData = async () => {
|
||||
await getAllApi()
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ContractApi.getContract(props.id!)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
const getAllApi = async () => {
|
||||
await Promise.all([getCustomerList(), getUserList(), getContactListList(), getBusinessList()])
|
||||
}
|
||||
const customerList = ref<CustomerApi.CustomerVO[]>([])
|
||||
/** 获取客户 */
|
||||
const getCustomerList = async () => {
|
||||
customerList.value = await CustomerApi.getSimpleCustomerList()
|
||||
}
|
||||
const contactList = ref<ContactApi.ContactVO[]>([])
|
||||
/** 动态获取客户联系人 */
|
||||
const getContactOptions = computed(() =>
|
||||
contactList.value.filter((item) => item.customerId === formData.value.customerId)
|
||||
)
|
||||
const getContactListList = async () => {
|
||||
contactList.value = await ContactApi.getSimpleContactList()
|
||||
}
|
||||
const userList = ref<UserApi.UserVO[]>([])
|
||||
/** 获取用户列表 */
|
||||
const getUserList = async () => {
|
||||
userList.value = await UserApi.getSimpleUserList()
|
||||
}
|
||||
const businessList = ref<BusinessApi.BusinessVO[]>([])
|
||||
/** 获取商机 */
|
||||
const getBusinessList = async () => {
|
||||
businessList.value = await BusinessApi.getSimpleBusinessList()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getFormData()
|
||||
})
|
||||
</script>
|
135
src/views/crm/customer/CustomerImportForm.vue
Normal file
135
src/views/crm/customer/CustomerImportForm.vue
Normal file
@ -0,0 +1,135 @@
|
||||
<!-- 客户导入窗口 -->
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="客户导入" width="400">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
v-model:file-list="fileList"
|
||||
:action="importUrl + '?updateSupport=' + updateSupport"
|
||||
:auto-upload="false"
|
||||
:disabled="formLoading"
|
||||
:headers="uploadHeaders"
|
||||
:limit="1"
|
||||
:on-error="submitFormError"
|
||||
:on-exceed="handleExceed"
|
||||
:on-success="submitFormSuccess"
|
||||
accept=".xlsx, .xls"
|
||||
drag
|
||||
>
|
||||
<Icon icon="ep:upload" />
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<div class="el-upload__tip">
|
||||
<el-checkbox v-model="updateSupport" />
|
||||
是否更新已经存在的客户数据(“客户名称”重复)
|
||||
</div>
|
||||
<span>仅允许导入 xls、xlsx 格式文件。</span>
|
||||
<el-link
|
||||
:underline="false"
|
||||
style="font-size: 12px; vertical-align: baseline"
|
||||
type="primary"
|
||||
@click="importTemplate"
|
||||
>
|
||||
下载模板
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import download from '@/utils/download'
|
||||
|
||||
defineOptions({ name: 'SystemUserImportForm' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const uploadRef = ref()
|
||||
const importUrl =
|
||||
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/crm/customer/import'
|
||||
const uploadHeaders = ref() // 上传 Header 头
|
||||
const fileList = ref([]) // 文件列表
|
||||
const updateSupport = ref(0) // 是否更新已经存在的客户数据
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
fileList.value = []
|
||||
resetForm()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
if (fileList.value.length == 0) {
|
||||
message.error('请上传文件')
|
||||
return
|
||||
}
|
||||
// 提交请求
|
||||
uploadHeaders.value = {
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
'tenant-id': getTenantId()
|
||||
}
|
||||
formLoading.value = true
|
||||
uploadRef.value!.submit()
|
||||
}
|
||||
|
||||
/** 文件上传成功 */
|
||||
const emits = defineEmits(['success'])
|
||||
const submitFormSuccess = (response: any) => {
|
||||
if (response.code !== 0) {
|
||||
message.error(response.msg)
|
||||
formLoading.value = false
|
||||
return
|
||||
}
|
||||
// 拼接提示语
|
||||
const data = response.data
|
||||
let text = '上传成功数量:' + data.createCustomerNames.length + ';'
|
||||
for (let customerName of data.createCustomerNames) {
|
||||
text += '< ' + customerName + ' >'
|
||||
}
|
||||
text += '更新成功数量:' + data.updateCustomerNames.length + ';'
|
||||
for (const customerName of data.updateCustomerNames) {
|
||||
text += '< ' + customerName + ' >'
|
||||
}
|
||||
text += '更新失败数量:' + Object.keys(data.failureCustomerNames).length + ';'
|
||||
for (const customerName in data.failureCustomerNames) {
|
||||
text += '< ' + customerName + ': ' + data.failureCustomerNames[customerName] + ' >'
|
||||
}
|
||||
message.alert(text)
|
||||
// 发送操作成功的事件
|
||||
emits('success')
|
||||
}
|
||||
|
||||
/** 上传错误提示 */
|
||||
const submitFormError = (): void => {
|
||||
message.error('上传失败,请您重新上传!')
|
||||
formLoading.value = false
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
// 重置上传状态和文件
|
||||
formLoading.value = false
|
||||
uploadRef.value?.clearFiles()
|
||||
}
|
||||
|
||||
/** 文件数超出提示 */
|
||||
const handleExceed = (): void => {
|
||||
message.error('最多只能上传一个文件!')
|
||||
}
|
||||
|
||||
/** 下载模板操作 */
|
||||
const importTemplate = async () => {
|
||||
const res = await CustomerApi.importCustomerTemplate()
|
||||
download.excel(res, '客户导入模版.xls')
|
||||
}
|
||||
</script>
|
@ -51,6 +51,7 @@
|
||||
:biz-id="customer.id!"
|
||||
:biz-type="BizTypeEnum.CRM_CUSTOMER"
|
||||
:show-action="!permissionListRef?.isPool || false"
|
||||
@quit-team="close"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商机" lazy>
|
||||
@ -90,6 +91,7 @@ import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
||||
import FollowUpList from '@/views/crm/followup/index.vue'
|
||||
import { BizTypeEnum } from '@/api/crm/permission'
|
||||
import type { OperateLogV2VO } from '@/api/system/operatelog'
|
||||
import { getOperateLogPage } from '@/api/crm/operateLog'
|
||||
|
||||
defineOptions({ name: 'CrmCustomerDetail' })
|
||||
|
||||
@ -122,7 +124,7 @@ const openForm = () => {
|
||||
/** 客户转移 */
|
||||
const crmTransferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 客户转移表单 ref
|
||||
const transfer = () => {
|
||||
crmTransferFormRef.value?.open('客户转移', customerId.value, CustomerApi.transfer)
|
||||
crmTransferFormRef.value?.open('客户转移', customerId.value, CustomerApi.transferCustomer)
|
||||
}
|
||||
|
||||
/** 锁定客户 */
|
||||
@ -163,7 +165,10 @@ const getOperateLog = async () => {
|
||||
if (!customerId.value) {
|
||||
return
|
||||
}
|
||||
const data = await CustomerApi.getOperateLogPage(customerId.value)
|
||||
const data = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_CUSTOMER,
|
||||
bizId: customerId.value
|
||||
})
|
||||
logList.value = data.list
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,10 @@
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['crm:customer:import']" plain type="warning" @click="handleImport">
|
||||
<Icon icon="ep:upload" />
|
||||
导入
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['crm:customer:export']"
|
||||
:loading="exportLoading"
|
||||
@ -106,8 +110,8 @@
|
||||
<el-tab-pane label="下属负责的" name="3" />
|
||||
</el-tabs>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" label="编号" prop="id" />
|
||||
<el-table-column align="center" label="客户名称" prop="name" width="160">
|
||||
<el-table-column align="center" label="编号" fixed="left" prop="id" />
|
||||
<el-table-column align="center" label="客户名称" fixed="left" prop="name" width="160">
|
||||
<template #default="scope">
|
||||
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
|
||||
{{ scope.row.name }}
|
||||
@ -145,7 +149,7 @@
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="距离进入公海" prop="poolDay">
|
||||
<el-table-column align="center" label="距离进入公海" prop="poolDay" width="120">
|
||||
<template #default="scope"> {{ scope.row.poolDay }} 天</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -204,6 +208,7 @@
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<CustomerForm ref="formRef" @success="getList" />
|
||||
<CustomerImportForm ref="importFormRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@ -212,6 +217,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import CustomerForm from './CustomerForm.vue'
|
||||
import CustomerImportForm from './CustomerImportForm.vue'
|
||||
import { TabsPaneContext } from 'element-plus'
|
||||
|
||||
defineOptions({ name: 'CrmCustomer' })
|
||||
@ -334,6 +340,12 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导入按钮操作 */
|
||||
const importFormRef = ref<InstanceType<typeof CustomerImportForm>>()
|
||||
const handleImport = () => {
|
||||
importFormRef.value?.open()
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
|
@ -31,52 +31,38 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @puhui999:不搞富文本哈;然后加个附件、图片两个 form-item 哈 -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="跟进内容" prop="content">
|
||||
<Editor v-model="formData.content" height="300px" />
|
||||
<el-input v-model="formData.content" :rows="3" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="图片" prop="content">
|
||||
<UploadImgs v-model="formData.picUrls" class="min-w-80px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="附件" prop="content">
|
||||
<UploadFile v-model="formData.fileUrls" class="min-w-80px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @puhui999:因为不考虑编辑的情况,是不是关联要是个弹窗选择哈? -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="关联联系人" prop="contactIds">
|
||||
<el-select v-model="formData.contactIds" multiple placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in allContactList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button @click="handleAddContact">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
添加联系人
|
||||
</el-button>
|
||||
<contact-list v-model:contactIds="formData.contactIds" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="关联联系人" prop="contactIds">-->
|
||||
<!-- <el-button @click="handleAddContact">-->
|
||||
<!-- <Icon class="mr-5px" icon="ep:plus" />-->
|
||||
<!-- 选择添加联系人-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <contact-list v-model:contactIds="formData.contactIds" />-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="关联商机" prop="businessIds">
|
||||
<el-select v-model="formData.businessIds" multiple placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in allBusinessList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button @click="handleAddBusiness">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
添加商机
|
||||
</el-button>
|
||||
<business-list v-model:businessIds="formData.businessIds" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="关联商机" prop="businessIds">-->
|
||||
<!-- <el-button @click="handleAddBusiness">-->
|
||||
<!-- <Icon class="mr-5px" icon="ep:plus" />-->
|
||||
<!-- 选择添加商机-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <business-list v-model:businessIds="formData.businessIds" />-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@ -85,13 +71,13 @@
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
<ContactTableSelect ref="contactTableSelectRef" v-model="formData.contactIds" />
|
||||
<BusinessTableSelect ref="businessTableSelectRef" v-model="formData.businessIds" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { FollowUpRecordApi, FollowUpRecordVO } from '@/api/crm/followup'
|
||||
import { BusinessList, ContactList } from './components'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import { BusinessList, BusinessTableSelect, ContactList, ContactTableSelect } from './components'
|
||||
|
||||
defineOptions({ name: 'FollowUpRecordForm' })
|
||||
|
||||
@ -110,8 +96,6 @@ const formRules = reactive({
|
||||
})
|
||||
|
||||
const formRef = ref() // 表单 Ref
|
||||
const allContactList = ref<ContactApi.ContactVO[]>([]) // 所有联系人列表
|
||||
const allBusinessList = ref<BusinessApi.BusinessVO[]>([]) // 所有商家列表
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (bizType: number, bizId: number, type: string, id?: number) => {
|
||||
@ -121,8 +105,6 @@ const open = async (bizType: number, bizId: number, type: string, id?: number) =
|
||||
resetForm()
|
||||
formData.value.bizType = bizType
|
||||
formData.value.bizId = bizId
|
||||
allContactList.value = await ContactApi.getSimpleContactList()
|
||||
allBusinessList.value = await BusinessApi.getSimpleBusinessList()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
@ -159,6 +141,18 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 关联联系人 */
|
||||
const contactTableSelectRef = ref<InstanceType<typeof ContactTableSelect>>()
|
||||
const handleAddContact = () => {
|
||||
contactTableSelectRef.value?.open()
|
||||
}
|
||||
|
||||
/** 关联商机 */
|
||||
const businessTableSelectRef = ref<InstanceType<typeof BusinessTableSelect>>()
|
||||
const handleAddBusiness = () => {
|
||||
businessTableSelectRef.value?.open()
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formRef.value?.resetFields()
|
||||
|
@ -52,7 +52,7 @@ watch(
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
list.value = BusinessApi.getBusinessListByIds(val) as unknown as BusinessApi.BusinessVO[]
|
||||
list.value = BusinessApi.getBusinessListByIds(unref(val)) as unknown as BusinessApi.BusinessVO[]
|
||||
}
|
||||
)
|
||||
const emits = defineEmits<{
|
||||
|
@ -1,79 +0,0 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="50%">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="跟进类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择跟进类型">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_FOLLOW_UP_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下次联系时间" prop="nextTime">
|
||||
<el-date-picker
|
||||
v-model="formData.nextTime"
|
||||
placeholder="选择下次联系时间"
|
||||
type="date"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
/** 跟进记录 表单 */
|
||||
defineOptions({ name: 'BusinessListSelectForm' })
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = ref([])
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await FollowUpRecordApi.getFollowUpRecord(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
88
src/views/crm/followup/components/BusinessTableSelect.vue
Normal file
88
src/views/crm/followup/components/BusinessTableSelect.vue
Normal file
@ -0,0 +1,88 @@
|
||||
<!-- 商机的选择列表 TODO 芋艿:后面看看要不要搞到统一封装里 -->
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :appendToBody="true" title="选择商机" width="700">
|
||||
<el-table
|
||||
ref="multipleTableRef"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:show-overflow-tooltip="true"
|
||||
:stripe="true"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="center" label="商机名称" prop="name" />
|
||||
<el-table-column align="center" label="客户名称" prop="customerName" />
|
||||
<el-table-column align="center" label="商机金额" prop="price" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="预计成交日期"
|
||||
prop="dealTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="备注" prop="remark" />
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { ElTable } from 'element-plus'
|
||||
|
||||
defineOptions({ name: 'BusinessTableSelect' })
|
||||
withDefaults(defineProps<{ modelValue: number[] }>(), { modelValue: () => [] })
|
||||
|
||||
const list = ref<BusinessApi.BusinessVO[]>([]) // 列表的数据
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false)
|
||||
|
||||
// 确认选择时的触发事件
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', v: number[]): void
|
||||
}>()
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection = ref<BusinessApi.BusinessVO[]>([])
|
||||
const handleSelectionChange = (val: BusinessApi.BusinessVO[]) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
/** 触发 */
|
||||
const submitForm = () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
emits(
|
||||
'update:modelValue',
|
||||
multipleSelection.value.map((item) => item.id)
|
||||
)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await BusinessApi.getSimpleBusinessList()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async () => {
|
||||
dialogVisible.value = true
|
||||
await nextTick()
|
||||
if (multipleSelection.value.length > 0) {
|
||||
multipleTableRef.value!.clearSelection()
|
||||
}
|
||||
await getList()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
</script>
|
@ -69,7 +69,7 @@ const props = withDefaults(defineProps<{ contactIds: number[] }>(), {
|
||||
const list = ref<ContactApi.ContactVO[]>([] as ContactApi.ContactVO[])
|
||||
const getContactList = async () => {
|
||||
list.value = (await ContactApi.getContactListByIds(
|
||||
props.contactIds
|
||||
unref(props.contactIds)
|
||||
)) as unknown as ContactApi.ContactVO[]
|
||||
}
|
||||
watch(
|
||||
|
87
src/views/crm/followup/components/ContactTableSelect.vue
Normal file
87
src/views/crm/followup/components/ContactTableSelect.vue
Normal file
@ -0,0 +1,87 @@
|
||||
<!-- 联系人的选择列表 TODO 芋艿:后面看看要不要搞到统一封装里 -->
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :appendToBody="true" title="选择联系人" width="700">
|
||||
<el-table
|
||||
ref="multipleTableRef"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:show-overflow-tooltip="true"
|
||||
:stripe="true"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="center" fixed="left" label="姓名" prop="name" width="140" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="left"
|
||||
label="客户名称"
|
||||
prop="customerName"
|
||||
width="120"
|
||||
/>
|
||||
<el-table-column align="center" label="手机" prop="mobile" width="120" />
|
||||
<el-table-column align="center" label="电话" prop="telephone" width="120" />
|
||||
<el-table-column align="center" label="邮箱" prop="email" width="120" />
|
||||
<el-table-column align="center" label="职位" prop="post" width="120" />
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import { ElTable } from 'element-plus'
|
||||
|
||||
defineOptions({ name: 'ContactTableSelect' })
|
||||
withDefaults(defineProps<{ modelValue: number[] }>(), { modelValue: () => [] })
|
||||
|
||||
const list = ref<ContactApi.ContactVO[]>([]) // 列表的数据
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false)
|
||||
|
||||
// 确认选择时的触发事件
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', v: number[]): void
|
||||
}>()
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection = ref<ContactApi.ContactVO[]>([])
|
||||
const handleSelectionChange = (val: ContactApi.ContactVO[]) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
/** 触发 */
|
||||
const submitForm = () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
emits(
|
||||
'update:modelValue',
|
||||
multipleSelection.value.map((item) => item.id)
|
||||
)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
}
|
||||
}
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await ContactApi.getSimpleContactList()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async () => {
|
||||
dialogVisible.value = true
|
||||
await nextTick()
|
||||
if (multipleSelection.value.length > 0) {
|
||||
multipleTableRef.value!.clearSelection()
|
||||
}
|
||||
await getList()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
</script>
|
@ -1,4 +1,6 @@
|
||||
import BusinessList from './BusinessList.vue'
|
||||
import BusinessTableSelect from './BusinessTableSelect.vue'
|
||||
import ContactList from './ContactList.vue'
|
||||
import ContactTableSelect from './ContactTableSelect.vue'
|
||||
|
||||
export { BusinessList, ContactList }
|
||||
export { BusinessList, BusinessTableSelect, ContactList, ContactTableSelect }
|
||||
|
@ -1,14 +0,0 @@
|
||||
<!-- 分配给我的线索 -->
|
||||
<template>
|
||||
<div>
|
||||
TODO: 分配给我的线索
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="FollowLeads">
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user