index.md
2.56 KB
nav: path: /component title: 组件 order: 1 group: path: /common title: 条件配置
order: 0
QxBaseCondition 基础条件配置
基础条件配置
import { QxBaseCondition } from '@qx/common';
import { Form } from 'antd';
export default () => {
return (
<div>
<Form>
<Form.Item name="condition">
<QxBaseCondition
options={[
{
field: 'text',
fieldType: 'STRING',
fieldName: '文本',
extract: { widget: 'qxInput' },
},
{
field: 'num_cagoif',
fieldType: 'DOUBLE',
fieldName: '数值',
extract: { widget: 'qxNumber' },
},
{
field: 'date_uvpapz',
fieldType: 'YEAR_SEC',
fieldName: '日期',
extract: { widget: 'qxDatetime' },
},
]}
/>
</Form.Item>
</Form>
</div>
);
};
import { QxBaseCondition } from '@qx/common';
import { Dropdown, Form, Select, Tag } from 'antd';
const ValueAssignmentPopup = (props) => {
const handleChange = (val) => {
props.onChange?.([{
type: '111',
value: val
}], () => <Tag>111111</Tag>)
}
return (
<Dropdown
{...props}
dropdownRender={() => (
<Select
onChange={handleChange}
options={[
{
label: '标题',
value: 'title',
},
]}
/>
)}
>
{props.children}
</Dropdown>
);
};
export default () => {
return (
<div>
<Form>
<Form.Item name="condition">
<QxBaseCondition
ValueAssignmentPopup={ValueAssignmentPopup}
showIdx={false}
mode="variable"
options={[
{
field: 'text',
fieldType: 'STRING',
fieldName: '文本',
extract: { widget: 'qxInput' },
},
{
field: 'num_cagoif',
fieldType: 'DOUBLE',
fieldName: '数值',
extract: { widget: 'qxNumber' },
},
{
field: 'date_uvpapz',
fieldType: 'YEAR_SEC',
fieldName: '日期',
extract: { widget: 'qxDatetime' },
},
]}
/>
</Form.Item>
</Form>
</div>
);
};