mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
fix: 选中关联编辑相关弹窗数据映射不统一 (#5296)
* fix: 选中关联编辑相关弹窗数据映射不统一 * 有可能需要有个初始化接口,因为选项的数据可能不全
This commit is contained in:
parent
1f853d78cd
commit
9854ed381e
@ -248,6 +248,7 @@ export interface OptionsProps
|
||||
creatable?: boolean;
|
||||
addApi?: Api;
|
||||
addControls?: Array<any>;
|
||||
editInitApi?: Api;
|
||||
editApi?: Api;
|
||||
editControls?: Array<any>;
|
||||
deleteApi?: Api;
|
||||
@ -1110,6 +1111,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
labelField,
|
||||
onOpenDialog,
|
||||
editApi,
|
||||
editInitApi,
|
||||
env,
|
||||
source,
|
||||
data,
|
||||
@ -1144,6 +1146,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
...editDialog,
|
||||
body: {
|
||||
type: 'form',
|
||||
initApi: editInitApi,
|
||||
api: editApi,
|
||||
controls: editControls
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import {StoreNode} from './node';
|
||||
import {getStoreById} from './manager';
|
||||
import {normalizeOptions} from '../utils/normalizeOptions';
|
||||
import {optionValueCompare} from '../utils/optionValueCompare';
|
||||
import {dataMapping} from '../utils/dataMapping';
|
||||
|
||||
interface IOption {
|
||||
value?: string | number | null;
|
||||
@ -1179,13 +1180,14 @@ export const FormItemStore = StoreNode.named('FormItemStore')
|
||||
clearError();
|
||||
}
|
||||
|
||||
function openDialog(
|
||||
schema: any,
|
||||
data: any,
|
||||
callback?: (ret?: any) => void
|
||||
) {
|
||||
function openDialog(schema: any, ctx: any, callback?: (ret?: any) => void) {
|
||||
if (schema.data) {
|
||||
self.dialogData = dataMapping(schema.data, ctx);
|
||||
} else {
|
||||
self.dialogData = ctx;
|
||||
}
|
||||
|
||||
self.dialogSchema = schema;
|
||||
self.dialogData = data;
|
||||
self.dialogOpen = true;
|
||||
callback && dialogCallbacks.set(self.dialogData, callback);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user