|
@@ -0,0 +1,76 @@
|
|
|
+import React from 'react'
|
|
|
+// import { PlusCircleOutlined } from '@ant-design/icons';
|
|
|
+import { Form, Input, Space, Select } from 'antd';
|
|
|
+
|
|
|
+export default class OutputNodeInfo extends React.Component<any, any> {
|
|
|
+
|
|
|
+ formRef = React.createRef()
|
|
|
+
|
|
|
+ constructor(props: any) {
|
|
|
+ super(props)
|
|
|
+ }
|
|
|
+
|
|
|
+ async componentDidMount(){
|
|
|
+ this.props.nodeInfo.outputSource = [
|
|
|
+ {dataField: 'name', dataType: 'string'},
|
|
|
+ {dataField: 'address', dataType: 'string'},
|
|
|
+ ];
|
|
|
+ (this.formRef.current as any).setFieldsValue({
|
|
|
+ outputSource: this.props.nodeInfo.outputSource
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ <div className='node-datasource'>
|
|
|
+ <Form
|
|
|
+ ref={this.formRef as any}
|
|
|
+ name="datasourceInfo"
|
|
|
+ autoComplete="off"
|
|
|
+ layout='vertical'
|
|
|
+ initialValues={{
|
|
|
+ outputSource: this.props.nodeInfo.outputSource,
|
|
|
+ nodeName: this.props.nodeInfo.nodeName,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Form.Item name='nodeName' label="节点名称:">
|
|
|
+ <Input placeholder='请输入节点名称' onChange={(e) => {
|
|
|
+ this.props.nodeInfo.nodeName = e.target.value
|
|
|
+ }}/>
|
|
|
+ </Form.Item>
|
|
|
+ <p>输出:</p>
|
|
|
+ <Form.List name="outputSource">
|
|
|
+ {(fields, { add, remove }) => (
|
|
|
+ <>
|
|
|
+ {fields.map(({ key, name, ...restField }) => (
|
|
|
+ <Space key={key} style={{ display: 'flex', margin: '10px 0 -20px'}} align="baseline">
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'dataField']}
|
|
|
+ rules={[{required: true, message: '请填写字段'}]}
|
|
|
+ >
|
|
|
+ <Input placeholder="字段名" disabled/>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'dataType']}
|
|
|
+ rules={[{required: true, message: '请填写字段类型'}]}
|
|
|
+ >
|
|
|
+ <Select options={[
|
|
|
+ {label: 'string', value: 'string'},
|
|
|
+ {label: 'int', value: 'int'},
|
|
|
+ {label: 'text', value: 'text'},
|
|
|
+ {label: 'float', value: 'float'},
|
|
|
+ {label: 'double', value: 'double'},
|
|
|
+ ]} placeholder='请选择字段类型' disabled/>
|
|
|
+ </Form.Item>
|
|
|
+ </Space>
|
|
|
+ ))}
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Form.List>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|