Commit b7b38364 by zhaochengxiang

优化数据类型编辑

parent 0caf1f2f
import React, { useState, useCallback, useRef } from 'react'; import React, { useState, useCallback, useRef } from 'react';
import { Table, Input, InputNumber, Form, Typography, Radio, Divider, Button, Popconfirm, Select } from 'antd'; import { Table, Input, InputNumber, Form, Typography, Radio, Divider, Button, Popconfirm, Select, Row, Col } from 'antd';
import { DndProvider, useDrag, useDrop } from 'react-dnd'; import { DndProvider, useDrag, useDrop } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend'; import { HTML5Backend } from 'react-dnd-html5-backend';
import update from 'immutability-helper'; import update from 'immutability-helper';
...@@ -54,29 +54,46 @@ const DatatypeInput = ({ value = {}, datatypes, onChange }) => { ...@@ -54,29 +54,46 @@ const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
return ( return (
<> <>
<span> <Row align='middle'>
<Select onChange={onNameChange} value={name}> <Col span={12}>
{ <span>类型名称:</span>
(datatypes||[]) && datatypes.map((_datatype, index) => { </Col>
return ( <Col span={12}>
<Option key={_datatype.name||''}>{_datatype.name||''}</Option> <Select
); onChange={onNameChange}
}) value={name}
} placeholder='请选择类型名称'
</Select> >
{ {
(parameterNames||[]).map((parameterName, index) => { (datatypes||[]) && datatypes.map((_datatype, index) => {
return ( return (
<InputNumber <Option key={_datatype.name||''}>{_datatype.name||''}</Option>
key={index} );
onChange={(value) => { })
onParameterValuesChange(value, index); }
}} </Select>
value={parameterValues[index]} /> </Col>
); </Row>
}) {
} (parameterNames||[]).map((parameterName, index) => {
</span> return (
<Row key={index} className='mt-2' align='middle'>
<Col span={12}>
<span>{`${parameterName||''}:`}</span>
</Col>
<Col span={12}>
<InputNumber
onChange={(value) => {
onParameterValuesChange(value, index);
}}
value={parameterValues[index]}
style={{ width: 60 }}
/>
</Col>
</Row>
);
})
}
</> </>
) )
} }
......
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