Browse Source

chore(api): 更新接口

wangshun 3 tháng trước cách đây
mục cha
commit
6412c0ace2
2 tập tin đã thay đổi với 79 bổ sung27 xóa
  1. 11 0
      src/api/index.ts
  2. 68 27
      src/types/index.ts

+ 11 - 0
src/api/index.ts

@@ -17,6 +17,7 @@ import type {
   InterfaceData,
   ListEquipmentParametersItemData,
   ListInfo,
+  ParameterVerification,
   PostProtocolPage,
   PostProtocolPageItemData,
   ProtocolBaseInfo,
@@ -121,6 +122,16 @@ export const deviceGatewayUpdate = async (equipmentUpdateForm: EquipmentUpdateFo
   });
 };
 
+// 设备协议参数验证
+
+export const postParameterVerification = async (deviceId: number) => {
+  const data = await request<ParameterVerification[]>(apiBiz('/protocolParamVerify/list'), {
+    method: 'POST',
+    body: JSON.stringify(deviceId),
+  });
+  return data;
+};
+
 // 网关基本信息
 
 export const addGateway = async () => {

+ 68 - 27
src/types/index.ts

@@ -189,6 +189,7 @@ export interface RegisterGatewayForm {
   password: string;
   modelId: number;
   linkType: string;
+  id: number;
 }
 
 export interface VerificationEquipment {
@@ -499,7 +500,7 @@ export interface ProtocolListPageItem {
   paramCode: string;
   paramName: string;
   unit: string | null;
-  module: any | null;
+  module: number;
   readWriteType: string | null;
   readWriteTypeCode: string | null;
   readFuncCode: string | null;
@@ -547,10 +548,10 @@ export interface ListEquipmentParametersItem {
   createUserId: number;
   updateUserId: number;
   baseInfoId: number;
-  platformParamCode: string | null; // 由于值为空字符串,但根据业务逻辑可能需要区分空字符串和null,这里使用string | null。如果不需要区分,可以仅使用string。
-  platformParamName: string | null; // 同上
-  gatewayParamCode: string | null; // 同上
-  gatewayParamName: string | null; // 同上
+  platformParamCode: string | null;
+  platformParamName: string | null;
+  gatewayParamCode: string | null;
+  gatewayParamName: string | null;
   paramCode: string;
   paramName: string;
   unit: string | null;
@@ -558,9 +559,9 @@ export interface ListEquipmentParametersItem {
   readWriteType: string;
   readWriteTypeCode: string;
   readFuncCode: string;
-  writeFuncCode: string | null; // 由于值为空字符串,但根据业务逻辑,这里使用string | null表示可能未设置写入功能码。
-  registerAddr: string; // 假设寄存器地址为字符串类型,如果应为数字类型则改为number。
-  addrNumber: string | null; // 由于值为空字符串,但可能表示未设置或未知地址编号,这里使用string | null。
+  writeFuncCode: string | null;
+  registerAddr: string;
+  addrNumber: string | null;
   registerType: string | null;
   registerTypeCode: string | null;
   parsingType: string;
@@ -570,8 +571,8 @@ export interface ListEquipmentParametersItem {
   wordLengthCode: string | null;
   quantity: number | null;
   coefficient: number;
-  isHighFreqParam: string; // 根据业务逻辑,这个字段表示是否高频参数,使用字符串"是"/"否"表示,也可以考虑使用boolean类型并转换值。
-  isHighFreqParamCode: string; // 使用字符串"1"/"0"表示,也可以考虑使用boolean类型并转换值。
+  isHighFreqParam: string;
+  isHighFreqParamCode: string;
   readCalcFormula: string | null;
   writeCalcFormula: string | null;
   decimalPlace: number | null;
@@ -598,34 +599,34 @@ export interface PostProtocolPageItem {
   createUserId: number;
   updateUserId: number;
   baseInfoId: number;
-  platformParamCode?: string; // 使用 ? 表示该属性可能是 undefined
-  platformParamName?: string; // 使用 ? 表示该属性可能是 undefined
-  gatewayParamCode?: string; // 使用 ? 表示该属性可能是 undefined
-  gatewayParamName?: string; // 使用 ? 表示该属性可能是 undefined
+  platformParamCode?: string;
+  platformParamName?: string;
+  gatewayParamCode?: string;
+  gatewayParamName?: string;
   paramCode: string;
   paramName: string;
-  unit?: string; // 使用 ? 表示该属性可能是 undefined
+  unit?: string;
   module: string;
   readWriteType: string;
   readWriteTypeCode: string;
   readFuncCode: string;
-  writeFuncCode?: string; // 使用 ? 表示该属性可能是 undefined
+  writeFuncCode?: string;
   registerAddr: string;
-  addrNumber?: string; // 使用 ? 表示该属性可能是 undefined
-  registerType?: any; // 使用 any 表示该属性类型未知,null 也是可能的值
-  registerTypeCode?: any; // 使用 any 表示该属性类型未知,null 也是可能的值
+  addrNumber?: string;
+  registerType: string;
+  registerTypeCode?: string;
   parsingType: string;
   parsingTypeCode: string;
   addrLength: number;
-  wordLength?: any; // 使用 any 表示该属性类型未知,null 也是可能的值
-  wordLengthCode?: any; // 使用 any 表示该属性类型未知,null 也是可能的值
-  quantity?: any; // 使用 any 表示该属性类型未知,null 也是可能的值
+  wordLength?: string;
+  wordLengthCode?: string;
+  quantity?: string;
   coefficient: number;
-  isHighFreqParam: string; // "是" 或 "否" 可以进一步定义为枚举类型
-  isHighFreqParamCode: string; // "1" 或 "0" 可以进一步定义为枚举类型
-  readCalcFormula?: string; // 使用 ? 表示该属性可能是 undefined
-  writeCalcFormula?: string; // 使用 ? 表示该属性可能是 undefined
-  decimalPlace?: any; // 使用 any 表示该属性类型未知,null 也是可能的值
+  isHighFreqParam: string;
+  isHighFreqParamCode: string;
+  readCalcFormula?: string;
+  writeCalcFormula?: string;
+  decimalPlace?: number;
 }
 
 export interface ProtocolGatewayListListItem {
@@ -634,3 +635,43 @@ export interface ProtocolGatewayListListItem {
   snCode?: number;
   gatewayId?: number;
 }
+
+export interface ParameterVerification {
+  id: number;
+  deviceParamGroupName: string;
+  valueVos: ParameterVerificationList[];
+}
+
+export interface ParameterVerificationList {
+  baseInfoId: number;
+  platformParamCode: string;
+  platformParamName: string;
+  gatewayParamCode: string;
+  gatewayParamName: string;
+  paramCode: string;
+  paramName: string;
+  unit: string;
+  module: string;
+  readWriteType: string;
+  readWriteTypeCode: string;
+  readFuncCode: string;
+  writeFuncCode: string;
+  registerAddr: string;
+  addrNumber: string;
+  registerType: string;
+  registerTypeCode: string;
+  parsingType: string;
+  parsingTypeCode: string;
+  addrLength: number;
+  wordLength: string;
+  wordLengthCode: string;
+  quantity: number;
+  coefficient: number;
+  isHighFreqParam: string;
+  isHighFreqParamCode: string;
+  readCalcFormula: string;
+  writeCalcFormula: string;
+  decimalPlace: number;
+  valueId: number;
+  value: number | string;
+}