去除协议校验

This commit is contained in:
sjl
2025-08-08 15:27:17 +08:00
parent ecbc3c30c8
commit 27d2d82fcd
5 changed files with 142 additions and 889 deletions

View File

@@ -1,65 +1,78 @@
<template>
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
<div class="table-main" max-height="282px">
<el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
<el-table :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }" max-height="282px"
style="width: 100%;">
<el-table-column type="index" label="序号" width="70" fixed="left"/>
<el-table-column prop="time" label="数据时间"/>
<el-table-column v-if="!isThreePhase && phaseA==1" prop="dataA" :label="'A相'+(unit==''?'':''+unit+'')"/>
<el-table-column v-if="!isThreePhase && phaseB==1" prop="dataB" :label="'B相'+(unit==''?'':''+unit+'')"/>
<el-table-column v-if="!isThreePhase && phaseC==1" prop="dataC" :label="'C相'+(unit==''?'':''+unit+'')"/>
<el-table-column v-if="!isThreePhase && phaseT === 1" prop="dataT" :label="tableHeader+(unit==''?'':''+unit+'')"/>
<el-table-column v-if="isThreePhase" prop="dataB" :label="'负序不平衡度'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataA" :label="'A相'">
<el-table-column prop="dataA" :label="'被检值'"/>
<el-table-column prop="isDataA" label="标准值"/>
</el-table-column>
<el-table-column prop="dataB" :label="'B相'">
<el-table-column prop="dataA" :label="'被检值'"/>
<el-table-column prop="isDataA" label="标准值"/>
</el-table-column>
<el-table-column prop="dataC" :label="'C相'">
<el-table-column prop="dataA" :label="'被检值'"/>
<el-table-column prop="isDataA" label="标准值"/>
</el-table-column>
</el-table>
</div>
</template>
<script lang="tsx" setup>
import {CheckData} from "@/api/check/interface";
import {computed} from "vue";
const {tableData, currentScriptTypeName} = defineProps<{
tableData: CheckData.RawDataItem[]
currentScriptTypeName: string
}>()
const emit = defineEmits(['exportRawDataHandler'])
const unit = computed(() => {
return tableData.length > 0 ? tableData[0].unit : '';
})
const phaseA = computed(() => {
return tableData[0].dataA == '/' ? 0 : 1
})
const phaseB = computed(() => {
return tableData[0].dataB == '/' ? 0 : 1
})
const phaseC = computed(() => {
return tableData[0].dataC == '/' ? 0 : 1
})
const phaseT = computed(() => {
return tableData[0].dataT == '/' ? 0 : 1
})
const tableHeader = computed(() => {
if (phaseT.value === 1) {
let index = currentScriptTypeName.indexOf('=');
return currentScriptTypeName.substring(0, index);
// 模拟数据数组
const tableData = [
{
time: "2023-10-25 14:30:00",
dataA: "220.12",
isDataA: "220.05",
dataB: "219.98",
isDataB: "220.02",
dataC: "220.05",
isDataC: "220.10"
},
{
time: "2023-10-25 14:30:03",
dataA: "219.85",
isDataA: "220.00",
dataB: "220.15",
isDataB: "220.08",
dataC: "220.20",
isDataC: "220.18"
},
{
time: "2023-10-25 14:30:06",
dataA: "220.03",
isDataA: "219.95",
dataB: "220.10",
isDataB: "220.00",
dataC: "219.90",
isDataC: "220.05"
},
{
time: "2023-10-25 14:30:09",
dataA: "220.25",
isDataA: "220.15",
dataB: "219.80",
isDataB: "219.90",
dataC: "220.10",
isDataC: "220.00"
},
{
time: "2023-10-25 14:30:12",
dataA: "219.95",
isDataA: "220.05",
dataB: "220.20",
isDataB: "220.15",
dataC: "220.05",
isDataC: "219.98"
}
return currentScriptTypeName
})
];
const isThreePhase = computed(() => {
return currentScriptTypeName.includes('三相电压不平衡度') || currentScriptTypeName.includes('三相电流不平衡度')
})
const exportData = () => {
emit('exportRawDataHandler')
}
</script>
<style scoped>

View File

@@ -1,23 +1,14 @@
<template>
<div class="table-main">
<el-table v-if="tableData.length > 0" :data="tableData" height="357px" :header-cell-style="{ textAlign: 'center' } "
<el-table :data="mockTableData" height="357px" :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }">
<!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
<!-- <template #default="{row}">-->
<!-- {{ '通道' + row.chnNum }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="A相" v-if="phaseA === 1">
<el-table-column prop="stdA" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataA" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column label="A相" >
<el-table-column prop="stdA" :label="'标准值'"/>
<el-table-column prop="dataA" :label="'被检值'"/>
<el-table-column prop="isDataA" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ scope.row.maxErrorA }} <br/>
误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? innerUnitA : '' }}
</template>
<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="warning" v-if="scope.row.isDataA === 4">/</el-tag>
@@ -26,16 +17,12 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="B相" v-if="phaseB === 1">
<el-table-column prop="stdB" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataB" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column label="B相" >
<el-table-column prop="stdB" :label="'标准值'"/>
<el-table-column prop="dataB" :label="'被检值'"/>
<el-table-column prop="isDataB" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ scope.row.maxErrorB }}<br/>
误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? innerUnitB : '' }}
</template>
<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="warning" v-if="scope.row.isDataB === 4">/</el-tag>
@@ -44,16 +31,12 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="C相" v-if="phaseC === 1">
<el-table-column prop="stdC" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataC" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column label="C相" >
<el-table-column prop="stdC" :label="'标准值'"/>
<el-table-column prop="dataC" :label="'被检值'"/>
<el-table-column prop="isDataC" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围 {{ scope.row.maxErrorC }}<br/>
误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? innerUnitC : '' }}
</template>
<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="warning" v-if="scope.row.isDataC === 4">/</el-tag>
@@ -62,87 +45,45 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column :label="tableHeader" v-if="phaseT === 1">
<el-table-column prop="stdT" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataT" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="isDataT" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围 {{ scope.row.maxErrorT }}<br/>
误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? innerUnitT : '' }}
</template>
<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="warning" v-if="scope.row.isDataT === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</template>
<script lang="tsx" setup>
import {defineProps} from 'vue';
import {CheckData} from "@/api/check/interface";
const {tableData, currentScriptTypeName} = defineProps<{
tableData: CheckData.CheckResult[],
currentScriptTypeName: string
}>();
const outerUnit = computed(() => {
return tableData.length > 0 ? tableData[0].unit : '';
})
const innerUnitA = computed(() => {
return tableData.length > 0 ? tableData[0].unitA : '';
})
const innerUnitB = computed(() => {
return tableData.length > 0 ? tableData[0].unitB : '';
})
const innerUnitC = computed(() => {
return tableData.length > 0 ? tableData[0].unitC : '';
})
const innerUnitT = computed(() => {
return tableData.length > 0 ? tableData[0].unitT : '';
})
const phaseA = computed(() => {
return tableData.length <= 0 || tableData[0].dataA == null || tableData[0].dataA == "/" ? 0 : 1
})
const phaseB = computed(() => {
return tableData.length <= 0 || tableData[0].dataB == null || tableData[0].dataB == "/" ? 0 : 1
})
const phaseC = computed(() => {
return tableData.length <= 0 || tableData[0].dataC == null || tableData[0].dataC == "/" ? 0 : 1
})
const phaseT = computed(() => {
return tableData.length <= 0 || tableData[0].dataT == null || tableData[0].dataT == "/" ? 0 : 1
})
const tableHeader = computed(() => {
if (phaseT.value === 1) {
let index = currentScriptTypeName.indexOf('=');
return currentScriptTypeName.substring(0, index);
const mockTableData = [
{
stdA: "220.00",
dataA: "219.85",
isDataA: 1,
maxErrorA: "±0.5%",
errorA: "0.068%",
unitA: "%",
stdB: "220.00",
dataB: "220.12",
isDataB: 1,
maxErrorB: "±0.5%",
errorB: "0.055%",
unitB: "%",
stdC: "220.00",
dataC: "219.95",
isDataC: 1,
maxErrorC: "±0.5%",
errorC: "0.023%",
unitC: "%",
stdT: "0.15",
dataT: "0.12",
isDataT: 1,
maxErrorT: "±0.2",
errorT: "0.03",
unitT: "",
unit: "V"
}
return currentScriptTypeName
})
];
// const maxErrorStr = computed((data) => {
// let result = tableData[0].maxError ?? '/'
// let idx = result.indexOf('~');
// if (idx > 0) {
// result = result.substring(0, idx) + outerUnit.value + result.substring(idx, result.length) + outerUnit.value;
// }
// return result;
// })
</script>

View File

@@ -2,7 +2,7 @@
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
v-bind="dialogBig" :draggable="false" width="1400px">
<div class="data-check-dialog">
<div class="data-check-head">
<div >
<el-form :model='formContent' label-width="auto" class="form-three ">
<el-form-item label="误差体系">
<el-select :disabled="checkStore.showDetailType===2 || checkStore.showDetailType===0" v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off"
@@ -25,27 +25,10 @@
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item v-if="checkStore.showDetailType===1">
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
</el-form-item>
<el-form-item v-if="checkStore.showDetailType===0">
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
</el-form-item>
</el-form>
</div>
<div class="data-check-body">
<div class="content-right">
<div class="content-right-title">
<el-form-item label='测试项'>
<el-cascader
v-model="currentCheckItem"
:options="checkListLevel"
:props="{expandTrigger: 'click' as const}"
placement="bottom-end"
/>
</el-form-item>
</div>
<div class="content-right-Tabs">
<el-tabs type="border-card" v-model="activeTab">
<el-tab-pane label="检测结果" name="resultTab">
@@ -69,12 +52,6 @@ import CompareDataCheckResultTable from './compareDataCheckResultTable.vue'
import CompareDataCheckRawDataTable from './compareDataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface";
import {useCheckStore} from "@/stores/modules/check";
import {changeErrorSystem, deleteTempTable, exportRawData, getFormData, getTableData, getTreeData, reCalculate} from "@/api/check/test";
import {generateDevReport, getPqErrSysList} from '@/api/plan/plan'
import {useDownload} from "@/hooks/useDownload";
import {Histogram, Postcard} from "@element-plus/icons-vue";
import {ResultEnum} from "@/enums/httpEnum";
import {ElMessage} from "element-plus";
const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean
@@ -99,523 +76,24 @@ const formContent = reactive<CheckData.DataCheck>({
deviceName: '',
chnNum: '',
})
// 原始误差体系id
let originErrorSysId: string = ''
let planCode: string = ''
// 当前选中的检测项
const currentCheckItem = ref<any>()
// 带有层级的检测项列表
const checkListLevel = reactive<{ value: string, label: string, children: { value: string, label: string }[] }[]>([])
let deviceId: string = ''
let originScriptType: string | null = null
let scriptType: string | null = null
// 通道下拉列表
let chnList: any[] = []
// 左侧树数据
const treeDataAll = reactive<CheckData.TreeItem[]>([])
// 左侧树被选中的叶子节点id
const checkIndex = ref<string>('')
// 当前检测项目名称
const currentScriptTypeName = ref('')
// 当前检测项目描述
const currentDesc = ref('');
// 右侧Tab选中项
const activeTab = ref<string>('resultTab')
//存放相应的表格数据
const resTableData = reactive<{ resultData: Map<string, any>, rawData: Map<string, any> }>({resultData: new Map(), rawData: new Map()})
// 检测结果表格数据
const checkResultData = reactive<CheckData.CheckResult[]>([])
// 原始数据表格数据
const rawTableData = reactive<CheckData.RawDataItem[]>([])
const handleErrorSysChange = async () => {
console.log("切换误差体系", formContent.errorSysId);
changeErrorSystem({
planId: checkStore.plan.id,
scriptId: checkStore.plan.scriptId,
errorSysId: formContent.errorSysId,
deviceId: deviceId,
code: checkStore.plan.code + '',
}).then((res) => {
if (res.code === ResultEnum.SUCCESS) {
ElMessage.success('切换误差体系成功')
if (originErrorSysId != formContent.errorSysId) {
planCode = checkStore.plan.code + "_temp"
} else {
planCode = checkStore.plan.code + ''
}
if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value
} else {
handleChnNumChange()
}
}
})
}
watch(() => formContent.chnNum, async (newVal, oldVal) => {
// console.log("通道号", newVal);
if (newVal != '') {
handleChnNumChange()
}
})
const handleChnNumChange = async () => {
console.log("通道号", formContent.chnNum);
// 发起请求,查询该测试项的检测结果
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
scriptType: originScriptType,
code: planCode
})
updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2)
treeDataAll.length = 0
Object.assign(treeDataAll, resTreeDataTemp)
defaultOperate()
await updateTableData()
activeTab.value = 'resultTab'
}
watch(currentCheckItem, (newVal, oldVal) => {
if (newVal !== '') {
let key = newVal[0]
if (newVal.length == 2) {
key += "_" + newVal[1]
}
console.log("当前检测项", key);
doCurrentCheckItemUpdate(key)
} else {
activeTab.value = 'resultTab'
}
})
// 默认操作
const defaultOperate = () => {
let node = getDefaultNode(treeDataAll)
if (node) {
currentScriptTypeName.value = node.scriptTypeName
currentDesc.value = node.sourceDesc
checkIndex.value = node.index
defaultExpandedKeys = [node.index]
treeRef.value?.setCurrentKey(node.index);
scriptType = node.scriptType ?? scriptType
} else {
currentScriptTypeName.value = ''
currentDesc.value = ''
checkIndex.value = ''
defaultExpandedKeys = []
}
}
const updateTableData = async () => {
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
if (checkIndex.value !== '') {
checkListLevel.length = 0
checkResultData.length = 0
rawTableData.length = 0
currentCheckItem.value = ''
// console.log("更新表格数据");
// 发起请求,查询该测试项的检测结果
const {data} = await getTableData({
scriptType,
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
code: planCode,
index: parseInt(checkIndex.value),
})
let keys1 = Object.keys(data.resultData)
let resultData = new Map()
for (let key of keys1) {
let children = []
let label = key
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
for (let item of data.resultData[key]) {
let num = formatHarmNum(item.harmNum + '')
label = item.isData === 1 ? `${num}` : item.isData === 4 ? `${num}/` : item.isData === 5 ? `${num}-` : `${num}(不符合)`
children.push({label: label, value: num})
resultData.set(key + "_" + num, item)
}
checkListLevel.push({label: key, value: key, children: children})
} else {
label = data.resultData[key][0].isData === 1 ? `${key}` : data.resultData[key][0].isData === 4 ? `${key}/` : data.resultData[key][0].isData === 5 ? `${key}-` : `${key}(不符合)`
resultData.set(key, data.resultData[key][0])
checkListLevel.push({label: label, value: key, children: []})
let temp = checkListLevel.find(item => item.label.includes('电压幅值'))
if (temp) {
checkListLevel.splice(checkListLevel.indexOf(temp), 1)
checkListLevel.unshift(temp)
}
}
}
let keys2 = Object.keys(data.rawData)
let rawData = new Map()
for (let key of keys2) {
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
for (let item of data.rawData[key]) {
let num = formatHarmNum(item.harmNum + '')
let value = rawData.get(key + "_" + num)
if (!value) {
rawData.set(key + "_" + num, [item])
} else {
value.push(item)
}
}
} else {
rawData.set(key, data.rawData[key])
}
}
resTableData.resultData = resultData
resTableData.rawData = rawData
toAngleLast()
if (checkListLevel.length !== 0) {
if (checkListLevel[0].children.length !== 0) {
currentCheckItem.value = [checkListLevel[0].value + '', checkListLevel[0].children[0].value + '']
} else {
currentCheckItem.value = [checkListLevel[0].value + '']
}
}
} else {
checkResultData.length = 0
rawTableData.length = 0
}
}
const doCurrentCheckItemUpdate = (newVal: string) => {
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal)
setCheckResultData(resCheckResult)
let tempRawData = resTableData.rawData.get(newVal)
if (tempRawData) {
setRawData(tempRawData)
} else {
setRawData([])
}
activeTab.value = 'resultTab'
}
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
planCode = checkStore.plan.code + ''
deviceId = _deviceId
originScriptType = _scriptType
scriptType = _scriptType
// // 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号
// const {data: resFormContent}: { data: any } = await getFormData({
// planId: checkStore.plan.id,
// deviceId,
// chnNum,
// scriptType
// })
// chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
// value: item.value,
// label: item.value
// //label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
// }))
// Object.assign(formContent, {
// ...resFormContent,
// chnNum: chnList.length > 0 ? chnList[0].value : '',
// })
// originErrorSysId = formContent.errorSysId
// pqErrorList.length = 0
// let {data: resPqErrorList} = await getPqErrSysList()
// Object.assign(pqErrorList, resPqErrorList)
visible.value = true;
}
const handleGenerateReport = async () => {
await generateDevReport({'planId': checkStore.plan.id, 'devIdList': [deviceId],'scriptId':checkStore.plan.scriptId,'planCode':planCode})
ElMessage.success({message: `报告生成成功!`})
}
const handleReCalculate = async () => {
reCalculate({
planId: checkStore.plan.id,
scriptId: checkStore.plan.scriptId,
errorSysId: formContent.errorSysId,
deviceId: deviceId,
code: checkStore.plan.code + ''
}).then((res) => {
ElMessage.success('重新计算成功!')
// if (originErrorSysId != formContent.errorSysId) {
// planCode = checkStore.plan.code + "_temp"
// } else {
// planCode = checkStore.plan.code + ''
// }
if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value
} else {
handleChnNumChange()
}
})
}
const close = async () => {
//数据清空
Object.assign(formContent, {
scriptName: '',
errorSysName: '',
dataRule: '',
deviceName: '',
chnNum: '',
})
treeDataAll.length = 0
// harmNumList.length = 0
// currentHarmNum.value = '-1'
currentCheckItem.value = ''
checkResultData.length = 0
rawTableData.length = 0
//checkList.length = 0
defaultExpandedKeys = []
checkIndex.value = ''
activeTab.value = 'resultTab'
currentScriptTypeName.value = ''
currentDesc.value = ''
pqErrorList.length = 0
planCode = ''
visible.value = false;
if (checkStore.showDetailType === 1) {
await deleteTempTable(checkStore.plan.code + '')
}
};
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
let result: CheckData.CheckResult[] = []
if (data == null || data == undefined) {
Object.assign(checkResultData, [])
return
}
if (data.dataA != null && data.dataB != null && data.dataC != null) {
result.push({
// stdA: numberToFixed(data.dataA.resultData),
// dataA: numberToFixed(data.dataA.data),
stdA: dataToShow(data.dataA.resultData),
dataA: dataToShow(data.dataA.data),
errorA: data.dataA.errorData == null ? '/' : data.dataA.errorData + '',
maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
unitA: data.dataA.unit,
isDataA: data.dataA.isData,
// stdB: numberToFixed(data.dataB.resultData),
// dataB: numberToFixed(data.dataB.data),
stdB: dataToShow(data.dataB.resultData),
dataB: dataToShow(data.dataB.data),
errorB: data.dataB.errorData == null ? '/' : data.dataB.errorData + '',
maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
isDataB: data.dataB.isData,
unitB: data.dataB.unit,
// stdC: numberToFixed(data.dataC.resultData),
// dataC: numberToFixed(data.dataC.data),
stdC: dataToShow(data.dataC.resultData),
dataC: dataToShow(data.dataC.data),
errorC: data.dataC.errorData == null ? '/' : data.dataC.errorData + '',
maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
isDataC: data.dataC.isData,
unitC: data.dataC.unit,
maxError: data.radius,
unit: data.unit,
result: data.isData,
})
}
if (data.dataT != null && data.dataA == null && data.dataB == null && data.dataC == null) {
result.push({
// stdT: numberToFixed(data.dataT.resultData),
// dataT: numberToFixed(data.dataT.data),
stdT: dataToShow(data.dataT.resultData),
dataT: dataToShow(data.dataT.data),
errorT: data.dataT.errorData == null ? '/' : data.dataT.errorData + '',
maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
isDataT: data.dataT?.isData,
unitT: data.dataT.unit,
maxError: data.radius,
unit: data.unit,
result: data.isData,
})
}
Object.assign(checkResultData, result)
console.log("检测结果", checkResultData);
}
const exportRawDataHandler = () => {
useDownload(exportRawData, '原始数据', {
scriptType,
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
code: checkStore.plan.code + '',
index: parseInt(checkIndex.value),
}, false, '.xlsx')
}
const formatHarmNum = (num: string) => {
// debugger
if (num.includes('.5')) {
return num
} else {
num = num.replace('.0', '')
return num
}
}
const setRawData = (data: CheckData.RawDataItem[]) => {
data.forEach((item: CheckData.RawDataItem) => {
item.dataA = dataToShow(item.dataA)
item.dataB = dataToShow(item.dataB)
item.dataC = dataToShow(item.dataC)
item.dataT = dataToShow(item.dataT)
})
rawTableData.length = 0
Object.assign(rawTableData, data)
console.log("原始数据", rawTableData)
}
const dataToShow = (num: number): string => {
if (num == null || num == undefined) {
return '/'
}
return num+''
}
const toMaxErrorStr = (oldMaxErroe: any, unit: any) => {
let result = oldMaxErroe ?? '/'
let idx = result.indexOf('~');
if (idx > 0) {
let left = result.substring(0, idx)
let right = result.substring(idx, result.length)
result = left + unit + right + unit;
}
return result;
}
const findFirstLeafNode = (node: any): any => {
if (!node.children || node.children.length === 0) {
return node;
}
return findFirstLeafNode(node.children[0]);
}
const getDefaultNode = (data: any[]) => {
if (!data || data.length === 0) {
return null;
}
const firstElement = data[0];
return findFirstLeafNode(firstElement);
}
const toAngleLast = () => {
let angleIndex = -1
for (let i = 0; i < checkListLevel.length; i++) {
if (checkListLevel[i].value.toString().includes('相角')) {
angleIndex = i
break
}
}
if (angleIndex != -1) {
let temp = checkListLevel[angleIndex]
checkListLevel.splice(angleIndex, 1)
checkListLevel.push(temp)
}
}
const filter = (treeData: any[], fly: number) => {
for (let i = treeData.length - 1; i >= 0; i--) {
let node = treeData[i]
if (node.fly !== fly) {
if (node.children && node.children.length > 0) {
filter(node.children, fly)
// 检查 children 是否被全部移除
if (node.children.length === 0) {
treeData.splice(i, 1);
}
} else {
treeData.splice(i, 1)
}
}
}
}
const updateTreeFly = (treeData: any[], fly: number) => {
// 递归函数
function recursiveUpdate(node: any, targetFly: number) {
//if (!node) return false; // 如果节点不存在,返回 false
// 如果当前节点是叶子节点且 fly 字段等于 targetFly
if (!node.children || node.children.length === 0) {
if (node.fly === targetFly) {
node.fly = targetFly; // 确保叶子节点的 fly 字段被设置为 targetFly
return true; // 返回 true 表示找到并更新了
}
return false; // 否则返回 false
}
// 递归更新子节点
let updated = false;
for (let child of node.children) {
if (recursiveUpdate(child, targetFly)) {
updated = true;
}
}
// 如果有子节点被更新了,则更新当前节点的 fly 字段
if (updated) {
node.fly = targetFly;
}
return updated;
}
for (let i = 0; i < treeData.length; i++) {
// 调用递归函数从根节点开始更新
recursiveUpdate(treeData[i], fly);
}
}
defineExpose({
open

View File

@@ -14,12 +14,11 @@
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
finish-status="success">
<el-step :status="step1" title="设备通讯校验"/>
<el-step :status="step2" title="协议校验"/>
<el-step :status="step3" title="模型一致性校验"/>
<el-step :status="step4" title="实时数据对齐验证"/>
<el-step :status="step5" title="相序校验"/>
<el-step :status="step2" title="模型一致性校验"/>
<el-step :status="step3" title="实时数据对齐验证"/>
<el-step :status="step4" title="相序校验"/>
<!-- <el-step :status="step6" title="遥控录波功能验证"/> -->
<el-step :status="step6" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
</el-steps>
</div>
<div class="dialog-right">
@@ -32,7 +31,7 @@
</p>
</div>
</el-collapse-item>
<el-collapse-item title="协议校验" name="2">
<el-collapse-item title="模型一致性校验" name="2">
<div class="div-log">
<p v-for="(item, index) in step2InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
@@ -40,30 +39,22 @@
</p>
</div>
</el-collapse-item>
<el-collapse-item title="模型一致性校验" name="3">
<div class="div-log">
<p v-for="(item, index) in step3InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br/>
</p>
</div>
</el-collapse-item>
<el-collapse-item name="4">
<el-collapse-item name="3">
<template #title>
实时数据对齐验证
<el-icon class="title-icon" @click="openDialog"><InfoFilled/></el-icon>
</template>
<div class="div-log">
<p v-for="(item, index) in step4InitLog" :key="index"
<p v-for="(item, index) in step3InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }}
<br/>
</p>
</div>
</el-collapse-item>
<el-collapse-item title="相序校验" name="5">
<el-collapse-item title="相序校验" name="4">
<div class="div-log">
<p v-for="(item, index) in step5InitLog" :key="index"
<p v-for="(item, index) in step4InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br/>
</p>
@@ -125,12 +116,6 @@ const step4InitLog = ref([
},
])
const step5InitLog = ref([
{
type: 'info',
log: '暂无数据,等待检测开始',
},
])
@@ -142,7 +127,7 @@ const step2 = ref<StepProps['status']>('wait')
const step3 = ref<StepProps['status']>('wait')
const step4 = ref<StepProps['status']>('wait')
const step5 = ref<StepProps['status']>('wait')
const step6 = ref<StepProps['status']>('wait')
//定义与预检测配置数组
const detectionOptions = ref([
@@ -153,21 +138,16 @@ const detectionOptions = ref([
},
{
id: 1,
name: "协议校验",
selected: true,
},
{
id: 2,
name: "模型一致性校验",
selected: true,
},
{
id: 3,
id: 2,
name: "实时数据对齐验证",
selected: true,
},
{
id: 4,
id: 3,
name: "相序校验",
selected: true,
},
@@ -249,165 +229,21 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
}
break;
case 'yjc_xyjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$01':
if (newValue.code == 10200) {
step2InitLog.value.push({
type: 'info',
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
step2.value = 'process'
step2InitLog.value = [{
type: 'wait',
log: '正在进行通讯协议校验.....',
}];
} else if (newValue.code == 10550) {
step2InitLog.value.push({
type: 'error',
log: newValue.data + '设备连接异常!',
})
step2.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step2InitLog.value.push({
type: 'error',
log: newValue.data + '设备触发报告异常!',
})
step2.value = 'error'
ts.value = 'error'
step6.value = 'error'
} else if (newValue.code == 10552) {
step2.value = 'error'
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
step2InitLog.value = [{
type: 'wait',
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
}];
ts.value = 'error'
step6.value = 'error'
}
break;
case 'INIT_GATHER$02':
if (newValue.code == 10200) {
step2InitLog.value.push({
type: 'info',
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
step2.value = 'process'
step2InitLog.value = [{
type: 'wait',
log: '正在进行通讯协议校验.....',
}];
} else if (newValue.code == 10550) {
step2InitLog.value.push({
type: 'error',
log: newValue.data + '设备连接异常!',
})
step2.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step2InitLog.value.push({
type: 'error',
log: newValue.data + '设备触发报告异常!',
})
step2.value = 'error'
ts.value = 'error'
step6.value = 'error'
} else if (newValue.code == 10552) {
step2.value = 'error'
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
step2InitLog.value = [{
type: 'wait',
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
}];
ts.value = 'error'
step6.value = 'error'
}
break;
case 'INIT_GATHER$03':
if (newValue.code == 10200) {
step2InitLog.value.push({
type: 'info',
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
step2.value = 'process'
} else if (newValue.code == 10550) {
step2InitLog.value.push({
type: 'error',
log: newValue.data + '设备连接异常!',
})
step3.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step2InitLog.value.push({
type: 'error',
log: newValue.data + '设备触发报告异常!',
})
step2.value = 'error'
ts.value = 'error'
step6.value = 'error'
} else if (newValue.code == 10552) {
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
step2.value = 'error'
step2InitLog.value = [{
type: 'wait',
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
}];
ts.value = 'error'
step6.value = 'error'
}
break;
case 'VERIFY_MAPPING$01':
if (newValue.code == 25001) {
activeIndex.value = 2
step2.value = 'success'
step3.value = 'process'
} else if (newValue.code == 10200) {
let data = JSON.parse(newValue.data)
step2InitLog.value.push({
type: 'error',
log: `脚本与icd检验失败! icd名称${data['icdType']} -> 校验项:${data['dataType']}`,
})
step2.value = 'error'
ts.value = 'error'
step6.value = 'error'
} else if (newValue.code == 10500) {
step2InitLog.value.push({
type: 'error',
log: `装置中未找到该icd`,
})
step2.value = 'error'
ts.value = 'error'
step6.value = 'error'
}
break;
}
break;
case 'YJC_mxyzxjy':
switch (newValue.operateCode){
case 'DATA_REQUEST$02':
if (newValue.code == 10200) {
step3InitLog.value.push({
step2InitLog.value.push({
type: 'info',
log: '模型一致性检验成功!',
})
}
if (newValue.code == 25001) {
step3.value = 'success'
step4.value = 'process'
activeIndex.value = 3
step2.value = 'success'
step3.value = 'process'
activeIndex.value = 2
}else if (newValue.code == 25004) {
step3.value = 'error'
step2.value = 'error'
}
break;
}
@@ -422,30 +258,30 @@ watch(webMsgSend, function (newValue, oldValue) {
switch (newValue.operateCode) {
case 'OPER_GATHER':
if (newValue.code == 10200) {
step5InitLog.value.push({
step4InitLog.value.push({
type: 'info',
log: '源参数下发成功,等待校验中.....',
})
} else if (newValue.code == 10201) {
step5.value = 'process'
step5InitLog.value = [{
step4.value = 'process'
step4InitLog.value = [{
type: 'wait',
log: '源参数下发中.....',
}];
} else if (newValue.code == 10552) {
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
step5.value = 'error'
step4.value = 'error'
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10520) {
step5.value = 'error'
step5InitLog.value.push({
step4InitLog.value.push({
type: 'error',
log: '解析报文异常',
})
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
}
break;
case 'DATA_REQUEST$02':
@@ -455,35 +291,35 @@ watch(webMsgSend, function (newValue, oldValue) {
type = 'error'
}
newValue.data.split('<br/>')
step5InitLog.value.push({
step4InitLog.value.push({
type: type,
log: newValue.data,
})
} else if (newValue.code == 10201) {
step5.value = 'process'
step5InitLog.value = [{
step4.value = 'process'
step4InitLog.value = [{
type: 'wait',
log: '获取数据相序校验数据!',
}];
} else if (newValue.code == 25003) {
step5.value = 'error'
step5InitLog.value.push({
step4.value = 'error'
step4InitLog.value.push({
type: 'error',
log: '相序校验未通过!',
})
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
} else if (newValue.code == 25001) {
step4.value = 'success'
step5.value = 'success'
step6.value = 'success'
step5InitLog.value.push({
step4InitLog.value.push({
type: 'wait',
log: '相序校验成功!',
})
ts.value = 'success'
}
activeIndex.value = 5
activeIndex.value = 4
break
}
break;
@@ -491,23 +327,14 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'connect':
switch (newValue.operateCode) {
case "Source":
case "Contrast_Dev":
step1.value = 'error'
step1InitLog.value = [{
type: 'error',
log: '源服务端连接失败!',
}];
ts.value = 'error'
step6.value = 'error'
break;
case "Dev":
step2.value = 'error'
step2InitLog.value = [{
type: 'error',
log: '设备服务端连接失败!',
}];
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
break;
}
break;
@@ -520,7 +347,7 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
})
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
break;
case 'socket_timeout':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
@@ -528,7 +355,7 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
})
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
break;
case 'server_error':
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
@@ -536,7 +363,7 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
})
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
break;
case 'device_error':
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
@@ -544,7 +371,7 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
})
ts.value = 'error'
step6.value = 'error'
step5.value = 'error'
break;
}
}
@@ -620,12 +447,6 @@ function initializeParameters() {
log: '暂无数据,等待检测开始',
},
]
step5InitLog.value = [
{
type: 'info',
log: '暂无数据,等待检测开始',
},
]
}
const openDialog = () => {

View File

@@ -79,7 +79,7 @@
<script lang="tsx" setup name="test">
import {InfoFilled, Loading} from '@element-plus/icons-vue'
import CompareDataCheckSingleChannelSingleTestPopup from './compareDataCheckSingleChannelSingleTestPopup.vue'
import {computed, onBeforeMount, reactive, ref, toRef, watch} from "vue";
import {computed, ComputedRef, onBeforeMount, reactive, ref, toRef, watch} from "vue";
import {dialogBig} from "@/utils/elementBind";
import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
@@ -146,7 +146,7 @@ const webMsgSend = toRef(props, 'webMsgSend')
// const resultDialogVisible = ref(false)
const scrollContainerRef = ref();
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof CompareDataCheckSingleChannelSingleTestPopup>>()
// 总通道数
const chnSum = computed(() => {