feat:【antd】【ele】【member 会员】group 迁移 antd

This commit is contained in:
YunaiV
2025-10-07 09:40:52 +08:00
parent a025d12790
commit d150475efb
3 changed files with 45 additions and 13 deletions

View File

@@ -10,17 +10,18 @@ import { z } from '#/adapter/form';
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
return [ return [
{ {
component: 'Input',
fieldName: 'id', fieldName: 'id',
component: 'Input',
dependencies: { dependencies: {
triggerFields: [''], triggerFields: [''],
show: () => false, show: () => false,
}, },
}, },
{ {
component: 'Input',
fieldName: 'name', fieldName: 'name',
label: '分组名称', label: '分组名称',
component: 'Input',
rules: 'required',
}, },
{ {
fieldName: 'status', fieldName: 'status',
@@ -33,6 +34,14 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
rules: z.number().default(CommonStatusEnum.ENABLE), rules: z.number().default(CommonStatusEnum.ENABLE),
}, },
{
fieldName: 'remark',
label: '备注',
component: 'Textarea',
componentProps: {
placeholder: '请输入备注',
},
},
]; ];
} }
@@ -43,14 +52,28 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name', fieldName: 'name',
label: '分组名称', label: '分组名称',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入分组名称',
allowClear: true,
},
}, },
{ {
fieldName: 'status', fieldName: 'status',
label: '状态', label: '状态',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
placeholder: '请选择状态',
allowClear: true,
},
},
{
fieldName: 'createTime',
label: '创建时间',
component: 'RangePicker',
componentProps: {
placeholder: ['开始日期', '结束日期'],
allowClear: true,
}, },
}, },
]; ];
@@ -62,14 +85,23 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',
minWidth: 100,
}, },
{ {
field: 'name', field: 'name',
title: '分组名称', title: '分组名称',
minWidth: 150,
},
{
field: 'remark',
title: '备注',
minWidth: 200,
showOverflow: 'tooltip',
}, },
{ {
field: 'status', field: 'status',
title: '状态', title: '状态',
minWidth: 100,
cellRender: { cellRender: {
name: 'CellDict', name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS }, props: { type: DICT_TYPE.COMMON_STATUS },
@@ -78,6 +110,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'createTime', field: 'createTime',
title: '创建时间', title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {

View File

@@ -19,7 +19,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@@ -40,11 +40,9 @@ async function handleDelete(row: MemberGroupApi.Group) {
duration: 0, duration: 0,
}); });
try { try {
await deleteGroup(row.id as number); await deleteGroup(row.id!);
message.success({ message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
content: $t('ui.actionMessage.deleteSuccess', [row.name]), handleRefresh();
});
onRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@@ -71,6 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
rowConfig: { rowConfig: {
keyField: 'id', keyField: 'id',
isHover: true,
}, },
toolbarConfig: { toolbarConfig: {
refresh: true, refresh: true,
@@ -82,7 +81,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title="分组列表"> <Grid table-title="分组列表">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@@ -17,8 +17,8 @@ const emit = defineEmits(['success']);
const formData = ref<MemberGroupApi.Group>(); const formData = ref<MemberGroupApi.Group>();
const getTitle = computed(() => { const getTitle = computed(() => {
return formData.value?.id return formData.value?.id
? $t('ui.actionTitle.edit', ['会员分组']) ? $t('ui.actionTitle.edit', ['分组'])
: $t('ui.actionTitle.create', ['会员分组']); : $t('ui.actionTitle.create', ['分组']);
}); });
const [Form, formApi] = useVbenForm({ const [Form, formApi] = useVbenForm({
@@ -76,7 +76,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal class="w-2/5" :title="getTitle"> <Modal :title="getTitle" class="w-1/2">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>