Commit 9cdeace0 by zhaochengxiang

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

parent 169a5eba
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { Modal, Checkbox, Row, Col, Divider, Input, Typography, Form, Switch } from 'antd'; import { Modal, Checkbox, Row, Col, Divider, Input, Typography, Form, Switch, Select } from 'antd';
import { dispatch } from '../../../../model'; 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 UpdateTaskModal = (props) => {
const { visible, onCancel, action, id, datasourceId,currentDatabase } = props; const { visible, onCancel, action, id, datasourceId,currentDatabase } = props;
const [ schemas, setSchemas ] = useState([]); const [ schemas, setSchemas ] = useState([]);
...@@ -157,6 +177,22 @@ const UpdateTaskModal = (props) => { ...@@ -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 = { const formItemLayout = {
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
...@@ -219,7 +255,7 @@ const UpdateTaskModal = (props) => { ...@@ -219,7 +255,7 @@ const UpdateTaskModal = (props) => {
<Divider>过滤信息</Divider> <Divider>过滤信息</Divider>
<Form {...formItemLayout} form={form}> <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 ( return (
<Form.Item <Form.Item
label={param.cnName||''} label={param.cnName||''}
...@@ -227,9 +263,7 @@ const UpdateTaskModal = (props) => { ...@@ -227,9 +263,7 @@ const UpdateTaskModal = (props) => {
key={index} key={index}
rules={[{ required: param.required, message: '必填项'}]} rules={[{ required: param.required, message: '必填项'}]}
> >
{ { targetItem(param) }
( param.show ? <Input placeholder={param.explain||''} /> : <Input.Password placeholder={param.explain||''} visibilityToggle={false} /> )
}
</Form.Item> </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