perf: 更新写法
This commit is contained in:
parent
27e976c40d
commit
b68d746fdd
@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { clientAdd, clientInfo, clientUpdate } from '#/api/system/client';
|
||||
@ -12,11 +13,6 @@ import SecretInput from './secret-input.vue';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface DrawerProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -64,11 +60,11 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id, update } = drawerApi.getData() as DrawerProps;
|
||||
isUpdate.value = update;
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
// 初始化
|
||||
setupForm(update);
|
||||
if (update && id) {
|
||||
setupForm(isUpdate.value);
|
||||
if (isUpdate.value && id) {
|
||||
const record = await clientInfo(id);
|
||||
// 不能禁用id为1的记录
|
||||
formApi.updateSchema([
|
||||
@ -79,10 +75,7 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
fieldName: 'status',
|
||||
},
|
||||
]);
|
||||
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -95,7 +88,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? clientUpdate(data) : clientAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { configAdd, configInfo, configUpdate } from '#/api/system/config';
|
||||
@ -53,7 +54,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? configUpdate(data) : configAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { addFullName, listToTree } from '@vben/utils';
|
||||
import { addFullName, cloneDeep, listToTree } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import {
|
||||
@ -120,10 +120,8 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
if (id) {
|
||||
await formApi.setFieldValue('parentId', id);
|
||||
if (update) {
|
||||
const ret = await deptInfo(id);
|
||||
Object.keys(ret).forEach((key) => {
|
||||
formApi.setFieldValue(key, ret[key as keyof typeof ret]);
|
||||
});
|
||||
const record = await deptInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +140,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? deptUpdate(data) : deptAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { clientAdd, clientUpdate } from '#/api/system/client';
|
||||
@ -69,9 +70,7 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
if (dictCode && isUpdate.value) {
|
||||
const record = await dictDetailInfo(dictCode);
|
||||
setupSelectType(record.listClass);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
|
||||
drawerApi.drawerLoading(false);
|
||||
@ -85,7 +84,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? clientUpdate(data) : clientAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,19 +3,19 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { dictTypeAdd, dictTypeUpdate } from '#/api/system/dict/dict-type';
|
||||
import {
|
||||
dictTypeAdd,
|
||||
dictTypeInfo,
|
||||
dictTypeUpdate,
|
||||
} from '#/api/system/dict/dict-type';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface ModalProps {
|
||||
update: boolean;
|
||||
record?: any;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -38,12 +38,11 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const { record, update } = modalApi.getData() as ModalProps;
|
||||
isUpdate.value = update;
|
||||
if (update && record) {
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key]);
|
||||
}
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && id) {
|
||||
const record = await dictTypeInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
@ -56,7 +55,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? dictTypeUpdate(data) : dictTypeAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,7 +3,12 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { addFullName, getPopupContainer, listToTree } from '@vben/utils';
|
||||
import {
|
||||
addFullName,
|
||||
cloneDeep,
|
||||
getPopupContainer,
|
||||
listToTree,
|
||||
} from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { menuAdd, menuInfo, menuList, menuUpdate } from '#/api/system/menu';
|
||||
@ -12,11 +17,6 @@ import { drawerSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface DrawerProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -81,15 +81,13 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id, update } = drawerApi.getData() as DrawerProps;
|
||||
isUpdate.value = update;
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
// 加载菜单树选择
|
||||
await setupMenuSelect();
|
||||
if (update && id) {
|
||||
if (isUpdate.value && id) {
|
||||
const record = await menuInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -102,7 +100,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? menuUpdate(data) : menuAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { noticeAdd, noticeInfo, noticeUpdate } from '#/api/system/notice';
|
||||
@ -12,11 +13,6 @@ import { modalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface ModalProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -38,13 +34,11 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const { id, update } = modalApi.getData() as ModalProps;
|
||||
isUpdate.value = update;
|
||||
if (update && id) {
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && id) {
|
||||
const record = await noticeInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
@ -57,8 +51,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
console.log(data);
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? noticeUpdate(data) : noticeAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import {
|
||||
@ -15,11 +16,6 @@ import { drawerSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface DrawerProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -43,13 +39,11 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id, update } = drawerApi.getData() as DrawerProps;
|
||||
isUpdate.value = update;
|
||||
if (update && id) {
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && id) {
|
||||
const record = await ossConfigInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -66,7 +60,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? ossConfigUpdate(data) : ossConfigAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { addFullName } from '@vben/utils';
|
||||
import { addFullName, cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { postAdd, postInfo, postUpdate } from '#/api/system/post';
|
||||
@ -13,11 +13,6 @@ import { drawerSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface DrawerProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -59,16 +54,14 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id, update } = drawerApi.getData() as DrawerProps;
|
||||
isUpdate.value = update;
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
// 初始化
|
||||
await setupDeptSelect();
|
||||
// 更新 && 赋值
|
||||
if (update && id) {
|
||||
if (isUpdate.value && id) {
|
||||
const record = await postInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -81,7 +74,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? postUpdate(data) : postAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -2,8 +2,7 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { roleDataScope, roleDeptTree, roleInfo } from '#/api/system/role';
|
||||
@ -46,9 +45,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
setupDeptTree(id);
|
||||
const record = await roleInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
|
@ -3,8 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
import { menuTreeSelect, roleMenuTreeSelect } from '#/api/system/menu';
|
||||
@ -61,9 +60,7 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await roleInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
// init菜单 注意顺序要放在赋值record之后 内部watch会依赖record
|
||||
await setupMenuTree(id);
|
||||
|
@ -3,6 +3,7 @@ import { computed, h, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
@ -15,11 +16,6 @@ import { drawerSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface DrawerProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -66,15 +62,13 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id, update } = drawerApi.getData() as DrawerProps;
|
||||
isUpdate.value = update;
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
// 初始化
|
||||
await setupPackageSelect();
|
||||
if (update && id) {
|
||||
if (isUpdate.value && id) {
|
||||
const record = await tenantInfo(id);
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -87,7 +81,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? clientUpdate(data) : clientAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { Card, Tree } from 'ant-design-vue';
|
||||
|
||||
@ -13,11 +14,6 @@ import { drawerSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
interface DrawerProps {
|
||||
update: boolean;
|
||||
id?: number | string;
|
||||
}
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
@ -65,11 +61,11 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id, update } = drawerApi.getData() as DrawerProps;
|
||||
isUpdate.value = update;
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
// 初始化
|
||||
setupForm(update);
|
||||
if (update && id) {
|
||||
setupForm(isUpdate.value);
|
||||
if (isUpdate.value && id) {
|
||||
const record = await clientInfo(id);
|
||||
// 不能禁用id为1的记录
|
||||
formApi.updateSchema([
|
||||
@ -80,10 +76,7 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
fieldName: 'status',
|
||||
},
|
||||
]);
|
||||
|
||||
for (const key in record) {
|
||||
await formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -96,7 +89,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? clientUpdate(data) : clientAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
@ -5,7 +5,7 @@ import { computed, h, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { addFullName, getPopupContainer } from '@vben/utils';
|
||||
import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
@ -125,7 +125,7 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
return null;
|
||||
}
|
||||
drawerApi.drawerLoading(true);
|
||||
const { id } = drawerApi.getData() as { id: number | string };
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
/** update时 禁用用户名修改 不显示密码框 */
|
||||
formApi.updateSchema([
|
||||
@ -155,11 +155,13 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
// 部门选择
|
||||
await setupDeptSelect();
|
||||
if (user) {
|
||||
// 添加基础信息
|
||||
formApi.setValues(user);
|
||||
// 添加角色和岗位
|
||||
await formApi.setFieldValue('postIds', postIds);
|
||||
await formApi.setFieldValue('roleIds', roleIds);
|
||||
await Promise.all([
|
||||
// 添加基础信息
|
||||
formApi.setValues(user),
|
||||
// 添加角色和岗位
|
||||
formApi.setFieldValue('postIds', postIds),
|
||||
formApi.setFieldValue('roleIds', roleIds),
|
||||
]);
|
||||
}
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
@ -172,7 +174,7 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? userUpdate(data) : userAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
Loading…
Reference in New Issue
Block a user