mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-04-10 15:33:14 +08:00
Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
@@ -43,12 +43,10 @@ const emits = defineEmits<{
|
|||||||
|
|
||||||
const wrapperClass = computed(() => {
|
const wrapperClass = computed(() => {
|
||||||
const cls = ['flex'];
|
const cls = ['flex'];
|
||||||
if (props.layout === 'vertical') {
|
if (props.layout === 'inline') {
|
||||||
cls.push(props.compact ? 'gap-x-2' : 'gap-x-4', 'flex-col grid');
|
cls.push('flex-wrap gap-x-2');
|
||||||
} else if (props.layout === 'inline') {
|
|
||||||
cls.push('flex-wrap gap-2');
|
|
||||||
} else {
|
} else {
|
||||||
cls.push('gap-2 flex-col grid');
|
cls.push(props.compact ? 'gap-x-2' : 'gap-x-4', 'flex-col grid');
|
||||||
}
|
}
|
||||||
return cn(...cls, props.wrapperClass);
|
return cn(...cls, props.wrapperClass);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ export class ModalApi {
|
|||||||
this.store.setState((prev) => ({
|
this.store.setState((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
submitting: false,
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +171,11 @@ export class ModalApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
this.store.setState((prev) => ({ ...prev, isOpen: true }));
|
this.store.setState((prev) => ({
|
||||||
|
...prev,
|
||||||
|
isOpen: true,
|
||||||
|
submitting: false,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
setData<T>(payload: T) {
|
setData<T>(payload: T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { Recordable } from '@vben/types';
|
|||||||
|
|
||||||
import type { SystemRoleApi } from '#/api/system/role';
|
import type { SystemRoleApi } from '#/api/system/role';
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
import { computed, nextTick, ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenDrawer, VbenTree } from '@vben/common-ui';
|
import { useVbenDrawer, VbenTree } from '@vben/common-ui';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
@@ -47,20 +47,26 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
|||||||
drawerApi.unlock();
|
drawerApi.unlock();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onOpenChange(isOpen) {
|
|
||||||
|
async onOpenChange(isOpen) {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
const data = drawerApi.getData<SystemRoleApi.SystemRole>();
|
const data = drawerApi.getData<SystemRoleApi.SystemRole>();
|
||||||
formApi.resetForm();
|
formApi.resetForm();
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
formData.value = data;
|
formData.value = data;
|
||||||
id.value = data.id;
|
id.value = data.id;
|
||||||
formApi.setValues(data);
|
|
||||||
} else {
|
} else {
|
||||||
id.value = undefined;
|
id.value = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permissions.value.length === 0) {
|
if (permissions.value.length === 0) {
|
||||||
loadPermissions();
|
await loadPermissions();
|
||||||
|
}
|
||||||
|
// Wait for Vue to flush DOM updates (form fields mounted)
|
||||||
|
await nextTick();
|
||||||
|
if (data) {
|
||||||
|
formApi.setValues(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user