diff --git a/frontend/src/api/check/interface/index.ts b/frontend/src/api/check/interface/index.ts index 84aa651..f5290fc 100644 --- a/frontend/src/api/check/interface/index.ts +++ b/frontend/src/api/check/interface/index.ts @@ -1,96 +1,104 @@ -export interface DataCheck { - testScriptName: string, - errorSysName: string, - dataRule: string, - deviceName: string, - monitorIdx: string, -} - -/** - * 用于定义 查看(设备)通道检测结果 类型 - */ -export interface CheckResult { - chnNum: string, - standardValue: number, - L1: number, - L1_errValue: number, - L2: number, - L2_errValue: number, - L3: number, - L3_errValue: number, - maxErrVaule: number, - result: string, -} - -/** - * 用于定义 具体通道的原始数据类型 - */ -export interface RawDataItem { - updateTime: string, - L1: number, - L2: number, - L3: number -} - - -// 用来描述检测脚本类型 -export interface ScriptItem { - id: string, - scriptItemName: string, - children?: ScriptItem[] -} - -// 用来描述 通道检测结果 -export enum ChnCheckResultEnum { - UNKNOWN = -1, - FAIL = 0, - SUCCESS = 1, -} - -//用来描述 某个脚本测试项对所有通道的检测结果 -export interface ScriptChnItem { - scriptID: string - scriptItemName: string - - // 设备 - devices: Array<{ - deviceID: string, +export namespace CheckData { + export interface DataCheck { + testScriptName: string, + errorSysName: string, + dataRule: string, deviceName: string, - chnResult: ChnCheckResultEnum[] //通道检测结果 - }> -} + monitorIdx: string, + } -/** - * 用于描述 (设备)通道检测结果展示的按钮类型 - */ -export interface ButtonResult { - resultType: 'info' | 'success' | 'danger', - resultValue: '-' | '√' | '×' -} + /** + * 用于定义 查看(设备)通道检测结果 类型 + */ + export interface CheckResult { + chnNum: string, + standardValue: number, + L1: number, + L1_errValue: number, + L2: number, + L2_errValue: number, + L3: number, + L3_errValue: number, + maxErrVaule: number, + result: string, + } -/** - * 用于描述 脚本检测结果展示的按钮类型 - */ -export interface ScriptChnViewItem { - scriptID: string, - scriptItemName: string //脚本项名称 + /** + * 用于定义 具体通道的原始数据类型 + */ + export interface RawDataItem { + updateTime: string, + L1: number, + L2: number, + L3: number + } - // 设备 - devices:Array<{ - deviceID: string, - deviceName: string, - chnResult: ButtonResult[], - }> -} + export interface Device { + deviceID: string; //装置序号ID + deviceName: string; //设备名称 + chnNum: number; //设备通道数 + } + + // 用来描述检测脚本类型 + export interface ScriptItem { + id: string, + scriptItemName: string, + children?: ScriptItem[] + } + + // 用来描述 通道检测结果 + export enum ChnCheckResultEnum { + UNKNOWN = -1, + FAIL = 0, + SUCCESS = 1, + } + + //用来描述 某个脚本测试项对所有通道的检测结果 + export interface ScriptChnItem { + scriptID: string + scriptItemName: string + + // 设备 + devices: Array<{ + deviceID: string, + deviceName: string, + chnResult: ChnCheckResultEnum[] //通道检测结果 + }> + } + + /** + * 用于描述 (设备)通道检测结果展示的按钮类型 + */ + export interface ButtonResult { + resultType: 'info' | 'success' | 'danger', + resultValue: '-' | '√' | '×' + } + + /** + * 用于描述 脚本检测结果展示的按钮类型 + */ + export interface ScriptChnViewItem { + scriptID: string, + scriptItemName: string //脚本项名称 + + // 设备 + devices: Array<{ + deviceID: string, + deviceName: string, + chnResult: ButtonResult[], + }> + } -/** - * 定义检测日志类型 - */ -export interface LogItem { - type: 'info' | 'error' - log: string + /** + * 定义检测日志类型 + */ + export interface LogItem { + type: 'info' | 'error' + log: string + } } + diff --git a/frontend/src/stores/constant.ts b/frontend/src/stores/constant.ts index 4047d0c..d82b4d6 100644 --- a/frontend/src/stores/constant.ts +++ b/frontend/src/stores/constant.ts @@ -17,3 +17,5 @@ export const USER_STORE_KEY = "cn-user"; // pinia中dict store的key export const DICT_STORE_KEY = "cn-dictData"; +export const CHECK_STORE_KEY = "cn-check"; + diff --git a/frontend/src/stores/modules/check.ts b/frontend/src/stores/modules/check.ts new file mode 100644 index 0000000..b7022d2 --- /dev/null +++ b/frontend/src/stores/modules/check.ts @@ -0,0 +1,24 @@ +import {defineStore} from "pinia"; +import {CHECK_STORE_KEY} from "@/stores/constant"; +import type {CheckData} from "@/api/check/interface"; + + +export const useCheckStore = defineStore("check", { + id: CHECK_STORE_KEY, + + state: () => ({ + devices: Array() + }), + + getters: {}, + + actions: { + addDevices(device: CheckData.Device[]) { + this.devices.push(...device); + }, + + clearDevices() { + this.devices = []; + } + } +}); \ No newline at end of file diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index 1358df0..b61c777 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -255,8 +255,11 @@ import { onMounted, reactive, ref, watch } from "vue"; import { useDictStore } from '@/stores/modules/dict' import ChannelsTest from './channelsTest.vue' import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store +import {useCheckStore} from '@/stores/modules/check' const dictStore = useDictStore() +const checkStore = useCheckStore() + let devNum = 0;//当前选取的被检设备数量 let devChannelsNum = 0;//当前选择的被检设备通道总数 let devTestedNum = 0;//当前选择的已完成检测的被检设备数量 @@ -555,6 +558,16 @@ const handleSelectionChange = (selection: any[]) => { { testType= "reTest"; } + let devices: Check.Device[] = selection.map((item: any) => { + return { + deviceId: item.id, + deviceName: item.name, + deviceType: item.devType, + chnNum: item.devChns, + } + }); + checkStore.clearDevices() + checkStore.addDevices(devices) } //查询 diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 886f8b8..aa14226 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -16,8 +16,6 @@ 检测完成 - - 检测项进度 继续检测 + 检测项进度