feat:【antd】【member 会员】完成 level-form 的迁移与 bugfix
This commit is contained in:
@@ -318,15 +318,15 @@ export function useLevelFormSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'point',
|
fieldName: 'levelId',
|
||||||
label: '用户等级',
|
label: '用户等级',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: () => getSimpleLevelList(),
|
api: () => getSimpleLevelList(),
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
placeholder: '请选择用户等级',
|
placeholder: '请选择用户等级',
|
||||||
|
allowClear: true,
|
||||||
},
|
},
|
||||||
rules: 'required',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'reason',
|
fieldName: 'reason',
|
||||||
|
|||||||
@@ -1,20 +1,23 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { MemberUserApi } from '#/api/member/user';
|
import type { MemberUserApi } from '#/api/member/user';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { getUser, updateUser } from '#/api/member/user';
|
import { getUser, updateUserLevel } from '#/api/member/user';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useLevelFormSchema } from '../data';
|
import { useLevelFormSchema } from '../data';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<MemberUserApi.User>();
|
const formData = ref<MemberUserApi.User>();
|
||||||
|
const getTitle = computed(() => {
|
||||||
|
return $t('ui.actionTitle.edit', ['用户等级']);
|
||||||
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
@@ -37,9 +40,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const data = (await formApi.getValues()) as MemberUserApi.User;
|
const data =
|
||||||
|
(await formApi.getValues()) as MemberUserApi.UserLevelUpdateReqVO;
|
||||||
try {
|
try {
|
||||||
await updateUser(data);
|
await updateUserLevel(data);
|
||||||
// 关闭并提示
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
@@ -71,7 +75,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal class="w-1/3" :title="$t('ui.actionTitle.edit', ['用户等级'])">
|
<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