Commit 9cdeace0 by zhaochengxiang

采集增加抽取方式和入库审核

parent 169a5eba
import React, { useEffect, useState } from 'react';
import { Modal, Checkbox, Row, Col, Divider, Input, Typography, Form, Switch } from 'antd';
import React, { useEffect, useState, useMemo } from 'react';
import { Modal, Checkbox, Row, Col, Divider, Input, Typography, Form, Switch, Select } from 'antd';
import { dispatch } from '../../../../model';
const ApprovalCheckbox = ({ value, onChange }) => {
const currentChecked = useMemo(() => {
if (value === 'true') return true;
if (value === 'false') return false;
return null;
}, [value])
const handleChange = (e) => {
onChange?.(`${e.target.checked}`);
}
return (
<Checkbox
checked={currentChecked}
onChange={handleChange}
/>
)
}
const UpdateTaskModal = (props) => {
const { visible, onCancel, action, id, datasourceId,currentDatabase } = props;
const [ schemas, setSchemas ] = useState([]);
......@@ -157,6 +177,22 @@ const UpdateTaskModal = (props) => {
}
}
const targetItem = (param) => {
if (param.selectMode === 'select') {
return (
<Select allowClear>
{
param.selectItem?.map((item, index) => <Select.Option key={index} value={item}>{item}</Select.Option>)
}
</Select>
)
} else if (param.selectMode === 'checkBox') {
return <ApprovalCheckbox />;
}
return ( param.show ? <Input placeholder={param.explain||''} /> : <Input.Password placeholder={param.explain||''} visibilityToggle={false} /> )
}
const formItemLayout = {
labelCol: {
xs: { span: 24 },
......@@ -219,7 +255,7 @@ const UpdateTaskModal = (props) => {
<Divider>过滤信息</Divider>
<Form {...formItemLayout} form={form}>
{
taskSettings && (taskSettings.targetConfParameters||[]).filter(item => item.name!=='schema').map((param, index) => {
taskSettings && (taskSettings.targetConfParameters||[]).sort((val1, val2) => (val1.seq-val2.seq)).filter(item => item.name!=='schema').map((param, index) => {
return (
<Form.Item
label={param.cnName||''}
......@@ -227,9 +263,7 @@ const UpdateTaskModal = (props) => {
key={index}
rules={[{ required: param.required, message: '必填项'}]}
>
{
( param.show ? <Input placeholder={param.explain||''} /> : <Input.Password placeholder={param.explain||''} visibilityToggle={false} /> )
}
{ targetItem(param) }
</Form.Item>
)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment