setUpdate改成异步

This commit is contained in:
Xu Chang 2022-08-24 10:46:28 +08:00
parent 454bbfdde9
commit ddd0133497
4 changed files with 21 additions and 12 deletions

View File

@ -389,16 +389,25 @@ function makeCommonComponentMethods(features, exceptionRouterDict, formData) {
return features.runningTree.resetUpdateData(this.state.oakFullpath);
},
setAction: function (action, path) {
var fullpath = path
? "".concat(this.state.oakFullpath, ".").concat(path)
: this.state.oakFullpath;
return features.runningTree.setAction(fullpath, action);
return tslib_1.__awaiter(this, void 0, void 0, function () {
var fullpath;
return tslib_1.__generator(this, function (_a) {
fullpath = path
? "".concat(this.state.oakFullpath, ".").concat(path)
: this.state.oakFullpath;
return [2 /*return*/, features.runningTree.setAction(fullpath, action)];
});
});
},
setUpdateData: function (attr, value) {
if (this.state.oakExecuting) {
return;
}
return features.runningTree.setUpdateData(this.state.oakFullpath, attr, value);
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
if (this.state.oakExecuting) {
return [2 /*return*/];
}
return [2 /*return*/, features.runningTree.setUpdateData(this.state.oakFullpath, attr, value)];
});
});
},
};
}

2
lib/types/Page.d.ts vendored
View File

@ -149,7 +149,7 @@ export declare type OakCommonComponentMethods<ED extends EntityDict & BaseEntity
delta: number;
}) => Promise<void>;
resetUpdateData: () => void;
setUpdateData: (attr: string, input: any) => void;
setUpdateData: (attr: string, input: any) => Promise<void>;
t(key: string, params?: object): string;
callPicker: (attr: string, params: Record<string, any>) => void;
setForeignKey: (id: string, goBackDelta?: number) => Promise<void>;

View File

@ -420,14 +420,14 @@ export function makeCommonComponentMethods<
return features.runningTree.resetUpdateData(this.state.oakFullpath);
},
setAction(action, path) {
async setAction(action, path) {
const fullpath = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
return features.runningTree.setAction(fullpath, action);
},
setUpdateData(attr, value) {
async setUpdateData(attr, value) {
if (this.state.oakExecuting) {
return;
}

View File

@ -254,7 +254,7 @@ export type OakCommonComponentMethods<ED extends EntityDict & BaseEntityDict, T
) => Promise<void>;
navigateBack: (option?: { delta: number }) => Promise<void>;
resetUpdateData: () => void;
setUpdateData: (attr: string, input: any) => void;
setUpdateData: (attr: string, input: any) => Promise<void>;
t(key: string, params?: object): string;
callPicker: (attr: string, params: Record<string, any>) => void;
setForeignKey: (id: string, goBackDelta?: number) => Promise<void>;