2025-08-06 15:18:27 +08:00
|
|
|
|
<template>
|
2025-09-08 14:55:25 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<div class="dialog" v-bind="dialogBig">
|
|
|
|
|
|
<div class="dialog-title">
|
|
|
|
|
|
<div class="timeView">
|
|
|
|
|
|
<el-icon style="margin: 0px 5px">
|
|
|
|
|
|
<Clock/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
<span>检测用时:{{ timeView }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-progress style="width: 82%; margin-right: 3%" :percentage="percentage" :color="customColors"/>
|
|
|
|
|
|
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="dialog-content">
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
:data="checkResultView"
|
|
|
|
|
|
row-key="scriptType"
|
|
|
|
|
|
height="450px"
|
|
|
|
|
|
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' }"
|
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
|
border
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
fixed
|
|
|
|
|
|
prop="scriptName"
|
|
|
|
|
|
label="检测项目"
|
|
|
|
|
|
width="150px"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
></el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="chnSum <= MAX_CHN_SUM">
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(item, index1) in deviceList"
|
|
|
|
|
|
:key="item.deviceId"
|
|
|
|
|
|
:label="item.deviceName"
|
|
|
|
|
|
:min-width="110"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(chnItem, index2) in checkStore.chnNumList"
|
|
|
|
|
|
:key="`${item.deviceId}${chnItem}`"
|
|
|
|
|
|
:label="'通道' + chnItem"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-tooltip
|
|
|
|
|
|
:content="
|
2025-08-20 20:02:22 +08:00
|
|
|
|
row.devices[index1].chnResult[index2].icon === 'More'
|
|
|
|
|
|
? '暂无数据'
|
|
|
|
|
|
: row.devices[index1].chnResult[index2].icon === 'CircleCheckFilled'
|
|
|
|
|
|
? '符合'
|
|
|
|
|
|
: row.devices[index1].chnResult[index2].icon === 'Close'
|
|
|
|
|
|
? '不符合'
|
|
|
|
|
|
: row.devices[index1].chnResult[index2].icon ===
|
|
|
|
|
|
'WarnTriangleFilled'
|
|
|
|
|
|
? '数据异常'
|
|
|
|
|
|
: row.devices[index1].chnResult[index2].icon === 'Loading'
|
|
|
|
|
|
? '检测中'
|
|
|
|
|
|
: '连接中断'
|
|
|
|
|
|
"
|
2025-09-08 14:55:25 +08:00
|
|
|
|
placement="right"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
:disabled="
|
2025-08-20 20:02:22 +08:00
|
|
|
|
row.devices[index1].chnResult[index2].color ===
|
|
|
|
|
|
CheckData.ButtonColorEnum.INFO ||
|
|
|
|
|
|
row.devices[index1].chnResult[index2].color ===
|
|
|
|
|
|
CheckData.ButtonColorEnum.LOADING
|
|
|
|
|
|
"
|
2025-09-08 14:55:25 +08:00
|
|
|
|
:color="row.devices[index1].chnResult[index2].color"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
@click="handleClick(row, chnItem, row.scriptType)"
|
|
|
|
|
|
style="align-self: center"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-icon
|
|
|
|
|
|
v-if="row.devices[index1].chnResult[index2].icon === 'Loading'"
|
|
|
|
|
|
class="loading-box"
|
|
|
|
|
|
style="color: #fff"
|
|
|
|
|
|
>
|
|
|
|
|
|
<component :is="Loading"/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
<el-icon v-else style="color: #fff">
|
|
|
|
|
|
<component :is="row.devices[index1].chnResult[index2].icon"/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="drawer-container">
|
|
|
|
|
|
<el-drawer v-model="drawer" title="检测项进度" direction="btt" :size="'38%'">
|
|
|
|
|
|
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto">
|
|
|
|
|
|
<p
|
|
|
|
|
|
v-for="(item, index) in testLogList"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
:style="{
|
2025-08-20 20:02:22 +08:00
|
|
|
|
color:
|
|
|
|
|
|
item.type === 'error'
|
|
|
|
|
|
? '#F56C6C'
|
|
|
|
|
|
: item.type === 'warning'
|
|
|
|
|
|
? '#e6a23c'
|
|
|
|
|
|
: 'var(--el-text-color-regular)'
|
|
|
|
|
|
}"
|
2025-09-08 14:55:25 +08:00
|
|
|
|
>
|
|
|
|
|
|
{{ item.log }}
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
</p>
|
2025-08-07 14:43:56 +08:00
|
|
|
|
</div>
|
2025-09-08 14:55:25 +08:00
|
|
|
|
</el-drawer>
|
2025-08-20 20:02:22 +08:00
|
|
|
|
</div>
|
2025-09-08 14:55:25 +08:00
|
|
|
|
|
|
|
|
|
|
<CompareDataCheckSingleChannelSingleTestPopup
|
|
|
|
|
|
ref="dataCheckSingleChannelSingleTestPopupRef"
|
|
|
|
|
|
:append-to-body="true"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2025-08-06 15:18:27 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<script lang="tsx" setup name="test">
|
2025-09-08 14:55:25 +08:00
|
|
|
|
import {InfoFilled, Loading} from '@element-plus/icons-vue'
|
2025-08-08 13:18:01 +08:00
|
|
|
|
import CompareDataCheckSingleChannelSingleTestPopup from './compareDataCheckSingleChannelSingleTestPopup.vue'
|
2025-09-09 09:14:42 +08:00
|
|
|
|
import {computed, ComputedRef, nextTick, onBeforeMount, onMounted, reactive, ref, toRef, watch} from 'vue'
|
2025-09-08 14:55:25 +08:00
|
|
|
|
import {dialogBig} from '@/utils/elementBind'
|
|
|
|
|
|
import {CheckData} from '@/api/check/interface'
|
|
|
|
|
|
import {useCheckStore} from '@/stores/modules/check'
|
|
|
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
|
|
|
import {getBigTestItem} from '@/api/check/test'
|
|
|
|
|
|
import {getAutoGenerate} from '@/api/user/login'
|
|
|
|
|
|
import {useModeStore} from '@/stores/modules/mode' // 引入模式 store
|
|
|
|
|
|
import {useDictStore} from '@/stores/modules/dict'
|
2025-10-09 15:47:00 +08:00
|
|
|
|
import { ca } from 'element-plus/es/locale'
|
2025-08-07 14:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
const checkStore = useCheckStore()
|
2025-08-15 08:37:35 +08:00
|
|
|
|
const modeStore = useModeStore()
|
|
|
|
|
|
const dictStore = useDictStore()
|
2025-08-07 14:43:56 +08:00
|
|
|
|
// 最大通道数
|
|
|
|
|
|
const MAX_CHN_SUM = 12
|
|
|
|
|
|
|
|
|
|
|
|
// 总测试项数
|
|
|
|
|
|
let checkTotal = 0
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
2025-09-08 14:55:25 +08:00
|
|
|
|
testStatus: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'waiting'
|
|
|
|
|
|
},
|
|
|
|
|
|
stepsActive: {
|
|
|
|
|
|
type: Number
|
|
|
|
|
|
},
|
|
|
|
|
|
webMsgSend: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => ({})
|
|
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
})
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
const emit = defineEmits([
|
2025-09-08 14:55:25 +08:00
|
|
|
|
'update:testStatus',
|
|
|
|
|
|
'update:webMsgSend',
|
|
|
|
|
|
'sendPause',
|
|
|
|
|
|
'sendResume',
|
|
|
|
|
|
'sendReCheck',
|
|
|
|
|
|
'closeWebSocket'
|
2025-08-20 20:02:22 +08:00
|
|
|
|
])
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-08-07 14:43:56 +08:00
|
|
|
|
// 用来保存测试项进度抽屉是否打开
|
|
|
|
|
|
const drawer = ref(false)
|
|
|
|
|
|
// 进度条颜色
|
2025-09-08 14:55:25 +08:00
|
|
|
|
const customColors = [{color: '#91cc75', percentage: 100}]
|
2025-08-07 14:43:56 +08:00
|
|
|
|
// 检测脚本数据
|
|
|
|
|
|
let scriptData: CheckData.ScriptItem[] = []
|
|
|
|
|
|
// 用来保存被检设备
|
|
|
|
|
|
const deviceList = reactive<CheckData.Device[]>([])
|
|
|
|
|
|
// 当前进行的测试项索引
|
|
|
|
|
|
let activeIndex = 0
|
|
|
|
|
|
// 百分比
|
2025-08-20 20:02:22 +08:00
|
|
|
|
const percentage = ref(0)
|
2025-08-07 14:43:56 +08:00
|
|
|
|
// 时间计数器
|
|
|
|
|
|
let timer: any = null
|
|
|
|
|
|
const timeCount = ref(0)
|
|
|
|
|
|
const timeView = ref('00:00:00')
|
|
|
|
|
|
//测试项开始检测时间(或继续检测时间)
|
|
|
|
|
|
const startData = ref(new Date())
|
|
|
|
|
|
//测试项检测结束时间(或暂停时的时间)
|
|
|
|
|
|
const endData = ref(new Date())
|
|
|
|
|
|
const timeDifference = ref(0)
|
|
|
|
|
|
// 真正的检测结果(详细到通道)
|
|
|
|
|
|
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
|
|
|
|
|
|
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格,则该检测项的id会被加入该数组。
|
2025-08-20 20:02:22 +08:00
|
|
|
|
let errorCheckItem: Array<{ scriptType: string; type: CheckData.ChnCheckResultEnum }> = []
|
2025-08-07 14:43:56 +08:00
|
|
|
|
// 用来存放检测日志
|
2025-09-08 14:55:25 +08:00
|
|
|
|
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
2025-09-09 09:14:42 +08:00
|
|
|
|
// 添加一个响应式变量来跟踪是否需要显示录波项目
|
|
|
|
|
|
const showWaveItem = ref(false)
|
2025-08-07 14:43:56 +08:00
|
|
|
|
const testStatus = toRef(props, 'testStatus')
|
|
|
|
|
|
const webMsgSend = toRef(props, 'webMsgSend')
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
const scrollContainerRef = ref()
|
|
|
|
|
|
const dataCheckSingleChannelSingleTestPopupRef =
|
|
|
|
|
|
ref<InstanceType<typeof CompareDataCheckSingleChannelSingleTestPopup>>()
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-08-07 14:43:56 +08:00
|
|
|
|
// 总通道数
|
|
|
|
|
|
const chnSum = computed(() => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
let sum = 0
|
|
|
|
|
|
deviceList.forEach(item => {
|
|
|
|
|
|
sum += item.chnNum
|
|
|
|
|
|
})
|
|
|
|
|
|
return sum
|
2025-08-07 14:43:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 用来展示的检测结果
|
|
|
|
|
|
const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
|
|
|
|
|
|
let temp: CheckData.ScriptChnViewItem = {
|
|
|
|
|
|
scriptType: item.scriptType,
|
|
|
|
|
|
scriptName: item.scriptName,
|
|
|
|
|
|
devices: []
|
|
|
|
|
|
}
|
|
|
|
|
|
item.devices.forEach(device => {
|
|
|
|
|
|
let tempChnBtnResult: CheckData.ButtonResult[] = []
|
|
|
|
|
|
|
|
|
|
|
|
if (chnSum.value <= MAX_CHN_SUM) {
|
|
|
|
|
|
for (let j = 0; j < device.chnResult.length; j++) {
|
|
|
|
|
|
switch (device.chnResult[j]) {
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'More'})
|
|
|
|
|
|
break
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.LOADING:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
|
|
|
|
|
break
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.SUCCESS:
|
|
|
|
|
|
tempChnBtnResult.push({
|
|
|
|
|
|
color: CheckData.ButtonColorEnum.SUCCESS,
|
|
|
|
|
|
icon: 'CircleCheckFilled'
|
|
|
|
|
|
})
|
|
|
|
|
|
break
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.FAIL:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
|
|
|
|
|
break
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.TIMEOUT:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
|
|
|
|
|
break
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
|
|
|
|
|
tempChnBtnResult.push({
|
|
|
|
|
|
color: CheckData.ButtonColorEnum.WARNING,
|
|
|
|
|
|
icon: 'WarnTriangleFilled'
|
|
|
|
|
|
})
|
|
|
|
|
|
break
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
|
|
|
|
|
break
|
|
|
|
|
|
default:
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
}
|
2025-09-09 20:54:22 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
temp.devices.push({
|
|
|
|
|
|
deviceId: device.deviceId,
|
|
|
|
|
|
deviceName: device.deviceName,
|
|
|
|
|
|
chnResult: tempChnBtnResult
|
|
|
|
|
|
})
|
2025-08-07 14:43:56 +08:00
|
|
|
|
})
|
2025-09-08 14:55:25 +08:00
|
|
|
|
return temp
|
|
|
|
|
|
})
|
|
|
|
|
|
return result
|
2025-08-07 14:43:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
watch(testStatus, function (newValue, oldValue) {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (newValue == 'start' || newValue == 'waiting') {
|
|
|
|
|
|
if (!checkStore.selectTestItems.preTest && !checkStore.selectTestItems.channelsTest) {
|
|
|
|
|
|
ElMessage.success('初始化开始!')
|
|
|
|
|
|
emit('update:testStatus', 'test_init')
|
|
|
|
|
|
if (checkStore.selectTestItems.test && checkStore.selectTestItems.preTest) {
|
|
|
|
|
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
emit('update:testStatus', 'process')
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
// 开始计时
|
|
|
|
|
|
startTimeCount()
|
|
|
|
|
|
showTestLog()
|
|
|
|
|
|
|
|
|
|
|
|
//startTimer() // todo 可移除
|
|
|
|
|
|
startData.value = new Date()
|
|
|
|
|
|
timeDifference.value = 0
|
|
|
|
|
|
} else if (newValue == 'error') {
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
webMsgSend,
|
|
|
|
|
|
function (newValue, oldValue) {
|
2025-09-09 20:54:22 +08:00
|
|
|
|
switch (newValue.requestId) {
|
2025-09-22 09:16:35 +08:00
|
|
|
|
case 'record_wave_step1':
|
2025-09-09 09:14:42 +08:00
|
|
|
|
switch (newValue.code) {
|
|
|
|
|
|
case 10200:
|
|
|
|
|
|
setLogList('info', newValue.data)
|
|
|
|
|
|
break
|
|
|
|
|
|
case 25002:
|
|
|
|
|
|
setLogList('error', newValue.data)
|
|
|
|
|
|
break
|
|
|
|
|
|
case 25003:
|
|
|
|
|
|
ElMessageBox.alert('录波对齐失败!', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
})
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break
|
2025-09-09 20:54:22 +08:00
|
|
|
|
case 25001: {
|
2025-09-09 09:14:42 +08:00
|
|
|
|
// 当录波校验完成时,更新录波项目的按钮状态
|
2025-09-16 13:47:40 +08:00
|
|
|
|
setLogList('info', '录波校验完成!')
|
2025-09-10 09:28:04 +08:00
|
|
|
|
// 解析返回的数据
|
|
|
|
|
|
const waveData = JSON.parse(newValue.data)
|
2025-09-09 20:54:22 +08:00
|
|
|
|
// 找到录波项目并更新其状态
|
|
|
|
|
|
const waveResultItem = checkResult.find(item => item.scriptType === 'wave_data')
|
2025-09-10 09:28:04 +08:00
|
|
|
|
// if (waveResultItem) {
|
|
|
|
|
|
// // 将录波项目状态设置为SUCCESS
|
|
|
|
|
|
// waveResultItem.devices.forEach(device => {
|
|
|
|
|
|
// device.chnResult.fill(CheckData.ChnCheckResultEnum.SUCCESS)
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
2025-09-09 20:54:22 +08:00
|
|
|
|
if (waveResultItem) {
|
2025-09-10 09:28:04 +08:00
|
|
|
|
// 根据返回的chnResult更新各个设备的通道状态
|
2025-09-09 20:54:22 +08:00
|
|
|
|
waveResultItem.devices.forEach(device => {
|
2025-09-10 09:28:04 +08:00
|
|
|
|
const deviceData = waveData.find((d: any) => d.deviceId === device.deviceId)
|
|
|
|
|
|
if (deviceData) {
|
|
|
|
|
|
// 根据实际返回的chnResult更新状态
|
|
|
|
|
|
deviceData.chnResult.forEach((result: number, index: number) => {
|
|
|
|
|
|
// 创建数字到枚举的映射
|
|
|
|
|
|
const resultMap: { [key: number]: CheckData.ChnCheckResultEnum } = {
|
|
|
|
|
|
1: CheckData.ChnCheckResultEnum.SUCCESS,
|
|
|
|
|
|
2: CheckData.ChnCheckResultEnum.FAIL,
|
|
|
|
|
|
3: CheckData.ChnCheckResultEnum.TIMEOUT,
|
|
|
|
|
|
4: CheckData.ChnCheckResultEnum.ERRORDATA,
|
|
|
|
|
|
5: CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 使用映射关系设置状态,如果没有对应的映射则设为UNKNOWN
|
|
|
|
|
|
device.chnResult[index] = resultMap[result] || CheckData.ChnCheckResultEnum.UNKNOWN
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-09-09 20:54:22 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// 触发响应式更新
|
2025-09-10 09:28:04 +08:00
|
|
|
|
checkResult.splice(0, 0)
|
2025-09-09 20:54:22 +08:00
|
|
|
|
stopTimeCount()
|
2025-09-12 13:35:29 +08:00
|
|
|
|
updatePercentage()
|
2025-09-09 20:54:22 +08:00
|
|
|
|
break
|
|
|
|
|
|
}
|
2025-09-09 09:14:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
break
|
2025-10-13 13:56:37 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
case 'connect':
|
|
|
|
|
|
switch (newValue.operateCode) {
|
|
|
|
|
|
case 'Contrast_Dev':
|
|
|
|
|
|
setLogList('error', '设备服务端连接失败!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'unknown_operate':
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'error_flow_end':
|
|
|
|
|
|
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
})
|
|
|
|
|
|
setLogList('error', '当前流程存在异常结束!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'socket_timeout':
|
|
|
|
|
|
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
})
|
|
|
|
|
|
setLogList('error', '设备连接异常,请检查设备连接情况!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'server_error':
|
|
|
|
|
|
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
})
|
|
|
|
|
|
setLogList('error', '服务端主动关闭连接!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'device_error':
|
|
|
|
|
|
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
})
|
|
|
|
|
|
setLogList('error', '设备主动关闭连接!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break
|
2025-09-29 14:49:29 +08:00
|
|
|
|
case 'yjc_xyjy' :
|
|
|
|
|
|
if (newValue.code == 10552) {
|
|
|
|
|
|
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
setLogList('error', '重复的初始化操作!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-09-19 11:20:06 +08:00
|
|
|
|
case 'yjc_sbtxjy' :
|
2025-09-29 14:49:29 +08:00
|
|
|
|
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
setLogList('error', '重复的初始化操作!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
break;
|
2025-09-08 14:55:25 +08:00
|
|
|
|
}
|
2025-09-09 20:54:22 +08:00
|
|
|
|
if (checkStore.selectTestItems.preTest == false && newValue.requestId != 'formal_real') {
|
|
|
|
|
|
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
|
|
|
|
|
testLogList.shift()
|
|
|
|
|
|
setLogList('info', '初始化开始!')
|
|
|
|
|
|
}
|
|
|
|
|
|
let str =
|
|
|
|
|
|
newValue.requestId == 'yjc_sbtxjy'
|
|
|
|
|
|
? '设备通讯校验'
|
|
|
|
|
|
: newValue.requestId == 'yjc_mxyzxjy'
|
|
|
|
|
|
? '模型一致性检验'
|
|
|
|
|
|
: newValue.requestId == 'yjc_align'
|
2025-09-29 14:49:29 +08:00
|
|
|
|
? '数据对齐检验'
|
2025-09-09 20:54:22 +08:00
|
|
|
|
: newValue.requestId == 'YJC_xujy'
|
|
|
|
|
|
? '相序校验'
|
|
|
|
|
|
: ''
|
|
|
|
|
|
// 预检测处理
|
|
|
|
|
|
switch (newValue.code) {
|
|
|
|
|
|
case 25001:
|
|
|
|
|
|
// 成功
|
|
|
|
|
|
if (newValue.data != undefined) return
|
|
|
|
|
|
setLogList('info', str + '成功!')
|
|
|
|
|
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化成功!')
|
|
|
|
|
|
break
|
|
|
|
|
|
case 25003:
|
|
|
|
|
|
// 失败
|
|
|
|
|
|
if (newValue.data != undefined) return
|
|
|
|
|
|
setLogList('error', str + '失败!')
|
|
|
|
|
|
emit('update:testStatus', 'error')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
|
|
|
|
|
break
|
2025-09-19 11:20:06 +08:00
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 预监测 正式检测
|
|
|
|
|
|
else if (newValue.requestId == 'formal_real') {
|
|
|
|
|
|
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
|
|
|
|
|
testLogList.shift()
|
|
|
|
|
|
}
|
|
|
|
|
|
switch (newValue.code) {
|
|
|
|
|
|
case 25001:
|
2025-10-09 15:47:00 +08:00
|
|
|
|
case 25006:
|
2025-09-09 20:54:22 +08:00
|
|
|
|
case 25005:
|
2025-10-13 13:56:37 +08:00
|
|
|
|
case 25007:// 添加闪变处理
|
2025-09-09 20:54:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
let result: CheckData.ScriptChnItem[] = []
|
2025-09-12 13:35:29 +08:00
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
let message = JSON.parse(newValue.data)
|
2025-10-09 15:49:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-09-29 14:49:29 +08:00
|
|
|
|
// 当收到 25005/25006 消息时,录波项目开始loading
|
2025-10-09 15:49:29 +08:00
|
|
|
|
|
2025-10-09 15:47:00 +08:00
|
|
|
|
if (newValue.code == 25005 || newValue.code == 25006) {
|
2025-09-09 20:54:22 +08:00
|
|
|
|
// 设置录波项目为LOADING状态
|
|
|
|
|
|
const waveResultItem = checkResult.find(item => item.code === 'wave_data')
|
|
|
|
|
|
|
|
|
|
|
|
if (waveResultItem) {
|
|
|
|
|
|
waveResultItem.devices.forEach(device => {
|
|
|
|
|
|
device.chnResult.fill(CheckData.ChnCheckResultEnum.LOADING)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-10-13 13:56:37 +08:00
|
|
|
|
|
|
|
|
|
|
if (newValue.code == 25007) {
|
|
|
|
|
|
// 设置闪变项目为LOADING状态
|
|
|
|
|
|
const flickerResultItem = checkResult.find(item => item.code === 'flicker_data')
|
|
|
|
|
|
|
|
|
|
|
|
if (flickerResultItem) {
|
|
|
|
|
|
flickerResultItem.devices.forEach(device => {
|
|
|
|
|
|
device.chnResult.fill(CheckData.ChnCheckResultEnum.LOADING)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
scriptData.forEach(item => {
|
|
|
|
|
|
// 处理当前节点的数据
|
|
|
|
|
|
const temp: CheckData.ScriptChnItem = {
|
|
|
|
|
|
scriptType: item.id,
|
|
|
|
|
|
scriptName: item.scriptName,
|
|
|
|
|
|
devices: []
|
|
|
|
|
|
}
|
2025-09-12 13:35:29 +08:00
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
// 特殊处理录波项目 - 如果是25005消息且当前项目是录波项目,则使用已设置的状态
|
2025-10-09 15:47:00 +08:00
|
|
|
|
if ((newValue.code == 25005 || newValue.code == 25006) && item.code === 'wave_data') {
|
2025-10-09 15:49:29 +08:00
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
const existingWaveItem = checkResult.find(checkItem => checkItem.scriptType === 'wave_data')
|
|
|
|
|
|
if (existingWaveItem) {
|
|
|
|
|
|
temp.devices = [...existingWaveItem.devices] // 保留已设置的devices
|
|
|
|
|
|
}
|
2025-10-13 13:56:37 +08:00
|
|
|
|
} // 特殊处理闪变项目 - 如果是25007消息且当前项目是闪变项目,则使用已设置的状态
|
|
|
|
|
|
else if (newValue.code == 25007 && item.code === 'PST') {
|
|
|
|
|
|
const existingFlickerItem = checkResult.find(checkItem => checkItem.scriptType === 'PST')
|
|
|
|
|
|
if (existingFlickerItem) {
|
|
|
|
|
|
temp.devices = [...existingFlickerItem.devices] // 保留已设置的devices
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
2025-09-09 20:54:22 +08:00
|
|
|
|
// 找到message中所有scriptName与当前item.code匹配的项
|
|
|
|
|
|
const matchedDevices = message
|
|
|
|
|
|
.filter((msg: any) => msg.scriptName === item.code)
|
|
|
|
|
|
.map((msg: any) => ({
|
|
|
|
|
|
deviceId: msg.deviceId,
|
|
|
|
|
|
deviceName: msg.deviceName,
|
|
|
|
|
|
chnResult: msg.chnResult
|
|
|
|
|
|
}))
|
2025-09-12 13:35:29 +08:00
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
// 添加匹配到的设备
|
|
|
|
|
|
temp.devices.push(...matchedDevices)
|
2025-09-12 13:35:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 对于未匹配到的设备,也要添加占位符(特别是录波项目)
|
2025-10-13 13:56:37 +08:00
|
|
|
|
if (item.code === 'wave_data' || item.code === 'PST') {
|
2025-09-12 13:35:29 +08:00
|
|
|
|
deviceList.forEach(device => {
|
|
|
|
|
|
const isDeviceExist = matchedDevices.some((matchedDevice: any) => matchedDevice.deviceId === device.deviceId)
|
|
|
|
|
|
if (!isDeviceExist) {
|
|
|
|
|
|
// 对于录波项目或未匹配到的设备,添加默认状态
|
|
|
|
|
|
temp.devices.push({
|
|
|
|
|
|
deviceId: device.deviceId,
|
|
|
|
|
|
deviceName: device.deviceName,
|
|
|
|
|
|
chnResult: new Array(checkStore.chnNumList.length).fill(
|
|
|
|
|
|
item.code === 'wave_data' ?
|
|
|
|
|
|
CheckData.ChnCheckResultEnum.UNKNOWN :
|
|
|
|
|
|
CheckData.ChnCheckResultEnum.UNKNOWN
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-09-09 20:54:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
result.push(temp)
|
|
|
|
|
|
})
|
2025-09-10 09:28:04 +08:00
|
|
|
|
|
2025-09-09 20:54:22 +08:00
|
|
|
|
Object.assign(checkResult, result)
|
|
|
|
|
|
if (newValue.code == 25001) {
|
|
|
|
|
|
setLogList('info', '检测完成!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
updatePercentage()
|
|
|
|
|
|
}
|
|
|
|
|
|
if(newValue.code == 25005){
|
|
|
|
|
|
setLogList("error", '实时数据校验失败!开始录波校验...')
|
|
|
|
|
|
}
|
2025-10-09 15:47:00 +08:00
|
|
|
|
if(newValue.code == 25006){
|
|
|
|
|
|
setLogList("error", '统计数据校验失败!开始录波校验...')
|
|
|
|
|
|
}
|
2025-09-09 20:54:22 +08:00
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case 25003:
|
|
|
|
|
|
setLogList('error', '检测失败!')
|
|
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
updatePercentage()
|
|
|
|
|
|
break
|
|
|
|
|
|
default:
|
|
|
|
|
|
if (newValue.code != 10201) {
|
|
|
|
|
|
setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
},
|
2025-09-08 14:55:25 +08:00
|
|
|
|
{deep: true}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
)
|
2025-08-21 13:14:59 +08:00
|
|
|
|
const setLogList = (state: 'error' | 'info' | 'warning', text: string) => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
testLogList.push({
|
|
|
|
|
|
type: state,
|
|
|
|
|
|
log: `${new Date().toLocaleString()}:` + text
|
|
|
|
|
|
})
|
2025-08-21 13:14:59 +08:00
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
|
|
|
|
|
|
// 更新进度条
|
|
|
|
|
|
const updatePercentage = async () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (testLogList.length - 1 < checkStore.chnNumList.length) {
|
|
|
|
|
|
percentage.value = Math.trunc(((testLogList.length - 1) / checkStore.chnNumList.length) * 100)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
percentage.value = 100
|
|
|
|
|
|
emit('update:testStatus', 'success')
|
|
|
|
|
|
|
|
|
|
|
|
let {data: autoGenerate} = await getAutoGenerate()
|
|
|
|
|
|
if (autoGenerate == 1) {
|
|
|
|
|
|
//调用自动生成报告接口
|
|
|
|
|
|
let devIdList = checkStore.devices.map(item => {
|
|
|
|
|
|
return item.deviceId
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// await generateDevReport({
|
|
|
|
|
|
// planId: checkStore.plan.id,
|
|
|
|
|
|
// devIdList: devIdList,
|
|
|
|
|
|
// scriptId: checkStore.plan.scriptId,
|
|
|
|
|
|
// planCode: checkStore.plan.code + ''
|
|
|
|
|
|
// })
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
stopTimeCount()
|
|
|
|
|
|
ElMessageBox.alert(
|
|
|
|
|
|
'检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作',
|
|
|
|
|
|
'检测完成',
|
|
|
|
|
|
{
|
|
|
|
|
|
confirmButtonText: '确定'
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
// 关闭WebSocket连接
|
|
|
|
|
|
emit('closeWebSocket')
|
|
|
|
|
|
//clear();
|
|
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
// ========== 时间计数器管理函数 ==========
|
|
|
|
|
|
// 开始计时
|
|
|
|
|
|
const startTimeCount = () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (!timer) {
|
|
|
|
|
|
timer = setInterval(() => {
|
|
|
|
|
|
timeCount.value = timeCount.value + 1
|
|
|
|
|
|
timeView.value = secondToTime(timeCount.value)
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
}
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
initCheckResult(CheckData.ChnCheckResultEnum.LOADING)
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
})
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
// 停止计时
|
|
|
|
|
|
const stopTimeCount = () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (timer) {
|
|
|
|
|
|
clearInterval(timer)
|
|
|
|
|
|
timer = null
|
|
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
// 将秒数转换为 HH:MM:SS 格式
|
|
|
|
|
|
const secondToTime = (second: number) => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
let h: string | number = Math.floor(second / 3600) // 小时
|
|
|
|
|
|
let m: string | number = Math.floor((second - h * 3600) / 60) // 分钟
|
|
|
|
|
|
let s: string | number = Math.floor(second % 60) // 秒
|
|
|
|
|
|
|
|
|
|
|
|
// 补齐前导零
|
|
|
|
|
|
h = h < 10 ? '0' + h : h
|
|
|
|
|
|
m = m < 10 ? '0' + m : m
|
|
|
|
|
|
s = s < 10 ? '0' + s : s
|
|
|
|
|
|
return h + ':' + m + ':' + s
|
2025-08-20 20:02:22 +08:00
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
|
|
})
|
2025-08-07 14:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
const showTestLog = () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
drawer.value = true
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化检测脚本数据
|
|
|
|
|
|
const initScriptData = async () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
scriptData = []
|
|
|
|
|
|
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
|
|
|
|
|
|
let response: any = await getBigTestItem({
|
|
|
|
|
|
reCheckType: checkStore.reCheckType,
|
|
|
|
|
|
planId: checkStore.plan.id,
|
|
|
|
|
|
devIds: checkStore.devices.map(item => item.deviceId),
|
|
|
|
|
|
patternId: pattern
|
|
|
|
|
|
})
|
2025-09-09 09:14:42 +08:00
|
|
|
|
// 格式化脚本数据,初始化时排除录波项目
|
|
|
|
|
|
let temp = response.data
|
|
|
|
|
|
.map((item: any) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
scriptName: item.scriptName
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-08-15 08:37:35 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
// 保存脚本数据并设置总数
|
|
|
|
|
|
scriptData.push(...temp)
|
|
|
|
|
|
checkTotal = scriptData.length
|
2025-09-22 15:51:58 +08:00
|
|
|
|
console.log('shul',checkTotal)
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 初始化设备列表
|
|
|
|
|
|
const initDeviceList = () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
Object.assign(deviceList, checkStore.devices)
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化检测结果 (详细到通道)
|
2025-08-26 18:29:14 +08:00
|
|
|
|
const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
let result: CheckData.ScriptChnItem[] = []
|
|
|
|
|
|
|
|
|
|
|
|
scriptData.forEach(item => {
|
|
|
|
|
|
let temp: CheckData.ScriptChnItem = {
|
|
|
|
|
|
scriptType: item.id,
|
|
|
|
|
|
code: item.code,
|
|
|
|
|
|
scriptName: item.scriptName,
|
|
|
|
|
|
devices: []
|
|
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
for (let i = 0; i < deviceList?.length; i++) {
|
|
|
|
|
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
|
|
|
|
|
for (let j = 0; j < checkStore.chnNumList.length; j++) {
|
2025-09-09 20:54:22 +08:00
|
|
|
|
// 录波项目初始化为UNKNOWN状态,其他项目使用传入的默认值
|
2025-10-13 13:56:37 +08:00
|
|
|
|
if ((item.code === 'wave_data' || item.code === 'PST')&& checkTotal > 1) {
|
2025-09-09 20:54:22 +08:00
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
tempChnResult.push(defaultValue)
|
|
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
temp.devices.push({
|
|
|
|
|
|
deviceId: deviceList[i].deviceId,
|
|
|
|
|
|
deviceName: deviceList[i].deviceName,
|
|
|
|
|
|
chnResult: tempChnResult
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
result.push(temp)
|
|
|
|
|
|
})
|
2025-08-20 20:02:22 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
Object.assign(checkResult, result)
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const scrollToBottom = () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (scrollContainerRef.value) {
|
|
|
|
|
|
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight + 70
|
|
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
testLogList,
|
|
|
|
|
|
() => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
scrollToBottom()
|
2025-08-20 20:02:22 +08:00
|
|
|
|
},
|
2025-09-08 14:55:25 +08:00
|
|
|
|
{deep: true}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
)
|
2025-08-07 14:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 点击查看(设备)通道检测详情。参数1:设备信息,参数2:通道号,-1:代表查看全部通道
|
|
|
|
|
|
const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
|
2025-09-09 20:54:22 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
let flag = -1
|
|
|
|
|
|
if (checkResultItem) {
|
|
|
|
|
|
let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
|
|
|
|
|
|
if (device) {
|
|
|
|
|
|
let chnResult = device.chnResult
|
|
|
|
|
|
if (chnNum === -1) {
|
|
|
|
|
|
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.TIMEOUT) !== -1) {
|
|
|
|
|
|
flag = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) {
|
|
|
|
|
|
flag = 1
|
2025-08-22 15:33:57 +08:00
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.TIMEOUT) {
|
|
|
|
|
|
flag = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) {
|
|
|
|
|
|
flag = 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-22 15:33:57 +08:00
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
}
|
2025-08-22 15:33:57 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (flag === 0) {
|
|
|
|
|
|
ElMessageBox.alert('连接超时,请检查设备通讯是否正常', '连接超时', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
if (flag === -1 || flag === 1) {
|
|
|
|
|
|
checkStore.setShowDetailType(2)
|
2025-08-22 15:33:57 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
dataCheckSingleChannelSingleTestPopupRef.value?.open(item, chnNum + '', item.devices[0].deviceId, 1)
|
|
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
}
|
2025-08-11 15:59:29 +08:00
|
|
|
|
|
2025-08-07 14:43:56 +08:00
|
|
|
|
const handlePause = () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
//emit('sendPause')
|
|
|
|
|
|
testLogList.push({
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`
|
|
|
|
|
|
})
|
2025-08-20 20:02:22 +08:00
|
|
|
|
}
|
2025-08-21 13:14:59 +08:00
|
|
|
|
const initializeParameters = async () => {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
await initScriptData()
|
|
|
|
|
|
initDeviceList()
|
|
|
|
|
|
initCheckResult(CheckData.ChnCheckResultEnum.UNKNOWN)
|
|
|
|
|
|
percentage.value = 0
|
|
|
|
|
|
timeCount.value = 0
|
|
|
|
|
|
timeView.value = '00:00:00'
|
|
|
|
|
|
testLogList.splice(0, testLogList.length, {
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
log: checkStore.selectTestItems.preTest ? '正在检测,请稍等...' : '暂无数据,等待检测开始'
|
|
|
|
|
|
})
|
2025-08-07 14:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
//
|
|
|
|
|
|
onMounted(() => {
|
2025-09-09 20:54:22 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
if (!checkStore.selectTestItems.preTest) {
|
|
|
|
|
|
// 判断是否预检测
|
|
|
|
|
|
initializeParameters()
|
|
|
|
|
|
}
|
2025-08-20 20:02:22 +08:00
|
|
|
|
})
|
2025-08-07 14:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
2025-09-08 14:55:25 +08:00
|
|
|
|
initializeParameters,
|
|
|
|
|
|
handlePause,
|
|
|
|
|
|
showTestLog,
|
|
|
|
|
|
startTimeCount
|
2025-08-07 14:43:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2025-08-06 15:18:27 +08:00
|
|
|
|
:deep(.el-table .header-row) {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
background-color: #f5f7fa;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-table .warning-row) {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
color: red;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-table .success-row {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
--el-table-tr-bg-color: var(--el-color-success-light-9);
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dialog {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
|
overflow-x: hidden;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dialog-title {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
.timeView {
|
2025-08-06 15:18:27 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2025-09-08 14:55:25 +08:00
|
|
|
|
color: #91cc75;
|
|
|
|
|
|
width: 28%;
|
|
|
|
|
|
margin-right: 0px;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
font-size: 26px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dialog-content {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
max-height: 450px;
|
|
|
|
|
|
overflow-y: hidden;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-collapse-item__header) {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
height: 30px;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dialog-log {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
height: 50px;
|
|
|
|
|
|
overflow-y: hidden;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
p {
|
|
|
|
|
|
margin: 5px 0;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.drawer-container {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
:deep(header.el-drawer__header) {
|
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
|
background-color: var(--el-color-primary) !important;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
.el-drawer__close-btn svg:hover {
|
|
|
|
|
|
color: #ccc !important;
|
|
|
|
|
|
}
|
2025-08-06 15:18:27 +08:00
|
|
|
|
|
2025-09-08 14:55:25 +08:00
|
|
|
|
.el-drawer__title {
|
|
|
|
|
|
color: #fff !important;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
2025-09-08 14:55:25 +08:00
|
|
|
|
}
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-box {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
animation: loading 1.5s linear infinite;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes loading {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
from {
|
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
|
}
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
:deep(.el-button--small) {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
height: 20px !important;
|
|
|
|
|
|
width: 20px !important;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-20 20:02:22 +08:00
|
|
|
|
:deep(.el-table--default td) {
|
2025-09-08 14:55:25 +08:00
|
|
|
|
padding: 5px 0 !important;
|
2025-08-06 15:18:27 +08:00
|
|
|
|
}
|
2025-08-07 14:43:56 +08:00
|
|
|
|
</style>
|