forked from p96170835/amis
Merge remote-tracking branch 'amis/master' into new
This commit is contained in:
commit
2080928eda
|
@ -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,8 +383,10 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
|
||||
this.props.onChange(value, submitOnChange, true);
|
||||
|
||||
store.forms.forEach(item =>
|
||||
item.items.forEach(item => item.unique && item.syncOptions())
|
||||
store.forms.forEach(
|
||||
item =>
|
||||
isAlive(item) &&
|
||||
item.items.forEach(item => item.unique && item.syncOptions())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue