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