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,9 +162,10 @@ export const step1Schemas: FormSchema[] = [ | ||
| 162 | changeEvent: 'update:value', | 162 | changeEvent: 'update:value', |
| 163 | valueField: 'value', | 163 | valueField: 'value', |
| 164 | componentProps: { | 164 | componentProps: { |
| 165 | - type: AddressTypeEnum.HEX, | ||
| 166 | - maxValue: Number(247).toString(16), | 165 | + type: AddressTypeEnum.DEC, |
| 166 | + maxValue: 247, | ||
| 167 | minValue: 0, | 167 | minValue: 0, |
| 168 | + disabledSwitch: true, | ||
| 168 | }, | 169 | }, |
| 169 | ifShow: ({ values }) => { | 170 | ifShow: ({ values }) => { |
| 170 | return ( | 171 | return ( |
| @@ -389,7 +389,7 @@ | @@ -389,7 +389,7 @@ | ||
| 389 | setFieldsValue({ | 389 | setFieldsValue({ |
| 390 | ...data, | 390 | ...data, |
| 391 | code: data?.code, | 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,7 +398,12 @@ | ||
| 398 | return { | 398 | return { |
| 399 | ...value, | 399 | ...value, |
| 400 | ...(value?.code || value?.addressCode | 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,6 +18,7 @@ | ||
| 18 | minValue?: number | string; | 18 | minValue?: number | string; |
| 19 | type?: string; | 19 | type?: string; |
| 20 | toUpperCase?: boolean; | 20 | toUpperCase?: boolean; |
| 21 | + disabledSwitch?: boolean; | ||
| 21 | }>(), | 22 | }>(), |
| 22 | { | 23 | { |
| 23 | inputProps: () => ({}), | 24 | inputProps: () => ({}), |
| @@ -113,7 +114,7 @@ | @@ -113,7 +114,7 @@ | ||
| 113 | 114 | ||
| 114 | const validate = (value: string | number) => { | 115 | const validate = (value: string | number) => { |
| 115 | if (unref(inputType) === AddressTypeEnum.DEC) { | 116 | if (unref(inputType) === AddressTypeEnum.DEC) { |
| 116 | - return /^[1-9]\d*$/.test(value.toString()); | 117 | + return /^[0-9]\d*$/.test(value.toString()); |
| 117 | } else { | 118 | } else { |
| 118 | return /(0x)?[0-9a-fA-F]+/.test(value.toString()); | 119 | return /(0x)?[0-9a-fA-F]+/.test(value.toString()); |
| 119 | } | 120 | } |
| @@ -142,12 +143,12 @@ | @@ -142,12 +143,12 @@ | ||
| 142 | <template> | 143 | <template> |
| 143 | <InputGroup compact class="!flex"> | 144 | <InputGroup compact class="!flex"> |
| 144 | <Select | 145 | <Select |
| 146 | + v-if="!disabledSwitch" | ||
| 145 | v-model:value="inputType" | 147 | v-model:value="inputType" |
| 146 | :options="addressTypeOptions" | 148 | :options="addressTypeOptions" |
| 147 | :disabled="disabled" | 149 | :disabled="disabled" |
| 148 | class="bg-gray-200 max-w-20" | 150 | class="bg-gray-200 max-w-20" |
| 149 | /> | 151 | /> |
| 150 | - | ||
| 151 | <Input | 152 | <Input |
| 152 | :value="getInputValue" | 153 | :value="getInputValue" |
| 153 | @change="handleSyncValue" | 154 | @change="handleSyncValue" |