feat:【antd】【crm】优化 receivable-plan 的整体代码风格

This commit is contained in:
YunaiV
2025-09-29 23:32:16 +08:00
parent 9bfd314311
commit 0afd36172b
9 changed files with 95 additions and 87 deletions

View File

@@ -98,7 +98,7 @@ export function deleteReceivablePlan(id: number) {
}
/** 导出回款计划 Excel */
export function exportReceivablePlan(params: PageParam) {
export function exportReceivablePlan(params: any) {
return requestClient.download('/crm/receivable-plan/export-excel', {
params,
});

View File

@@ -54,8 +54,7 @@ const routes: RouteRecordRaw[] = [
title: '回款计划详情',
activePath: '/crm/receivable-plan',
},
component: () =>
import('#/views/crm/receivable/plan/modules/detail.vue'),
component: () => import('#/views/crm/receivable/plan/detail/index.vue'),
},
{
path: 'receivable/detail/:id',

View File

@@ -5,9 +5,9 @@ export const ReceivableDetailsList = defineAsyncComponent(
);
export const ReceivablePlanDetailsInfo = defineAsyncComponent(
() => import('./plan/modules/detail-info.vue'),
() => import('./plan/detail/modules/info.vue'),
);
export const ReceivablePlanDetailsList = defineAsyncComponent(
() => import('./plan/modules/detail-list.vue'),
() => import('./plan/components/detail-list.vue'),
);

View File

@@ -0,0 +1,62 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
/** 详情列表的字段 */
export function useDetailListColumns(): VxeTableGridOptions['columns'] {
return [
{
title: '客户名称',
field: 'customerName',
minWidth: 150,
},
{
title: '合同编号',
field: 'contractNo',
minWidth: 150,
},
{
title: '期数',
field: 'period',
minWidth: 150,
},
{
title: '计划回款(元)',
field: 'price',
minWidth: 150,
formatter: 'formatAmount2',
},
{
title: '计划回款日期',
field: 'returnTime',
minWidth: 150,
formatter: 'formatDateTime',
},
{
title: '提前几天提醒',
field: 'remindDays',
minWidth: 150,
},
{
title: '提醒日期',
field: 'remindTime',
minWidth: 150,
formatter: 'formatDateTime',
},
{
title: '负责人',
field: 'ownerUserName',
minWidth: 150,
},
{
title: '备注',
field: 'remark',
minWidth: 150,
},
{
title: '操作',
field: 'actions',
width: 240,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@@ -15,8 +15,8 @@ import {
import { $t } from '#/locales';
import ReceivableForm from '../../modules/form.vue';
import { useDetailListColumns } from './detail-data';
import Form from './form.vue';
import Form from '../modules/form.vue';
import { useDetailListColumns } from './data';
const props = defineProps<{
contractId?: number; //

View File

@@ -1,4 +1,3 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -78,64 +77,3 @@ export function useDetailBaseSchema(): DescriptionItemSchema[] {
},
];
}
/** 详情列表的字段 */
export function useDetailListColumns(): VxeTableGridOptions['columns'] {
return [
{
title: '客户名称',
field: 'customerName',
minWidth: 150,
},
{
title: '合同编号',
field: 'contractNo',
minWidth: 150,
},
{
title: '期数',
field: 'period',
minWidth: 150,
},
{
title: '计划回款(元)',
field: 'price',
minWidth: 150,
formatter: 'formatAmount2',
},
{
title: '计划回款日期',
field: 'returnTime',
minWidth: 150,
formatter: 'formatDateTime',
},
{
title: '提前几天提醒',
field: 'remindDays',
minWidth: 150,
},
{
title: '提醒日期',
field: 'remindTime',
minWidth: 150,
formatter: 'formatDateTime',
},
{
title: '负责人',
field: 'ownerUserName',
minWidth: 150,
},
{
title: '备注',
field: 'remark',
minWidth: 150,
},
{
title: '操作',
field: 'actions',
width: 240,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@@ -19,8 +19,8 @@ import { AsyncOperateLog } from '#/components/operate-log';
import { PermissionList } from '#/views/crm/permission';
import { ReceivablePlanDetailsInfo } from '#/views/crm/receivable';
import { useDetailSchema } from './detail-data';
import ReceivablePlanForm from './form.vue';
import { useDetailSchema } from './data';
import ReceivablePlanForm from '../modules/form.vue';
const loading = ref(false);

View File

@@ -6,7 +6,7 @@ import { Divider } from 'ant-design-vue';
import { useDescription } from '#/components/description';
import { useFollowUpDetailSchema } from '#/views/crm/followup/data';
import { useDetailBaseSchema } from './detail-data';
import { useDetailBaseSchema } from '../data';
defineProps<{
receivablePlan: CrmReceivablePlanApi.Plan; //

View File

@@ -36,13 +36,23 @@ const [ReceivableFormModal, receivableFormModalApi] = useVbenModal({
});
/** 刷新表格 */
function onRefresh() {
function handleRefresh() {
gridApi.query();
}
/** 处理场景类型的切换 */
function handleChangeSceneType(key: number | string) {
sceneType.value = key.toString();
gridApi.query();
}
/** 导出表格 */
async function handleExport() {
const data = await exportReceivablePlan(await gridApi.formApi.getValues());
const formValues = await gridApi.formApi.getValues();
const data = await exportReceivablePlan({
sceneType: sceneType.value,
...formValues,
});
downloadFileFromBlobPart({ fileName: '回款计划.xls', source: data });
}
@@ -64,16 +74,14 @@ async function handleDelete(row: CrmReceivablePlanApi.Plan) {
});
try {
await deleteReceivablePlan(row.id!);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.period]),
});
onRefresh();
message.success($t('ui.actionMessage.deleteSuccess', [row.period]));
handleRefresh();
} finally {
hideLoading();
}
}
/** 创建回款 */
/** 创建回款计划 */
function handleCreateReceivable(row: CrmReceivablePlanApi.Plan) {
receivableFormModalApi.setData({ plan: row }).open();
}
@@ -110,6 +118,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
@@ -117,11 +126,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<CrmReceivablePlanApi.Plan>,
});
function onChangeSceneType(key: number | string) {
sceneType.value = key.toString();
gridApi.query();
}
</script>
<template>
@@ -137,11 +141,11 @@ function onChangeSceneType(key: number | string) {
/>
</template>
<FormModal @success="onRefresh" />
<ReceivableFormModal @success="onRefresh" />
<FormModal @success="handleRefresh" />
<ReceivableFormModal @success="handleRefresh" />
<Grid>
<template #top>
<Tabs class="border-none" @change="onChangeSceneType">
<Tabs class="-mt-11" @change="handleChangeSceneType">
<Tabs.TabPane tab="我负责的" key="1" />
<Tabs.TabPane tab="下属负责的" key="3" />
</Tabs>
@@ -211,3 +215,8 @@ function onChangeSceneType(key: number | string) {
</Grid>
</Page>
</template>
<style scoped>
:deep(.vxe-toolbar div) {
z-index: 1;
}
</style>