Merge remote-tracking branch 'amis/master' into new

This commit is contained in:
rickcole 2020-07-24 17:20:31 +08:00
commit 3fed219388
2 changed files with 10 additions and 9 deletions

View File

@ -23,6 +23,7 @@ import {isEffectiveApi} from '../../utils/api';
import {Alert2} from '../../components';
import memoize from 'lodash/memoize';
import {Icon} from '../../components/icons';
import {isAlive} from 'mobx-state-tree';
export interface Condition {
test: string;
controls: Array<Schema>;
@ -382,7 +383,9 @@ export default class ComboControl extends React.Component<ComboProps> {
this.props.onChange(value, submitOnChange, true);
store.forms.forEach(item =>
store.forms.forEach(
item =>
isAlive(item) &&
item.items.forEach(item => item.unique && item.syncOptions())
);
}

View File

@ -7,6 +7,7 @@ import Scoped, {ScopedContext, IScopedContext} from '../../Scoped';
import {observer} from 'mobx-react';
import {ServiceStore, IServiceStore} from '../../store/service';
import {IFormStore} from '../../store/form';
import {isObject} from '../../utils/helper';
@Renderer({
test: /(^|\/)form\/(.*)\/service$/,
@ -57,16 +58,13 @@ export class ServiceRenderer extends BasicService {
const formStore: IFormStore = this.props.formStore;
const onChange = this.props.onChange;
if (
formStore &&
formStore === this.props.store.parentStore &&
this.isFormMode()
) {
const keys = Object.keys(payload.data);
// 有可能有很多层 serivce这里需要注意。
if (formStore && this.isFormMode()) {
const keys = isObject(payload?.data) ? Object.keys(payload.data) : [];
if (keys.length) {
formStore.setValues(payload.data);
onChange(keys[0], payload.data[keys[0]]);
onChange(payload.data[keys[0]], keys[0]);
}
}