From 081aeacff795f6de3302603270ea1fe85f62ec68 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Tue, 31 Dec 2024 14:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/check/interface/index.ts | 24 +- frontend/src/api/check/test/index.ts | 8 +- frontend/src/api/socket/socket.ts | 8 +- .../home/components/dataCheckRawDataTable.vue | 26 +- .../home/components/dataCheckResultTable.vue | 135 ++++++--- .../dataCheckSingleChannelSingleTestPopup.vue | 270 +++++++++++------- frontend/src/views/home/components/table.vue | 2 +- frontend/src/views/home/components/test.vue | 57 +--- .../src/views/home/components/testPopup.vue | 23 +- 9 files changed, 325 insertions(+), 228 deletions(-) diff --git a/frontend/src/api/check/interface/index.ts b/frontend/src/api/check/interface/index.ts index d75db35..7c1b305 100644 --- a/frontend/src/api/check/interface/index.ts +++ b/frontend/src/api/check/interface/index.ts @@ -13,12 +13,14 @@ export namespace CheckData { export interface CheckResult { chnNum: string, standardValue: number, - L1: number, - L1_errValue: number, - L2: number, - L2_errValue: number, - L3: number, - L3_errValue: number, + A?: number, + A_errValue?: number, + B?: number, + B_errValue?: number, + C?: number, + C_errValue?: number, + T?: number, + T_errValue?: number, maxErrVaule: number, result: string, } @@ -28,9 +30,10 @@ export namespace CheckData { */ export interface RawDataItem { updateTime: string, - L1: number, - L2: number, - L3: number + A?: number, + B?: number, + C?: number + T?: number } export interface Device { @@ -44,7 +47,6 @@ export namespace CheckData { id: string, code?: string, scriptName: string, - pid?: string, children?: ScriptItem[] } @@ -75,7 +77,7 @@ export namespace CheckData { INFO = '#909399', LOADING = '#607eab', SUCCESS = '#67c23a', - WARNING ='#e6a23c', + WARNING = '#e6a23c', DANGER = '#f56c6c', } diff --git a/frontend/src/api/check/test/index.ts b/frontend/src/api/check/test/index.ts index 6b32443..ad9e0c0 100644 --- a/frontend/src/api/check/test/index.ts +++ b/frontend/src/api/check/test/index.ts @@ -9,7 +9,7 @@ export const getBigTestItem = (planId: string) => { * 获取弹出框表单数据 * @param params 当为scriptType为null时,表示查询所有脚本类型,否则只查询指定脚本类型。当为chnNum为-1时,表示查询所有通道,否则只查询指定通道。 */ -export const getFormData = (params: { planId: string, deviceId: string, chnNum: number, scriptType?: string }) => { +export const getFormData = (params: { planId: string, deviceId: string, chnNum: string, scriptType: string|null }) => { return http.post("/result/formContent/", params, {loading: false}); } @@ -17,7 +17,7 @@ export const getFormData = (params: { planId: string, deviceId: string, chnNum: * 获取树形结构数据 * @param params */ -export const getTreeData = (params: { deviceId: string, chnNum: number, checkItemId: string }) => { +export const getTreeData = (params: { deviceId: string, chnNum: string, checkItemId: string }) => { return http.post("/result/treeData/", params, {loading: false}); } @@ -25,6 +25,6 @@ export const getTreeData = (params: { deviceId: string, chnNum: number, checkIte * 获取检查数据 * @param params */ -export const getCheckData = (params: { deviceId: string, chnNum: number, checkItemId: string }) => { - return http.post("/result/data/", params, {loading: false}); +export const getTableData = (params: { deviceId: string, chnNum: string, checkItemId: string }) => { + return http.post("/result/tableData/", params, {loading: false}); } \ No newline at end of file diff --git a/frontend/src/api/socket/socket.ts b/frontend/src/api/socket/socket.ts index 2ba2729..0236aaa 100644 --- a/frontend/src/api/socket/socket.ts +++ b/frontend/src/api/socket/socket.ts @@ -13,15 +13,15 @@ export const closePreTest = (params) => { * 开始正式检测 * @param params */ -export const startTest = (params: { deviceIds: string[] }) => { - return http.post(`/test/startTest`, params, {loading: false}) +export const startTest = (params) => { + return http.post(`/prepare/startTest`, params, {loading: false}) } /** * 暂停正式检测 * @param params */ -export const pauseTest = (params: { deviceIds: string[] }) => { +export const pauseTest = (params) => { return http.post(`/test/pauseTest`, params, {loading: false}) } @@ -29,6 +29,6 @@ export const pauseTest = (params: { deviceIds: string[] }) => { * 继续正式检测 * @param params */ -export const resumeTest = (params: { deviceIds: string[] }) => { +export const resumeTest = (params) => { return http.post(`/test/resumeTest`, params, {loading: false}) } diff --git a/frontend/src/views/home/components/dataCheckRawDataTable.vue b/frontend/src/views/home/components/dataCheckRawDataTable.vue index 2b254c0..ec5300c 100644 --- a/frontend/src/views/home/components/dataCheckRawDataTable.vue +++ b/frontend/src/views/home/components/dataCheckRawDataTable.vue @@ -6,9 +6,14 @@ style="width: 100%;"> - - - + + @@ -16,13 +21,26 @@ \ No newline at end of file diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue index 0015291..9b6910d 100644 --- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue @@ -68,7 +68,7 @@ import {reactive, ref} from 'vue' import DataCheckResultTable from './dataCheckResultTable.vue' import DataCheckRawDataTable from './dataCheckRawDataTable.vue' import {CheckData} from "@/api/check/interface"; -import {getFormData, getTreeData, getCheckData} from "@/api/check/test"; +import {getFormData, getTreeData, getTableData} from "@/api/check/test"; import {useDictStore} from "@/stores/modules/dict"; import {useCheckStore} from "@/stores/modules/check"; @@ -95,7 +95,7 @@ const formContent = reactive({ monitorIdx: '', }) let deviceId: string = '' -let scriptType: string = '' +let scriptType: string | null = null // 通道下拉列表 let chnList: any[] = [] @@ -134,19 +134,9 @@ const handleChnChange = (data: any) => { // treeDataUnQualified=[] // treeDataAll=[] + switchItem.value = 0 } -// watch(() => formContent.monitorIdx, (newVal, oldVal) => { -// if (newVal) { -// console.log("通道号下拉框", newVal, oldVal); -// -// // 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询) -// // const result = await getTreeData({deviceId, formContent.monitorIdx, scriptType}) -// // treeDataUnQualified=[] -// // treeDataAll=[] -// -// } -// }) // 点击左侧树节点触发事件 const handleNodeClick = (data: any) => { @@ -160,141 +150,234 @@ watch(checkedScriptId, (newVal, oldVal) => { if (newVal) { console.log("左侧树被选中的叶子节点id", newVal); // 发起请求,查询该测试项的检测结果 - // const result = await getCheckData({deviceId, formContent.monitorIdx, scriptType}) + // const result = await getTableData({deviceId, formContent.monitorIdx, scriptType}) + Object.assign(checkResultTableData, [{ chnNum: '1', standardValue: 57.74, - L1: 57.73, - L1_errValue: 0.01, - L2: 57.73, - L2_errValue: 0.01, - L3: 57.73, - L3_errValue: 0.01, + A: 57.73, + A_errValue: 0.01, + B: 57.73, + B_errValue: 0.01, + C: 57.73, + C_errValue: 0.01, maxErrVaule: 0.05774, result: '合格', }]) + // Object.assign(checkResultTableData, [{ + // chnNum: '1', + // standardValue: 57.74, + // T: 57.73, + // T_errValue: 0.01, + // maxErrVaule: 0.05774, + // result: '合格', + // }]) + Object.assign(rawTableData, [ { updateTime: "2024-10-10 09:30:00", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:03", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:06", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:09", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:12", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:15", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:18", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:21", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:24", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:27", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:30", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:33", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:36", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:39", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:42", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:45", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:48", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:51", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:54", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, }, { updateTime: "2024-10-10 09:30:57", - L1: 57.73, - L2: 57.73, - L3: 57.73, + A: 57.73, + B: 57.73, + C: 57.73, } ]) + + // Object.assign(rawTableData, [ + // { + // updateTime: "2024-10-10 09:30:00", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:03", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:06", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:09", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:12", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:15", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:18", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:21", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:24", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:27", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:30", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:33", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:36", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:39", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:42", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:45", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:48", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:51", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:54", + // T: 57.73, + // }, + // { + // updateTime: "2024-10-10 09:30:57", + // T: 57.73, + // } + // ]) } }) @@ -313,12 +396,13 @@ watch(switchItem, (newVal, oldVal) => { defaultExpandedKeys = [node?.id] }) -const open = async (_deviceId: string, chnNum: number, _scriptType?: string) => { +const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { console.log(_deviceId, chnNum, _scriptType); deviceId = _deviceId + scriptType = _scriptType switchItem.value = 0 // 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号 - //const resFormContent = await getFormData({checkStore.planId,deviceId, chnNum.toString(),scriptType}) + //const resFormContent = await getFormData({checkStore.planId,deviceId, chnNum,scriptType}) // 数据处理 let resFormContent = { @@ -326,7 +410,7 @@ const open = async (_deviceId: string, chnNum: number, _scriptType?: string) => errorSysName: 'Q/GDW 10650.2-2021', dataRule: '505f063f9f91ab108d895a9fe96b5dce', deviceName: '被检设备1', - chnList:[ + chnList: [ {value: '1', label: '1'}, {value: '2', label: '0'}, {value: '3', label: '1'}, @@ -337,69 +421,58 @@ const open = async (_deviceId: string, chnNum: number, _scriptType?: string) => label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)` })) - let dataRuleName = dictStore.getDictData('Data_Rule').find(item=>item.id==resFormContent.dataRule)?.name + let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name - Object.assign(formContent, {...resFormContent,dataRule:dataRuleName,monitorIdx: chnList[0].value}) + Object.assign(formContent, {...resFormContent, dataRule: dataRuleName, monitorIdx: chnList[0].value}) // const result2 = await getTreeData({deviceId, formContent.monitorIdx, checkItemId}) treeDataAll = [{ "id": "1", - "pid": "0", "scriptName": "频率准确度检测", "children": [ { "id": "1-1", - "pid": "1", "scriptName": "额定工作条件下的检测", "children": [ { "id": "1-1-1", - "pid": "1-1", "scriptName": "输入:频率 42.5Hz..." }, { "id": "1-1-2", - "pid": "1-1", "scriptName": "输入:频率 50.0Hz..." }, { "id": "1-1-3", - "pid": "1-1", "scriptName": "输入:频率 50.05Hz...." } ] }, { "id": "1-2", - "pid": "1", "scriptName": "电压对频率测量的影响", "children": [ { "id": "1-2-1", - "pid": "1-2", "scriptName": "输入:频率 50.05Hz Ua =10%Un..." }, { "id": "1-2-1", - "pid": "1-2", "scriptName": "输入:频率 51.05Hz Ua =10%Un..." }, { "id": "1-2-2", - "pid": "1-2", "scriptName": "输入:频率 52.05Hz Ua =10%Un..." } ] }, { "id": "1-3", - "pid": "1", "scriptName": "谐波对频率测量的影响", "children": [ { "id": "1-3-1", - "pid": "1-3", "scriptName": "输入:频率 50.05Hz Ua =100%Un..." } ] @@ -408,27 +481,22 @@ const open = async (_deviceId: string, chnNum: number, _scriptType?: string) => }] treeDataUnQualified = [{ "id": "1", - "pid": "0", "scriptName": "频率准确度检测", "children": [ { "id": "1-2", - "pid": "1", "scriptName": "电压对频率测量的影响", "children": [ { "id": "1-2-1", - "pid": "1-2", "scriptName": "输入:频率 50.05Hz Ua =10%Un..." }, { "id": "1-2-1", - "pid": "1-2", "scriptName": "输入:频率 51.05Hz Ua =10%Un..." }, { "id": "1-2-2", - "pid": "1-2", "scriptName": "输入:频率 52.05Hz Ua =10%Un..." } ] diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index b62fad6..3e2a868 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -916,7 +916,7 @@ const openDrawer = (title: string, row: any) => { if(title === '检测数据查询') { - dataCheckPopupRef.value?.open(row.id,-1) + dataCheckPopupRef.value?.open(row.id,'-1',null) } if (title === '误差体系更换') { diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 6ee392b..94e2186 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -54,10 +54,10 @@ :content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'" placement="top"> @@ -127,18 +127,7 @@