feat:【antd】【ele】【member 会员】level 迁移 ele
This commit is contained in:
@@ -11,6 +11,7 @@ export namespace MemberLevelApi {
|
|||||||
icon: string;
|
icon: string;
|
||||||
bgUrl: string;
|
bgUrl: string;
|
||||||
status: number;
|
status: number;
|
||||||
|
createTime?: Date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'backgroundUrl',
|
fieldName: 'backgroundUrl',
|
||||||
label: '背景图',
|
label: '等级背景图',
|
||||||
component: 'ImageUpload',
|
component: 'ImageUpload',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const [Form, formApi] = useVbenForm({
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
formItemClass: 'col-span-1',
|
formItemClass: 'col-span-2',
|
||||||
labelWidth: 110,
|
labelWidth: 110,
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export namespace MemberLevelApi {
|
|||||||
icon: string;
|
icon: string;
|
||||||
bgUrl: string;
|
bgUrl: string;
|
||||||
status: number;
|
status: number;
|
||||||
|
createTime?: Date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,15 +100,16 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
:actions="[
|
:actions="[
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.edit'),
|
||||||
type: 'link',
|
type: 'primary',
|
||||||
|
link: true,
|
||||||
icon: ACTION_ICON.EDIT,
|
icon: ACTION_ICON.EDIT,
|
||||||
auth: ['member:group:update'],
|
auth: ['member:group:update'],
|
||||||
onClick: handleEdit.bind(null, row),
|
onClick: handleEdit.bind(null, row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'link',
|
type: 'danger',
|
||||||
danger: true,
|
link: true,
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['member:group:delete'],
|
auth: ['member:group:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
|
|||||||
@@ -5,31 +5,40 @@ import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
|||||||
import { getDictOptions } from '@vben/hooks';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
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',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入等级名称',
|
||||||
|
},
|
||||||
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'InputNumber',
|
|
||||||
fieldName: 'level',
|
fieldName: 'level',
|
||||||
label: '等级',
|
label: '等级',
|
||||||
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
min: 0,
|
min: 0,
|
||||||
precision: 0,
|
precision: 0,
|
||||||
|
placeholder: '请输入等级',
|
||||||
|
controlsPosition: 'right',
|
||||||
|
class: '!w-full',
|
||||||
},
|
},
|
||||||
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'experience',
|
fieldName: 'experience',
|
||||||
@@ -38,7 +47,11 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
min: 0,
|
min: 0,
|
||||||
precision: 0,
|
precision: 0,
|
||||||
|
placeholder: '请输入升级经验',
|
||||||
|
controlsPosition: 'right',
|
||||||
|
class: '!w-full',
|
||||||
},
|
},
|
||||||
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'discountPercent',
|
fieldName: 'discountPercent',
|
||||||
@@ -48,17 +61,21 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
precision: 0,
|
precision: 0,
|
||||||
|
placeholder: '请输入享受折扣',
|
||||||
|
controlsPosition: 'right',
|
||||||
|
class: '!w-full',
|
||||||
},
|
},
|
||||||
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'ImageUpload',
|
|
||||||
fieldName: 'icon',
|
fieldName: 'icon',
|
||||||
label: '等级图标',
|
label: '等级图标',
|
||||||
|
component: 'ImageUpload',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'ImageUpload',
|
|
||||||
fieldName: 'backgroundUrl',
|
fieldName: 'backgroundUrl',
|
||||||
label: '等级背景图',
|
label: '等级背景图',
|
||||||
|
component: 'ImageUpload',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
@@ -81,16 +98,30 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '等级名称',
|
label: '等级名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入等级名称',
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
label: '状态',
|
label: '状态',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
component: 'RangePicker',
|
||||||
|
componentProps: {
|
||||||
|
...getRangePickerDefaultProps(),
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +130,13 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
field: 'id',
|
field: 'id',
|
||||||
title: '编号',
|
title: '等级编号',
|
||||||
|
minWidth: 80,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'icon',
|
field: 'icon',
|
||||||
title: '等级图标',
|
title: '等级图标',
|
||||||
|
minWidth: 100,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellImage',
|
name: 'CellImage',
|
||||||
},
|
},
|
||||||
@@ -111,6 +144,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
{
|
{
|
||||||
field: 'backgroundUrl',
|
field: 'backgroundUrl',
|
||||||
title: '等级背景图',
|
title: '等级背景图',
|
||||||
|
minWidth: 120,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellImage',
|
name: 'CellImage',
|
||||||
},
|
},
|
||||||
@@ -118,22 +152,27 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '等级名称',
|
title: '等级名称',
|
||||||
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'level',
|
field: 'level',
|
||||||
title: '等级',
|
title: '等级',
|
||||||
|
minWidth: 80,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'experience',
|
field: 'experience',
|
||||||
title: '升级经验',
|
title: '升级经验',
|
||||||
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'discountPercent',
|
field: 'discountPercent',
|
||||||
title: '享受折扣(%)',
|
title: '享受折扣(%)',
|
||||||
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
minWidth: 80,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||||
@@ -142,11 +181,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
|
minWidth: 180,
|
||||||
formatter: 'formatDateTime',
|
formatter: 'formatDateTime',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 130,
|
width: 180,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
slots: { default: 'actions' },
|
slots: { default: 'actions' },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { MemberLevelApi } from '#/api/member/level';
|
import type { MemberLevelApi } from '#/api/member/level';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
import { ElLoading, ElMessage } from 'element-plus';
|
import { ElLoading, ElMessage } from 'element-plus';
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ async function handleDelete(row: MemberLevelApi.Level) {
|
|||||||
try {
|
try {
|
||||||
await deleteLevel(row.id as number);
|
await deleteLevel(row.id as number);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async (_params, formValues) => {
|
query: async (_, formValues) => {
|
||||||
return await getLevelList({
|
return await getLevelList({
|
||||||
...formValues,
|
...formValues,
|
||||||
});
|
});
|
||||||
@@ -69,6 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: true,
|
refresh: true,
|
||||||
@@ -80,7 +81,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<FormModal @success="onRefresh" />
|
<DocAlert
|
||||||
|
title="会员等级、积分、签到"
|
||||||
|
url="https://doc.iocoder.cn/member/level/"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid table-title="等级列表">
|
<Grid table-title="等级列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const [Form, formApi] = useVbenForm({
|
|||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
labelWidth: 80,
|
labelWidth: 110,
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: useFormSchema(),
|
schema: useFormSchema(),
|
||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user