浏览代码

fix: mobus

wzyyy 3 年之前
父节点
当前提交
53d06c3560
共有 1 个文件被更改,包括 26 次插入6 次删除
  1. 26 6
      src/pages/link/Channel/Modbus/Access/addPoint/index.tsx

+ 26 - 6
src/pages/link/Channel/Modbus/Access/addPoint/index.tsx

@@ -152,7 +152,7 @@ const AddPoint = (props: Props) => {
           </Col>
         </Row>
         <Row gutter={[24, 24]}>
-          <Col span={24}>
+          <Col span={12}>
             <Form.Item
               label="地址"
               name="address"
@@ -172,6 +172,25 @@ const AddPoint = (props: Props) => {
               <InputNumber style={{ width: '100%' }} placeholder="请输入" min={1} />
             </Form.Item>
           </Col>
+          <Col span={12}>
+            <Form.Item
+              label="寄存器数量"
+              name="quantity"
+              rules={[
+                { required: true, message: '请输入寄存器数量' },
+                ({}) => ({
+                  validator(_, value) {
+                    if (/(^[0-9]\d*$)/.test(value)) {
+                      return Promise.resolve();
+                    }
+                    return Promise.reject(new Error('请输入正整数'));
+                  },
+                }),
+              ]}
+            >
+              <InputNumber style={{ width: '100%' }} placeholder="请输入" min={1} />
+            </Form.Item>
+          </Col>
         </Row>
         <Row gutter={[24, 24]}>
           <Col span={12}>
@@ -212,14 +231,15 @@ const AddPoint = (props: Props) => {
         <Row gutter={[24, 24]}>
           <Col span={12}>
             <Form.Item
-              label="数据格式转换"
-              name={['codecConfig', 'unsigned']}
+              label="数据格式"
+              name={['codecConfig', 'format']}
               required
-              rules={[{ required: true, message: '数据格式转换必填' }]}
+              rules={[{ required: true, message: '数据格式必选' }]}
             >
               <Select placeholder="请选择">
-                <Select.Option value={false}>无符号数字</Select.Option>
-                <Select.Option value={true}>有符号数字</Select.Option>
+                <Select.Option value={'unsigned'}>无符号数字</Select.Option>
+                <Select.Option value={'signed'}>有符号数字</Select.Option>
+                <Select.Option value={'ieee754'}>IEEE754</Select.Option>
               </Select>
             </Form.Item>
           </Col>