feat: 删除CRM模块
This commit is contained in:
@@ -1,895 +0,0 @@
|
|||||||
import type { Ref } from 'vue';
|
|
||||||
|
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmContractApi } from '#/api/crm/contract';
|
|
||||||
import type { CrmReceivableApi } from '#/api/crm/receivable';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
|
|
||||||
import { DICT_TYPE } from '#/utils';
|
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
|
||||||
|
|
||||||
export interface LeftSideItem {
|
|
||||||
name: string;
|
|
||||||
menu: string;
|
|
||||||
count: Ref<number>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 跟进状态 */
|
|
||||||
export const FOLLOWUP_STATUS = [
|
|
||||||
{ label: '待跟进', value: false },
|
|
||||||
{ label: '已跟进', value: true },
|
|
||||||
];
|
|
||||||
|
|
||||||
/** 归属范围 */
|
|
||||||
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: 10 },
|
|
||||||
{ label: '审核通过', value: 20 },
|
|
||||||
{ label: '审核不通过', value: 30 },
|
|
||||||
];
|
|
||||||
|
|
||||||
/** 回款提醒类型 */
|
|
||||||
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 },
|
|
||||||
];
|
|
||||||
|
|
||||||
export const useLeftSides = (
|
|
||||||
customerTodayContactCount: Ref<number>,
|
|
||||||
clueFollowCount: Ref<number>,
|
|
||||||
customerFollowCount: Ref<number>,
|
|
||||||
customerPutPoolRemindCount: Ref<number>,
|
|
||||||
contractAuditCount: Ref<number>,
|
|
||||||
contractRemindCount: Ref<number>,
|
|
||||||
receivableAuditCount: Ref<number>,
|
|
||||||
receivablePlanRemindCount: Ref<number>,
|
|
||||||
): LeftSideItem[] => {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
name: '今日需联系客户',
|
|
||||||
menu: 'customerTodayContact',
|
|
||||||
count: customerTodayContactCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '分配给我的线索',
|
|
||||||
menu: 'clueFollow',
|
|
||||||
count: clueFollowCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '分配给我的客户',
|
|
||||||
menu: 'customerFollow',
|
|
||||||
count: customerFollowCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '待进入公海的客户',
|
|
||||||
menu: 'customerPutPoolRemind',
|
|
||||||
count: customerPutPoolRemindCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '待审核合同',
|
|
||||||
menu: 'contractAudit',
|
|
||||||
count: contractAuditCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '待审核回款',
|
|
||||||
menu: 'receivableAudit',
|
|
||||||
count: receivableAuditCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '待回款提醒',
|
|
||||||
menu: 'receivablePlanRemind',
|
|
||||||
count: receivablePlanRemindCount,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '即将到期的合同',
|
|
||||||
menu: 'contractRemind',
|
|
||||||
count: contractRemindCount,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 分配给我的线索 列表的搜索表单 */
|
|
||||||
export function useClueFollowFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'followUpStatus',
|
|
||||||
label: '状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: FOLLOWUP_STATUS,
|
|
||||||
},
|
|
||||||
defaultValue: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 分配给我的线索 列表的字段 */
|
|
||||||
export function useClueFollowColumns(): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '线索名称',
|
|
||||||
minWidth: 160,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: { default: 'name' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
title: '线索来源',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_SOURCE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
title: '手机',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'telephone',
|
|
||||||
title: '电话',
|
|
||||||
minWidth: 130,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
title: '邮箱',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'detailAddress',
|
|
||||||
title: '地址',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'industryId',
|
|
||||||
title: '客户行业',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'level',
|
|
||||||
title: '客户级别',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
title: '下次联系时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
title: '最后跟进时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastContent',
|
|
||||||
title: '最后跟进记录',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 合同审核列表的搜索表单 */
|
|
||||||
export function useContractAuditFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'auditStatus',
|
|
||||||
label: '合同状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: AUDIT_STATUS,
|
|
||||||
},
|
|
||||||
defaultValue: 10,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 合同提醒列表的搜索表单 */
|
|
||||||
export function useContractRemindFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'expiryType',
|
|
||||||
label: '到期状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: CONTRACT_EXPIRY_TYPE,
|
|
||||||
},
|
|
||||||
defaultValue: 1,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 合同审核列表的字段 */
|
|
||||||
export function useContractColumns<T = CrmContractApi.Contract>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'no',
|
|
||||||
title: '合同编号',
|
|
||||||
minWidth: 160,
|
|
||||||
fixed: 'left',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '合同名称',
|
|
||||||
minWidth: 160,
|
|
||||||
slots: {
|
|
||||||
default: 'name',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'customerName',
|
|
||||||
title: '客户名称',
|
|
||||||
minWidth: 160,
|
|
||||||
slots: {
|
|
||||||
default: 'customerName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'businessName',
|
|
||||||
title: '商机名称',
|
|
||||||
minWidth: 160,
|
|
||||||
slots: {
|
|
||||||
default: 'businessName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'price',
|
|
||||||
title: '合同金额(元)',
|
|
||||||
minWidth: 120,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'orderDate',
|
|
||||||
title: '下单时间',
|
|
||||||
minWidth: 120,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'startTime',
|
|
||||||
title: '合同开始时间',
|
|
||||||
minWidth: 120,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'endTime',
|
|
||||||
title: '合同结束时间',
|
|
||||||
minWidth: 120,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactName',
|
|
||||||
title: '客户签约人',
|
|
||||||
minWidth: 130,
|
|
||||||
slots: {
|
|
||||||
default: 'contactName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'signUserName',
|
|
||||||
title: '公司签约人',
|
|
||||||
minWidth: 130,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'totalReceivablePrice',
|
|
||||||
title: '已回款金额(元)',
|
|
||||||
minWidth: 140,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'noReceivablePrice',
|
|
||||||
title: '未回款金额(元)',
|
|
||||||
minWidth: 120,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
title: '最后跟进时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'auditStatus',
|
|
||||||
title: '合同状态',
|
|
||||||
minWidth: 120,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_AUDIT_STATUS },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
minWidth: 130,
|
|
||||||
align: 'center',
|
|
||||||
fixed: 'right',
|
|
||||||
cellRender: {
|
|
||||||
attrs: {
|
|
||||||
nameField: 'no',
|
|
||||||
nameTitle: '合同编号',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'processDetail',
|
|
||||||
show: hasAccessByCodes(['crm:contract:update']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 客户跟进列表的搜索表单 */
|
|
||||||
export function useCustomerFollowFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'followUpStatus',
|
|
||||||
label: '状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: FOLLOWUP_STATUS,
|
|
||||||
},
|
|
||||||
defaultValue: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 待进入公海客户列表的搜索表单 */
|
|
||||||
export function useCustomerPutPoolFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'sceneType',
|
|
||||||
label: '归属',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: SCENE_TYPES,
|
|
||||||
},
|
|
||||||
defaultValue: 1,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 今日需联系客户列表的搜索表单 */
|
|
||||||
export function useCustomerTodayContactFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'contactStatus',
|
|
||||||
label: '状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: CONTACT_STATUS,
|
|
||||||
},
|
|
||||||
defaultValue: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'sceneType',
|
|
||||||
label: '归属',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: SCENE_TYPES,
|
|
||||||
},
|
|
||||||
defaultValue: 1,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 客户列表的字段 */
|
|
||||||
export function useCustomerColumns(): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '客户名称',
|
|
||||||
minWidth: 160,
|
|
||||||
slots: {
|
|
||||||
default: 'name',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
title: '客户来源',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_SOURCE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
title: '手机',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'telephone',
|
|
||||||
title: '电话',
|
|
||||||
minWidth: 130,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
title: '邮箱',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'level',
|
|
||||||
title: '客户级别',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'industryId',
|
|
||||||
title: '客户行业',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
title: '下次联系时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'lockStatus',
|
|
||||||
title: '锁定状态',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'dealStatus',
|
|
||||||
title: '成交状态',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
title: '最后跟进时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastContent',
|
|
||||||
title: '最后跟进记录',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'detailAddress',
|
|
||||||
title: '地址',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'poolDay',
|
|
||||||
title: '距离进入公海天数',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 回款审核列表的搜索表单 */
|
|
||||||
export function useReceivableAuditFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'auditStatus',
|
|
||||||
label: '合同状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: AUDIT_STATUS,
|
|
||||||
},
|
|
||||||
defaultValue: 10,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 回款审核列表的字段 */
|
|
||||||
export function useReceivableAuditColumns<T = CrmReceivableApi.Receivable>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'no',
|
|
||||||
title: '回款编号',
|
|
||||||
minWidth: 180,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: {
|
|
||||||
default: 'no',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'customerName',
|
|
||||||
title: '客户名称',
|
|
||||||
minWidth: 120,
|
|
||||||
slots: {
|
|
||||||
default: 'customerName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contractNo',
|
|
||||||
title: '合同编号',
|
|
||||||
minWidth: 180,
|
|
||||||
slots: {
|
|
||||||
default: 'contractNo',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'returnTime',
|
|
||||||
title: '回款日期',
|
|
||||||
minWidth: 150,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'price',
|
|
||||||
title: '回款金额(元)',
|
|
||||||
minWidth: 140,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'returnType',
|
|
||||||
title: '回款方式',
|
|
||||||
minWidth: 130,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contract.totalPrice',
|
|
||||||
title: '合同金额(元)',
|
|
||||||
minWidth: 140,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'auditStatus',
|
|
||||||
title: '回款状态',
|
|
||||||
minWidth: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_AUDIT_STATUS },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
width: 140,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
cellRender: {
|
|
||||||
attrs: {
|
|
||||||
nameField: 'name',
|
|
||||||
nameTitle: '角色',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'processDetail',
|
|
||||||
text: '查看审批',
|
|
||||||
show: hasAccessByCodes(['crm:receivable:update']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 回款计划提醒列表的搜索表单 */
|
|
||||||
export function useReceivablePlanRemindFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'remindType',
|
|
||||||
label: '合同状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
allowClear: true,
|
|
||||||
options: RECEIVABLE_REMIND_TYPE,
|
|
||||||
},
|
|
||||||
defaultValue: 1,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 回款计划提醒列表的字段 */
|
|
||||||
export function useReceivablePlanRemindColumns<T = CrmReceivableApi.Receivable>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'customerName',
|
|
||||||
title: '客户名称',
|
|
||||||
minWidth: 160,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: {
|
|
||||||
default: 'customerName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contractNo',
|
|
||||||
title: '合同编号',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'period',
|
|
||||||
title: '期数',
|
|
||||||
minWidth: 160,
|
|
||||||
slots: {
|
|
||||||
default: 'period',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'price',
|
|
||||||
title: '计划回款金额(元)',
|
|
||||||
minWidth: 120,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'returnTime',
|
|
||||||
title: '计划回款日期',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remindDays',
|
|
||||||
title: '提前几天提醒',
|
|
||||||
minWidth: 150,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remindTime',
|
|
||||||
title: '提醒日期',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'returnType',
|
|
||||||
title: '回款方式',
|
|
||||||
minWidth: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'receivable.price',
|
|
||||||
title: '实际回款金额(元)',
|
|
||||||
minWidth: 160,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'receivable.returnTime',
|
|
||||||
title: '实际回款日期',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
width: 140,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
cellRender: {
|
|
||||||
attrs: {
|
|
||||||
nameField: 'customerName',
|
|
||||||
nameTitle: '客户名称',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'receivableForm',
|
|
||||||
text: '创建回款',
|
|
||||||
show: hasAccessByCodes(['crm:receivable:create']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { computed, onActivated, onMounted, ref } from 'vue';
|
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Badge, Card, List } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import * as ClueApi from '#/api/crm/clue';
|
|
||||||
import * as ContractApi from '#/api/crm/contract';
|
|
||||||
import * as CustomerApi from '#/api/crm/customer';
|
|
||||||
import * as ReceivableApi from '#/api/crm/receivable';
|
|
||||||
import * as ReceivablePlanApi from '#/api/crm/receivable/plan';
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
|
|
||||||
import { useLeftSides } from './data';
|
|
||||||
import ClueFollowList from './modules/ClueFollowList.vue';
|
|
||||||
import ContractAuditList from './modules/ContractAuditList.vue';
|
|
||||||
import ContractRemindList from './modules/ContractRemindList.vue';
|
|
||||||
import CustomerFollowList from './modules/CustomerFollowList.vue';
|
|
||||||
import CustomerPutPoolRemindList from './modules/CustomerPutPoolRemindList.vue';
|
|
||||||
import CustomerTodayContactList from './modules/CustomerTodayContactList.vue';
|
|
||||||
import ReceivableAuditList from './modules/ReceivableAuditList.vue';
|
|
||||||
import ReceivablePlanRemindList from './modules/ReceivablePlanRemindList.vue';
|
|
||||||
|
|
||||||
defineOptions({ name: 'CrmBacklog' });
|
|
||||||
|
|
||||||
const leftMenu = ref('customerTodayContact');
|
|
||||||
|
|
||||||
const clueFollowCount = ref(0);
|
|
||||||
const customerFollowCount = ref(0);
|
|
||||||
const customerPutPoolRemindCount = ref(0);
|
|
||||||
const customerTodayContactCount = ref(0);
|
|
||||||
const contractAuditCount = ref(0);
|
|
||||||
const contractRemindCount = ref(0);
|
|
||||||
const receivableAuditCount = ref(0);
|
|
||||||
const receivablePlanRemindCount = ref(0);
|
|
||||||
|
|
||||||
const leftSides = useLeftSides(
|
|
||||||
customerTodayContactCount,
|
|
||||||
clueFollowCount,
|
|
||||||
customerFollowCount,
|
|
||||||
customerPutPoolRemindCount,
|
|
||||||
contractAuditCount,
|
|
||||||
contractRemindCount,
|
|
||||||
receivableAuditCount,
|
|
||||||
receivablePlanRemindCount,
|
|
||||||
);
|
|
||||||
|
|
||||||
const currentComponent = computed(() => {
|
|
||||||
const components = {
|
|
||||||
customerTodayContact: CustomerTodayContactList,
|
|
||||||
clueFollow: ClueFollowList,
|
|
||||||
contractAudit: ContractAuditList,
|
|
||||||
receivableAudit: ReceivableAuditList,
|
|
||||||
contractRemind: ContractRemindList,
|
|
||||||
customerFollow: CustomerFollowList,
|
|
||||||
customerPutPoolRemind: CustomerPutPoolRemindList,
|
|
||||||
receivablePlanRemind: ReceivablePlanRemindList,
|
|
||||||
} as const;
|
|
||||||
return components[leftMenu.value as keyof typeof components];
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 侧边点击 */
|
|
||||||
function sideClick(item: { menu: string }) {
|
|
||||||
leftMenu.value = item.menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 获取数量 */
|
|
||||||
async function getCount() {
|
|
||||||
customerTodayContactCount.value =
|
|
||||||
await CustomerApi.getTodayContactCustomerCount();
|
|
||||||
customerPutPoolRemindCount.value =
|
|
||||||
await CustomerApi.getPutPoolRemindCustomerCount();
|
|
||||||
customerFollowCount.value = await CustomerApi.getFollowCustomerCount();
|
|
||||||
clueFollowCount.value = await ClueApi.getFollowClueCount();
|
|
||||||
contractAuditCount.value = await ContractApi.getAuditContractCount();
|
|
||||||
contractRemindCount.value = await ContractApi.getRemindContractCount();
|
|
||||||
receivableAuditCount.value = await ReceivableApi.getAuditReceivableCount();
|
|
||||||
receivablePlanRemindCount.value =
|
|
||||||
await ReceivablePlanApi.getReceivablePlanRemindCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 激活时 */
|
|
||||||
onActivated(async () => {
|
|
||||||
getCount();
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 初始化 */
|
|
||||||
onMounted(async () => {
|
|
||||||
getCount();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<Page auto-content-height>
|
|
||||||
<template #doc>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】跟进记录、待办事项"
|
|
||||||
url="https://doc.iocoder.cn/crm/follow-up/"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<div class="flex h-full w-full">
|
|
||||||
<Card class="w-1/5">
|
|
||||||
<List item-layout="horizontal" :data-source="leftSides">
|
|
||||||
<template #renderItem="{ item }">
|
|
||||||
<List.Item>
|
|
||||||
<List.Item.Meta>
|
|
||||||
<template #title>
|
|
||||||
<a @click="sideClick(item)"> {{ item.name }} </a>
|
|
||||||
</template>
|
|
||||||
</List.Item.Meta>
|
|
||||||
<template #extra v-if="item.count.value && item.count.value > 0">
|
|
||||||
<Badge :count="item.count.value" />
|
|
||||||
</template>
|
|
||||||
</List.Item>
|
|
||||||
</template>
|
|
||||||
</List>
|
|
||||||
</Card>
|
|
||||||
<component class="ml-4 w-4/5" :is="currentComponent" />
|
|
||||||
</div>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<!-- 分配给我的线索 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmClueApi } from '#/api/crm/clue';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getCluePage } from '#/api/crm/clue';
|
|
||||||
|
|
||||||
import { useClueFollowColumns, useClueFollowFormSchema } from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 打开线索详情 */
|
|
||||||
function onDetail(row: CrmClueApi.Clue) {
|
|
||||||
push({ name: 'CrmClueDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useClueFollowFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useClueFollowColumns(),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getCluePage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
transformStatus: false,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="分配给我的线索">
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">{{ row.name }}</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
<!-- 待审核合同 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmContractApi } from '#/api/crm/contract';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getContractPage } from '#/api/crm/contract';
|
|
||||||
|
|
||||||
import { useContractAuditFormSchema, useContractColumns } from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 查看审批 */
|
|
||||||
function openProcessDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({
|
|
||||||
name: 'BpmProcessInstanceDetail',
|
|
||||||
query: { id: row.processInstanceId },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开合同详情 */
|
|
||||||
function openContractDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmContractDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function openCustomerDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开联系人详情 */
|
|
||||||
function openContactDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmContactDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开商机详情 */
|
|
||||||
function openBusinessDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmBusinessDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmContractApi.Contract>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'processDetail': {
|
|
||||||
openProcessDetail(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useContractAuditFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useContractColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getContractPage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
sceneType: 1, // 我负责的
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="待审核合同">
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="openContractDetail(row)">
|
|
||||||
{{ row.name }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #customerName="{ row }">
|
|
||||||
<Button type="link" @click="openCustomerDetail(row)">
|
|
||||||
{{ row.customerName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #businessName="{ row }">
|
|
||||||
<Button type="link" @click="openBusinessDetail(row)">
|
|
||||||
{{ row.businessName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #contactName="{ row }">
|
|
||||||
<Button type="link" @click="openContactDetail(row)">
|
|
||||||
{{ row.contactName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
<!-- 即将到期的合同 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmContractApi } from '#/api/crm/contract';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getContractPage } from '#/api/crm/contract';
|
|
||||||
|
|
||||||
import { useContractColumns, useContractRemindFormSchema } from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 查看审批 */
|
|
||||||
function openProcessDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({
|
|
||||||
name: 'BpmProcessInstanceDetail',
|
|
||||||
query: { id: row.processInstanceId },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开合同详情 */
|
|
||||||
function openContractDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmContractDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function openCustomerDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开联系人详情 */
|
|
||||||
function openContactDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmContactDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开商机详情 */
|
|
||||||
function openBusinessDetail(row: CrmContractApi.Contract) {
|
|
||||||
push({ name: 'CrmBusinessDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmContractApi.Contract>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'processDetail': {
|
|
||||||
openProcessDetail(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useContractRemindFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useContractColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getContractPage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
sceneType: 1, // 自己负责的
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="即将到期的合同">
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="openContractDetail(row)">
|
|
||||||
{{ row.name }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #customerName="{ row }">
|
|
||||||
<Button type="link" @click="openCustomerDetail(row)">
|
|
||||||
{{ row.customerName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #businessName="{ row }">
|
|
||||||
<Button type="link" @click="openBusinessDetail(row)">
|
|
||||||
{{ row.businessName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #contactName="{ row }">
|
|
||||||
<Button type="link" @click="openContactDetail(row)">
|
|
||||||
{{ row.contactName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<!-- 分配给我的客户 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmCustomerApi } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getCustomerPage } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { useCustomerColumns, useCustomerFollowFormSchema } from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function onDetail(row: CrmCustomerApi.Customer) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useCustomerFollowFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useCustomerColumns(),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getCustomerPage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
sceneType: 1,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="分配给我的客户">
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">{{ row.name }}</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<!-- 待进入公海的客户 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmCustomerApi } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getCustomerPage } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { useCustomerColumns, useCustomerPutPoolFormSchema } from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function onDetail(row: CrmCustomerApi.Customer) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useCustomerPutPoolFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useCustomerColumns(),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getCustomerPage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
pool: true, // 固定 公海参数为 true
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="待进入公海的客户">
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">{{ row.name }}</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<!-- 今日需联系客户 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmCustomerApi } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getCustomerPage } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { useCustomerColumns, useCustomerTodayContactFormSchema } from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function onDetail(row: CrmCustomerApi.Customer) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useCustomerTodayContactFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useCustomerColumns(),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getCustomerPage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
pool: null, // 是否公海数据
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="今日需联系客户">
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">{{ row.name }}</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
<!-- 待审核回款 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmReceivableApi } from '#/api/crm/receivable';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getReceivablePage } from '#/api/crm/receivable';
|
|
||||||
|
|
||||||
import {
|
|
||||||
useReceivableAuditColumns,
|
|
||||||
useReceivableAuditFormSchema,
|
|
||||||
} from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 查看审批 */
|
|
||||||
function openProcessDetail(row: CrmReceivableApi.Receivable) {
|
|
||||||
push({
|
|
||||||
name: 'BpmProcessInstanceDetail',
|
|
||||||
query: { id: row.processInstanceId },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开回款详情 */
|
|
||||||
function openDetail(row: CrmReceivableApi.Receivable) {
|
|
||||||
push({ name: 'CrmReceivableDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function openCustomerDetail(row: CrmReceivableApi.Receivable) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.customerId } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开合同详情 */
|
|
||||||
function openContractDetail(row: CrmReceivableApi.Receivable) {
|
|
||||||
push({ name: 'CrmContractDetail', params: { id: row.contractId } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmReceivableApi.Receivable>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'processDetail': {
|
|
||||||
openProcessDetail(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useReceivableAuditFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useReceivableAuditColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getReceivablePage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="待审核回款">
|
|
||||||
<template #no="{ row }">
|
|
||||||
<Button type="link" @click="openDetail(row)">
|
|
||||||
{{ row.no }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #customerName="{ row }">
|
|
||||||
<Button type="link" @click="openCustomerDetail(row)">
|
|
||||||
{{ row.customerName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #contractNo="{ row }">
|
|
||||||
<Button type="link" @click="openContractDetail(row)">
|
|
||||||
{{ row.contractNo }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
<!-- 待回款提醒 -->
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmReceivableApi } from '#/api/crm/receivable';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getReceivablePage } from '#/api/crm/receivable';
|
|
||||||
|
|
||||||
import {
|
|
||||||
useReceivablePlanRemindColumns,
|
|
||||||
useReceivablePlanRemindFormSchema,
|
|
||||||
} from '../data';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
/** 打开回款详情 */
|
|
||||||
function openDetail(row: CrmReceivableApi.Receivable) {
|
|
||||||
push({ name: 'CrmReceivableDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开客户详情 */
|
|
||||||
function openCustomerDetail(row: CrmReceivableApi.Receivable) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.customerId } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 创建回款 */
|
|
||||||
function openReceivableForm(row: CrmReceivableApi.Receivable) {
|
|
||||||
// Todo: 打开创建回款
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.customerId } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmReceivableApi.Receivable>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'receivableForm': {
|
|
||||||
openReceivableForm(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useReceivablePlanRemindFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useReceivablePlanRemindColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getReceivablePage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid table-title="待回款提醒">
|
|
||||||
<template #customerName="{ row }">
|
|
||||||
<Button type="link" @click="openCustomerDetail(row)">
|
|
||||||
{{ row.customerName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #period="{ row }">
|
|
||||||
<Button type="link" @click="openDetail(row)">{{ row.period }}</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</template>
|
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmBusinessApi } from '#/api/crm/business';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
|
|
||||||
import { getRangePickerDefaultProps } from '#/utils';
|
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: [''],
|
|
||||||
show: () => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '商机名称',
|
|
||||||
component: 'Input',
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'customerId',
|
|
||||||
label: '客户',
|
|
||||||
component: 'Input',
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'totalPrice',
|
|
||||||
label: '商机金额',
|
|
||||||
component: 'InputNumber',
|
|
||||||
componentProps: {
|
|
||||||
min: 0,
|
|
||||||
controlsPosition: 'right',
|
|
||||||
placeholder: '请输入商机金额',
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'dealTime',
|
|
||||||
label: '预计成交日期',
|
|
||||||
component: 'DatePicker',
|
|
||||||
rules: 'required',
|
|
||||||
componentProps: {
|
|
||||||
showTime: false,
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
valueFormat: 'x',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'remark',
|
|
||||||
label: '备注',
|
|
||||||
component: 'Textarea',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'contactNextTime',
|
|
||||||
label: '下次联系时间',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
showTime: false,
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
valueFormat: 'x',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '商机名称',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
component: 'RangePicker',
|
|
||||||
componentProps: {
|
|
||||||
...getRangePickerDefaultProps(),
|
|
||||||
allowClear: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的字段 */
|
|
||||||
export function useGridColumns<T = CrmBusinessApi.Business>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '商机名称',
|
|
||||||
minWidth: 160,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: {
|
|
||||||
default: 'name',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'customerName',
|
|
||||||
title: '客户名称',
|
|
||||||
minWidth: 120,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: {
|
|
||||||
default: 'customerName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'totalPrice',
|
|
||||||
title: '商机金额(元)',
|
|
||||||
minWidth: 140,
|
|
||||||
formatter: 'formatAmount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'dealTime',
|
|
||||||
title: '预计成交日期',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDate',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
title: '下次联系时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDate',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
title: '最后跟进时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'statusTypeName',
|
|
||||||
title: '商机状态组',
|
|
||||||
minWidth: 140,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'statusName',
|
|
||||||
title: '商机阶段',
|
|
||||||
minWidth: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
width: 130,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
cellRender: {
|
|
||||||
attrs: {
|
|
||||||
nameField: 'name',
|
|
||||||
nameTitle: '商机',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'edit',
|
|
||||||
show: hasAccessByCodes(['crm:business:update']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
code: 'delete',
|
|
||||||
show: hasAccessByCodes(['crm:business:delete']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type {
|
|
||||||
OnActionClickParams,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { CrmBusinessApi } from '#/api/crm/business';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
|
||||||
import { Download, Plus } from '@vben/icons';
|
|
||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import {
|
|
||||||
deleteBusiness,
|
|
||||||
exportBusiness,
|
|
||||||
getBusinessPage,
|
|
||||||
} from '#/api/crm/business';
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
|
||||||
import Form from './modules/form.vue';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
|
||||||
connectedComponent: Form,
|
|
||||||
destroyOnClose: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 刷新表格 */
|
|
||||||
function onRefresh() {
|
|
||||||
gridApi.query();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出表格 */
|
|
||||||
async function onExport() {
|
|
||||||
const data = await exportBusiness(await gridApi.formApi.getValues());
|
|
||||||
downloadFileFromBlobPart({ fileName: '商机.xls', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 创建商机 */
|
|
||||||
function onCreate() {
|
|
||||||
formModalApi.setData(null).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 编辑商机 */
|
|
||||||
function onEdit(row: CrmBusinessApi.Business) {
|
|
||||||
formModalApi.setData(row).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除商机 */
|
|
||||||
async function onDelete(row: CrmBusinessApi.Business) {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteBusiness(row.id as number);
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
|
||||||
onRefresh();
|
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查看商机详情 */
|
|
||||||
function onDetail(row: CrmBusinessApi.Business) {
|
|
||||||
push({ name: 'CrmBusinessDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查看客户详情 */
|
|
||||||
function onCustomerDetail(row: CrmBusinessApi.Business) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.customerId } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmBusinessApi.Business>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'delete': {
|
|
||||||
onDelete(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'edit': {
|
|
||||||
onEdit(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useGridFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useGridColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getBusinessPage({
|
|
||||||
page: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
} as VxeTableGridOptions<CrmBusinessApi.Business>,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page auto-content-height>
|
|
||||||
<template #doc>
|
|
||||||
<DocAlert
|
|
||||||
title="【商机】商机管理、商机状态"
|
|
||||||
url="https://doc.iocoder.cn/crm/business/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
|
||||||
<Grid table-title="商机列表">
|
|
||||||
<template #toolbar-tools>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
@click="onCreate"
|
|
||||||
v-access:code="['crm:business:create']"
|
|
||||||
>
|
|
||||||
<Plus class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.create', ['商机']) }}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
class="ml-2"
|
|
||||||
@click="onExport"
|
|
||||||
v-access:code="['crm:business:export']"
|
|
||||||
>
|
|
||||||
<Download class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.export') }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">
|
|
||||||
{{ row.name }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #customerName="{ row }">
|
|
||||||
<Button type="link" @click="onCustomerDetail(row)">
|
|
||||||
{{ row.customerName }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmBusinessApi } from '#/api/crm/business';
|
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
|
||||||
import {
|
|
||||||
createBusiness,
|
|
||||||
getBusiness,
|
|
||||||
updateBusiness,
|
|
||||||
} from '#/api/crm/business';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
|
||||||
const formData = ref<CrmBusinessApi.Business>();
|
|
||||||
const getTitle = computed(() => {
|
|
||||||
return formData.value?.id
|
|
||||||
? $t('ui.actionTitle.edit', ['商机'])
|
|
||||||
: $t('ui.actionTitle.create', ['商机']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
},
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
labelWidth: 120,
|
|
||||||
},
|
|
||||||
layout: 'horizontal',
|
|
||||||
schema: useFormSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
|
||||||
async onConfirm() {
|
|
||||||
const { valid } = await formApi.validate();
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
// 提交表单
|
|
||||||
const data = (await formApi.getValues()) as CrmBusinessApi.Business;
|
|
||||||
try {
|
|
||||||
await (formData.value?.id ? updateBusiness(data) : createBusiness(data));
|
|
||||||
// 关闭并提示
|
|
||||||
await modalApi.close();
|
|
||||||
emit('success');
|
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
|
||||||
if (!isOpen) {
|
|
||||||
formData.value = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 加载数据
|
|
||||||
const data = modalApi.getData<CrmBusinessApi.Business>();
|
|
||||||
if (!data || !data.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
try {
|
|
||||||
formData.value = await getBusiness(data.id as number);
|
|
||||||
// 设置到 values
|
|
||||||
await formApi.setValues(formData.value);
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Modal :title="getTitle" class="w-[40%]">
|
|
||||||
<Form class="mx-4" />
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmBusinessStatusApi } from '#/api/crm/business/status';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
|
||||||
import {
|
|
||||||
CommonStatusEnum,
|
|
||||||
DICT_TYPE,
|
|
||||||
getDictOptions,
|
|
||||||
getRangePickerDefaultProps,
|
|
||||||
} from '#/utils';
|
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: [''],
|
|
||||||
show: () => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '状态组名',
|
|
||||||
component: 'Input',
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'deptIds',
|
|
||||||
label: '应用部门',
|
|
||||||
component: 'TreeSelect',
|
|
||||||
componentProps: {
|
|
||||||
multiple: true,
|
|
||||||
treeCheckable: true,
|
|
||||||
showCheckedStrategy: 'SHOW_PARENT',
|
|
||||||
placeholder: '请选择应用部门',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'status',
|
|
||||||
label: '状态',
|
|
||||||
component: 'RadioGroup',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
|
||||||
buttonStyle: 'solid',
|
|
||||||
optionType: 'button',
|
|
||||||
},
|
|
||||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '状态组名',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
component: 'RangePicker',
|
|
||||||
componentProps: {
|
|
||||||
...getRangePickerDefaultProps(),
|
|
||||||
allowClear: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的字段 */
|
|
||||||
export function useGridColumns<T = CrmBusinessStatusApi.BusinessStatus>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '状态组名',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'deptNames',
|
|
||||||
title: '应用部门',
|
|
||||||
minWidth: 200,
|
|
||||||
formatter: ({ cellValue }) => {
|
|
||||||
return cellValue?.length > 0 ? cellValue.join(' ') : '全公司';
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creator',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
width: 160,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
cellRender: {
|
|
||||||
name: 'TableAction',
|
|
||||||
props: {
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
code: 'edit',
|
|
||||||
show: hasAccessByCodes(['crm:business-status:update']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
code: 'delete',
|
|
||||||
show: hasAccessByCodes(['crm:business-status:delete']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
onActionClick,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type {
|
|
||||||
OnActionClickParams,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { CrmBusinessStatusApi } from '#/api/crm/business/status';
|
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
|
||||||
import { Plus } from '@vben/icons';
|
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import {
|
|
||||||
deleteBusinessStatus,
|
|
||||||
getBusinessStatusPage,
|
|
||||||
} from '#/api/crm/business/status';
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
|
||||||
import Form from './modules/form.vue';
|
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
|
||||||
connectedComponent: Form,
|
|
||||||
destroyOnClose: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 刷新表格 */
|
|
||||||
function onRefresh() {
|
|
||||||
gridApi.query();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 创建商机状态 */
|
|
||||||
function onCreate() {
|
|
||||||
formModalApi.setData(null).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除商机状态 */
|
|
||||||
async function onDelete(row: CrmBusinessStatusApi.BusinessStatus) {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteBusinessStatus(row.id as number);
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
|
||||||
onRefresh();
|
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 编辑商机状态 */
|
|
||||||
function onEdit(row: CrmBusinessStatusApi.BusinessStatus) {
|
|
||||||
formModalApi.setData(row).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmBusinessStatusApi.BusinessStatus>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'delete': {
|
|
||||||
onDelete(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'edit': {
|
|
||||||
onEdit(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useGridFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useGridColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getBusinessStatusPage({
|
|
||||||
page: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
} as VxeTableGridOptions<CrmBusinessStatusApi.BusinessStatus>,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page auto-content-height>
|
|
||||||
<template #doc>
|
|
||||||
<DocAlert
|
|
||||||
title="【商机】商机管理、商机状态"
|
|
||||||
url="https://doc.iocoder.cn/crm/business/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
|
||||||
<Grid table-title="商机状态列表">
|
|
||||||
<template #toolbar-tools>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
@click="onCreate"
|
|
||||||
v-access:code="['crm:business-status:create']"
|
|
||||||
>
|
|
||||||
<Plus class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.create', ['商机状态']) }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmBusinessStatusApi } from '#/api/crm/business/status';
|
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
|
||||||
import {
|
|
||||||
createBusinessStatus,
|
|
||||||
getBusinessStatus,
|
|
||||||
updateBusinessStatus,
|
|
||||||
} from '#/api/crm/business/status';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
|
||||||
const formData = ref<CrmBusinessStatusApi.BusinessStatusType>();
|
|
||||||
const getTitle = computed(() => {
|
|
||||||
return formData.value?.id
|
|
||||||
? $t('ui.actionTitle.edit', ['商机状态'])
|
|
||||||
: $t('ui.actionTitle.create', ['商机状态']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
},
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
labelWidth: 80,
|
|
||||||
},
|
|
||||||
layout: 'horizontal',
|
|
||||||
schema: useFormSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
|
||||||
async onConfirm() {
|
|
||||||
const { valid } = await formApi.validate();
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
// 提交表单
|
|
||||||
const data =
|
|
||||||
(await formApi.getValues()) as CrmBusinessStatusApi.BusinessStatusType;
|
|
||||||
try {
|
|
||||||
await (formData.value?.id
|
|
||||||
? updateBusinessStatus(data)
|
|
||||||
: createBusinessStatus(data));
|
|
||||||
// 关闭并提示
|
|
||||||
await modalApi.close();
|
|
||||||
emit('success');
|
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
|
||||||
if (!isOpen) {
|
|
||||||
formData.value = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 加载数据
|
|
||||||
const data = modalApi.getData<CrmBusinessStatusApi.BusinessStatusType>();
|
|
||||||
if (!data || !data.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
try {
|
|
||||||
formData.value = await getBusinessStatus(data.id as number);
|
|
||||||
// 设置到 values
|
|
||||||
if (formData.value) {
|
|
||||||
await formApi.setValues(formData.value);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Modal :title="getTitle" class="w-1/2">
|
|
||||||
<Form class="mx-4" />
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -1,429 +0,0 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmClueApi } from '#/api/crm/clue';
|
|
||||||
import type { DescriptionItemSchema } from '#/components/description';
|
|
||||||
|
|
||||||
import { h } from 'vue';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
import { formatDateTime } from '@vben/utils';
|
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: [''],
|
|
||||||
show: () => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '线索名称',
|
|
||||||
component: 'Input',
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'source',
|
|
||||||
label: '客户来源',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_SOURCE),
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'mobile',
|
|
||||||
label: '手机',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'ownerUserId',
|
|
||||||
label: '负责人',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
api: 'getSimpleUserList',
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'telephone',
|
|
||||||
label: '电话',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'email',
|
|
||||||
label: '邮箱',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'wechat',
|
|
||||||
label: '微信',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'qq',
|
|
||||||
label: 'QQ',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'industryId',
|
|
||||||
label: '客户行业',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_INDUSTRY),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'level',
|
|
||||||
label: '客户级别',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_LEVEL),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'areaId',
|
|
||||||
label: '地址',
|
|
||||||
component: 'Cascader',
|
|
||||||
componentProps: {
|
|
||||||
api: 'getAreaTree',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'detailAddress',
|
|
||||||
label: '详细地址',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'contactNextTime',
|
|
||||||
label: '下次联系时间',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
showTime: true,
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
valueFormat: 'x',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'remark',
|
|
||||||
label: '备注',
|
|
||||||
component: 'Textarea',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '线索名称',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'transformStatus',
|
|
||||||
label: '转化状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: [
|
|
||||||
{ label: '未转化', value: false },
|
|
||||||
{ label: '已转化', value: true },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'mobile',
|
|
||||||
label: '手机号',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'telephone',
|
|
||||||
label: '电话',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
component: 'RangePicker',
|
|
||||||
componentProps: {
|
|
||||||
...getRangePickerDefaultProps(),
|
|
||||||
allowClear: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的字段 */
|
|
||||||
export function useGridColumns<T = CrmClueApi.Clue>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '线索名称',
|
|
||||||
minWidth: 160,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: {
|
|
||||||
default: 'name',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
title: '线索来源',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_SOURCE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
title: '手机',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'telephone',
|
|
||||||
title: '电话',
|
|
||||||
minWidth: 130,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
title: '邮箱',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'detailAddress',
|
|
||||||
title: '地址',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'industryId',
|
|
||||||
title: '客户行业',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'level',
|
|
||||||
title: '客户级别',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
title: '下次联系时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
title: '最后跟进时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
title: '创建人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
width: 130,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
cellRender: {
|
|
||||||
attrs: {
|
|
||||||
nameField: 'name',
|
|
||||||
nameTitle: '线索',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'edit',
|
|
||||||
show: hasAccessByCodes(['crm:clue:update']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
code: 'delete',
|
|
||||||
show: hasAccessByCodes(['crm:clue:delete']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情头部的配置 */
|
|
||||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
label: '线索来源',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, {
|
|
||||||
type: DICT_TYPE.CRM_CUSTOMER_SOURCE,
|
|
||||||
value: data?.source,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
label: '手机',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
label: '负责人',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
content: (data) => formatDateTime(data?.createTime) as string,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情基本信息的配置 */
|
|
||||||
export function useDetailBaseSchema(): DescriptionItemSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
label: '线索名称',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
label: '客户来源',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, {
|
|
||||||
type: DICT_TYPE.CRM_CUSTOMER_SOURCE,
|
|
||||||
value: data?.source,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
label: '手机',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
label: '负责人',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'telephone',
|
|
||||||
label: '电话',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
label: '邮箱',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'wechat',
|
|
||||||
label: '微信',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'qq',
|
|
||||||
label: 'QQ',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'industryId',
|
|
||||||
label: '客户行业',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, {
|
|
||||||
type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY,
|
|
||||||
value: data?.industryId,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'level',
|
|
||||||
label: '客户级别',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, {
|
|
||||||
type: DICT_TYPE.CRM_CUSTOMER_LEVEL,
|
|
||||||
value: data?.level,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'areaId',
|
|
||||||
label: '地址',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'detailAddress',
|
|
||||||
label: '详细地址',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
label: '下次联系时间',
|
|
||||||
content: (data) => formatDateTime(data?.contactNextTime) as string,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
label: '备注',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情系统信息的配置 */
|
|
||||||
export function useDetailSystemSchema(): DescriptionItemSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
label: '负责人',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastContent',
|
|
||||||
label: '最后跟进记录',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastContent',
|
|
||||||
label: '最后跟进时间',
|
|
||||||
content: (data) => formatDateTime(data?.contactLastContent) as string,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'creatorName',
|
|
||||||
label: '创建人',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
content: (data) => formatDateTime(data?.createTime) as string,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
label: '更新时间',
|
|
||||||
content: (data) => formatDateTime(data?.updateTime) as string,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type {
|
|
||||||
OnActionClickParams,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { CrmClueApi } from '#/api/crm/clue';
|
|
||||||
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
|
||||||
import { Download, Plus } from '@vben/icons';
|
|
||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { deleteClue, exportClue, getCluePage } from '#/api/crm/clue';
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
|
||||||
import Form from './modules/form.vue';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
|
||||||
connectedComponent: Form,
|
|
||||||
destroyOnClose: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 刷新表格 */
|
|
||||||
function onRefresh() {
|
|
||||||
gridApi.query();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出表格 */
|
|
||||||
async function onExport() {
|
|
||||||
const data = await exportClue(await gridApi.formApi.getValues());
|
|
||||||
downloadFileFromBlobPart({ fileName: '线索.xls', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 创建线索 */
|
|
||||||
function onCreate() {
|
|
||||||
formModalApi.setData(null).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 编辑线索 */
|
|
||||||
function onEdit(row: CrmClueApi.Clue) {
|
|
||||||
formModalApi.setData(row).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除线索 */
|
|
||||||
async function onDelete(row: CrmClueApi.Clue) {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteClue(row.id as number);
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
|
||||||
onRefresh();
|
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查看线索详情 */
|
|
||||||
function onDetail(row: CrmClueApi.Clue) {
|
|
||||||
push({ name: 'CrmClueDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({ code, row }: OnActionClickParams<CrmClueApi.Clue>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'delete': {
|
|
||||||
onDelete(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'edit': {
|
|
||||||
onEdit(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useGridFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useGridColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getCluePage({
|
|
||||||
page: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
} as VxeTableGridOptions<CrmClueApi.Clue>,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page auto-content-height>
|
|
||||||
<template #doc>
|
|
||||||
<DocAlert
|
|
||||||
title="【线索】线索管理"
|
|
||||||
url="https://doc.iocoder.cn/crm/clue/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
|
||||||
<Grid table-title="线索列表">
|
|
||||||
<template #toolbar-tools>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
@click="onCreate"
|
|
||||||
v-access:code="['crm:clue:create']"
|
|
||||||
>
|
|
||||||
<Plus class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.create', ['线索']) }}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
class="ml-2"
|
|
||||||
@click="onExport"
|
|
||||||
v-access:code="['crm:clue:export']"
|
|
||||||
>
|
|
||||||
<Download class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.export') }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">
|
|
||||||
{{ row.name }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmClueApi } from '#/api/crm/clue';
|
|
||||||
|
|
||||||
import { Divider } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useDescription } from '#/components/description';
|
|
||||||
|
|
||||||
import { useDetailBaseSchema, useDetailSystemSchema } from '../data';
|
|
||||||
|
|
||||||
defineOptions({ name: 'CrmClueDetailsInfo' });
|
|
||||||
|
|
||||||
const { clue } = defineProps<{
|
|
||||||
clue: CrmClueApi.Clue; // 线索信息
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const [BaseDescription] = useDescription({
|
|
||||||
componentProps: {
|
|
||||||
title: '基本信息',
|
|
||||||
bordered: false,
|
|
||||||
column: 4,
|
|
||||||
class: 'mx-4',
|
|
||||||
},
|
|
||||||
schema: useDetailBaseSchema(),
|
|
||||||
data: clue,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [SystemDescription] = useDescription({
|
|
||||||
componentProps: {
|
|
||||||
title: '系统信息',
|
|
||||||
bordered: false,
|
|
||||||
column: 3,
|
|
||||||
class: 'mx-4',
|
|
||||||
},
|
|
||||||
schema: useDetailSystemSchema(),
|
|
||||||
data: clue,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="p-4">
|
|
||||||
<BaseDescription />
|
|
||||||
<Divider />
|
|
||||||
<SystemDescription />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { CrmClueApi } from '#/api/crm/clue';
|
|
||||||
|
|
||||||
import { defineAsyncComponent, onMounted, ref } from 'vue';
|
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
|
||||||
import { ArrowLeft } from '@vben/icons';
|
|
||||||
|
|
||||||
import { Button, Card, Modal, Tabs } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { getClue, transformClue } from '#/api/crm/clue';
|
|
||||||
import { useDescription } from '#/components/description';
|
|
||||||
|
|
||||||
import { useDetailSchema } from '../data';
|
|
||||||
import ClueForm from './form.vue';
|
|
||||||
import TransferForm from './transfer.vue';
|
|
||||||
|
|
||||||
const ClueDetailsInfo = defineAsyncComponent(() => import('./detail-info.vue'));
|
|
||||||
|
|
||||||
const loading = ref(false);
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const clueId = ref(0);
|
|
||||||
|
|
||||||
const clue = ref<CrmClueApi.Clue>({} as CrmClueApi.Clue);
|
|
||||||
const permissionListRef = ref(); // 团队成员列表 Ref
|
|
||||||
|
|
||||||
const [Description] = useDescription({
|
|
||||||
componentProps: {
|
|
||||||
bordered: false,
|
|
||||||
column: 4,
|
|
||||||
class: 'mx-4',
|
|
||||||
},
|
|
||||||
schema: useDetailSchema(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
|
||||||
connectedComponent: ClueForm,
|
|
||||||
destroyOnClose: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [TransferModal, transferModalApi] = useVbenModal({
|
|
||||||
connectedComponent: TransferForm,
|
|
||||||
destroyOnClose: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 加载线索详情 */
|
|
||||||
async function loadClueDetail() {
|
|
||||||
loading.value = true;
|
|
||||||
clueId.value = Number(route.params.id);
|
|
||||||
const data = await getClue(clueId.value);
|
|
||||||
clue.value = data;
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 返回列表页 */
|
|
||||||
function onBack() {
|
|
||||||
router.push('/crm/clue');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 编辑线索 */
|
|
||||||
function onEdit() {
|
|
||||||
formModalApi.setData({ id: clueId }).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 转移线索 */
|
|
||||||
function onTransfer() {
|
|
||||||
transferModalApi.setData({ id: clueId }).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 转化为客户 */
|
|
||||||
async function onTransform() {
|
|
||||||
try {
|
|
||||||
await Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定将该线索转化为客户吗?',
|
|
||||||
});
|
|
||||||
await transformClue(clueId.value);
|
|
||||||
Modal.success({
|
|
||||||
title: '成功',
|
|
||||||
content: '转化客户成功',
|
|
||||||
});
|
|
||||||
await loadClueDetail();
|
|
||||||
} catch {
|
|
||||||
// 用户取消操作
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载数据
|
|
||||||
onMounted(async () => {
|
|
||||||
await loadClueDetail();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page auto-content-height :title="clue?.name" :loading="loading">
|
|
||||||
<template #extra>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<Button @click="onBack">
|
|
||||||
<ArrowLeft class="size-5" />
|
|
||||||
返回
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
v-if="permissionListRef?.validateWrite"
|
|
||||||
type="primary"
|
|
||||||
@click="onEdit"
|
|
||||||
v-access:code="['crm:clue:update']"
|
|
||||||
>
|
|
||||||
{{ $t('ui.actionTitle.edit') }}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
v-if="permissionListRef?.validateOwnerUser"
|
|
||||||
type="primary"
|
|
||||||
@click="onTransfer"
|
|
||||||
v-access:code="['crm:clue:update']"
|
|
||||||
>
|
|
||||||
转移
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
v-if="permissionListRef?.validateOwnerUser && !clue?.transformStatus"
|
|
||||||
type="primary"
|
|
||||||
@click="onTransform"
|
|
||||||
v-access:code="['crm:clue:update']"
|
|
||||||
>
|
|
||||||
转化为客户
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<Card>
|
|
||||||
<Description :data="clue" />
|
|
||||||
</Card>
|
|
||||||
<Card class="mt-4">
|
|
||||||
<Tabs>
|
|
||||||
<Tabs.TabPane tab="线索跟进" key="1">
|
|
||||||
<div>线索跟进</div>
|
|
||||||
</Tabs.TabPane>
|
|
||||||
<Tabs.TabPane tab="基本信息" key="2">
|
|
||||||
<ClueDetailsInfo :clue="clue" />
|
|
||||||
</Tabs.TabPane>
|
|
||||||
<Tabs.TabPane tab="团队成员" key="3">
|
|
||||||
<div>团队成员</div>
|
|
||||||
</Tabs.TabPane>
|
|
||||||
<Tabs.TabPane tab="操作日志" key="4">
|
|
||||||
<div>操作日志</div>
|
|
||||||
</Tabs.TabPane>
|
|
||||||
</Tabs>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<FormModal @success="loadClueDetail" />
|
|
||||||
<TransferModal @success="loadClueDetail" />
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmClueApi } from '#/api/crm/clue';
|
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
|
||||||
import { createClue, getClue, updateClue } from '#/api/crm/clue';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
|
||||||
const formData = ref<CrmClueApi.Clue>();
|
|
||||||
const getTitle = computed(() => {
|
|
||||||
return formData.value?.id
|
|
||||||
? $t('ui.actionTitle.edit', ['线索'])
|
|
||||||
: $t('ui.actionTitle.create', ['线索']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
},
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
labelWidth: 120,
|
|
||||||
},
|
|
||||||
layout: 'horizontal',
|
|
||||||
schema: useFormSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
|
||||||
async onConfirm() {
|
|
||||||
const { valid } = await formApi.validate();
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
// 提交表单
|
|
||||||
const data = (await formApi.getValues()) as CrmClueApi.Clue;
|
|
||||||
try {
|
|
||||||
await (formData.value?.id ? updateClue(data) : createClue(data));
|
|
||||||
// 关闭并提示
|
|
||||||
await modalApi.close();
|
|
||||||
emit('success');
|
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
|
||||||
if (!isOpen) {
|
|
||||||
formData.value = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 加载数据
|
|
||||||
const data = modalApi.getData<CrmClueApi.Clue>();
|
|
||||||
if (!data || !data.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
try {
|
|
||||||
formData.value = await getClue(data.id as number);
|
|
||||||
// 设置到 values
|
|
||||||
await formApi.setValues(formData.value);
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Modal :title="getTitle" class="w-[40%]">
|
|
||||||
<Form class="mx-4" />
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
|
||||||
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
|
||||||
import { transferClue } from '#/api/crm/clue';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
|
||||||
const formData = ref<{ id: number }>();
|
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
},
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
labelWidth: 120,
|
|
||||||
},
|
|
||||||
layout: 'horizontal',
|
|
||||||
schema: [
|
|
||||||
{
|
|
||||||
fieldName: 'ownerUserId',
|
|
||||||
label: '负责人',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
api: 'getSimpleUserList',
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
showDefaultActions: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
|
||||||
async onConfirm() {
|
|
||||||
const { valid } = await formApi.validate();
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
// 提交表单
|
|
||||||
const data = (await formApi.getValues()) as CrmPermissionApi.TransferReq;
|
|
||||||
try {
|
|
||||||
await transferClue(data);
|
|
||||||
// 关闭并提示
|
|
||||||
await modalApi.close();
|
|
||||||
emit('success');
|
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
|
||||||
if (!isOpen) {
|
|
||||||
formData.value = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 加载数据
|
|
||||||
const data = modalApi.getData<{ id: number }>();
|
|
||||||
if (!data || !data.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData.value = data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Modal :title="$t('ui.actionTitle.transfer')" class="w-[40%]">
|
|
||||||
<Form class="mx-4" />
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【客户】客户管理、公海客户"
|
|
||||||
url="https://doc.iocoder.cn/crm/customer/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/contact/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/contact/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【合同】合同管理、合同提醒"
|
|
||||||
url="https://doc.iocoder.cn/crm/contract/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/contract/config/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/contract/config/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【合同】合同管理、合同提醒"
|
|
||||||
url="https://doc.iocoder.cn/crm/contract/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/contract/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/contract/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,379 +0,0 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { CrmCustomerApi } from '#/api/crm/customer';
|
|
||||||
import type { DescriptionItemSchema } from '#/components/description';
|
|
||||||
|
|
||||||
import { h } from 'vue';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
import { formatDateTime } from '@vben/utils';
|
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: [''],
|
|
||||||
show: () => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '客户名称',
|
|
||||||
component: 'Input',
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'source',
|
|
||||||
label: '客户来源',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_SOURCE),
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'mobile',
|
|
||||||
label: '手机',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'ownerUserId',
|
|
||||||
label: '负责人',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
api: 'getSimpleUserList',
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'telephone',
|
|
||||||
label: '电话',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'email',
|
|
||||||
label: '邮箱',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'wechat',
|
|
||||||
label: '微信',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'qq',
|
|
||||||
label: 'QQ',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'industryId',
|
|
||||||
label: '客户行业',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_INDUSTRY),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'level',
|
|
||||||
label: '客户级别',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_LEVEL),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'areaId',
|
|
||||||
label: '地址',
|
|
||||||
component: 'Cascader',
|
|
||||||
componentProps: {
|
|
||||||
api: 'getAreaTree',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'detailAddress',
|
|
||||||
label: '详细地址',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'contactNextTime',
|
|
||||||
label: '下次联系时间',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
showTime: true,
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
valueFormat: 'x',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'remark',
|
|
||||||
label: '备注',
|
|
||||||
component: 'Textarea',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '客户名称',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'mobile',
|
|
||||||
label: '手机号',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'telephone',
|
|
||||||
label: '电话',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
component: 'RangePicker',
|
|
||||||
componentProps: {
|
|
||||||
...getRangePickerDefaultProps(),
|
|
||||||
allowClear: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的字段 */
|
|
||||||
export function useGridColumns<T = CrmCustomerApi.Customer>(
|
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
title: '客户名称',
|
|
||||||
minWidth: 160,
|
|
||||||
fixed: 'left',
|
|
||||||
slots: {
|
|
||||||
default: 'name',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
title: '客户来源',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_SOURCE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
title: '手机',
|
|
||||||
minWidth: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'telephone',
|
|
||||||
title: '电话',
|
|
||||||
minWidth: 130,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
title: '邮箱',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'detailAddress',
|
|
||||||
title: '地址',
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'industryId',
|
|
||||||
title: '客户行业',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'level',
|
|
||||||
title: '客户级别',
|
|
||||||
minWidth: 100,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
title: '负责人',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
title: '所属部门',
|
|
||||||
minWidth: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
title: '下次联系时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
title: '最后跟进时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
title: '更新时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
minWidth: 180,
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
|
||||||
width: 130,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
cellRender: {
|
|
||||||
attrs: {
|
|
||||||
nameField: 'name',
|
|
||||||
nameTitle: '线索',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'edit',
|
|
||||||
show: hasAccessByCodes(['crm:clue:update']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
code: 'delete',
|
|
||||||
show: hasAccessByCodes(['crm:clue:delete']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情页的字段 */
|
|
||||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
|
||||||
return [...useDetailBaseSchema(), ...useDetailSystemSchema()];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情页的基础字段 */
|
|
||||||
export function useDetailBaseSchema(): DescriptionItemSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
label: '客户名称',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'source',
|
|
||||||
label: '客户来源',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, {
|
|
||||||
type: DICT_TYPE.CRM_CUSTOMER_SOURCE,
|
|
||||||
value: data?.source,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'mobile',
|
|
||||||
label: '手机',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'telephone',
|
|
||||||
label: '电话',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
label: '邮箱',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'wechat',
|
|
||||||
label: '微信',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'qq',
|
|
||||||
label: 'QQ',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'industryId',
|
|
||||||
label: '客户行业',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, {
|
|
||||||
type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY,
|
|
||||||
value: data?.industryId,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'level',
|
|
||||||
label: '客户级别',
|
|
||||||
content: (data) =>
|
|
||||||
h(DictTag, { type: DICT_TYPE.CRM_CUSTOMER_LEVEL, value: data?.level }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'areaName',
|
|
||||||
label: '地址',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'detailAddress',
|
|
||||||
label: '详细地址',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactNextTime',
|
|
||||||
label: '下次联系时间',
|
|
||||||
content: (data) => formatDateTime(data?.contactNextTime) as string,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
label: '备注',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情页的系统字段 */
|
|
||||||
export function useDetailSystemSchema(): DescriptionItemSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
field: 'ownerUserName',
|
|
||||||
label: '负责人',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ownerUserDeptName',
|
|
||||||
label: '所属部门',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'contactLastTime',
|
|
||||||
label: '最后跟进时间',
|
|
||||||
content: (data) => formatDateTime(data?.contactLastTime) as string,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
content: (data) => formatDateTime(data?.createTime) as string,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'updateTime',
|
|
||||||
label: '更新时间',
|
|
||||||
content: (data) => formatDateTime(data?.updateTime) as string,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type {
|
|
||||||
OnActionClickParams,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { CrmCustomerApi } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
|
||||||
import { Download, Plus } from '@vben/icons';
|
|
||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
|
||||||
|
|
||||||
import { Button, message, Tabs } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import {
|
|
||||||
deleteCustomer,
|
|
||||||
exportCustomer,
|
|
||||||
getCustomerPage,
|
|
||||||
} from '#/api/crm/customer';
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
|
||||||
import Form from './modules/form.vue';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
|
||||||
const sceneType = ref('1');
|
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
|
||||||
connectedComponent: Form,
|
|
||||||
destroyOnClose: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 刷新表格 */
|
|
||||||
function onRefresh() {
|
|
||||||
gridApi.query();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出表格 */
|
|
||||||
async function onExport() {
|
|
||||||
const data = await exportCustomer(await gridApi.formApi.getValues());
|
|
||||||
downloadFileFromBlobPart({ fileName: '客户.xls', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 创建客户 */
|
|
||||||
function onCreate() {
|
|
||||||
formModalApi.setData(null).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 编辑客户 */
|
|
||||||
function onEdit(row: CrmCustomerApi.Customer) {
|
|
||||||
formModalApi.setData(row).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除客户 */
|
|
||||||
async function onDelete(row: CrmCustomerApi.Customer) {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteCustomer(row.id as number);
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
|
||||||
onRefresh();
|
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查看客户详情 */
|
|
||||||
function onDetail(row: CrmCustomerApi.Customer) {
|
|
||||||
push({ name: 'CrmCustomerDetail', params: { id: row.id } });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<CrmCustomerApi.Customer>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'delete': {
|
|
||||||
onDelete(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'edit': {
|
|
||||||
onEdit(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useGridFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useGridColumns(onActionClick),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getCustomerPage({
|
|
||||||
page: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
sceneType: sceneType.value,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: { code: 'query' },
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
} as VxeTableGridOptions<CrmCustomerApi.Customer>,
|
|
||||||
});
|
|
||||||
|
|
||||||
function onChangeSceneType(key: number | string) {
|
|
||||||
sceneType.value = key.toString();
|
|
||||||
gridApi.query();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page auto-content-height>
|
|
||||||
<template #doc>
|
|
||||||
<DocAlert
|
|
||||||
title="【客户】客户管理"
|
|
||||||
url="https://doc.iocoder.cn/crm/customer/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
|
||||||
|
|
||||||
<Grid>
|
|
||||||
<template #toolbar-actions>
|
|
||||||
<Tabs class="border-none" @change="onChangeSceneType">
|
|
||||||
<Tabs.TabPane tab="我负责的" key="1" />
|
|
||||||
<Tabs.TabPane tab="我参与的" key="2" />
|
|
||||||
<Tabs.TabPane tab="下属负责的" key="3" />
|
|
||||||
</Tabs>
|
|
||||||
</template>
|
|
||||||
<template #toolbar-tools>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
@click="onCreate"
|
|
||||||
v-access:code="['crm:customer:create']"
|
|
||||||
>
|
|
||||||
<Plus class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.create', ['客户']) }}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
class="ml-2"
|
|
||||||
@click="onExport"
|
|
||||||
v-access:code="['crm:customer:export']"
|
|
||||||
>
|
|
||||||
<Download class="size-5" />
|
|
||||||
{{ $t('ui.actionTitle.export') }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
<template #name="{ row }">
|
|
||||||
<Button type="link" @click="onDetail(row)">
|
|
||||||
{{ row.name }}
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【客户】客户管理、公海客户"
|
|
||||||
url="https://doc.iocoder.cn/crm/customer/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/limitConfig/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/limitConfig/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { CrmCustomerApi } from '#/api/crm/customer';
|
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenForm, useVbenModal } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import {
|
|
||||||
createCustomer,
|
|
||||||
getCustomer,
|
|
||||||
updateCustomer,
|
|
||||||
} from '#/api/crm/customer';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
|
||||||
const formData = ref<CrmCustomerApi.Customer>();
|
|
||||||
const getTitle = computed(() => {
|
|
||||||
return formData.value?.id
|
|
||||||
? $t('ui.actionTitle.edit', ['客户'])
|
|
||||||
: $t('ui.actionTitle.create', ['客户']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
},
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
labelWidth: 120,
|
|
||||||
},
|
|
||||||
layout: 'horizontal',
|
|
||||||
schema: useFormSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
|
||||||
async onConfirm() {
|
|
||||||
const { valid } = await formApi.validate();
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
// 提交表单
|
|
||||||
const data = (await formApi.getValues()) as CrmCustomerApi.Customer;
|
|
||||||
try {
|
|
||||||
await (formData.value?.id ? updateCustomer(data) : createCustomer(data));
|
|
||||||
// 关闭并提示
|
|
||||||
await modalApi.close();
|
|
||||||
emit('success');
|
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
|
||||||
if (!isOpen) {
|
|
||||||
formData.value = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 加载数据
|
|
||||||
const data = modalApi.getData<CrmCustomerApi.Customer>();
|
|
||||||
if (!data || !data.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modalApi.lock();
|
|
||||||
try {
|
|
||||||
formData.value = await getCustomer(data.id as number);
|
|
||||||
// 设置到 values
|
|
||||||
await formApi.setValues(formData.value);
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Modal :title="getTitle" class="w-[40%]">
|
|
||||||
<Form class="mx-4" />
|
|
||||||
</Modal>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【客户】客户管理、公海客户"
|
|
||||||
url="https://doc.iocoder.cn/crm/customer/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/pool/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/pool/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【客户】客户管理、公海客户"
|
|
||||||
url="https://doc.iocoder.cn/crm/customer/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/poolConfig/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/poolConfig/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
defineOptions({ name: 'CrmPermissionList' });
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
bizId: number | undefined; // 模块数据编号
|
|
||||||
bizType: number; // 模块类型
|
|
||||||
showAction: boolean; // 是否展示操作按钮
|
|
||||||
}>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【产品】产品管理、产品分类"
|
|
||||||
url="https://doc.iocoder.cn/crm/product/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/product/category/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/product/category/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【产品】产品管理、产品分类"
|
|
||||||
url="https://doc.iocoder.cn/crm/product/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/product/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/product/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【回款】回款管理、回款计划"
|
|
||||||
url="https://doc.iocoder.cn/crm/receivable/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/receivable/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/receivable/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<DocAlert
|
|
||||||
title="【回款】回款管理、回款计划"
|
|
||||||
url="https://doc.iocoder.cn/crm/receivable/"
|
|
||||||
/>
|
|
||||||
<DocAlert
|
|
||||||
title="【通用】数据权限"
|
|
||||||
url="https://doc.iocoder.cn/crm/permission/"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/receivable/plan/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/receivable/plan/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<p>待完成</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/customer/index.vue"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/customer/index.vue
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/funnel/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/funnel/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/performance/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/performance/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/portrait/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/portrait/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/rank/index"
|
|
||||||
>
|
|
||||||
可参考
|
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/statistics/rank/index
|
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
Reference in New Issue
Block a user