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

This commit is contained in:
YunaiV
2025-10-07 09:46:47 +08:00
parent d150475efb
commit f6ca135efb
3 changed files with 47 additions and 14 deletions

View File

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

View File

@@ -19,7 +19,7 @@ const [FormModal, formModalApi] = useVbenModal({
});
/** 刷新表格 */
function onRefresh() {
function handleRefresh() {
gridApi.query();
}
@@ -39,9 +39,9 @@ async function handleDelete(row: MemberGroupApi.Group) {
text: $t('ui.actionMessage.deleting', [row.name]),
});
try {
await deleteGroup(row.id as number);
await deleteGroup(row.id!);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
handleRefresh();
} finally {
loadingInstance.close();
}
@@ -68,6 +68,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
@@ -79,7 +80,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template>
<Page auto-content-height>
<FormModal @success="onRefresh" />
<FormModal @success="handleRefresh" />
<Grid table-title="分组列表">
<template #toolbar-tools>
<TableAction
@@ -99,16 +100,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
:actions="[
{
label: $t('common.edit'),
type: 'primary',
link: true,
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['member:group:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'danger',
link: true,
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['member:group:delete'],
popConfirm: {

View File

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