Commit b6e916ea57d74616b2cdc9e86388c748395044c6
Merge branch 'perf/device-create-device-code' into 'main_dev'
perf: 寄存器地址组件新增禁用切换属性&&创建TCP设备modbus指令输入框默认十进制输入 See merge request yunteng/thingskit-front!766
Showing
3 changed files
with
13 additions
and
6 deletions
| ... | ... | @@ -162,9 +162,10 @@ export const step1Schemas: FormSchema[] = [ |
| 162 | 162 | changeEvent: 'update:value', |
| 163 | 163 | valueField: 'value', |
| 164 | 164 | componentProps: { |
| 165 | - type: AddressTypeEnum.HEX, | |
| 166 | - maxValue: Number(247).toString(16), | |
| 165 | + type: AddressTypeEnum.DEC, | |
| 166 | + maxValue: 247, | |
| 167 | 167 | minValue: 0, |
| 168 | + disabledSwitch: true, | |
| 168 | 169 | }, |
| 169 | 170 | ifShow: ({ values }) => { |
| 170 | 171 | return ( | ... | ... |
| ... | ... | @@ -389,7 +389,7 @@ |
| 389 | 389 | setFieldsValue({ |
| 390 | 390 | ...data, |
| 391 | 391 | code: data?.code, |
| 392 | - addressCode: data?.code, | |
| 392 | + addressCode: parseInt(data?.code || '', 16), | |
| 393 | 393 | }); |
| 394 | 394 | } |
| 395 | 395 | // 父组件调用获取字段值的方法 |
| ... | ... | @@ -398,7 +398,12 @@ |
| 398 | 398 | return { |
| 399 | 399 | ...value, |
| 400 | 400 | ...(value?.code || value?.addressCode |
| 401 | - ? { code: value?.codeType === TaskTypeEnum.CUSTOM ? value?.code : value?.addressCode } | |
| 401 | + ? { | |
| 402 | + code: | |
| 403 | + value?.codeType === TaskTypeEnum.CUSTOM | |
| 404 | + ? value?.code | |
| 405 | + : (value?.addressCode || '').toString(16).padStart(2, '0').toUpperCase(), | |
| 406 | + } | |
| 402 | 407 | : {}), |
| 403 | 408 | }; |
| 404 | 409 | } | ... | ... |
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | minValue?: number | string; |
| 19 | 19 | type?: string; |
| 20 | 20 | toUpperCase?: boolean; |
| 21 | + disabledSwitch?: boolean; | |
| 21 | 22 | }>(), |
| 22 | 23 | { |
| 23 | 24 | inputProps: () => ({}), |
| ... | ... | @@ -113,7 +114,7 @@ |
| 113 | 114 | |
| 114 | 115 | const validate = (value: string | number) => { |
| 115 | 116 | if (unref(inputType) === AddressTypeEnum.DEC) { |
| 116 | - return /^[1-9]\d*$/.test(value.toString()); | |
| 117 | + return /^[0-9]\d*$/.test(value.toString()); | |
| 117 | 118 | } else { |
| 118 | 119 | return /(0x)?[0-9a-fA-F]+/.test(value.toString()); |
| 119 | 120 | } |
| ... | ... | @@ -142,12 +143,12 @@ |
| 142 | 143 | <template> |
| 143 | 144 | <InputGroup compact class="!flex"> |
| 144 | 145 | <Select |
| 146 | + v-if="!disabledSwitch" | |
| 145 | 147 | v-model:value="inputType" |
| 146 | 148 | :options="addressTypeOptions" |
| 147 | 149 | :disabled="disabled" |
| 148 | 150 | class="bg-gray-200 max-w-20" |
| 149 | 151 | /> |
| 150 | - | |
| 151 | 152 | <Input |
| 152 | 153 | :value="getInputValue" |
| 153 | 154 | @change="handleSyncValue" | ... | ... |