Commit 49d0da0ff185b7d288d2f4bd64da53f0158bc894

Authored by ww
1 parent 2f09a8de

fix: 修复设备下发modbus执行,值为浮点数时,符号问题

@@ -129,7 +129,6 @@ const SingleToHexBatch = (t) => { @@ -129,7 +129,6 @@ const SingleToHexBatch = (t) => {
129 129
130 const formSchemasConfig = (schemas, actionType): FormSchema[] => { 130 const formSchemasConfig = (schemas, actionType): FormSchema[] => {
131 const { identifier, functionName } = schemas; 131 const { identifier, functionName } = schemas;
132 - console.log(identifier, 'identifier', actionType, 'actionType');  
133 if (actionType == '06') { 132 if (actionType == '06') {
134 return [ 133 return [
135 { 134 {
@@ -142,8 +142,12 @@ @@ -142,8 +142,12 @@
142 if (unref(modBUSForm).method == '16' || unref(modBUSForm).method == '10') { 142 if (unref(modBUSForm).method == '16' || unref(modBUSForm).method == '10') {
143 const regex = /^-?\d+(\.\d{0,2})?$/; 143 const regex = /^-?\d+(\.\d{0,2})?$/;
144 const values = 144 const values =
145 - Math.floor(oldValue) * unref(zoomFactorValue) + 145 + Math.trunc(oldValue) * unref(zoomFactorValue) +
146 getFloatPart(oldValue) * unref(zoomFactorValue); 146 getFloatPart(oldValue) * unref(zoomFactorValue);
  147 + console.log({
  148 + int: Math.trunc(oldValue) * unref(zoomFactorValue),
  149 + float: getFloatPart(oldValue) * unref(zoomFactorValue),
  150 + });
147 if (!regex.test(values as any)) { 151 if (!regex.test(values as any)) {
148 createMessage.warning(`属性下发值精确到两位小数,缩放因子是${unref(zoomFactorValue)}`); 152 createMessage.warning(`属性下发值精确到两位小数,缩放因子是${unref(zoomFactorValue)}`);
149 return; 153 return;
@@ -20,7 +20,6 @@ export const useGenDynamicForm = () => { @@ -20,7 +20,6 @@ export const useGenDynamicForm = () => {
20 const { specs, type } = dataType; 20 const { specs, type } = dataType;
21 const { valueRange, step } = specs! as Partial<Specs>; 21 const { valueRange, step } = specs! as Partial<Specs>;
22 const { max, min } = valueRange || {}; 22 const { max, min } = valueRange || {};
23 - console.log({ max, min });  
24 return { 23 return {
25 field: identifier, 24 field: identifier,
26 label: functionName, 25 label: functionName,