diff --git a/frontend/src/api/check/interface/index.ts b/frontend/src/api/check/interface/index.ts index e666a3f..099ec80 100644 --- a/frontend/src/api/check/interface/index.ts +++ b/frontend/src/api/check/interface/index.ts @@ -95,6 +95,7 @@ export namespace CheckData { devType: string; //设备类型 devVolt:number; //设备电压 devCurr:number; //设备电流 + factorFlag:number; //是否支持系数校准 } // 用来描述检测脚本类型 diff --git a/frontend/src/views/home/components/selectTestItemPopup.vue b/frontend/src/views/home/components/selectTestItemPopup.vue index 03560d5..5f533b4 100644 --- a/frontend/src/views/home/components/selectTestItemPopup.vue +++ b/frontend/src/views/home/components/selectTestItemPopup.vue @@ -30,6 +30,7 @@ import {dialogSmall} from "@/utils/elementBind"; import {ref} from "vue"; import {useCheckStore} from "@/stores/modules/check"; import type {CheckData} from "@/api/check/interface"; +import {ElMessageBox} from "element-plus"; const emit = defineEmits(['openTestDialog']) const checkStore = useCheckStore(); @@ -61,6 +62,28 @@ const handleStart = () => { if (count === 0) { ElMessage.warning('请选择测试内容!') } else { + if(formContent.channelsTest){ + const factorFlagArray = ref([]) // 初始化为空数组 + for (let i = 0; i < checkStore.devices.length; i++) { + const factorFlag = checkStore.devices[i].factorFlag + if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) { + factorFlagArray.value.push(checkStore.devices[i].deviceName.toString()) + } + } + if (factorFlagArray.value.length > 0) { + const factorFlags = factorFlagArray.value.join(', ') + ElMessageBox.confirm( + factorFlags + '设备不支持系数校准,请重新选择', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }, + ) + return + } + } checkStore.setCheckType(0) checkStore.setSelectTestItems({...formContent}) handleClose() diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index f7b8f9b..a0900b9 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -651,6 +651,7 @@ const handleSelectionChange = (selection: any[]) => { deviceType: item.devType, devVolt: item.devVolt, devCurr: item.devCurr, + factorFlag: item.factorFlag, } }) @@ -962,26 +963,7 @@ const handleTest = async (val: string) => { selectTestItemPopupRef.value?.open() } } else if (val === '系数校准') { - const factorFlagArray = ref([]) // 初始化为空数组 - for (let i = 0; i < channelsSelection.value.length; i++) { - const factorFlag = channelsSelection.value[i].factorFlag - if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) { - factorFlagArray.value.push(channelsSelection.value[i].name.toString()) - } - } - if (factorFlagArray.value.length > 0) { - const factorFlags = factorFlagArray.value.join(', ') - ElMessageBox.confirm( - factorFlags + '设备不支持系数校准,请重新选择', - '提示', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }, - ) - return - } + // // 检查 socketClient.Instance 是否存在 // if (!socketClient.Instance) { @@ -989,22 +971,22 @@ const handleTest = async (val: string) => { // return; // } - socketClient.Instance.connect(); - dataSocket.socketServe = socketClient.Instance; - dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => { - // 处理来自服务器的消息 - //console.log('Received message:', res) - // 根据需要在这里添加更多的处理逻辑 - if (res.code === 20000) { - ElMessage.error(message.message) - loading.close() - } else { - webMsgSend.value = res - } - }) + // socketClient.Instance.connect(); + // dataSocket.socketServe = socketClient.Instance; + // dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => { + // // 处理来自服务器的消息 + // //console.log('Received message:', res) + // // 根据需要在这里添加更多的处理逻辑 + // if (res.code === 20000) { + // ElMessage.error(message.message) + // loading.close() + // } else { + // webMsgSend.value = res + // } + // }) - channelsTest.value?.open(channelsSelection.value, props.plan) - return + // channelsTest.value?.open(channelsSelection.value, props.plan) + // return } else { // 一键检测 checkStore.setCheckType(1)