diff --git a/.vscode/settings.json b/.vscode/settings.json index 34f8496..0a358bb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,7 @@ { "cSpell.words": [ + "CHNFACTOR", + "CHNPACTOR", "Chns", "Combox", "Datasource", diff --git a/frontend/.env.development b/frontend/.env.development index 8f13788..ca3d07d 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -19,6 +19,6 @@ VITE_API_URL=/api # 开发环境跨域代理,支持配置多个 -VITE_PROXY=[["/api","http://192.168.1.124:18092/"]] +VITE_PROXY=[["/api","http://192.168.1.127:18092/"]] #VITE_PROXY=[["/api","http://192.168.1.125:18092/"]] # VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文 diff --git a/frontend/src/api/home/channelsTest/index.ts b/frontend/src/api/home/channelsTest/index.ts index 6a51f42..876d855 100644 --- a/frontend/src/api/home/channelsTest/index.ts +++ b/frontend/src/api/home/channelsTest/index.ts @@ -1,6 +1,6 @@ import http from "@/api"; -import {ChannelsTest} from "@/api/home/interface/channelsTest"; -export const getBigTestItem = () => { - return http.get(''); -} \ No newline at end of file +//系数校准发送基本信息 +export const getCoefficientCheck = (params: any) => { + return http.post(`/prepare/coefficientCheck`, params) + } \ No newline at end of file diff --git a/frontend/src/api/home/interface/channelsTest.ts b/frontend/src/api/home/interface/channelsTest.ts index 92c6d18..60230ab 100644 --- a/frontend/src/api/home/interface/channelsTest.ts +++ b/frontend/src/api/home/interface/channelsTest.ts @@ -3,20 +3,24 @@ export namespace ChannelsTest { // 系数校准列表 export interface CoefficientVO { + devName?: string;//设备名称 + type?:string;//区分大小电压 monitorNum: string;//监测点序号 desc: string;//描述 aVuData:string;//电压通道A数据 aVuXi:string;//电压通道A系数 bVuData:string;//电压通道B数据 - bVuXi:number;//电压通道B系数 - cVuData:number;//电压通道C数据 - cVuXi?:string;//电压通道C系数 - aIeData?:string;//电流通道A数据 - aIeXi?:string;//电流通道A系数 - bIeData?:string;//电流通道B数据 - bIeXi?:string;//电流通道B系数 - cIeData?:string;//电流通道C数据 - cIeXi?:string;//电流通道C系数 + bVuXi:string;//电压通道B系数 + cVuData:string;//电压通道C数据 + cVuXi:string;//电压通道C系数 + aIeData:string;//电流通道A数据 + aIeXi:string;//电流通道A系数 + bIeData:string;//电流通道B数据 + bIeXi:string;//电流通道B系数 + cIeData:string;//电流通道C数据 + cIeXi:string;//电流通道C系数 + loading: boolean; + } } \ No newline at end of file diff --git a/frontend/src/components/IpAddress/index.vue b/frontend/src/components/IpAddress/index.vue index 8a6f574..5e5a357 100644 --- a/frontend/src/components/IpAddress/index.vue +++ b/frontend/src/components/IpAddress/index.vue @@ -313,7 +313,7 @@ border: 1px solid #dcdfe6; border-radius: 4px; line-height: 40px; - width: 110%; + width: 100%; height: 35px; padding-inline-start: 0px; padding-left: 10px; diff --git a/frontend/src/components/echarts/pie/default.vue b/frontend/src/components/echarts/pie/default.vue index d151910..825f128 100644 --- a/frontend/src/components/echarts/pie/default.vue +++ b/frontend/src/components/echarts/pie/default.vue @@ -35,7 +35,7 @@ const init = () => { isRadius: false, //是否圆角 isSpace: false, //是否显示间隔 isLabelLine: true, //是否显示引导线 - titleFontSize: '18px', //标题字体大小 + titleFontSize: '14px', //标题字体大小 ...props.customData, }; legendData.value = { diff --git a/frontend/src/views/home/components/channelsTest.vue b/frontend/src/views/home/components/channelsTest.vue index 726cd95..33a23f1 100644 --- a/frontend/src/views/home/components/channelsTest.vue +++ b/frontend/src/views/home/components/channelsTest.vue @@ -23,32 +23,36 @@ @@ -56,60 +60,28 @@
- - + + - - - -
@@ -121,6 +93,9 @@ import { SuccessFilled, Failed, Message, MessageBox } from '@element-plus/icons- import { type Ref, ref, toRef, watch } from 'vue' import {dialogBig} from '@/utils/elementBind' import { ElMessage, ElMessageBox, TabsPaneContext } from 'element-plus'; +import { getCoefficientCheck } from '@/api/home/channelsTest/index' +import type { ChannelsTest } from '@/api/home/interface/channelsTest'; +import type { Plan } from '@/api/plan/interface'; const activeIndex = ref(0) const activeTotalNum = ref(4) const qualified = ref(0) @@ -132,328 +107,355 @@ let timer1: NodeJS.Timeout | null = null; // 声明并初始化 timer1 let timer2: NodeJS.Timeout | null = null; // 同样声明并初始化 timer2 const name = ref([])//系数校准所选设备名字数组 const channel = ref([])//系数校准所选设备通道数组 +const devIdArray = ref([])//系数校准所选设备ID数组 +const select_Plan = ref() +const planId = ref('') +const isButtonDisabled = ref(false); // 在 setup 函数中 const errorStates = ref(new Array(name.value.length).fill(false)); -const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态 +//const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态 +const big_V_loadingStates = ref(false); // 初始化 大电压大电流下装loading 状态 +const small_V_loadingStates = ref(false); // 初始化 小电压小电流下装loading 状态 +const big_V_loadingStates2 = ref(false); // 初始化 大电压大电流校准loading 状态 +const small_V_loadingStates2 = ref(false); // 初始化 小电压小电流校准loading 状态 const editableTabsValue = ref('0') +const big_V_Download = ref('') +const big_I_Download = ref('') +const small_V_Download = ref('') +const small_I_Download = ref('') +const big_V_Adjust = ref('') +const big_I_Adjust = ref('') +const small_V_Adjust = ref('') +const small_I_Adjust = ref('') const props = defineProps({ webMsgSend: { type: Object, default: () => ({}) } }) + +const tableDataMap = new Map>([]); +const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); const webMsgSend = toRef(props, 'webMsgSend'); watch(webMsgSend,function (newValue,oldValue){ switch (newValue.requestId){ - - } + case 'yjc_sbtxjy': + switch (newValue.operateCode) { + case 'INIT_GATHER$01': + if (newValue.code == 10550) { + ElMessageBox.alert('设备连接异常', '设备连接异常', { + confirmButtonText: '确定', + type: 'error', + }) + }else if (newValue.code == 10551) { + ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', { + confirmButtonText: '确定', + type: 'error', + }) + } else if (newValue.code == 10552) { + ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', { + confirmButtonText: '确定', + type: 'error', + }) + } + break; + } + break; + case 'Coefficient_Check': + switch (newValue.operateCode){ + case 'big_end'://大电压,电流下装 + active.value++; + big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V'; + big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A'; + tableLoading('small','系数下装') + break; + } + switch (newValue.operateCode){ + case 'small_end'://小电压,电流下装 + active.value++; + small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V'; + small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A'; + + tableLoading('big','系数校准') + break; + } + switch (newValue.operateCode){ + case 'big_comp_end'://大电压,电流校准 + active.value++; + big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V'; + big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A'; + + tableLoading('small','系数校准') + break; + } + switch (newValue.operateCode){ + case 'small_comp_end'://小电压,电流校准 + active.value++; + small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V'; + small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A'; + active.value++; + + for (let i = 0; i < name.value.length; i++) { + const currentDataRef = tableDataMap.get(i); + if (currentDataRef) { + const currentData = currentDataRef.value; + // 检查当前数据中有无不合格字段 + const hasError = checkForErrors(currentData); + if (hasError) { + } else { + qualified.value++; + } + updateErrorState(i, hasError); + } + } + + //editableTabsValue.value = (tabNumber.value).toString();//显示下一个tab + isButtonDisabled.value = false; // 恢复按钮 + break; + } + switch (newValue.operateCode){ + case 'DATA_CHNFACTOR$02'://表格 + // 输出 key 为 0 的数组中的第一条 ChannelsTest.CoefficientVO 对象 + for (let i = 0; i < name.value.length; i++) { + const targetArrayRef = tableDataMap.get(i); + if (targetArrayRef) { + const targetArray = targetArrayRef.value; + if (targetArray.length > 0) { + const firstCoefficientVO = targetArray.find(item => item.monitorNum === newValue.data.monitorNum && + item.type === newValue.data.type && + item.desc === newValue.data.desc && + item.devName === newValue.data.devName); + if (firstCoefficientVO) { // 检查 firstCoefficientVO 是否存在 + firstCoefficientVO.aVuData = parseFloat(newValue.data.aVuData).toFixed(4);; + firstCoefficientVO.aVuXi = newValue.data.aVuXi; + firstCoefficientVO.bVuData = parseFloat(newValue.data.bVuData).toFixed(4); + firstCoefficientVO.bVuXi = newValue.data.bVuXi; + firstCoefficientVO.cVuData = parseFloat(newValue.data.cVuData).toFixed(4); + firstCoefficientVO.cVuXi = newValue.data.cVuXi; + firstCoefficientVO.aIeData = parseFloat(newValue.data.aIeData).toFixed(4); + firstCoefficientVO.aIeXi = newValue.data.aIeXi; + firstCoefficientVO.bIeData = parseFloat(newValue.data.bIeData).toFixed(4); + firstCoefficientVO.bIeXi = newValue.data.bIeXi; + firstCoefficientVO.cIeData = parseFloat(newValue.data.cIeData).toFixed(4); + firstCoefficientVO.cIeXi = newValue.data.cIeXi; + console.log(newValue.data.devName + '对象:', firstCoefficientVO); + activeIndex.value++; + } else { + console.log('未找到匹配的'+ newValue.data.devName+'对象'); + } + } else { + console.log(newValue.data.devName + '数组为空'); + } + } else { + console.log('未找到'+newValue.data.devName+'对应的数组'); + } + } + break; + } + break; + case 'socket_timeout': + switch(newValue.operateCode){ + case 'VOLTAGE': + ElMessageBox.alert('连接超时!', '连接超时', { + confirmButtonText: '确定', + type: 'error', + }) + break; + } + break; + case 'connect': + switch (newValue.operateCode){ + case "Source": + ElMessageBox.alert('源服务端连接失败', '源服务端连接失败', { + confirmButtonText: '确定', + type: 'error', + }) + break; + case "Dev": + ElMessageBox.alert('设备服务端连接失败', '设备服务端连接失败', { + confirmButtonText: '确定', + type: 'error', + }) + break; + } + break; + } }) -// 定义 TableDataItem 接口 -interface TableDataItem { - id: string; - deviceName?: string; - MonitorIdx: number; - UaData?: number | string; - UaChannel?: number | string; - UbData?: number | string; - UbChannel?: number | string; - UcData?: number | string; - UcChannel?: number | string; - IaData?: number | string; - IaChannel?: number | string; - IbData?: number | string; - IbChannel?: number | string; - IcData?: number | string; - IcChannel?: number | string; + +//按行图标转动 +const tableLoading = (type: string, desc: string) => { + for (let i = 0; i < channel.value.length; i++) { + + const targetArrayRef = tableDataMap.get(i); + if (targetArrayRef) { + const targetArray = targetArrayRef.value; + if (targetArray.length > 0) { + for (let j = 0; j < channel.value[i]; j++) { + const firstCoefficientVO = targetArray.find(item => item.monitorNum === (j + 1).toString() && + item.type === type && + item.desc === desc); + if (firstCoefficientVO){ + firstCoefficientVO.loading = true; + } + } + } + } + } } -const dataTemplates3 = [ +const dataTemplates : ChannelsTest.CoefficientVO[]= [ { - id: '', // 新增 id 属性 - MonitorIdx: 1, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: '—', - UaChannel:'—', - UbData: '—', - UbChannel: '—', - UcData: '—', - UcChannel: '—', - IaData: '—', - IaChannel: '—', - IbData: '—', - IbChannel: '—', - IcData: '—', - IcChannel: '—', + monitorNum: '1', + desc: '系数下装', + type:'big', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', + loading:false, + devName:'' }, { - id: '', // 新增 id 属性 - MonitorIdx: 2, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: '—', - UaChannel:'—', - UbData: '—', - UbChannel: '—', - UcData: '—', - UcChannel: '—', - IaData: '—', - IaChannel: '—', - IbData: '—', - IbChannel: '—', - IcData: '—', - IcChannel: '—', + monitorNum: '2', + desc: '系数下装', + type:'small', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', + loading:false, + devName:'' }, { - id: '', // 新增 id 属性 - MonitorIdx: 3, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: '—', - UaChannel:'—', - UbData: '—', - UbChannel: '—', - UcData: '—', - UcChannel: '—', - IaData: '—', - IaChannel: '—', - IbData: '—', - IbChannel: '—', - IcData: '—', - IcChannel: '—', + monitorNum: '3', + desc: '系数校准', + type:'big', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', + loading:false, + devName:'' }, - { - id: '', // 新增 id 属性 - MonitorIdx: 4, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: '—', - UaChannel:'—', - UbData: '—', - UbChannel: '—', - UcData: '—', - UcChannel: '—', - IaData: '—', - IaChannel: '—', - IbData: '—', - IbChannel: '—', - IcData: '—', - IcChannel: '—', + monitorNum: '4', + desc: '系数校准', + type:'small', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', + loading:false, + devName:'' }, ]; -const dataTemplates4 = [ +const dataTemplates2 : ChannelsTest.CoefficientVO[]= [ { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: 57.74, - UaChannel: 1.0003, - UbData: 57.74, - UbChannel: 1.0003, - UcData: 57.74, - UcChannel: 1.0003, - IaData: 10, - IaChannel: 1.0001, - IbData: 10, - IbChannel: 1.0001, - IcData: 10, - IcChannel: 1.0001, + monitorNum: '1', + desc: '系数下装', + type:'big', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', }, { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: 5.774, - UaChannel: 1.0003, - UbData: 5.774, - UbChannel: 1.0003, - UcData: 5.774, - UcChannel: 1.0003, - IaData: 1, - IaChannel: 1.0001, - IbData: 1, - IbChannel: 1.0001, - IcData: 1, - IcChannel: 1.0001, + monitorNum: '2', + desc: '系数下装', + type:'small', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', }, { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: '—', - UaChannel:'—', - UbData: '—', - UbChannel: '—', - UcData: '—', - UcChannel: '—', - IaData: '—', - IaChannel: '—', - IbData: '—', - IbChannel: '—', - IcData: '—', - IcChannel: '—', + monitorNum: '3', + desc: '系数校准', + type:'big', + aVuData: '—', + aVuXi:'不合格', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', }, { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: '—', - UaChannel:'—', - UbData: '—', - UbChannel: '—', - UcData: '—', - UcChannel: '—', - IaData: '—', - IaChannel: '—', - IbData: '—', - IbChannel: '—', - IcData: '—', - IcChannel: '—', + monitorNum: '4', + desc: '系数校准', + type:'small', + aVuData: '—', + aVuXi:'—', + bVuData: '—', + bVuXi: '—', + cVuData: '—', + cVuXi: '—', + aIeData: '—', + aIeXi: '—', + bIeData: '—', + bIeXi: '—', + cIeData: '—', + cIeXi: '—', }, -]; -const dataTemplates5 = [ - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: 57.74, - UaChannel: 1.0003, - UbData: 57.74, - UbChannel: 1.0003, - UcData: 57.74, - UcChannel: 1.0003, - IaData: 10, - IaChannel: 1.0001, - IbData: 10, - IbChannel: 1.0001, - IcData: 10, - IcChannel: 1.0001, - }, - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: 5.774, - UaChannel: 1.0003, - UbData: 5.774, - UbChannel: 1.0003, - UcData: 5.774, - UcChannel: 1.0003, - IaData: 1, - IaChannel: 1.0001, - IbData: 1, - IbChannel: 1.0001, - IcData: 1, - IcChannel: 1.0001, - }, - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: 57.74, - UaChannel: '不合格', - UbData: 57.74, - UbChannel: '合格', - UcData: 57.74, - UcChannel: '合格', - IaData: 10, - IaChannel: '合格', - IbData: 10, - IbChannel: '合格', - IcData: 10, - IcChannel: '合格', - }, - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: 5.774, - UaChannel: '不合格', - UbData: 5.774, - UbChannel: '合格', - UcData: 5.774, - UcChannel: '合格', - IaData: 1, - IaChannel: '合格', - IbData: 1, - IbChannel: '合格', - IcData: 1, - IcChannel: '合格', - }, -]; - -const dataTemplates6 = [ - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: 57.74, - UaChannel: 1.0003, - UbData: 57.74, - UbChannel: 1.0003, - UcData: 57.74, - UcChannel: 1.0003, - IaData: 10, - IaChannel: 1.0001, - IbData: 10, - IbChannel: 1.0001, - IcData: 10, - IcChannel: 1.0001, - }, - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数下装', - UaData: 5.774, - UaChannel: 1.0003, - UbData: 5.774, - UbChannel: 1.0003, - UcData: 5.774, - UcChannel: 1.0003, - IaData: 1, - IaChannel: 1.0001, - IbData: 1, - IbChannel: 1.0001, - IcData: 1, - IcChannel: 1.0001, - }, - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: 57.74, - UaChannel: '合格', - UbData: 57.74, - UbChannel: '合格', - UcData: 57.74, - UcChannel: '合格', - IaData: 10, - IaChannel: '合格', - IbData: 10, - IbChannel: '合格', - IcData: 10, - IcChannel: '合格', - }, - { - id: '', // 新增 id 属性 - MonitorIdx: 0, // 新增 MonitorIdx 属性 - deviceName: '系数校准', - UaData: 5.774, - UaChannel: '合格', - UbData: 5.774, - UbChannel: '合格', - UcData: 5.774, - UcChannel: '合格', - IaData: 1, - IaChannel: '合格', - IbData: 1, - IbChannel: '合格', - IcData: 1, - IcChannel: '合格', - }, ]; // 更新错误状态的方法 @@ -461,46 +463,11 @@ const updateErrorState = (index: number, hasError: boolean) => { errorStates.value[index] = hasError; }; -const activities = [ - { - content: '开始检测', - timestamp: '2018-04-12 20:46', - size: 'large', - color: '#0bbd87', - icon: SuccessFilled, - }, - { - content: 'GPS上送时刻', - timestamp: '2018-04-03 20:46', - hollow: true, - }, - { - content: '设备最早上送时刻', - timestamp: '2018-04-03 20:46', - hollow: true, - }, - { - content: '设备最晚上送时刻', - timestamp: '2018-04-03 20:46', - hollow: true, - }, - { - content: '检测结束', - timestamp: '2018-04-03 20:46', - hollow: true, - }, -] - - const tableDataMap = new Map>([]); - - const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); - // 打开弹窗,可能是新增,也可能是编辑 - const open = (selection: Device.ResPqDev[]) => { + const open = (selection: Device.ResPqDev[],plan:Plan.ReqPlan) => { const checkStates = selection.map(item => item.checkState); const allCheckStatesEqual = new Set(checkStates).size <= 1; - if (!allCheckStatesEqual) { ElMessageBox.confirm( '所勾选设备检测状态不一致,请重新选择', @@ -514,6 +481,10 @@ const activities = [ return } + isButtonDisabled.value = false; // 恢复按钮 + select_Plan.value = plan + planId.value = selection[0]?.planId || ''; + devIdArray.value = selection.map(item => item.id); name.value = selection.map(item => item.name) channel.value = selection.map(item => item.devChns) dialogVisible.value = true; @@ -521,13 +492,14 @@ const activities = [ // 初始化 loadingStates 为 false - loadingStates.value = new Array(selection.length).fill(false); + // loadingStates.value = new Array(selection.length).fill(false); errorStates.value = new Array(selection.length).fill(false); for (let i = 0; i < channel.value.length; i++) { - const currentTableData = initializeTableData(dataTemplates3, i); + const currentTableData = initializeTableData(dataTemplates, i); tableDataMap.set(i,currentTableData) } + console.log('tableDataMap',tableDataMap); } const handleCancel=() => { @@ -546,50 +518,6 @@ const getTableDataForChannel = (index: number): any[] => { const data = tableDataMap.get(index); return data ? data.value : []; } -// const props = defineProps({ -// testStatus: { -// type: String, -// default: 'wait' -// } -// }) -// const testStatus = toRef(props, 'testStatus'); -// const ts = ref(''); -// //监听goods_sn的变化 -// watch(testStatus, function (newValue, oldValue) { - -// ts.value = props.testStatus; -// if (ts.value === 'start') { -// ts.value = 'process' -// let timer = setInterval(() => { -// if (activeIndex.value < activeTotalNum.value) { -// activeIndex.value++ -// if(activeIndex.value > 1) -// qualified.value = activeIndex.value -1;//演示效果,实际运行时使用后端传来的真实数据即可 -// else -// qualified.value = activeIndex.value; -// } -// else if (activeIndex.value === activeTotalNum.value) { -// clearInterval(timer) -// ts.value = 'success' -// } -// else { -// clearInterval(timer) -// ts.value = 'success' -// } - -// total.value = activeTotalNum.value -// }, 1000); -// } -// }) - - - -// const emit = defineEmits(['update:testStatus']); -// //监听sn -// watch(ts, function (newValue, oldValue) { -// //修改父组件 -// emit('update:testStatus', ts.value) -// }) watch(activeIndex, function (newValue, oldValue) { @@ -601,32 +529,47 @@ watch(activeIndex, function (newValue, oldValue) { }) // 示例的 checkForErrors 函数,根据实际需求进行调整 -const checkForErrors = (data: TableDataItem[]): boolean => { +const checkForErrors = (data: ChannelsTest.CoefficientVO[]): boolean => { // 这里假设不合格字段的标准是 status 为 '不合格' 或 isValid 为 false return data.some(item => - item.UaChannel === '不合格' || - item.UbChannel === '不合格' || - item.UcChannel === '不合格' || - item.IaChannel === '不合格' || - item.IbChannel === '不合格' || - item.IcChannel === '不合格' + item.aVuXi === '不合格' || + item.bVuXi === '不合格' || + item.cVuXi === '不合格' || + item.aIeXi === '不合格' || + item.bIeXi === '不合格' || + item.cIeXi === '不合格' ); }; const handleSubmit = async () => { - debugger + isButtonDisabled.value = true; // 禁用按钮 + tableLoading('big','系数下装') + await getCoefficientCheck({ + userPageId: "cdf", + devIds: devIdArray.value, + planId:planId.value, + errorSysId: select_Plan.value?.errorSysId, +     scriptId: select_Plan.value?.scriptId, + operateType:'0' // '0'为预检测、‘1‘为正式检测 + }) + active.value++; + + // 初始化 loadingStates 为 true + // loadingStates.value = new Array(name.value.length).fill(true); + + return; // 初始化 currentTableData let isTimer2Completed = false; - // 初始化 loadingStates 为 true - loadingStates.value = new Array(name.value.length).fill(true); + + //"80b4b4f52a4c4064a18319525f8ac13c", for (let i = 0; i < channel.value.length; i++) { // 重置状态变量 active.value = 0; //activeIndex.value = 0; editableTabsValue.value = i.toString(); // 初始化并填充 currentTableData - const currentTableData = initializeTableData(dataTemplates4, i); + const currentTableData = initializeTableData(dataTemplates2, i); tableDataMap.set(i, currentTableData); //activeIndex.value++; @@ -638,14 +581,14 @@ const handleSubmit = async () => { if (active.value > 5) { clearInterval(timer1); } - }, 500); + }, 3000); // 清除之前的 timer2 clearInterval(timer2); // 启动 timer2 timer2 = setInterval(() => { // 初始化并填充 currentTableData - const currentTableData = initializeTableData(i > 0 ? dataTemplates5 : dataTemplates6, i); + const currentTableData = initializeTableData(i > 0 ? dataTemplates2 : dataTemplates2, i); tableDataMap.set(i, currentTableData); activeIndex.value++; @@ -678,135 +621,43 @@ const handleSubmit = async () => { }; // 提取初始化并填充 currentTableData 的函数 -const initializeTableData = (templates: TableDataItem[], index: number): Ref => { - const currentTableData = ref([]); - +const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: number): Ref => { + const currentTableData = ref([]); for (let j = 0; j < channel.value[index]; j++) { - const id = (j + 1).toString(); templates.forEach((template) => { // 使用解构赋值排除 id 和 MonitorIdx 属性 - const { id: _, MonitorIdx: __, ...rest } = template; - currentTableData.value.push({ - id, - MonitorIdx: j + 1, + const { devName,monitorNum: __, ...rest } = template; + currentTableData.value.push({ + monitorNum: (j + 1).toString(), + devName: name.value[index], ...rest, }); }); } - return currentTableData; }; -// const handleSubmit = async () => { -// // 初始化 currentTableData -// let isTimer2Completed = false; -// // 初始化 loadingStates 为 true -// loadingStates.value = new Array(name.value.length).fill(true); - -// for (let i = 0; i < channel.value.length; i++) { - -// // 重置状态变量 -// active.value = 0;activeIndex.value = 0; -// const currentTableData = ref([]); -// const selectedTemplates = dataTemplates4; - -// for (let j = 0; j < channel.value[i]; j++) { -// const id = (j + 1).toString(); -// selectedTemplates.forEach((template) => { -// currentTableData.value.push({ -// id: id, -// MonitorIdx: j + 1, -// ...template, -// }); -// }); -// } - -// tableDataMap.set(i, currentTableData); -// activeIndex.value++; -// // 清除之前的 timer1 -// clearInterval(timer1); -// // 启动 timer1 -// timer1 = setInterval(() => { -// active.value++; -// if (active.value > 5) { -// clearInterval(timer1); -// } -// }, 500); - -// // 清除之前的 timer2 -// clearInterval(timer2); -// // 启动 timer2 -// timer2 = setInterval(() => { -// // 初始化 currentTableData -// const currentTableData = ref([]); - -// if(i > 0){ -// const selectedTemplates = dataTemplates5; -// for (let j = 0; j < channel.value[i]; j++) { -// const id = (j + 1).toString(); -// selectedTemplates.forEach((template) => { -// currentTableData.value.push({ -// id: id, -// MonitorIdx: j + 1, -// ...template, -// }); -// }); -// } -// }else{ -// const selectedTemplates = dataTemplates6; -// for (let j = 0; j < channel.value[i]; j++) { -// const id = (j + 1).toString(); -// selectedTemplates.forEach((template) => { -// currentTableData.value.push({ -// id: id, -// MonitorIdx: j + 1, -// ...template, -// }); -// }); -// } -// } - -// tableDataMap.set(i, currentTableData); -// activeIndex.value++; - -// clearInterval(timer2); -// const currentDataRef = tableDataMap.get(i); -// if (currentDataRef) { -// const currentData = currentDataRef.value; -// // 检查当前数据中有无不合格字段 -// const hasError = checkForErrors(currentData); -// if (hasError) { -// } else { -// qualified.value++; -// } -// updateErrorState(i, hasError); -// } - -// // 设置标志变量为 true,表示 timer2 已经完成 -// isTimer2Completed = true; -// }, 3000); - -// // 等待 timer2 完成 -// while (!isTimer2Completed) { -// // 这里可以添加一个短暂的等待,避免死循环 -// await new Promise(resolve => setTimeout(resolve, 100)); - -// } - -// // 重置标志变量 -// isTimer2Completed = false; -// } - -// }; - - - - // 对外映射 defineExpose({ open }) diff --git a/frontend/src/views/home/components/channelsTestTable.vue b/frontend/src/views/home/components/channelsTestTable.vue index d662b4e..e8bac94 100644 --- a/frontend/src/views/home/components/channelsTestTable.vue +++ b/frontend/src/views/home/components/channelsTestTable.vue @@ -6,127 +6,127 @@ style="width: 100%" max-height="400px" :span-method="objectSpanMethod"> - - + + - + - + - + - + - + - + @@ -135,117 +135,117 @@ - + - + - + - + - + - + @@ -259,29 +259,10 @@