Commit 61c1e2746470039c5338c5bb439b29e7d6c5feb5
Merge branch 'fix/attribute-distribution-price' into 'main_dev'
fix: 修改属性下发验证值时先乘缩放因子 See merge request yunteng/thingskit-front!795
Showing
2 changed files
with
12 additions
and
2 deletions
@@ -138,8 +138,9 @@ const formSchemasConfig = (schemas, actionType): FormSchema[] => { | @@ -138,8 +138,9 @@ const formSchemasConfig = (schemas, actionType): FormSchema[] => { | ||
138 | component: 'InputNumber', | 138 | component: 'InputNumber', |
139 | rules: [{ required: true, message: '请输入值' }], | 139 | rules: [{ required: true, message: '请输入值' }], |
140 | componentProps: { | 140 | componentProps: { |
141 | - precision: 0, | ||
142 | - placeholder: `请输入整数`, | 141 | + formatter: (e) => |
142 | + `${e}`.replace(/\B(?=(\d{3})+(?!\d))/g, '').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3'), | ||
143 | + placeholder: `请输入值`, | ||
143 | }, | 144 | }, |
144 | }, | 145 | }, |
145 | ]; | 146 | ]; |
@@ -112,6 +112,15 @@ | @@ -112,6 +112,15 @@ | ||
112 | modBUSForm.value.registerNumber = 1; | 112 | modBUSForm.value.registerNumber = 1; |
113 | modBUSForm.value.registerValues = [oldValue]; | 113 | modBUSForm.value.registerValues = [oldValue]; |
114 | if (unref(isShowMultiply) && unref(modBUSForm).method == '06') { | 114 | if (unref(isShowMultiply) && unref(modBUSForm).method == '06') { |
115 | + if (String(oldValue * unref(zoomFactorValue)).indexOf('.') > -1) { | ||
116 | + createMessage.warning(`属性下发类型必须是整数,缩放因子为${unref(zoomFactorValue)}`); | ||
117 | + return; | ||
118 | + } | ||
119 | + | ||
120 | + if (oldValue * unref(zoomFactorValue) > 65535) { | ||
121 | + createMessage.warning(`属性下发值不能超过65535,缩放因子是${unref(zoomFactorValue)}`); | ||
122 | + return; | ||
123 | + } | ||
115 | //bool类型的就不用去乘缩放因子了 | 124 | //bool类型的就不用去乘缩放因子了 |
116 | modBUSForm.value.registerValues = [oldValue * unref(zoomFactorValue)]; | 125 | modBUSForm.value.registerValues = [oldValue * unref(zoomFactorValue)]; |
117 | } | 126 | } |