Commit b7b38364 by zhaochengxiang

优化数据类型编辑

parent 0caf1f2f
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 { HTML5Backend } from 'react-dnd-html5-backend';
import update from 'immutability-helper';
......@@ -54,29 +54,46 @@ const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
return (
<>
<span>
<Select onChange={onNameChange} value={name}>
{
(datatypes||[]) && datatypes.map((_datatype, index) => {
return (
<Option key={_datatype.name||''}>{_datatype.name||''}</Option>
);
})
}
</Select>
{
(parameterNames||[]).map((parameterName, index) => {
return (
<InputNumber
key={index}
onChange={(value) => {
onParameterValuesChange(value, index);
}}
value={parameterValues[index]} />
);
})
}
</span>
<Row align='middle'>
<Col span={12}>
<span>类型名称:</span>
</Col>
<Col span={12}>
<Select
onChange={onNameChange}
value={name}
placeholder='请选择类型名称'
>
{
(datatypes||[]) && datatypes.map((_datatype, index) => {
return (
<Option key={_datatype.name||''}>{_datatype.name||''}</Option>
);
})
}
</Select>
</Col>
</Row>
{
(parameterNames||[]).map((parameterName, index) => {
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