fix: 修复用户选择 Modal 数据传入时 getData 为 {} 的问题

pull/164/head
anjon 2025-07-04 15:01:58 +08:00
parent b25f2916fb
commit d26fd8fce1
1 changed files with 11 additions and 5 deletions

View File

@ -69,6 +69,7 @@ const deptSearchKeys = ref('');
//
const userList = ref<SystemUserApi.User[]>([]); //
const selectedUserIds = ref<string[]>([]);
const openModalData = ref<{ userIds?: number[] }>({});
//
const [Modal, modalApi] = useVbenModal({
@ -80,7 +81,7 @@ const [Modal, modalApi] = useVbenModal({
return;
}
//
const data = modalApi.getData();
const data = openModalData.value || modalApi.getData();
if (!data) {
return;
}
@ -125,7 +126,12 @@ const [Modal, modalApi] = useVbenModal({
});
defineExpose({
open: modalApi.open,
open(userIds: number[]) {
openModalData.value = {
userIds,
};
modalApi.open();
},
close: modalApi.close,
});
@ -413,9 +419,9 @@ function processDeptNode(node: any): DeptTreeNode {
</script>
<template>
<Modal class="w-2/5" key="user-select-modal" :title="title">
<Modal class="w-3/5" key="user-select-modal" :title="title">
<Row :gutter="[16, 16]">
<Col :span="6">
<Col :span="7">
<div class="h-[500px] overflow-auto rounded border">
<div class="border-b p-2">
<Input
@ -434,7 +440,7 @@ function processDeptNode(node: any): DeptTreeNode {
/>
</div>
</Col>
<Col :span="18">
<Col :span="17">
<Transfer
:row-key="(record) => String(record.id)"
:data-source="transferDataSource"