Forráskód Böngészése

chore(types): 更新类型定义

wangcong 3 hónapja
szülő
commit
0f2487bf0d
1 módosított fájl, 27 hozzáadás és 40 törlés
  1. 27 40
      src/types/index.ts

+ 27 - 40
src/types/index.ts

@@ -1,8 +1,8 @@
 import { DictCode } from '@/constants';
 
-import type { Component } from 'vue';
-import type { StepProps } from 'ant-design-vue';
-import type { Rule } from 'ant-design-vue/es/form';
+import type { Component, ComponentPublicInstance } from 'vue';
+import type { StepProps, UploadProps } from 'ant-design-vue';
+import type { Rule, RuleObject } from 'ant-design-vue/es/form';
 import type { ProtocolConfigMethod } from '@/constants';
 
 export interface ApiResponse<T> {
@@ -30,6 +30,8 @@ export type FormRules<T> = {
   [key: string]: Rule[];
 };
 
+export type RuleValidator<T> = (rule: RuleObject, value: T, callback: (error?: string) => void) => Promise<void>;
+
 export interface DictTypeDataParams {
   id?: number;
   dictCode?: DictCode;
@@ -57,18 +59,29 @@ export interface UseGuideStepItem extends StepProps {
   component: Component;
   contentOffset?: number;
   formLayout?: 'horizontal' | 'vertical' | 'inline';
+  isLastStep?: boolean;
   nextStepButtonText?: string;
   nextStepButtonDisabled?: boolean;
 }
 
 export interface UseGuideStepItemProps<T> {
   form: T;
+  steps: UseGuideStepItem[];
+  stepIndex: number;
 }
 
+export type UseGuideStepItemExpose = {
+  finish?: () => void | Promise<void>;
+};
+
+export type UseGuideStepItemInstance = ComponentPublicInstance<unknown, UseGuideStepItemExpose>;
+
 export interface SetupProtocolForm {
   protocolType: string;
   protocolInfo: ProtocolBaseInfo;
+  protocolFile: UploadProps['fileList'];
   configMethod: ProtocolConfigMethod;
+  deviceType: string;
 }
 
 export interface CustomParamsForm {
@@ -91,51 +104,25 @@ export interface CustomParamsForm {
 }
 
 export interface ProtocolBaseInfo {
-  /*协议名称 */
+  id: number | null;
   protocolName: string;
-
-  /*协议类型(modbusRtu/modbusTcp/S7三选一) */
   protocolType: string;
-
-  /*设备类型 */
   deviceType: string;
-
-  /*数据位(仅限modbusRtu, 5/6/7/8) */
-  dataBit?: number;
-
-  /*校验位(仅限modbusRtu, N/O/E) */
-  parityBit: string;
-
-  /*停止位(仅限modbusRtu,1/1.5/2) */
-  stopBit: string;
-
-  /*波特率(仅限modbusRtu) */
-  baudRate?: number;
-
-  /*数据发送间隔 */
+  deviceTypeId: number | null;
+  dataBit: 5 | 6 | 7 | 8;
+  parityBit: 'N' | 'O' | 'E';
+  stopBit: '1' | '1.5' | '2';
+  baudRate: number;
   dataSendInterval: number;
-
-  /*高频发送间隔 */
   highFreqSendInterval: number;
-
-  /*读取超时时间 */
   readTimeout: number;
-
-  /*下条数据读取延时时间 */
   nextDataReadDelay: number;
-
-  /*下轮数据读取延时时间 */
   nextRoundDataReadDelay: number;
-
-  /*自动连读地址(仅限modbusRtu/modbusTcp) */
-  readContinuousAddr?: string;
-
-  /*自动连读地址最大长度(仅限modbusRtu/modbusTcp) */
-  readContinuousAddrLength?: number;
-
-  /*字节顺序(正序/反序) */
+  readContinuousAddr: string;
+  readContinuousAddrCode: number;
+  readContinuousAddrLength: number;
   byteOrder: string;
-
-  /*地址顺序(正序/反序) */
+  byteOrderCode: string;
   addrOrder: string;
+  addrOrderCode: string;
 }