mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
fix: 修复crud2切换搜索时jsonql未更新问题
This commit is contained in:
parent
eaea15af30
commit
04c9487bf2
@ -18,7 +18,7 @@ import {
|
|||||||
autobind
|
autobind
|
||||||
} from 'amis';
|
} from 'amis';
|
||||||
import {TooltipWrapper} from 'amis-ui';
|
import {TooltipWrapper} from 'amis-ui';
|
||||||
import {DSFeatureEnum} from '../../builder/constants';
|
import {DSFeatureEnum, ModelDSBuilderKey} from '../../builder/constants';
|
||||||
import {traverseSchemaDeep} from '../../builder/utils';
|
import {traverseSchemaDeep} from '../../builder/utils';
|
||||||
import {deepRemove} from '../../plugin/CRUD2/utils';
|
import {deepRemove} from '../../plugin/CRUD2/utils';
|
||||||
|
|
||||||
@ -650,7 +650,8 @@ export class CRUDFiltersControl extends React.Component<
|
|||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
async handleToggle(checked: boolean) {
|
async handleToggle(checked: boolean) {
|
||||||
const {feat, builder} = this.props;
|
const {manager, nodeId, feat, builder} = this.props;
|
||||||
|
const store = manager.store;
|
||||||
this.setState({loading: true, checked});
|
this.setState({loading: true, checked});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -665,6 +666,23 @@ export class CRUDFiltersControl extends React.Component<
|
|||||||
if (feat === DSFeatureEnum.FuzzyQuery && builder.filterByFeat(feat)) {
|
if (feat === DSFeatureEnum.FuzzyQuery && builder.filterByFeat(feat)) {
|
||||||
await this.updateFuzzyQuery(checked);
|
await this.updateFuzzyQuery(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// crud模型实体每次都需要重新生成jsonql的筛选条件
|
||||||
|
if (builder.key === ModelDSBuilderKey) {
|
||||||
|
const node = store.getNodeById(nodeId);
|
||||||
|
const crudSchema = node?.schema;
|
||||||
|
if (crudSchema) {
|
||||||
|
let schema = await builder.buildApiSchema({
|
||||||
|
schema: node.schema,
|
||||||
|
renderer: 'crud',
|
||||||
|
sourceKey: 'api',
|
||||||
|
feat: DSFeatureEnum.List
|
||||||
|
});
|
||||||
|
node.updateSchema({
|
||||||
|
api: schema.api
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
|
|
||||||
this.setState({loading: false, checked});
|
this.setState({loading: false, checked});
|
||||||
|
Loading…
Reference in New Issue
Block a user