index.md
5.05 KB
nav: path: /component title: 组件 order: 1 group: path: /common title: 条件配置
order: 0
QxBaseCondition 条件配置
条件配置
import { QxCondition } from '@qx/common';
import { Form } from 'antd';
const node = {
id: 'dfc29d5b64fa42489a65b3cfaeb999da',
type: 'default_DF_CONDITION',
name: '条件',
iconColor: '#F77234',
data: {},
children: [],
previousId: 'b0a2c7925a7b45e884fe8f82a0f39e9b',
};
const nodes = [
{
id: '4c4fc5213db149808c57d093b15e6295',
name: '开始',
type: 'default_DF_START',
data: {
nodeVersion: '3.0.0',
data: {
enablePropagation: false,
propagation: 'REQUIRED',
isolation: 'REPEATABLE_READ',
},
result: [
{
id: '9911c21704ba4d8da8651185f441f9d3',
code: '5sfuiz',
type: 'OBJECT',
title: '5sfuiz',
qxProps: {},
pid: '',
description: '',
valueMapping: { mappingValues: [] },
valuesObj: [],
child: [
{
id: '022c007b4c304c58850ed592ef5c1774',
type: 'STRING',
pid: '9911c21704ba4d8da8651185f441f9d3',
code: 'gcc8qd',
title: 'gcc8qd',
},
],
},
{
id: '6289083b52474567aba6d3f5fe9eda90',
code: '3coizb',
type: 'FORM',
title: '3coizb',
qxProps: {
appId: 'HQIXKC0dxbuYENalZzP',
formId: 'VX1TdanWSgYrKYn3vT8',
isTree: false,
},
pid: '',
},
{
id: 'deb0705410b24087bf22ccee74e4e7e4',
code: 'tbxkuz',
type: 'FORM',
title: 'input',
qxProps: {
appId: 'k6cY4GqjTaxQTW3XLua',
formId: 'FhkvYvVgpWmijBVEbk2',
isTree: false,
},
description: '',
valueMapping: {
mappingValues: [],
},
required: false,
disabled: true,
},
{
id: '3b1e0f82c6a049dca8a01d83a7a09b35',
code: 'vjo6ta',
type: 'OBJECT',
title: 'vjo6ta',
qxProps: {},
pid: '',
description: '',
valueMapping: {
mappingValues: [],
},
valuesObj: [],
child: [
{
id: 'be3d37ae184144dc88c0d39a644fe2c1',
type: 'STRING',
pid: '3b1e0f82c6a049dca8a01d83a7a09b35',
code: '87b2ww',
title: '87b2ww',
},
],
},
],
},
children: [],
},
{
id: 'b0a2c7925a7b45e884fe8f82a0f39e9b',
name: '分支',
type: 'default_DF_BRANCH',
previousId: '4c4fc5213db149808c57d093b15e6295',
children: [
{
id: 'dfc29d5b64fa42489a65b3cfaeb999da',
type: 'default_DF_CONDITION',
previousId: 'b0a2c7925a7b45e884fe8f82a0f39e9b',
name: '条件',
data: {},
children: [],
},
{
id: '003ca991f70548a3ba8c4f9b8d0daad2',
name: '条件',
type: 'default_DF_CONDITION',
previousId: 'b0a2c7925a7b45e884fe8f82a0f39e9b',
children: [],
},
],
},
{
id: '576f817ce67846318d1132f231128f05',
name: '结束',
previousId: 'b0a2c7925a7b45e884fe8f82a0f39e9b',
type: 'default_DF_END',
data: { nodeVersion: '3.0.0' },
children: [],
},
];
export default () => {
return (
<div>
<Form
initialValues={{
condition: {
sqlType: 'AND',
operators: [
{
type: 'STRING',
name: '文本',
code: '${4c4fc5213db149808c57d093b15e6295|022c007b4c304c58850ed592ef5c1774}',
mappingValues: [
'${4c4fc5213db149808c57d093b15e6295|022c007b4c304c58850ed592ef5c1774}',
],
field: {
id: '022c007b4c304c58850ed592ef5c1774',
type: 'STRING',
pid: '9911c21704ba4d8da8651185f441f9d3',
code: '4c4fc5213db149808c57d093b15e6295|022c007b4c304c58850ed592ef5c1774',
title: 'gcc8qd',
name: '2313123123123',
extract: {
fieldType: 'STRING',
fieldKey: '022c007b4c304c58850ed592ef5c1774',
},
},
valuesObj: [
{
value:
'${4c4fc5213db149808c57d093b15e6295|022c007b4c304c58850ed592ef5c1774}',
type: 'FIELD',
},
],
},
],
},
}}
onValuesChange={(value, values) => {
console.log('values', values);
}}
>
<Form.Item name="condition">
<QxCondition
nodes={nodes}
node={node}
showHeader
formId="FhkvYvVgpWmijBVEbk2"
/>
</Form.Item>
</Form>
</div>
);
};