feat:【antd】【crm】contact 列表的优化
This commit is contained in:
@@ -203,15 +203,6 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
minWidth: 240,
|
minWidth: 240,
|
||||||
slots: { default: 'customerName' },
|
slots: { default: 'customerName' },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'sex',
|
|
||||||
title: '性别',
|
|
||||||
minWidth: 120,
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.SYSTEM_USER_SEX },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'mobile',
|
field: 'mobile',
|
||||||
title: '手机',
|
title: '手机',
|
||||||
@@ -220,12 +211,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
{
|
{
|
||||||
field: 'telephone',
|
field: 'telephone',
|
||||||
title: '电话',
|
title: '电话',
|
||||||
minWidth: 120,
|
minWidth: 130,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'email',
|
field: 'email',
|
||||||
title: '邮箱',
|
title: '邮箱',
|
||||||
minWidth: 120,
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'post',
|
field: 'post',
|
||||||
@@ -233,10 +224,15 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'detailAddress',
|
field: 'areaName',
|
||||||
title: '地址',
|
title: '地址',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'detailAddress',
|
||||||
|
title: '详细地址',
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'master',
|
field: 'master',
|
||||||
title: '关键决策人',
|
title: '关键决策人',
|
||||||
@@ -252,6 +248,32 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
slots: { default: 'parentId' },
|
slots: { default: 'parentId' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'contactNextTime',
|
||||||
|
title: '下次联系时间',
|
||||||
|
formatter: 'formatDateTime',
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'sex',
|
||||||
|
title: '性别',
|
||||||
|
minWidth: 120,
|
||||||
|
cellRender: {
|
||||||
|
name: 'CellDict',
|
||||||
|
props: { type: DICT_TYPE.SYSTEM_USER_SEX },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'contactLastTime',
|
||||||
|
title: '最后跟进时间',
|
||||||
|
formatter: 'formatDateTime',
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'ownerUserName',
|
field: 'ownerUserName',
|
||||||
title: '负责人',
|
title: '负责人',
|
||||||
@@ -263,16 +285,11 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'contactNextTime',
|
field: 'updateTime',
|
||||||
title: '下次联系时间',
|
title: '更新时间',
|
||||||
formatter: 'formatDateTime',
|
formatter: 'formatDateTime',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'remark',
|
|
||||||
title: '备注',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
@@ -280,10 +297,9 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'updateTime',
|
field: 'creatorName',
|
||||||
title: '更新时间',
|
title: '创建人',
|
||||||
formatter: 'formatDateTime',
|
minWidth: 120,
|
||||||
minWidth: 180,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ export const ContactForm = defineAsyncComponent(
|
|||||||
() => import('./modules/form.vue'),
|
() => import('./modules/form.vue'),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const ContactDetails = defineAsyncComponent(
|
|
||||||
() => import('./detail/index.vue'),
|
|
||||||
);
|
|
||||||
|
|
||||||
export const ContactDetailsList = defineAsyncComponent(
|
export const ContactDetailsList = defineAsyncComponent(
|
||||||
() => import('./detail/modules/detail-list.vue'),
|
() => import('./detail/modules/detail-list.vue'),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,13 +30,17 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function handleExport() {
|
async function handleExport() {
|
||||||
const data = await exportContact(await gridApi.formApi.getValues());
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportContact({
|
||||||
|
sceneType: sceneType.value,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
downloadFileFromBlobPart({ fileName: '联系人.xls', source: data });
|
downloadFileFromBlobPart({ fileName: '联系人.xls', source: data });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,10 +62,8 @@ async function handleDelete(row: CrmContactApi.Contact) {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteContact(row.id as number);
|
await deleteContact(row.id as number);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
handleRefresh();
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
@@ -77,6 +79,12 @@ function handleCustomerDetail(row: CrmContactApi.Contact) {
|
|||||||
push({ name: 'CrmCustomerDetail', params: { id: row.customerId } });
|
push({ name: 'CrmCustomerDetail', params: { id: row.customerId } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理场景类型的切换 */
|
||||||
|
function handleChangeSceneType(key: number | string) {
|
||||||
|
sceneType.value = key.toString();
|
||||||
|
gridApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
@@ -99,6 +107,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: true,
|
refresh: true,
|
||||||
@@ -106,11 +115,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
} as VxeTableGridOptions<CrmContactApi.Contact>,
|
} as VxeTableGridOptions<CrmContactApi.Contact>,
|
||||||
});
|
});
|
||||||
|
|
||||||
function onChangeSceneType(key: number | string) {
|
|
||||||
sceneType.value = key.toString();
|
|
||||||
gridApi.query();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -126,10 +130,10 @@ function onChangeSceneType(key: number | string) {
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid>
|
<Grid>
|
||||||
<template #top>
|
<template #top>
|
||||||
<Tabs class="border-none" @change="onChangeSceneType">
|
<Tabs class="-mt-11" @change="handleChangeSceneType">
|
||||||
<Tabs.TabPane tab="我负责的" key="1" />
|
<Tabs.TabPane tab="我负责的" key="1" />
|
||||||
<Tabs.TabPane tab="我参与的" key="2" />
|
<Tabs.TabPane tab="我参与的" key="2" />
|
||||||
<Tabs.TabPane tab="下属负责的" key="3" />
|
<Tabs.TabPane tab="下属负责的" key="3" />
|
||||||
@@ -167,7 +171,7 @@ function onChangeSceneType(key: number | string) {
|
|||||||
</template>
|
</template>
|
||||||
<template #parentId="{ row }">
|
<template #parentId="{ row }">
|
||||||
<Button type="link" @click="handleDetail(row)">
|
<Button type="link" @click="handleDetail(row)">
|
||||||
{{ row.parentId }}
|
{{ row.parentName }}
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
@@ -180,12 +184,6 @@ function onChangeSceneType(key: number | string) {
|
|||||||
auth: ['crm:contact:update'],
|
auth: ['crm:contact:update'],
|
||||||
onClick: handleEdit.bind(null, row),
|
onClick: handleEdit.bind(null, row),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: $t('common.detail'),
|
|
||||||
type: 'link',
|
|
||||||
icon: ACTION_ICON.VIEW,
|
|
||||||
onClick: handleDetail.bind(null, row),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
@@ -203,3 +201,8 @@ function onChangeSceneType(key: number | string) {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
<style scoped>
|
||||||
|
:deep(.vxe-toolbar div) {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<CrmContactApi.Contact>();
|
const data = modalApi.getData<CrmContactApi.Contact>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
// 设置到 values
|
|
||||||
await formApi.setValues(data);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
|
|||||||
Reference in New Issue
Block a user