This commit is contained in:
caozehui
2025-01-08 14:33:47 +08:00
parent a1d113562b
commit 8125d60105
3 changed files with 82 additions and 92 deletions

View File

@@ -45,21 +45,21 @@ export namespace CheckData {
* 用于定义 查看(设备)通道检测结果表格展示数据 类型 * 用于定义 查看(设备)通道检测结果表格展示数据 类型
*/ */
export interface CheckResult { export interface CheckResult {
aStd?: string, stdA?: string,
aData?: string, dataA?: string,
aError?: string, errorA?: string,
isDataA?: number, isDataA?: number,
bStd?: string, stdB?: string,
bData?: string, dataB?: string,
bError?: string, errorB?: string,
isDataB?: number, isDataB?: number,
cStd?: string, stdC?: string,
cData?: string, dataC?: string,
cError?: string, errorC?: string,
isDataC?: number, isDataC?: number,
tStd?: string, stdT?: string,
tData?: string, dataT?: string,
tError?: string, errorT?: string,
isDataT?: number, isDataT?: number,
//最大误差值 //最大误差值
@@ -74,12 +74,12 @@ export namespace CheckData {
*/ */
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 {

View File

@@ -10,14 +10,14 @@
<!-- </el-table-column>--> <!-- </el-table-column>-->
<template v-if="phaseT === 0"> <template v-if="phaseT === 0">
<el-table-column :label="`A${unit}`"> <el-table-column :label="`A${unit}`">
<el-table-column prop="aStd" width="100" label="标准值"/> <el-table-column prop="stdA" width="100" label="标准值"/>
<el-table-column prop="aData" width="100" label="被检值"/> <el-table-column prop="dataA" width="100" label="被检值"/>
<el-table-column prop="isDataA" label="检测结果"> <el-table-column prop="isDataA" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差{{ maxErrorView }}<br/> 最大误差{{ maxErrorStr }}<br/>
误差值{{ scope.row.aError }} {{ unit }} 误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag> <el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
@@ -25,23 +25,16 @@
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="aError" width="92" label="误差值">-->
<!-- <template #default="scope">-->
<!-- <span v-if="scope.row.isDataA === 1">{{scope.row.aError}}</span>-->
<!-- <el-tag type="danger" v-if="scope.row.isDataA === 2">{{scope.row.aError}}</el-tag>-->
<!-- <span v-if="scope.row.isDataA === 4">/</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table-column> </el-table-column>
<el-table-column :label="`B${unit}`"> <el-table-column :label="`B${unit}`">
<el-table-column prop="bStd" width="100" label="标准值"/> <el-table-column prop="stdB" width="100" label="标准值"/>
<el-table-column prop="bData" width="100" label="被检值"/> <el-table-column prop="dataB" width="100" label="被检值"/>
<el-table-column prop="isDataB" label="检测结果"> <el-table-column prop="isDataB" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差{{ maxErrorView }}<br/> 最大误差{{ maxErrorStr }}<br/>
误差值{{ scope.row.bError }} {{ unit }} 误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag> <el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
@@ -51,14 +44,14 @@
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column :label="`C${unit}`"> <el-table-column :label="`C${unit}`">
<el-table-column prop="cStd" width="100" label="标准值"/> <el-table-column prop="stdC" width="100" label="标准值"/>
<el-table-column prop="cData" width="100" label="被检值"/> <el-table-column prop="dataC" width="100" label="被检值"/>
<el-table-column prop="isDataC" label="检测结果"> <el-table-column prop="isDataC" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差 {{ maxErrorView }}<br/> 最大误差 {{ maxErrorStr }}<br/>
误差值{{ scope.row.cError }} {{ unit }} 误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag> <el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
@@ -67,27 +60,18 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="maxError" :label="`最大误差(${unit}`"/>-->
<!-- <el-table-column prop="result" label="检测结果" width="88">-->
<!-- <template #default="scope">-->
<!-- <el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>-->
<!-- <span v-if="scope.row.result === 1">符合</span>-->
<!-- <span v-if="scope.row.result === 4">/</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</template> </template>
<template v-if="phaseT === 1"> <template v-if="phaseT === 1">
<el-table-column :label="`T${unit}`"> <el-table-column :label="`T${unit}`">
<el-table-column prop="tStd" label="标准值"/> <el-table-column prop="stdT" label="标准值"/>
<el-table-column prop="tData" label="被检值"/> <el-table-column prop="dataT" label="被检值"/>
<el-table-column prop="tError" label="误差值"/> <el-table-column prop="isDataT" label="检测结果">
<el-table-column prop="result" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差 {{ maxErrorView }}<br/> 最大误差 {{ maxErrorStr }}<br/>
误差值{{ scope.row.tError }} {{ unit }} 误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag> <el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
@@ -125,18 +109,11 @@ const unit = computed(() => {
}) })
const phaseT = computed(() => { const phaseT = computed(() => {
let result = 0; return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
if (tableData.length > 0) {
result = !tableData[0].tData ? 0 : 1;
}
return result;
}) })
const maxErrorView = computed((data) => { const maxErrorStr = computed((data) => {
let result = ''; let result = tableData[0].maxError ?? '/'
if (tableData.length > 0) {
result = tableData[0].maxError ? tableData[0].maxError : '';
}
let idx = result.indexOf('~'); let idx = result.indexOf('~');
if (idx > 0) { if (idx > 0) {
result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value; result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;

View File

@@ -26,7 +26,7 @@
<div class="data-check-body"> <div class="data-check-body">
<div class="content-left-tree"> <div class="content-left-tree">
<div style="width: 190px;"> <div style="width: 99%;">
<el-input <el-input
placeholder='请输入测试项名称' placeholder='请输入测试项名称'
clearable clearable
@@ -50,12 +50,12 @@
<div class="content-right"> <div class="content-right">
<div class="content-right-title"> <div class="content-right-title">
<div style="width: 680px;"> <div style="width: 750px;">
<span class="content-right-title-text">当前检测项目 <span class="content-right-title-text">当前检测项目
<el-popover trigger="hover" :content="currentDesc? currentDesc : '无'" :width="popoverWidth" placement="right"> <el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
<template #reference> <template #reference>
<el-button type="text" style="font-size: 14px;"> <el-button type="text" style="font-size: 14px;">
{{ currentScriptTypeName ? currentScriptTypeName : '无' }} {{ currentScriptTypeName }}
</el-button> </el-button>
</template> </template>
</el-popover> </el-popover>
@@ -164,7 +164,7 @@ let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } =
const checkResultData = reactive<CheckData.CheckResult[]>([]) const checkResultData = reactive<CheckData.CheckResult[]>([])
const popoverWidth: ComputedRef<string> = computed(() => { const popoverWidth: ComputedRef<string> = computed(() => {
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 140 : 0)}px` return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
}) })
// 原始数据表格数据 // 原始数据表格数据
@@ -206,9 +206,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
updateTreeFly(resTreeDataTemp, 2) updateTreeFly(resTreeDataTemp, 2)
Object.assign(treeDataAll, resTreeDataTemp) Object.assign(treeDataAll, resTreeDataTemp)
console.log("树数据", treeDataAll)
// await handleSwitchChange(0)
defaultOperate() defaultOperate()
await updateTableData() await updateTableData()
} }
@@ -219,7 +217,13 @@ watch(currentHarmNum, (newVal, oldVal) => {
if (newVal !== '-1') { if (newVal !== '-1') {
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString()) let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
setCheckResultData(resCheckResult) setCheckResultData(resCheckResult)
setRawData(resTableData.rawData.get(newVal.toString()))
let tempRawData = resTableData.rawData.get(newVal.toString())
if (tempRawData) {
setRawData(tempRawData)
} else {
setRawData([])
}
} }
}) })
@@ -229,7 +233,13 @@ watch(currentCheckItem, (newVal, oldVal) => {
let key = newVal.toString() === 'Voltage' ? '电压幅值' : '持续时间' let key = newVal.toString() === 'Voltage' ? '电压幅值' : '持续时间'
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(key) let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(key)
setCheckResultData(resCheckResult) setCheckResultData(resCheckResult)
setRawData(resTableData.rawData.get(key))
let tempRawData = resTableData.rawData.get(key)
if (tempRawData) {
setRawData(tempRawData)
} else {
setRawData([])
}
} }
}) })
@@ -382,8 +392,10 @@ const close = () => {
treeDataAll.length = 0 treeDataAll.length = 0
harmNumList.length = 0 harmNumList.length = 0
currentHarmNum.value = '-1' currentHarmNum.value = '-1'
currentCheckItem.value = ''
checkResultData.length = 0 checkResultData.length = 0
rawTableData.length = 0 rawTableData.length = 0
checkList.length = 0
defaultExpandedKeys = [] defaultExpandedKeys = []
checkIndex.value = '' checkIndex.value = ''
activeTab.value = 'resultTab' activeTab.value = 'resultTab'
@@ -394,21 +406,22 @@ const close = () => {
}; };
const setCheckResultData = (data: CheckData.ResCheckResult) => { const setCheckResultData = (data: CheckData.ResCheckResult) => {
console.log("检测结果", data);
let result: CheckData.CheckResult[] = [] let result: CheckData.CheckResult[] = []
if (data.dataA && data.dataB && data.dataC) { if (data.dataA != null && data.dataB != null && data.dataC != null) {
result.push({ result.push({
aStd: numberToFixed(data.dataA?.resultData), stdA: numberToFixed(data.dataA.resultData),
aData: numberToFixed(data.dataA?.data), dataA: numberToFixed(data.dataA.data),
aError: getError(data.dataA?.resultData, data.dataA?.data), errorA: getError(data.dataA.resultData, data.dataA.data),
isDataA: data.dataA?.isData, isDataA: data.dataA.isData,
bStd: numberToFixed(data.dataB?.resultData), stdB: numberToFixed(data.dataB.resultData),
bData: numberToFixed(data.dataB?.data), dataB: numberToFixed(data.dataB.data),
bError: getError(data.dataB?.resultData, data.dataB?.data), errorB: getError(data.dataB.resultData, data.dataB.data),
isDataB: data.dataB?.isData, isDataB: data.dataB.isData,
cStd: numberToFixed(data.dataC?.resultData), stdC: numberToFixed(data.dataC.resultData),
cData: numberToFixed(data.dataC?.data), dataC: numberToFixed(data.dataC.data),
cError: getError(data.dataC?.resultData, data.dataC?.data), errorC: getError(data.dataC.resultData, data.dataC.data),
isDataC: data.dataC?.isData, isDataC: data.dataC.isData,
maxError: data.radius, maxError: data.radius,
unit: data.unit, unit: data.unit,
@@ -416,35 +429,35 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
}) })
} }
if (data.dataT) { if (data.dataT != null) {
result.push({ result.push({
tStd: numberToFixed(data.dataT?.resultData), stdT: numberToFixed(data.dataT.resultData),
tData: numberToFixed(data.dataT?.data), dataT: numberToFixed(data.dataT.data),
tError: getError(data.dataT?.resultData, data.dataT?.data), errorT: getError(data.dataT.resultData, data.dataT.data),
isDataT: data.dataT?.isData, isDataT: data.dataT?.isData,
maxError: data.radius, maxError: data.radius,
unit: data.unit, unit: data.unit,
result: data.isData, result: data.isData,
}) })
} }
console.log("检测结果", result);
Object.assign(checkResultData, result) Object.assign(checkResultData, result)
} }
const setRawData = (data: CheckData.RawDataItem[]) => { const setRawData = (data: CheckData.RawDataItem[]) => {
console.log("原始数据", data) console.log("原始数据", data)
data.forEach((item: CheckData.RawDataItem) => { data.forEach((item: CheckData.RawDataItem) => {
item.dataA = item.dataA == null || item.dataA == undefined ? '' : Number(item.dataA).toFixed(fixed).replace(/-/g, "") item.dataA = item.dataA == null || item.dataA == undefined ? '/' : Number(item.dataA).toFixed(fixed).replace(/-/g, "")
item.dataB = item.dataB == null || item.dataB == undefined ? '' : Number(item.dataB).toFixed(fixed).replace(/-/g, "") item.dataB = item.dataB == null || item.dataB == undefined ? '/' : Number(item.dataB).toFixed(fixed).replace(/-/g, "")
item.dataC = item.dataC == null || item.dataC == undefined ? '' : Number(item.dataC).toFixed(fixed).replace(/-/g, "") item.dataC = item.dataC == null || item.dataC == undefined ? '/' : Number(item.dataC).toFixed(fixed).replace(/-/g, "")
item.dataT = item.dataT == null || item.dataT == undefined ? '' : Number(item.dataT).toFixed(fixed).replace(/-/g, "") item.dataT = item.dataT == null || item.dataT == undefined ? '/' : Number(item.dataT).toFixed(fixed).replace(/-/g, "")
}) })
Object.assign(rawTableData, data) Object.assign(rawTableData, data)
} }
const numberToFixed = (num: number): string => { const numberToFixed = (num: number): string => {
if (num == null || num == undefined) { if (num == null || num == undefined) {
return '' return '/'
} else { } else {
return num.toFixed(fixed).replace(/-/g, "") return num.toFixed(fixed).replace(/-/g, "")
} }
@@ -452,7 +465,7 @@ const numberToFixed = (num: number): string => {
const getError = (num1: number, num2: number): string => { const getError = (num1: number, num2: number): string => {
if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) { if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) {
return '' return '/'
} }
return Math.abs(Number(numberToFixed(num1)) - Number(numberToFixed(num2))).toFixed(fixed) return Math.abs(Number(numberToFixed(num1)) - Number(numberToFixed(num2))).toFixed(fixed)
} }
@@ -574,14 +587,14 @@ defineExpose({
align-items: center; align-items: center;
max-height: 473px; max-height: 473px;
padding: 10px 0; padding: 10px 0.5% 0px 0.5%;
border: 1px solid #ccc; border: 1px solid #ccc;
overflow-y: auto; overflow-y: auto;
overflow-x: auto;
.content-tree { .content-tree {
width: 100%; width: 100%;
height: 100%; height: 100%;
max-height: 100%;
margin-top: 10px; margin-top: 10px;
.custom-tree-node { .custom-tree-node {