联调 正式检测结果页面

This commit is contained in:
guanj
2025-08-22 15:33:57 +08:00
parent 959ae1dee9
commit dd9ca8f956
7 changed files with 664 additions and 475 deletions

View File

@@ -1,127 +1,149 @@
export namespace CheckData { export namespace CheckData {
export interface DataCheck { export interface DataCheck {
scriptName: string, scriptName: string
errorSysId: string, errorSysId: string
dataRule: string, dataRule: string
deviceName: string, deviceName: string
chnNum: string, chnNum: string
deviceId: string
num?: string | number | null
} }
export interface PhaseCheckResult { export interface PhaseCheckResult {
// 检测源定值-标准值 // 检测源定值-标准值
resultData: number, resultData: number
// 装置原始数据-被检值 // 装置原始数据-被检值
data: number, data: number
// 误差值 // 误差值
errorData: number, errorData: number
// 第几次谐波 // 第几次谐波
num?: number, num?: number
//符合、不符合 //符合、不符合
isData?: number, isData?: number
//最大误差值 //最大误差值
radius?: string, radius?: string
unit?: string, unit?: string
}
export interface DataItem {
num: number
isData: number
data: number
resultData: number
radius: string
errorData: number
unit: string
}
export interface TableRow {
isData: number
harmNum: number
radius: string
dataA: DataItem
dataB: DataItem
dataC: DataItem
dataT: DataItem | null
unit: string
} }
/** /**
* 用于定义 查看(设备)通道检测结果响应数据 类型 * 用于定义 查看(设备)通道检测结果响应数据 类型
*/ */
export interface ResCheckResult { export interface ResCheckResult {
dataA?: PhaseCheckResult | null, dataA?: PhaseCheckResult | null
dataB?: PhaseCheckResult | null, dataB?: PhaseCheckResult | null
dataC?: PhaseCheckResult | null, dataC?: PhaseCheckResult | null
dataT?: PhaseCheckResult | null, dataT?: PhaseCheckResult | null
// 第几次谐波 // 第几次谐波
//num: number | null, //num: number | null,
//符合、不符合 //符合、不符合
isData?: number, isData?: number
//最大误差值 //最大误差值
radius?: string, radius?: string
//单位 //单位
unit?: string, unit?: string
} }
/** /**
* 用于定义 查看(设备)通道检测结果表格展示数据 类型 * 用于定义 查看(设备)通道检测结果表格展示数据 类型
*/ */
export interface CheckResult { export interface CheckResult {
stdA?: string, stdA?: string
dataA?: string, dataA?: string
errorA?: string, errorA?: string
maxErrorA?: string, maxErrorA?: string
isDataA?: number, isDataA?: number
unitA?: string, unitA?: string
stdB?: string, stdB?: string
dataB?: string, dataB?: string
errorB?: string, errorB?: string
maxErrorB?: string, maxErrorB?: string
isDataB?: number, isDataB?: number
unitB?: string, unitB?: string
stdC?: string, stdC?: string
dataC?: string, dataC?: string
errorC?: string, errorC?: string
maxErrorC?: string, maxErrorC?: string
isDataC?: number, isDataC?: number
unitC?: string, unitC?: string
stdT?: string, stdT?: string
dataT?: string, dataT?: string
errorT?: string, errorT?: string
maxErrorT?: string, maxErrorT?: string
isDataT?: number, isDataT?: number
unitT?: string, unitT?: string
//最大误差值 //最大误差值
maxError?: string, maxError?: string
unit?: string, unit?: string
//符合、不符合 //符合、不符合
result?: number, result?: number
} }
/** /**
* 用于定义 具体通道的原始数据类型 * 用于定义 具体通道的原始数据类型
*/ */
export interface RawDataItem { export interface RawDataItem {
time?: string, time?: string
harmNum?: number | null, harmNum?: number | null
dataA?: string, dataA?: string
dataB?: string, dataB?: string
dataC?: string, dataC?: string
dataT?: string, dataT?: string
unit?: string | null unit?: string | null
} }
export interface Device { export interface Device {
deviceId: string; //装置序号Id deviceId: string //装置序号Id
deviceName: string; //设备名称 deviceName: string //设备名称
chnNum: number; //设备通道数 chnNum: number //设备通道数
planId: string; //计划Id planId: string //计划Id
devType: string; //设备类型 devType: string //设备类型
devVolt: number; //设备电压 devVolt: number //设备电压
devCurr: number; //设备电流 devCurr: number //设备电流
factorFlag: number; //是否支持系数校准 factorFlag: number //是否支持系数校准
checkResult:number; //检测结果 checkResult: number //检测结果
chnNumList: object[]; //连线存储数据 chnNumList: string[] //连线存储数据
} }
// 用来描述检测脚本类型 // 用来描述检测脚本类型
export interface ScriptItem { export interface ScriptItem {
id: string, id: string
code: string, code: string
scriptName: string, scriptName: string
} }
// 用来描述 检测数据-左侧树结构 // 用来描述 检测数据-左侧树结构
export interface TreeItem { export interface TreeItem {
id: string | null, id: string | null
scriptTypeName: string | null, scriptTypeName: string | null
sourceDesc: string | null, sourceDesc: string | null
harmNum: number | null, harmNum: number | null
index: number | null, index: number | null
fly: number | null, fly: number | null
children: TreeItem[] | null, children: TreeItem[] | null
} }
// 用来描述 通道检测结果 // 用来描述 通道检测结果
@@ -136,15 +158,15 @@ export namespace CheckData {
} }
export interface DeviceCheckResult { export interface DeviceCheckResult {
deviceId: string, deviceId: string
deviceName: string, deviceName: string
chnResult: ChnCheckResultEnum[] //通道检测结果 chnResult: ChnCheckResultEnum[] //通道检测结果
} }
//用来描述 某个脚本测试项对所有通道的检测结果 //用来描述 某个脚本测试项对所有通道的检测结果
export interface ScriptChnItem { export interface ScriptChnItem {
scriptType: string scriptType: string
scriptName?: string //可以不要该属性,有点多余 scriptName?: string //可以不要该属性,有点多余
// 设备 // 设备
devices: Array<DeviceCheckResult> devices: Array<DeviceCheckResult>
@@ -155,7 +177,7 @@ export namespace CheckData {
LOADING = 'var(--el-color-primary)', LOADING = 'var(--el-color-primary)',
SUCCESS = '#91cc75', SUCCESS = '#91cc75',
WARNING = '#e6a23c', WARNING = '#e6a23c',
DANGER = '#f56c6c', DANGER = '#f56c6c'
} }
/** /**
@@ -170,18 +192,17 @@ export namespace CheckData {
* 用于描述 脚本检测结果展示的按钮类型 * 用于描述 脚本检测结果展示的按钮类型
*/ */
export interface ScriptChnViewItem { export interface ScriptChnViewItem {
scriptType: string, scriptType: string
scriptName?: string //脚本项名称,可以不要该属性,有点多余 scriptName?: string //脚本项名称,可以不要该属性,有点多余
// 设备 // 设备
devices: Array<{ devices: Array<{
deviceId: string, deviceId: string
deviceName: string, deviceName: string
chnResult: ButtonResult[], chnResult: ButtonResult[]
}> }>
} }
/** /**
* 定义检测日志类型 * 定义检测日志类型
*/ */
@@ -194,21 +215,16 @@ export namespace CheckData {
* 定义手动检测时,勾选的测试项 * 定义手动检测时,勾选的测试项
*/ */
export interface SelectTestItem { export interface SelectTestItem {
preTest: boolean, preTest: boolean
timeTest: boolean, timeTest: boolean
channelsTest: boolean, channelsTest: boolean
test: boolean test: boolean
} }
//描述比对式检测项描述 //描述比对式检测项描述
export interface CompareTestItem { export interface CompareTestItem {
id: string, id: string
code: string, code: string
name: string, name: string
} }
} }

View File

@@ -1,14 +1,14 @@
import { pa } from 'element-plus/es/locale/index.mjs'; import { pa } from 'element-plus/es/locale/index.mjs'
import http from "@/api"; import http from '@/api'
import {CheckData} from "@/api/check/interface"; import { CheckData } from '@/api/check/interface'
export const getBigTestItem = (params: { export const getBigTestItem = (params: {
reCheckType: number, reCheckType: number
planId: string, planId: string
devIds: string[], devIds: string[]
patternId: string patternId: string
}) => { }) => {
return http.post(`/adPlan/getBigTestItem`, params, {loading: false}); return http.post(`/adPlan/getBigTestItem`, params, { loading: false })
} }
/** /**
@@ -16,12 +16,12 @@ export const getBigTestItem = (params: {
* @param params 当为scriptType为null时表示查询所有脚本类型否则只查询指定脚本类型。当为chnNum为-1时表示查询所有通道否则只查询指定通道。 * @param params 当为scriptType为null时表示查询所有脚本类型否则只查询指定脚本类型。当为chnNum为-1时表示查询所有通道否则只查询指定通道。
*/ */
export const getFormData = (params: { export const getFormData = (params: {
planId: string, planId: string
deviceId: string, deviceId: string
chnNum: string, chnNum: string
scriptType: string | null scriptType: string | null
}) => { }) => {
return http.post("/result/formContent/", params, {loading: false}); return http.post('/result/formContent/', params, { loading: false })
} }
/** /**
@@ -29,13 +29,13 @@ export const getFormData = (params: {
* @param params * @param params
*/ */
export const getTreeData = (params: { export const getTreeData = (params: {
scriptId?: string, scriptId?: string
devId?: string, devId?: string
devNum?: string, devNum?: string
scriptType?: string | null, scriptType?: string | null
code?: string, code?: string
}) => { }) => {
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: false}); return http.post<CheckData.TreeItem[]>('/result/treeData/', params, { loading: false })
} }
/** /**
@@ -43,25 +43,25 @@ export const getTreeData = (params: {
* @param params * @param params
*/ */
export const getTableData = (params: { export const getTableData = (params: {
scriptType: string | null, scriptType: string | null
scriptId: string, scriptId: string
devId: string, devId: string
devNum: string, devNum: string
code: string, code: string
index: number, index: number
}) => { }) => {
return http.post("/result/resultData/", params, {loading: false}); return http.post('/result/resultData/', params, { loading: false })
} }
export const exportRawData = (params: { export const exportRawData = (params: {
scriptType: string | null, scriptType: string | null
scriptId: string, scriptId: string
devId: string, devId: string
devNum: string, devNum: string
code: string, code: string
index: number, index: number
}) => { }) => {
return http.download("/result/exportRawData", params, {loading: false}); return http.download('/result/exportRawData', params, { loading: false })
} }
/** /**
@@ -69,13 +69,39 @@ export const exportRawData = (params: {
* @param params * @param params
*/ */
export const reCalculate = (params: { export const reCalculate = (params: {
planId: string, planId: string
scriptId: string, scriptId: string
errorSysId: string, errorSysId: string
deviceId: string, deviceId: string
code: string code: string
}) => { }) => {
return http.post("/result/reCalculate", params, {loading: true}); return http.post('/result/reCalculate', params, { loading: true })
}
/**
* 获取数据获取基本信息
* @param params
*/
export const getContrastFormContent = (params: {
planId: string
scriptType: string
deviceId: string
chnNum: string | number
num: number | string | null
}) => {
return http.post('/result/getContrastFormContent', params, { loading: false })
}
/**
* 获取检测结果
* @param params
*/
export const getContrastResult = (params: {
planId: string
scriptType: string
deviceId: string
chnNum: string | number
num: number | string | null
}) => {
return http.post('/result/getContrastResult', params, { loading: false })
} }
/** /**
@@ -83,13 +109,13 @@ export const reCalculate = (params: {
* @param params * @param params
*/ */
export const changeErrorSystem = (params: { export const changeErrorSystem = (params: {
planId: string, planId: string
scriptId: string, scriptId: string
errorSysId: string, errorSysId: string
deviceId: string, deviceId: string
code: string code: string
}) => { }) => {
return http.post("/result/changeErrorSystem", params, {loading: true}); return http.post('/result/changeErrorSystem', params, { loading: true })
} }
/** /**
@@ -97,5 +123,5 @@ export const changeErrorSystem = (params: {
* @param code * @param code
*/ */
export const deleteTempTable = (code: string) => { export const deleteTempTable = (code: string) => {
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false}) return http.get(`/result/deleteTempTable?code=${code}`, null, { loading: false })
} }

View File

@@ -1,121 +1,192 @@
<template> <template>
<div class="table-main">
<div class="table-main"> <el-table
<el-table :data="mockTableData" height="357px" :header-cell-style="{ textAlign: 'center' } " :data="prop.tableData"
:cell-style="{ textAlign: 'center' }"> height="357px"
<el-table-column label="A相" > :header-cell-style="{ textAlign: 'center' }"
<el-table-column prop="stdA" :label="'被检值'"/> :cell-style="{ textAlign: 'center' }"
<el-table-column prop="dataA" :label="'标准值'"/> >
<el-table-column prop="isDataA" label="检测结果"> <el-table-column label="A相" v-if="prop.tableData[0].dataT ==null">
<template #default="scope"> <el-table-column prop="stdA" :label="'被检值'">
<el-tooltip effect="dark" placement="bottom"> <template #default="{ row }">
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag> {{ row.dataA.data }}
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag> </template>
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag> </el-table-column>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag> <el-table-column prop="dataA" :label="'标准值'">
</el-tooltip> <template #default="{ row }">
</template> {{ row.dataA.resultData }}
</el-table-column> </template>
</el-table-column> </el-table-column>
<el-table-column label="B相" > <el-table-column prop="isDataA" label="检测结果">
<el-table-column prop="stdB" :label="'被检值'"/> <template #default="{ row }">
<el-table-column prop="dataB" :label="'标准值'"/> <el-tooltip effect="dark" placement="bottom">
<el-table-column prop="isDataB" label="检测结果"> <template #content>
<template #default="scope"> 误差范围{{ addPercentSigns(row.dataA.radius,row.dataA.unit) }}
<el-tooltip effect="dark" placement="bottom"> <br />
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag> 误差值{{ row.dataA.errorData }}
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag> </template>
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag> <el-tag type="success" v-if="row.dataA.isData === 1">符合</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag> <el-tag type="danger" v-if="row.dataA.isData === 2">不符合</el-tag>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="C相" > <el-table-column label="B相" v-if="prop.tableData[0].dataT==null">
<el-table-column prop="stdC" :label="'被检值'"/> <el-table-column prop="stdB" :label="'被检值'">
<el-table-column prop="dataC" :label="'标准值'"/> <template #default="{ row }">
<el-table-column prop="isDataC" label="检测结果"> {{ row.dataB.data }}
<template #default="scope"> </template>
<el-tooltip effect="dark" placement="bottom"> </el-table-column>
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag> <el-table-column prop="dataB" :label="'标准值'">
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag> <template #default="{ row }">
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag> {{ row.dataB.resultData }}
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag> </template>
</el-tooltip> </el-table-column>
</template> <el-table-column prop="isDataB" label="检测结果">
</el-table-column> <template #default="{ row }">
</el-table-column> <el-tooltip effect="dark" placement="bottom">
</el-table> <template #content>
</div> 误差范围{{ addPercentSigns(row.dataB.radius,row.dataB.unit) }}
<br />
误差值{{ row.dataB.errorData }}
</template>
<el-tag type="success" v-if="row.dataB.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataB.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="C相" v-if="prop.tableData[0].dataT==null">
<el-table-column prop="stdC" :label="'被检值'" >
<template #default="{ row }">
{{ row.dataC.data }}
</template>
</el-table-column>
<el-table-column prop="dataC" :label="'标准值'">
<template #default="{ row }">
{{ row.dataC.resultData }}
</template>
</el-table-column>
<el-table-column prop="isDataC" label="检测结果">
<template #default="{ row }">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ addPercentSigns(row.dataC.radius,row.dataC.unit) }}
<br />
误差值{{ row.dataC.errorData }}
</template>
<el-tag type="success" v-if="row.dataC.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataC.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="T相" v-if="prop.tableData[0].dataT">
<el-table-column prop="stdT" :label="'被检值'" >
<template #default="{ row }">
{{ row.dataT.data }}
</template>
</el-table-column>
<el-table-column prop="dataT" :label="'标准值'">
<template #default="{ row }">
{{ row.dataT.resultData }}
</template>
</el-table-column>
<el-table-column prop="isDataT" label="检测结果">
<template #default="{ row }">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ addPercentSigns(row.dataT.radius,row.dataT.unit) }}
<br />
误差值{{ row.dataT.errorData }}
</template>
<el-tag type="success" v-if="row.dataT.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataT.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</template> </template>
<script lang="tsx" setup> <script lang="tsx" setup>
import {} from 'vue'
import { CheckData } from '@/api/check/interface'
const prop = defineProps({
tableData: {
type: Array as () => CheckData.TableRow[],
default: []
}
})
// 添加单位
const addPercentSigns = (text: string,unit: string) => {
return text
.split('~')
.map(part => `${part}${unit}`)
.join('~')
}
const mockTableData = [ const mockTableData = [
{ {
stdA: "220.00", stdA: '220.00',
dataA: "219.85", dataA: '219.85',
isDataA: 1, isDataA: 1,
maxErrorA: "±0.5%", maxErrorA: '±0.5%',
errorA: "0.068%", errorA: '0.068%',
unitA: "%", unitA: '%',
stdB: "220.00", stdB: '220.00',
dataB: "220.12", dataB: '220.12',
isDataB: 1, isDataB: 1,
maxErrorB: "±0.5%", maxErrorB: '±0.5%',
errorB: "0.055%", errorB: '0.055%',
unitB: "%", unitB: '%',
stdC: "220.00", stdC: '220.00',
dataC: "219.95", dataC: '219.95',
isDataC: 1, isDataC: 1,
maxErrorC: "±0.5%", maxErrorC: '±0.5%',
errorC: "0.023%", errorC: '0.023%',
unitC: "%", unitC: '%',
stdT: "0.15", stdT: '0.15',
dataT: "0.12", dataT: '0.12',
isDataT: 1, isDataT: 1,
maxErrorT: "±0.2", maxErrorT: '±0.2',
errorT: "0.03", errorT: '0.03',
unitT: "", unitT: '',
unit: "V" unit: 'V'
} }
]; ]
</script> </script>
<style scoped> <style scoped>
.form-grid { .form-grid {
display: flex; display: flex;
flex-direction: row; /* 横向排列 */ flex-direction: row; /* 横向排列 */
flex-wrap: wrap; /* 允许换行 */ flex-wrap: wrap; /* 允许换行 */
} }
.form-grid .el-form-item { .form-grid .el-form-item {
flex: 1 1 30%; /* 控件宽度 */ flex: 1 1 30%; /* 控件宽度 */
margin-right: 20px; /* 控件间距 */ margin-right: 20px; /* 控件间距 */
} }
.form-grid .el-form-item:last-child { .form-grid .el-form-item:last-child {
margin-right: 0; /* 最后一个控件不需要右边距 */ margin-right: 0; /* 最后一个控件不需要右边距 */
} }
.dialog-footer { .dialog-footer {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */ margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
} }
.el-tabs { .el-tabs {
margin-bottom: 20px; /* 添加底部边距 */ margin-bottom: 20px; /* 添加底部边距 */
} }
.el-table th, .el-table td { .el-table th,
text-align: center; /* 所有单元格文字居中 */ .el-table td {
text-align: center; /* 所有单元格文字居中 */
} }
</style>
</style>

View File

@@ -1,248 +1,311 @@
<template> <template>
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close" <el-dialog
v-bind="dialogBig" :draggable="false" width="1400px"> :append-to-body="appendToBody"
<div class="data-check-dialog"> class="dialog"
<div > title="数据查询"
<el-form :model='formContent' label-width="auto" class="form-three "> :model-value="visible"
<el-form-item label="误差体系"> @close="close"
<el-select :disabled="checkStore.showDetailType===2 || checkStore.showDetailType===0" v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" v-bind="dialogBig"
@change="handleErrorSysChange"> :draggable="false"
<el-option width="1400px"
v-for="(option) in pqErrorList" >
:key="option.id" <div class="data-check-dialog">
:label="option.name" <div>
:value="option.id"/> <el-form :model="formContent" label-width="auto" class="form-three">
</el-select> <el-form-item label="误差体系">
</el-form-item> <el-select
<el-form-item label="数据原则"> :disabled="checkStore.showDetailType === 2 || checkStore.showDetailType === 0"
<el-input v-model='formContent.dataRule' :disabled="true"/> v-model="formContent.errorSysId"
</el-form-item> placeholder="请选择误差体系"
<el-form-item label="设备名称"> autocomplete="off"
<el-input v-model='formContent.deviceName' :disabled="true"/> >
</el-form-item> <el-option
<el-form-item label='通道号'> v-for="option in pqErrorList"
<el-select v-model="formContent.chnNum"> :key="option.id"
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/> :label="option.name"
</el-select> :value="option.id"
</el-form-item> />
<el-form-item v-if="checkStore.showDetailType===1"> </el-select>
<el-button type="primary" :icon="Postcard" >报告生成</el-button> </el-form-item>
</el-form-item> <el-form-item label="数据原则">
<el-form-item v-if="checkStore.showDetailType===0"> <el-input v-model="formContent.dataRule" :disabled="true" />
<el-button type="primary" :icon="Histogram" >重新计算</el-button> </el-form-item>
</el-form-item> <el-form-item label="设备名称">
</el-form> <el-input v-model="formContent.deviceName" :disabled="true" />
</div> </el-form-item>
<div class="data-check-body"> <el-form-item label="通道号">
<div class="content-right"> <el-select v-model="formContent.chnNum">
<div class="content-right-title"> <el-option v-for="item in chnList" :key="item" :label="item" :value="item" />
<div style="width: 840px;"> </el-select>
<span class="content-right-title-text">当前检测项目</span> </el-form-item>
<span style="color: var(--el-color-primary);">频率</span> <el-form-item v-if="checkStore.showDetailType === 1">
<el-button type="primary" :icon="Postcard">报告生成</el-button>
</el-form-item>
<el-form-item v-if="checkStore.showDetailType === 0">
<el-button type="primary" :icon="Histogram">重新计算</el-button>
</el-form-item>
</el-form>
</div> </div>
<el-form-item style="margin-left: 280px;margin-bottom:0px !important;width: 280px;" label='测试项'> <div class="data-check-body">
<el-cascader v-model="currentCheckItem" :options="options" clearable /> <div class="content-right">
</el-form-item> <div class="content-right-title">
</div> <div style="width: 840px">
<span class="content-right-title-text">当前检测项目</span>
<span style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
</div>
<el-form-item
style="margin-left: 280px; margin-bottom: 0px !important; width: 280px"
label="测试项"
>
<el-select v-model="currentCheckItem">
<el-option
v-for="item in tesList"
:key="item"
:label="item.replace(/\.0$/, '')"
:value="item"
/>
</el-select>
</el-form-item>
</div>
<div class="content-right-Tabs"> <div class="content-right-Tabs">
<el-tabs type="border-card" v-model="activeTab"> <el-tabs type="border-card" v-model="activeTab">
<el-tab-pane label="检测结果" name="resultTab"> <el-tab-pane label="检测结果" name="resultTab">
<CompareDataCheckResultTable :tableData="checkResultData" :currentScriptTypeName="currentScriptTypeName"/> <CompareDataCheckResultTable
</el-tab-pane> :tableData="currentCheckResultData"
<el-tab-pane label="原始数据" name="rawDataTab"> :currentScriptTypeName="currentScriptTypeName"
<CompareDataCheckRawDataTable :tableData="rawTableData" :currentScriptTypeName="currentScriptTypeName" @exportRawDataHandler="exportRawDataHandler"/> />
</el-tab-pane> </el-tab-pane>
</el-tabs> <el-tab-pane label="原始数据" name="rawDataTab">
</div> <CompareDataCheckRawDataTable
:tableData="rawTableData[currentCheckItem]"
:currentScriptTypeName="currentScriptTypeName"
@exportRawDataHandler="exportRawDataHandler"
/>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</div> </div>
</div> </el-dialog>
</div>
</el-dialog>
</template> </template>
<script setup lang='ts'> <script setup lang="ts">
import {dialogBig} from '@/utils/elementBind' import { dialogBig } from '@/utils/elementBind'
import {reactive, ref, watch} from 'vue' import { reactive, ref, watch, computed } from 'vue'
import CompareDataCheckResultTable from './compareDataCheckResultTable.vue' import CompareDataCheckResultTable from './compareDataCheckResultTable.vue'
import CompareDataCheckRawDataTable from './compareDataCheckRawDataTable.vue' import CompareDataCheckRawDataTable from './compareDataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface"; import { CheckData } from '@/api/check/interface'
import {useCheckStore} from "@/stores/modules/check"; import { useCheckStore } from '@/stores/modules/check'
import {Histogram, Postcard} from "@element-plus/icons-vue"; import { Histogram, Postcard } from '@element-plus/icons-vue'
import {getPqErrSysList} from '@/api/plan/plan' import { getPqErrSysList } from '@/api/plan/plan'
import { getFormData} from "@/api/check/test"; import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useDictStore } from '@/stores/modules/dict'
const {appendToBody} = withDefaults(defineProps<{ import { getContrastFormContent, getContrastResult, getBigTestItem } from '@/api/check/test'
appendToBody: boolean
}>(), {appendToBody: true})
const { appendToBody } = withDefaults(
defineProps<{
appendToBody: boolean
}>(),
{ appendToBody: true }
)
const checkStore = useCheckStore() const checkStore = useCheckStore()
const modeStore = useModeStore()
const dictStore = useDictStore()
const visible = ref(false) const visible = ref(false)
const treeRef = ref() const treeRef = ref()
const searchValue = ref<string>('') const searchValue = ref<string>('')
const pqErrorList = reactive<{ id: string; name: string; }[]>([]) const pqErrorList = reactive<{ id: string; name: string }[]>([])
const activeTab = ref('resultTab') const activeTab = ref('resultTab')
const currentCheckItem = ref<any>() const currentCheckItem = ref<any>()
let deviceId: string = '' const rowList: any = ref([])
let scriptType: string | null = null let scriptType: string | null = null
watch(searchValue, (val) => { watch(searchValue, val => {
treeRef.value!.filter(val) treeRef.value!.filter(val)
}) })
// 表单数据 // 表单数据
const formContent = reactive<CheckData.DataCheck>({ const formContent = reactive<CheckData.DataCheck>({
scriptName: '', scriptName: '',
errorSysId: '', errorSysId: '',
dataRule: '', dataRule: '',
deviceName: '', deviceName: '',
chnNum: '', chnNum: '',
deviceId: '',
num: null
}) })
// 通道下拉列表 // 通道下拉列表
let chnList: any[] = [] const chnList: any = ref([])
// 当前检测项目名称 // 当前检测项目名称
const currentScriptTypeName = ref('') const currentScriptTypeName = ref('')
// 检测结果表格数据 // 检测结果表格数据
const checkResultData = reactive<CheckData.CheckResult[]>([]) const checkResultData = ref<CheckData.CheckResult[]>([])
// 原始数据表格数据 // 原始数据表格数据
const rawTableData = reactive<CheckData.RawDataItem[]>([]) const rawTableData = ref<CheckData.RawDataItem[]>([])
const tesList: any = ref([])
// 检测结果
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { const currentCheckResultData = computed(() => {
visible.value = true; const data = checkResultData.value[currentCheckItem.value]
deviceId = _deviceId return Array.isArray(data) ? data : []
scriptType = null })
// 设置默认选中第一个选项 const open = async (row: any, chnNum: string, deviceId: string | null, source: number) => {
if (options.length > 0) { if (source == 1) {
const firstOption = options[0]; // 正式检测进入页面
currentCheckItem.value = [firstOption.value]; rowList.value = row
formContent.chnNum = chnNum
// 如果第一个选项有子选项,默认也选中第一个子选项 formContent.deviceId = deviceId || ''
if (firstOption.children && firstOption.children.length > 0) {
currentCheckItem.value.push(firstOption.children[0].value);
} }
} visible.value = true
scriptType = null
formContent.errorSysId = checkStore.plan.errorSysId
pqErrorList.length = 0
formContent.errorSysId = checkStore.plan.errorSysId // 获取误差体系
let { data: resPqErrorList } = await getPqErrSysList()
pqErrorList.length = 0 Object.assign(pqErrorList, resPqErrorList)
let {data: resPqErrorList} = await getPqErrSysList() // 获取基本信息
Object.assign(pqErrorList, resPqErrorList) await getBasicInformation()
await getTestItem()
await getResults()
}
//获取基本信息
const getBasicInformation = async () => {
getContrastFormContent({
planId: checkStore.plan.id,
scriptType: rowList.value.scriptType,
deviceId: formContent.deviceId,
chnNum: formContent.chnNum,
num: formContent.num ?? null
}).then((res: any) => {
formContent.dataRule = res.data.dataRule
formContent.deviceName = res.data.deviceName
formContent.errorSysId = res.data.errorSysId
let chnMap: string[] = []
for (let key in res.data.chnMap) {
chnMap.push(key)
}
chnList.value = chnMap
})
}
// 获取测试项
const getTestItem = async () => {
getBigTestItem({
reCheckType: 1,
planId: checkStore.plan.id,
devIds: [formContent.deviceId],
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
}).then((res: any) => {})
}
// 获取结果
const getResults = async () => {
getContrastResult({
planId: checkStore.plan.id,
scriptType: rowList.value.scriptType,
deviceId: formContent.deviceId,
chnNum: formContent.chnNum,
num: formContent.num ?? null
}).then((res: any) => {
let list: string[] = []
for (let key in res.data.resultMap) {
list.push(key)
}
currentCheckItem.value = list[0]
tesList.value = list
checkResultData.value = res.data.resultMap
rawTableData.value = res.data.rawDataMap
})
} }
const close = () => { const close = () => {
visible.value = false; visible.value = false
// 可以在这里添加其他清理逻辑 // 可以在这里添加其他清理逻辑
} }
const options = [
{
value: 'guide',
label: '谐波电压',
children: [
{
value: 'disciplines',
label: '2次',
},
{
value: 'disciplines',
label: '3次',
},
],
},
]
defineExpose({ defineExpose({
open open
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog { .dialog {
display: flex;
flex-direction: column;
overflow-y: hidden;
overflow-x: hidden;
.data-check-dialog {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: hidden; overflow-y: hidden;
overflow-x: hidden;
.data-check-head { .data-check-dialog {
display: flex;
flex-direction: row;
width: 100%;
}
.data-check-body {
height: 500px;
width: 100%;
display: flex;
flex-direction: row;
.content-left-tree {
width: 18%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; overflow-y: hidden;
max-height: 495px;
padding: 10px 0.5% 0px 0.5%; .data-check-head {
border: 1px solid #ccc; display: flex;
overflow-y: auto; flex-direction: row;
overflow-x: auto; width: 100%;
.content-tree {
width: 100%;
height: 100%;
margin-top: 10px;
.custom-tree-node {
overflow-x: hidden !important;
white-space: nowrap !important;
text-overflow: ellipsis !important;
}
} }
}
.content-right { .data-check-body {
width: 82%; height: 500px;
margin-left: 10px; width: 100%;
flex: 1; display: flex;
flex-direction: row;
.content-right-title { .content-left-tree {
display: flex; width: 18%;
padding: 10px 0; display: flex;
margin-top: 0px; flex-direction: column;
line-height: 1.5; align-items: center;
max-height: 495px;
.content-right-title-text { padding: 10px 0.5% 0px 0.5%;
font-size: 14px; border: 1px solid #ccc;
font-weight: bold; overflow-y: auto;
} overflow-x: auto;
.content-tree {
width: 100%;
height: 100%;
margin-top: 10px;
.custom-tree-node {
overflow-x: hidden !important;
white-space: nowrap !important;
text-overflow: ellipsis !important;
}
}
}
.content-right {
width: 82%;
margin-left: 10px;
flex: 1;
.content-right-title {
display: flex;
padding: 10px 0;
margin-top: 0px;
line-height: 1.5;
.content-right-title-text {
font-size: 14px;
font-weight: bold;
}
}
}
.content-right-Tabs {
box-sizing: border-box;
margin-top: 10px;
margin-bottom: 10px;
max-height: 400px;
}
} }
}
.content-right-Tabs {
box-sizing: border-box;
margin-top: 10px;
margin-bottom: 10px;
max-height: 400px;
}
} }
}
} }
</style> </style>

View File

@@ -40,7 +40,7 @@
<el-table-column <el-table-column
v-for="(chnItem, index2) in checkStore.chnNumList" v-for="(chnItem, index2) in checkStore.chnNumList"
:key="`${item.deviceId}${chnItem}`" :key="`${item.deviceId}${chnItem}`"
:label="'通道' + chnItem.label" :label="'通道' + chnItem"
align="center" align="center"
> >
<template #default="{ row }"> <template #default="{ row }">
@@ -70,7 +70,7 @@
" "
:color="row.devices[index1].chnResult[index2].color" :color="row.devices[index1].chnResult[index2].color"
size="small" size="small"
@click="handleClick(item, chnItem, row.scriptType)" @click="handleClick(row, chnItem, row.scriptType)"
style="align-self: center" style="align-self: center"
> >
<el-icon <el-icon
@@ -329,6 +329,8 @@ watch(
// 失败 // 失败
if (newValue.data != undefined) return if (newValue.data != undefined) return
setLogList('error', str + '失败!') setLogList('error', str + '失败!')
emit('update:testStatus', 'error')
stopTimeCount()
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!') if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
break break
} }
@@ -361,17 +363,16 @@ watch(
Object.assign(checkResult, result) Object.assign(checkResult, result)
setLogList('info', '检测完成!') setLogList('info', '检测完成!')
stopTimeCount() stopTimeCount()
updatePercentage()
break break
case 25003: case 25003:
setLogList('error', '检测失败!') setLogList('error', '检测失败!')
stopTimeCount() stopTimeCount()
updatePercentage()
break break
default: default:
if (newValue.code != 10201) { if (newValue.code != 10201) {
setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data) setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data)
updatePercentage()
} }
break break
@@ -382,6 +383,7 @@ watch(
switch (newValue.operateCode) { switch (newValue.operateCode) {
case 'Contrast_Dev': case 'Contrast_Dev':
setLogList('error', '设备服务端连接失败!') setLogList('error', '设备服务端连接失败!')
stopTimeCount()
break break
} }
break break
@@ -393,6 +395,7 @@ watch(
type: 'error' type: 'error'
}) })
setLogList('error', '当前流程存在异常结束!') setLogList('error', '当前流程存在异常结束!')
stopTimeCount()
break break
case 'socket_timeout': case 'socket_timeout':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', { ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
@@ -400,6 +403,7 @@ watch(
type: 'error' type: 'error'
}) })
setLogList('error', '设备连接异常,请检查设备连接情况!') setLogList('error', '设备连接异常,请检查设备连接情况!')
stopTimeCount()
break break
case 'server_error': case 'server_error':
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', { ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
@@ -407,6 +411,7 @@ watch(
type: 'error' type: 'error'
}) })
setLogList('error', '服务端主动关闭连接!') setLogList('error', '服务端主动关闭连接!')
stopTimeCount()
break break
case 'device_error': case 'device_error':
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', { ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
@@ -414,6 +419,7 @@ watch(
type: 'error' type: 'error'
}) })
setLogList('error', '设备主动关闭连接!') setLogList('error', '设备主动关闭连接!')
stopTimeCount()
break break
} }
}, },
@@ -501,6 +507,7 @@ const showTestLog = () => {
// 初始化检测脚本数据 // 初始化检测脚本数据
const initScriptData = async () => { const initScriptData = async () => {
scriptData = []
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '' const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
let response: any = await getBigTestItem({ let response: any = await getBigTestItem({
reCheckType: checkStore.reCheckType, reCheckType: checkStore.reCheckType,
@@ -675,41 +682,41 @@ const getResult = (devices: CheckData.DeviceCheckResult[] = []) => {
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道 // 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (item: any, chnNum: number, scriptType: string) => { const handleClick = (item: any, chnNum: number, scriptType: string) => {
// let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType) let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
// let flag = -1 let flag = -1
// if (checkResultItem) { if (checkResultItem) {
// let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId) let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
// if (device) { if (device) {
// let chnResult = device.chnResult let chnResult = device.chnResult
// if (chnNum === -1) { if (chnNum === -1) {
// if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.TIMEOUT) !== -1) { if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.TIMEOUT) !== -1) {
// flag = 0 flag = 0
// } }
// if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) { if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) {
// flag = 1 flag = 1
// } }
// } else { } else {
// if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.TIMEOUT) { if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.TIMEOUT) {
// flag = 0 flag = 0
// } }
// if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) { if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) {
// flag = 1 flag = 1
// } }
// } }
// } }
// } }
// if (flag === 0) { if (flag === 0) {
// ElMessageBox.alert('连接超时,请检查设备通讯是否正常', '连接超时', { ElMessageBox.alert('连接超时,请检查设备通讯是否正常', '连接超时', {
// confirmButtonText: '确定', confirmButtonText: '确定',
// type: 'warning', type: 'warning',
// }) })
// } }
// if (flag === -1 || flag === 1) { if (flag === -1 || flag === 1) {
// checkStore.setShowDetailType(2) checkStore.setShowDetailType(2)
console.log('handleTest', item.deviceId, chnNum, scriptType)
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType) dataCheckSingleChannelSingleTestPopupRef.value?.open(item, chnNum+'', item.devices[0].deviceId,1)
//} }
} }
const handlePause = () => { const handlePause = () => {
@@ -723,9 +730,9 @@ const initializeParameters = async () => {
await initScriptData() await initScriptData()
initDeviceList() initDeviceList()
initCheckResult() initCheckResult()
percentage.value = 0 percentage.value = 0
timeCount.value = 0
timeView.value = '00:00:00'
testLogList.splice(0, testLogList.length, { testLogList.splice(0, testLogList.length, {
type: 'info', type: 'info',
log: checkStore.selectTestItems.preTest ? '正在检测,请稍等...' : '暂无数据,等待检测开始' log: checkStore.selectTestItems.preTest ? '正在检测,请稍等...' : '暂无数据,等待检测开始'
@@ -754,9 +761,10 @@ const handleResumeTest = () => {
} }
// //
onMounted(() => { onMounted(() => {
console.log(123123) if (!checkStore.selectTestItems.preTest) {
// 判断是否预检测
initializeParameters() initializeParameters()
}
}) })
defineExpose({ defineExpose({

View File

@@ -63,12 +63,12 @@
> >
开始检测 开始检测
</el-button> </el-button>
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled> <!-- <el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff; margin-right: 8px"> <el-icon class="loading-box" style="color: #fff; margin-right: 8px">
<component :is="Refresh" /> <component :is="Refresh" />
</el-icon> </el-icon>
初始化中 初始化中
</el-button> </el-button> -->
<el-button type="primary" v-if="TestStatus == 'process'" :icon="VideoPause" @click="handlePause()"> <el-button type="primary" v-if="TestStatus == 'process'" :icon="VideoPause" @click="handlePause()">
停止检测 停止检测
</el-button> </el-button>
@@ -81,7 +81,6 @@
<el-button type="warning" v-if="TestStatus == 'paused'" :icon="VideoPlay" @click="sendResume"> <el-button type="warning" v-if="TestStatus == 'paused'" :icon="VideoPlay" @click="sendResume">
继续检测 继续检测
</el-button> </el-button>
<el-button <el-button
type="warning" type="warning"
:icon="VideoPlay" :icon="VideoPlay"
@@ -259,9 +258,17 @@ const open = async (
//预检测-重新检测 //预检测-重新检测
const handleSubmitAgain = async () => { const handleSubmitAgain = async () => {
stepsActiveIndex.value = 1 console.log("🚀 ~ handleSubmitAgain ~ stepsActive.value:", stepsActiveIndex.value,stepsActiveView.value , stepsActive.value)
if(checkStore.selectTestItems.preTest){
stepsActiveIndex.value = 1
stepsActiveView.value = 1 stepsActiveView.value = 1
stepsActive.value = 1 stepsActive.value = 1
}else{
stepsActiveIndex.value = 1
stepsActiveView.value = 2
stepsActive.value = 2
}
let count = 0 let count = 0
for (let key in checkStore.selectTestItems) { for (let key in checkStore.selectTestItems) {
if (checkStore.selectTestItems[key]) { if (checkStore.selectTestItems[key]) {
@@ -319,6 +326,8 @@ const handleSubmitFast = async () => {
}) })
preTestStatus.value = 'start' preTestStatus.value = 'start'
if (checkStore.selectTestItems.test) { if (checkStore.selectTestItems.test) {
console.log(111111);
testRef.value.initializeParameters() testRef.value.initializeParameters()
testRef.value.showTestLog() testRef.value.showTestLog()
} }
@@ -369,7 +378,6 @@ watch(TestStatus, function (newValue, oldValue) {
watch(stepsActiveIndex, function (newValue, oldValue) { watch(stepsActiveIndex, function (newValue, oldValue) {
if (checkStore.selectTestItems.test && checkStore.selectTestItems.preTest && newValue == 2) { if (checkStore.selectTestItems.test && checkStore.selectTestItems.preTest && newValue == 2) {
setTimeout(() => { setTimeout(() => {
console.log(1);
testRef.value.initializeParameters() testRef.value.initializeParameters()
testRef.value.showTestLog() testRef.value.showTestLog()

View File

@@ -214,15 +214,12 @@ const handleNext = async () => {
return return
} }
// const sourceKey = edge.source.replace('被检通道-', '').replace('-', '_'); // const sourceKey = edge.source.replace('被检通道-', '').replace('-', '_');
let chnNumList: object[] = [] let chnNumList: string[] = []
await edges.value.forEach(edge => { await edges.value.forEach(edge => {
const match = edge.source.split('-') const match = edge.source.split('-')
if (match) { if (match) {
chnNumList.push({ chnNumList.push(match[2])
deviceId: match[1],
label: match[2]
})
} }
}) })