预检测,正式检测,数据查询能处理只有录波的情况

This commit is contained in:
sjl
2025-09-22 15:51:58 +08:00
parent 44cdb3273c
commit 783e1c080b
7 changed files with 81 additions and 50 deletions

View File

@@ -14,6 +14,7 @@ export const getBigTestItem = (params: {
export const getScriptList = (params: {
devId:string,
chnNum:number,
num:number
}) => {
return http.post('/result/getCheckItem', params, {loading: false})
}

View File

@@ -238,7 +238,7 @@ const open = async (row: any, chnNum: string, deviceId: string | null, source: n
formContent.deviceId = deviceId || ''
formContent.chnNum = chnNum
sourceKey.value = source
// 获取基本信息
// 获取基本信息
await getBasicInformation(row.scriptType)
if (source == 1) {
// 正式检测进入页面 - 创建新的对象避免引用共享
@@ -265,36 +265,32 @@ const open = async (row: any, chnNum: string, deviceId: string | null, source: n
}
const initGetResult = async () => {
// 查询表格数据
if(sourceKey.value == 1 && rowList.value.scriptName == "录波"){
isWaveData.value = true
// 设置录波数据相关的选项,与选中左侧录波树时保持一致
scriptNameOptions.value = selectScript.value
//.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
.map(item => ({
label: item.scriptName,
value: item.scriptName
}))
// 判断是否为录波数据
const isLuoboData = (sourceKey.value == 1 && rowList.value.scriptName == "录波") ||
(sourceKey.value == 2 && scriptData.value[0]?.code == "wave_data");
// 默认选中第一个选项
if (scriptNameOptions.value.length > 0) {
if (isLuoboData) {
isWaveData.value = true
// 设置录波数据相关的选项
scriptNameOptions.value = selectScript.value.map(item => ({
label: item.scriptName,
value: item.scriptName
}))
selectedScriptName.value = scriptNameOptions.value[0].value
// 更新rowList以匹配选中的script
const selectedItem = scriptData.value.find(item => item.scriptName === selectedScriptName.value)
if (selectedItem) {
rowList.value.scriptName = selectedScriptName.value
rowList.value.scriptType = selectedItem.id
}
// 默认选中第一个选项
if (scriptNameOptions.value.length > 0) {
selectedScriptName.value = scriptNameOptions.value[0].value
// 更新rowList以匹配选中的script
const selectedItem = selectScript.value.find(item => item.scriptName === selectedScriptName.value)
if (selectedItem) {
rowList.value.scriptName = selectedScriptName.value
rowList.value.scriptType = selectedItem.id
}
await getResults('wave_data')
} else {
await getResults('')
}
await getResults('wave_data')
} else {
await getResults('')
}
}
@@ -303,6 +299,7 @@ const initScriptData = async () => {
let response: any = await getScriptList({
devId: formContent.deviceId,
chnNum: formContent.chnNum,
num: formContent.num
})
// 格式化脚本数据
@@ -335,6 +332,7 @@ const initScriptData = async () => {
// 只有在sourceKey == 2时才设置rowList和tree相关属性
if (sourceKey.value === 2 && temp.length > 0) {
rowList.value.scriptName = temp[0].scriptName
rowList.value.scriptType = temp[0].id
selectedScriptName.value = temp[0].scriptName
@@ -346,8 +344,6 @@ const initScriptData = async () => {
}
// 获取基本信息
const getBasicInformation = async (scriptType: any) => {
checkResultData.value = []
@@ -424,7 +420,6 @@ const handleCommonChange = async () => {
if (sourceKey.value === 2 && scriptData.value.length > 0) {
// 查找当前选中的节点
const currentNode = scriptData.value.find((item: any) => item.id === rowList.value.scriptType)
if (currentNode) {
// 如果找到了当前节点,则触发点击事件
handleNodeClick(currentNode)
@@ -470,16 +465,19 @@ const handleNodeClick = (data: any) => {
// 每次选中录波数据时都重置为第一个选项并触发getResults
if (scriptNameOptions.value.length > 0) {
selectedScriptName.value = scriptNameOptions.value[0].value
// 更新rowList并触发getResults
rowList.value.scriptName = selectedScriptName.value
const selectedItem = scriptData.value.find(item => item.scriptName === selectedScriptName.value)
const selectedItem = selectScript.value.find(item => item.scriptName === selectedScriptName.value)
if (selectedItem) {
rowList.value.scriptType = selectedItem.id
getResults('wave_data')
}
}
} else {
isWaveData.value = false
getResults(data.code)
}
@@ -520,7 +518,7 @@ const handleScriptNameChange = (value: string) => {
selectedScriptName.value = value
rowList.value.scriptName = value
// 查找选中项的scriptType
const selectedItem = scriptData.value.find(item => item.scriptName === value)
const selectedItem = selectScript.value.find(item => item.scriptName === value)
if (selectedItem) {
rowList.value.scriptType = selectedItem.id
getResults('wave_data')
@@ -544,7 +542,6 @@ const close = async () => {
}
const handleErrorSysChange = async () => {
console.log("切换误差体系", formContent.errorSysId);
changeErrorSystem({
planId: checkStore.plan.id,
scriptId: '',

View File

@@ -15,7 +15,7 @@
finish-status="success">
<el-step :status="step1" title="设备通讯校验"/>
<el-step :status="step2" title="模型一致性校验"/>
<el-step :status="step3" title="实时数据对齐验证"/>
<el-step :status="step3" title="实时数据对齐验证" v-if="!props.onlyWave"/>
<el-step :status="step4" title="相序校验"/>
<!-- <el-step :status="step6" title="遥控录波功能验证"/> -->
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
@@ -39,7 +39,7 @@
</p>
</div>
</el-collapse-item>
<el-collapse-item name="3">
<el-collapse-item name="3" v-if="!props.onlyWave">
<template #title>
实时数据对齐验证
<el-icon class="title-icon" @click="openDialog" v-if="isShowDialog"><InfoFilled/></el-icon>
@@ -82,7 +82,7 @@
</template>
<script lang="tsx" setup name="preTest">
import {ElMessage, ElMessageBox, StepProps} from "element-plus";
import {defineExpose, PropType, ref, toRef, watch} from 'vue';
import {computed, defineExpose, PropType, ref, toRef, watch} from 'vue';
import RealTimeData from './realTimeDataAlign.vue'
const realTimeDataRef = ref()
@@ -121,7 +121,13 @@ const step4InitLog = ref([
const isShowDialog = ref(false)
const collapseActiveName = ref('1')
const activeIndex = ref(0)
const activeTotalNum = ref(5)
const activeTotalNum = computed(() => {
let count = 4; // 基础步骤数:设备通讯校验、模型一致性校验、相序校验、最终状态
if (props.onlyWave) {
count++; // 添加实时数据对齐验证步骤
}
return count;
});
const step1 = ref<StepProps['status']>('wait')
const step2 = ref<StepProps['status']>('wait')
const step3 = ref<StepProps['status']>('wait')
@@ -167,6 +173,10 @@ const props = defineProps({
mapping: {
type: Object as PropType<Record<string, Record<string, string>>>,
default: () => ({})
},
onlyWave: {
type: Boolean,
default: false
}
})
@@ -201,6 +211,9 @@ interface DeviceData {
const testDataStructure = ref<Record<string, DeviceData>>({});
watch(webMsgSend, function (newValue, oldValue) {
if(testStatus.value == 'success' || testStatus.value == 'error'){
return
}
if (testStatus.value !== 'waiting') {
if(newValue.code == 25004){
ElMessage.error('接收数据超时!')
@@ -454,11 +467,19 @@ watch(webMsgSend, function (newValue, oldValue) {
}
})
// watch(activeIndex, function (newValue, oldValue) {
// if (newValue <= activeTotalNum.value - 2) {
// collapseActiveName.value = (newValue + 1).toString()
// } else {
// collapseActiveName.value = newValue.toString()
// }
// })
watch(activeIndex, function (newValue, oldValue) {
if (newValue <= activeTotalNum.value - 2) {
collapseActiveName.value = (newValue + 1).toString()
} else {
collapseActiveName.value = newValue.toString()
collapseActiveName.value = (activeTotalNum.value - 1).toString()
}
})
@@ -483,6 +504,7 @@ watch(testStatus, function (newValue, oldValue) {
}
})
const emit = defineEmits(['update:testStatus']);
//监听sn
watch(ts, function (newValue, oldValue) {

View File

@@ -264,8 +264,6 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
})
return temp
})
console.log('🚀 ~ result:', result)
return result
})
@@ -665,6 +663,7 @@ const initScriptData = async () => {
// 保存脚本数据并设置总数
scriptData.push(...temp)
checkTotal = scriptData.length
console.log('shul',checkTotal)
}
// 初始化设备列表
const initDeviceList = () => {
@@ -687,7 +686,7 @@ const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
for (let j = 0; j < checkStore.chnNumList.length; j++) {
// 录波项目初始化为UNKNOWN状态其他项目使用传入的默认值
if (item.code === 'wave_data') {
if (item.code === 'wave_data' && checkTotal > 1) {
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
} else {
tempChnResult.push(defaultValue)

View File

@@ -55,6 +55,7 @@
v-model:testStatus="preTestStatus"
:webMsgSend="webMsgSend"
:mapping="channelMapping"
:onlyWave="onlyWave"
/>
</keep-alive>
<keep-alive>
@@ -242,6 +243,7 @@ const pairs = ref<any>()
const testAgain = ref(false) //重新检测按钮是否显示
const checkNumber = ref(0) //检测次数
const deviceMonitor2= ref<Map<string, any[]>>();
const onlyWave = ref(false);//计划数据源是否只有录波
const open = async (
title: string,
mapping: any,
@@ -250,13 +252,14 @@ const open = async (
devIdsArray: [],
standardDevIdsArray: [],
pair: any,
deviceMonitor:Map<string, any[]>
deviceMonitor:Map<string, any[]>,
planIsOnlyWave: boolean
) => {
if (checkStore.selectTestItems.preTest && !checkStore.selectTestItems.test) {
testAgain.value = true
}
deviceMonitor2.value = deviceMonitor;
console.log('deviceMonitor:',deviceMonitor2.value)
onlyWave.value = planIsOnlyWave;
checkStore.setNodesConnectable(true)
dialogTitle.value = title
channelMapping.value = mapping

View File

@@ -62,6 +62,8 @@ import { ElMessage } from 'element-plus'
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
import { jwtUtil } from '@/utils/jwtUtil'
import { useCheckStore } from '@/stores/modules/check'
import { Plan } from '@/api/plan/interface'
import { fa } from 'element-plus/es/locale'
const checkStore = useCheckStore()
const dialogVisible = ref(false)
@@ -203,16 +205,18 @@ const devIdList = ref<Device.ResPqDev[]>([])
const pqStandardDevList = ref<StandardDevice.ResPqStandardDevice[]>([])
const planIdKey = ref<string>('')
const deviceMonitor = ref<Map<string, any[]>>();
const planIsOnlyWave = ref(false)
const open = async (
device: Device.ResPqDev[],
standardDev: StandardDevice.ResPqStandardDevice[],
fatherPlanId: string,
DeviceMonitoringMap: Map<string, any[]>,
checkType: string
checkType: string,
isOnlyWave:boolean
) => {
planIsOnlyWave.value = isOnlyWave
CompareTestVisible.value = false
devIdList.value = device
pqStandardDevList.value = standardDev
planIdKey.value = fatherPlanId
@@ -290,7 +294,8 @@ const openTestDialog = async () => {
devIds.value,
standardDevIds.value,
connections,
deviceMonitor.value
deviceMonitor.value ,
planIsOnlyWave.value
)
}, 100)
}

View File

@@ -829,7 +829,11 @@ const handleTest2 = async (val: string) => {
// 只传递有监测点的设备
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id,filteredDeviceMonitoringMap,val)
const targetPlan = props.planTable.data.find((item: any) => item.id === props.plan.id);
// 检查数组长度是否为1且唯一元素是'wave_data'
const isOnlyWave = targetPlan.datasourceIds.length === 1 && targetPlan.datasourceIds[0] === 'wave_data';
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id,filteredDeviceMonitoringMap,val,isOnlyWave)
}
/**