2024-11-18 22:04:59 +08:00
|
|
|
|
<template>
|
2024-12-18 20:26:18 +08:00
|
|
|
|
<div class="dialog" v-bind="dialogBig">
|
2024-12-18 15:56:59 +08:00
|
|
|
|
<div class="dialog-title">
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<el-progress
|
|
|
|
|
|
style="width: 90%"
|
|
|
|
|
|
:percentage="percentage"
|
|
|
|
|
|
:color="customColors"/>
|
|
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="primary"
|
2024-12-24 19:21:43 +08:00
|
|
|
|
v-if="testStatus=='process' && activeIndex < checkTotal"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
:disabled="activeIndex===0"
|
|
|
|
|
|
:icon="VideoPause"
|
2024-12-30 14:41:34 +08:00
|
|
|
|
@click="handlePauseTest">停止检测
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-button>
|
2025-01-02 18:00:58 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
v-if="testStatus=='preTest_process' && activeIndex < checkTotal"
|
|
|
|
|
|
:icon="VideoPause"
|
|
|
|
|
|
disabled>预检测中
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
v-if="testStatus=='preTest_fail'"
|
|
|
|
|
|
:icon="Failed"
|
|
|
|
|
|
disabled>预检测失败
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
2024-12-24 19:21:43 +08:00
|
|
|
|
<el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="warning"
|
2024-12-24 19:21:43 +08:00
|
|
|
|
v-if="testStatus=='paused' && activeIndex < checkTotal"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
:icon="Refresh"
|
2024-12-30 14:41:34 +08:00
|
|
|
|
@click="handleResumeTest"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
>继续检测
|
|
|
|
|
|
</el-button>
|
2024-12-20 18:19:18 +08:00
|
|
|
|
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<!-- <el-button
|
|
|
|
|
|
type="warning"
|
2024-12-24 19:21:43 +08:00
|
|
|
|
v-if="activeIndex >= checkTotal"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
:icon="Refresh"
|
|
|
|
|
|
@click="handleReCheck"
|
|
|
|
|
|
>重新检测</el-button
|
|
|
|
|
|
> -->
|
|
|
|
|
|
<!-- <el-button type="danger" :icon="Close" @click="handleFinishTest"
|
|
|
|
|
|
>停止检测</el-button
|
|
|
|
|
|
> -->
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
|
|
|
|
|
</div>
|
2024-11-20 21:30:05 +08:00
|
|
|
|
|
2024-12-18 20:26:18 +08:00
|
|
|
|
<div class="dialog-content">
|
2025-01-02 18:00:58 +08:00
|
|
|
|
<el-table :data="checkResultView" row-key="scriptType" height="450px"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
|
|
|
|
|
|
border>
|
2024-12-30 20:55:11 +08:00
|
|
|
|
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="chnSum<=MAX_CHN_SUM">
|
2024-12-21 12:41:06 +08:00
|
|
|
|
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName"
|
2024-12-20 10:19:58 +08:00
|
|
|
|
:min-width="110" align="center">
|
2024-12-21 12:41:06 +08:00
|
|
|
|
<el-table-column v-for="(chnItem,index2) in item.chnNum" :key="`${item.deviceId}${chnItem}`"
|
2024-12-20 10:19:58 +08:00
|
|
|
|
:label="'通道'+chnItem" align="center">
|
|
|
|
|
|
<template #default="{row}">
|
|
|
|
|
|
<el-tooltip
|
2024-12-27 10:31:15 +08:00
|
|
|
|
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
2024-12-20 10:19:58 +08:00
|
|
|
|
placement="top">
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<el-button
|
2024-12-31 14:27:36 +08:00
|
|
|
|
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
|
2024-12-27 10:31:15 +08:00
|
|
|
|
:color="row.devices[index1].chnResult[index2].color"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
size="small"
|
2025-01-02 18:00:58 +08:00
|
|
|
|
@click="handleClick(item,chnItem+'',row.scriptType)"
|
2024-12-27 10:31:15 +08:00
|
|
|
|
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>
|
|
|
|
|
|
|
2024-12-18 15:56:59 +08:00
|
|
|
|
</el-tooltip>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else>
|
2024-12-27 10:31:15 +08:00
|
|
|
|
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName"
|
2024-12-20 10:19:58 +08:00
|
|
|
|
:min-width="110" align="center">
|
|
|
|
|
|
<template #default="{row}">
|
2024-12-27 10:31:15 +08:00
|
|
|
|
<el-tooltip
|
|
|
|
|
|
:content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
|
|
|
|
|
placement="top">
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<el-button
|
2024-12-31 14:27:36 +08:00
|
|
|
|
:disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"
|
2024-12-27 10:31:15 +08:00
|
|
|
|
:color="row.devices[index1].chnResult[0].color"
|
2024-12-18 18:53:55 +08:00
|
|
|
|
size="small"
|
2025-01-02 18:00:58 +08:00
|
|
|
|
@click="handleClick(item,'-1',row.scriptType)"
|
2024-12-27 10:31:15 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-icon v-if="row.devices[index1].chnResult[0].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[0].icon"/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
</el-button>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-tooltip>
|
2024-12-18 15:56:59 +08:00
|
|
|
|
</template>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</template>
|
2024-12-18 15:56:59 +08:00
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-table>
|
2024-11-18 22:04:59 +08:00
|
|
|
|
</div>
|
2024-12-20 20:14:52 +08:00
|
|
|
|
|
2024-12-20 20:20:08 +08:00
|
|
|
|
</div>
|
2024-12-24 19:21:43 +08:00
|
|
|
|
<div class="drawer-container">
|
|
|
|
|
|
<el-drawer v-model="drawer" title="检测项进度">
|
|
|
|
|
|
<!-- <template #header>-->
|
|
|
|
|
|
<!-- <div style="background: #003078 !important; color: #fff !important; font-size: 18px;">检测项进度</div>-->
|
|
|
|
|
|
<!-- </template>-->
|
2024-12-27 14:29:21 +08:00
|
|
|
|
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
|
2024-12-24 19:21:43 +08:00
|
|
|
|
<p v-for="(item, index) in testLogList"
|
|
|
|
|
|
:key="index"
|
2024-12-27 10:31:15 +08:00
|
|
|
|
:style="{color:item.type==='error'?'#F56C6C': item.type==='warning'?'#e6a23c':'var(--el-text-color-regular)'}">
|
2024-12-24 19:21:43 +08:00
|
|
|
|
{{ item.log }}<br/>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-drawer>
|
|
|
|
|
|
</div>
|
2024-12-20 10:21:36 +08:00
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<resultPopup
|
|
|
|
|
|
:visible="resultDialogVisible"
|
|
|
|
|
|
@update:visible="resultDialogVisible = $event"
|
|
|
|
|
|
></resultPopup>
|
2024-12-20 10:19:58 +08:00
|
|
|
|
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
2024-11-18 22:04:59 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<script lang="tsx" setup name="test">
|
2025-01-02 18:00:58 +08:00
|
|
|
|
import {Check, InfoFilled, Loading, Refresh, VideoPause, Failed} from '@element-plus/icons-vue'
|
2024-11-19 19:34:00 +08:00
|
|
|
|
import resultPopup from './resultPopup.vue'
|
|
|
|
|
|
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
2025-01-02 09:02:46 +08:00
|
|
|
|
import {computed, reactive, ref, toRef, watch} from "vue";
|
2024-12-18 20:26:18 +08:00
|
|
|
|
import {dialogBig} from "@/utils/elementBind";
|
2024-12-20 18:19:18 +08:00
|
|
|
|
import {CheckData} from "@/api/check/interface"
|
|
|
|
|
|
import {useCheckStore} from "@/stores/modules/check";
|
2024-12-30 14:41:34 +08:00
|
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
2024-12-30 20:55:11 +08:00
|
|
|
|
import {getBigTestItem} from "@/api/check/test";
|
2024-12-20 18:19:18 +08:00
|
|
|
|
|
|
|
|
|
|
const checkStore = useCheckStore()
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 最大通道数
|
2024-12-27 10:31:15 +08:00
|
|
|
|
const MAX_CHN_SUM = 8
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-12-24 19:21:43 +08:00
|
|
|
|
// 总测试项数
|
2024-12-27 10:31:15 +08:00
|
|
|
|
let checkTotal = 0
|
2024-12-24 19:21:43 +08:00
|
|
|
|
|
2024-12-24 11:29:31 +08:00
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
testStatus: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'waiting'
|
|
|
|
|
|
},
|
|
|
|
|
|
webMsgSend: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => ({})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-12-30 20:55:11 +08:00
|
|
|
|
const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause', 'sendResume']);
|
2024-12-24 11:29:31 +08:00
|
|
|
|
|
|
|
|
|
|
// 用来保存测试项进度抽屉是否打开
|
|
|
|
|
|
const drawer = ref(false)
|
|
|
|
|
|
// 进度条颜色
|
|
|
|
|
|
const customColors = [{color: "#5cb87a", percentage: 100}]
|
2024-12-24 19:21:43 +08:00
|
|
|
|
// 检测脚本数据
|
2024-12-30 20:55:11 +08:00
|
|
|
|
let scriptData: CheckData.ScriptItem[] = []
|
2024-12-24 11:29:31 +08:00
|
|
|
|
// 用来保存被检设备
|
|
|
|
|
|
const deviceList = reactive<CheckData.Device[]>([])
|
|
|
|
|
|
// 当前进行的测试项索引
|
2024-12-27 10:31:15 +08:00
|
|
|
|
let activeIndex = 1
|
2024-12-24 11:29:31 +08:00
|
|
|
|
// 百分比
|
|
|
|
|
|
const percentage = ref(0);
|
|
|
|
|
|
//测试项开始检测时间(或继续检测时间)
|
|
|
|
|
|
const startData = ref(new Date())
|
|
|
|
|
|
//测试项检测结束时间(或暂停时的时间)
|
|
|
|
|
|
const endData = ref(new Date())
|
|
|
|
|
|
const timeDifference = ref(0)
|
2024-12-24 19:21:43 +08:00
|
|
|
|
// 真正的检测结果(详细到通道)
|
|
|
|
|
|
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
|
2024-12-24 11:29:31 +08:00
|
|
|
|
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格,则该检测项的id会被加入该数组。
|
2025-01-02 18:00:58 +08:00
|
|
|
|
let errorCheckItem: Array<{ scriptType: string, type: 'info' | 'warning' | 'error' }> = []
|
2024-12-24 11:29:31 +08:00
|
|
|
|
// 用来存放检测日志
|
2024-12-27 10:31:15 +08:00
|
|
|
|
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2024-12-24 11:29:31 +08:00
|
|
|
|
const testStatus = toRef(props, 'testStatus')
|
|
|
|
|
|
const webMsgSend = toRef(props, 'webMsgSend')
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-12-24 11:29:31 +08:00
|
|
|
|
const resultDialogVisible = ref(false)
|
2024-12-27 13:36:20 +08:00
|
|
|
|
const scrollContainerRef = ref();
|
2024-12-24 19:21:43 +08:00
|
|
|
|
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
|
|
|
|
|
|
2024-12-13 08:56:42 +08:00
|
|
|
|
|
2024-12-18 15:56:59 +08:00
|
|
|
|
// 总通道数
|
|
|
|
|
|
const chnSum = computed(() => {
|
|
|
|
|
|
let sum = 0
|
2024-12-20 18:19:18 +08:00
|
|
|
|
deviceList.forEach((item) => {
|
2024-12-18 15:56:59 +08:00
|
|
|
|
sum += item.chnNum
|
|
|
|
|
|
})
|
|
|
|
|
|
return sum
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2024-12-24 19:21:43 +08:00
|
|
|
|
// 用来展示的检测结果
|
2025-01-02 18:00:58 +08:00
|
|
|
|
const checkResultView: any[] = computed(() => {
|
2024-12-24 19:21:43 +08:00
|
|
|
|
|
|
|
|
|
|
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
|
|
|
|
|
|
let temp: CheckData.ScriptChnViewItem = {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
scriptType: item.scriptType,
|
2024-12-25 18:04:16 +08:00
|
|
|
|
scriptName: item.scriptName,
|
2024-12-24 19:21:43 +08:00
|
|
|
|
devices: []
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
item.devices.forEach(device => {
|
|
|
|
|
|
let tempChnBtnResult: CheckData.ButtonResult[] = []
|
|
|
|
|
|
|
|
|
|
|
|
if (chnSum.value <= MAX_CHN_SUM) {
|
|
|
|
|
|
for (let j = 0; j < device.chnResult.length; j++) {
|
2024-12-26 10:49:55 +08:00
|
|
|
|
switch (device.chnResult[j]) {
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.LOADING:
|
2024-12-27 13:36:20 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.SUCCESS:
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
|
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.FAIL:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.UNCONNECTED:
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
|
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2024-12-24 19:21:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
|
|
|
|
|
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
|
|
|
|
|
tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
|
|
|
|
|
}
|
2024-12-26 10:49:55 +08:00
|
|
|
|
switch (tempChnResult) {
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.LOADING:
|
2024-12-27 13:36:20 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.SUCCESS:
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
|
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.FAIL:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.UNCONNECTED:
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
|
|
|
|
|
break;
|
|
|
|
|
|
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
|
|
|
|
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2024-12-24 19:21:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
temp.devices.push({
|
|
|
|
|
|
deviceId: device.deviceId,
|
|
|
|
|
|
deviceName: device.deviceName,
|
|
|
|
|
|
chnResult: tempChnBtnResult
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
return temp
|
|
|
|
|
|
})
|
|
|
|
|
|
return result
|
|
|
|
|
|
})
|
2024-12-24 11:29:31 +08:00
|
|
|
|
|
|
|
|
|
|
watch(testStatus, function (newValue, oldValue) {
|
|
|
|
|
|
if (newValue == 'start') {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
ElMessage.success('预检测开始!')
|
|
|
|
|
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测开始!`})
|
|
|
|
|
|
emit('update:testStatus', 'preTest_process')
|
|
|
|
|
|
startTimer() // todo 可移除
|
|
|
|
|
|
//emit('update:testStatus', 'process') // todo 可移除
|
2024-12-24 11:29:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (newValue == 'paused' && oldValue == 'process') {
|
|
|
|
|
|
handlePauseOrContinue()
|
|
|
|
|
|
}
|
|
|
|
|
|
if (newValue === 'process' && oldValue == 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++
|
2024-12-24 11:29:31 +08:00
|
|
|
|
handlePauseOrContinue()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
watch(webMsgSend, function (newValue, oldValue) {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
if (activeIndex <= checkTotal) {
|
2024-12-24 11:29:31 +08:00
|
|
|
|
switch (newValue.requestId) {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
// case 'connect':
|
|
|
|
|
|
// switch (newValue.operateCode) {
|
|
|
|
|
|
// case "Source":
|
|
|
|
|
|
// ElMessageBox.alert('源通讯失败,请检查源连接情况!', '预检测失败', {
|
|
|
|
|
|
// confirmButtonText: '确定',
|
|
|
|
|
|
// type: 'error',
|
|
|
|
|
|
// })
|
|
|
|
|
|
// testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`})
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case "Dev":
|
|
|
|
|
|
// ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '预检测失败', {
|
|
|
|
|
|
// confirmButtonText: '确定',
|
|
|
|
|
|
// type: 'error',
|
|
|
|
|
|
// })
|
|
|
|
|
|
// testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`})
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// emit('update:testStatus', 'preTest_fail')
|
|
|
|
|
|
// break;
|
|
|
|
|
|
case 'yjc_ytxjy':
|
|
|
|
|
|
switch (newValue.operateCode) {
|
|
|
|
|
|
case 'INIT_GATHER':
|
|
|
|
|
|
if (newValue.code == 10552) {
|
|
|
|
|
|
ElMessageBox.alert('源通讯中断,请检查源连接情况!', '预检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯中断!`})
|
|
|
|
|
|
emit('update:testStatus', 'preTest_fail')
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2024-12-31 14:27:36 +08:00
|
|
|
|
break;
|
2025-01-02 18:00:58 +08:00
|
|
|
|
case 'yjc_sbtxjy':
|
|
|
|
|
|
switch (newValue.operateCode) {
|
|
|
|
|
|
case 'INIT_GATHER$01':
|
|
|
|
|
|
if (newValue.code == 10550) {
|
|
|
|
|
|
ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '预检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:${newValue.data}设备通讯中断!`})
|
|
|
|
|
|
emit('update:testStatus', 'preTest_fail')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (newValue.code == 10551) {
|
|
|
|
|
|
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '预检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:${newValue.data}设备触发报告异常!`})
|
|
|
|
|
|
emit('update:testStatus', 'preTest_fail')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (newValue.code == 10552) {
|
|
|
|
|
|
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '预检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
testLogList.push({
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
|
|
|
|
|
|
})
|
|
|
|
|
|
emit('update:testStatus', 'preTest_fail')
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'YJC_xujy':
|
|
|
|
|
|
switch (newValue.operateCode) {
|
|
|
|
|
|
case 'DATA_REQUEST$02':
|
|
|
|
|
|
ElMessage.success('预检测成功!')
|
|
|
|
|
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测成功!`})
|
|
|
|
|
|
emit('update:testStatus', 'process')
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
2024-12-30 14:41:34 +08:00
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'Pause_Success':
|
2024-12-30 14:41:34 +08:00
|
|
|
|
ElMessage.success('暂停成功')
|
2024-12-30 20:55:11 +08:00
|
|
|
|
emit('update:testStatus', 'paused')
|
2024-12-30 14:41:34 +08:00
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'Pause_Fail':
|
2024-12-30 14:41:34 +08:00
|
|
|
|
ElMessage.error('暂停失败')
|
|
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'Resume_Success':
|
2024-12-30 14:41:34 +08:00
|
|
|
|
ElMessage.success('开始继续检测')
|
2024-12-30 20:55:11 +08:00
|
|
|
|
emit('update:testStatus', 'process')
|
2024-12-30 14:41:34 +08:00
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'Resume_Fail':
|
2024-12-30 14:41:34 +08:00
|
|
|
|
ElMessage.error('无法继续检测')
|
|
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'FREQ_Start':
|
|
|
|
|
|
updateCheckResultView("FREQ", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'FREQ_End':
|
|
|
|
|
|
updateCheckResultView("FREQ", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-30 20:55:11 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'V_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("V", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'V_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("V", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-30 20:55:11 +08:00
|
|
|
|
activeIndex++
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HV_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HV", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HV_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HV", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HI_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HI", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HI_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HI", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HP_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HP", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HP_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HP", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HSV_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HSV", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HSV_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HSV", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HSI_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HSI", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'HSI_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("HSI", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'VOLTAGE_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("VOLTAGE", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'VOLTAGE_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("VOLTAGE", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'I_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("I", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'I_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("I", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'IMBV_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("IMBV", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'IMBV_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("IMBV", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'IMBA_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("IMBA", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'IMBA_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("IMBA", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'F_Start':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("F", true)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(true)
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2025-01-02 20:27:36 +08:00
|
|
|
|
case 'F_End':
|
2024-12-30 20:55:11 +08:00
|
|
|
|
updateCheckResultView("F", false)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-26 10:49:55 +08:00
|
|
|
|
if (testStatus.value != 'paused') {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex++;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
break;
|
2024-12-30 20:55:11 +08:00
|
|
|
|
case 'Quit':
|
2024-12-27 10:31:15 +08:00
|
|
|
|
updateLog(false)
|
|
|
|
|
|
updatePercentage()
|
2024-12-24 11:29:31 +08:00
|
|
|
|
console.log('检测结束')
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}, {deep: true})
|
2024-12-24 11:29:31 +08:00
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
// 更新进度条
|
|
|
|
|
|
const updatePercentage = () => {
|
|
|
|
|
|
if (activeIndex < checkTotal) {
|
|
|
|
|
|
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
|
2024-12-24 11:29:31 +08:00
|
|
|
|
} else {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
percentage.value = 100;
|
2024-12-24 11:29:31 +08:00
|
|
|
|
emit('update:testStatus', 'success')
|
2024-12-27 10:31:15 +08:00
|
|
|
|
|
|
|
|
|
|
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
|
|
|
|
|
|
// if you want to disable its autofocus
|
|
|
|
|
|
// autofocus: false,
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
})
|
|
|
|
|
|
clear();
|
2024-12-24 11:29:31 +08:00
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// todo 可移除start
|
|
|
|
|
|
let randomUnConnectedRaw = -1
|
|
|
|
|
|
let randomUnConnectedDeviceId = -1
|
|
|
|
|
|
let randomErrorDataRaw = -1
|
|
|
|
|
|
// todo 可移除end
|
2024-12-24 11:29:31 +08:00
|
|
|
|
|
2024-12-30 20:55:11 +08:00
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
|
|
await initScriptData()
|
2024-12-20 18:19:18 +08:00
|
|
|
|
initDeviceList()
|
2024-12-20 10:19:58 +08:00
|
|
|
|
initCheckResult()
|
2024-12-27 10:31:15 +08:00
|
|
|
|
|
|
|
|
|
|
// todo 可移除start
|
2024-12-27 13:36:20 +08:00
|
|
|
|
let a = getRandomInt(scriptData.length) + 4
|
|
|
|
|
|
randomUnConnectedRaw = a < scriptData.length ? a : scriptData.length
|
2024-12-27 10:31:15 +08:00
|
|
|
|
randomUnConnectedDeviceId = deviceList[getRandomInt(deviceList.length)].deviceId
|
|
|
|
|
|
randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
|
|
|
|
|
while (randomErrorDataRaw === randomUnConnectedRaw) {
|
|
|
|
|
|
randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
|
|
|
|
|
}
|
|
|
|
|
|
// todo 可移除end
|
2024-12-20 10:19:58 +08:00
|
|
|
|
})
|
2024-12-13 08:56:42 +08:00
|
|
|
|
|
2024-12-27 13:36:20 +08:00
|
|
|
|
|
2024-12-24 11:29:31 +08:00
|
|
|
|
const showTestLog = () => {
|
|
|
|
|
|
drawer.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 初始化检测脚本数据
|
2024-12-30 20:55:11 +08:00
|
|
|
|
const initScriptData = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
let response: any = await getBigTestItem(checkStore.planId)
|
|
|
|
|
|
|
|
|
|
|
|
let temp = response.data.map(item => {
|
2024-12-24 11:29:31 +08:00
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
2024-12-30 20:55:11 +08:00
|
|
|
|
scriptName: item.scriptName
|
2024-12-24 11:29:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-12-24 11:29:31 +08:00
|
|
|
|
scriptData.push(...temp)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
checkTotal = scriptData.length + 1
|
2024-12-20 10:19:58 +08:00
|
|
|
|
}
|
2024-12-20 18:19:18 +08:00
|
|
|
|
// 初始化设备列表
|
|
|
|
|
|
const initDeviceList = () => {
|
|
|
|
|
|
checkStore.devices.forEach(item => {
|
|
|
|
|
|
deviceList.push({
|
2024-12-21 12:41:06 +08:00
|
|
|
|
deviceId: item.deviceId,
|
2024-12-20 18:19:18 +08:00
|
|
|
|
deviceName: item.deviceName,
|
|
|
|
|
|
chnNum: item.chnNum,
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2024-12-24 19:21:43 +08:00
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 初始化检测结果 (详细到通道)
|
|
|
|
|
|
const initCheckResult = () => {
|
|
|
|
|
|
scriptData.forEach(item => {
|
|
|
|
|
|
// 处理当前节点的数据
|
2024-12-20 18:19:18 +08:00
|
|
|
|
let temp: CheckData.ScriptChnItem = {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
scriptType: item.id,
|
2024-12-25 18:04:16 +08:00
|
|
|
|
scriptName: item.scriptName,
|
2024-12-20 10:19:58 +08:00
|
|
|
|
devices: []
|
|
|
|
|
|
}
|
2024-12-20 18:19:18 +08:00
|
|
|
|
for (let i = 0; i < deviceList?.length; i++) {
|
|
|
|
|
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
|
|
|
|
|
for (let j = 0; j < deviceList[i].chnNum; j++) {
|
|
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
|
2024-11-21 23:02:43 +08:00
|
|
|
|
}
|
2024-12-20 10:19:58 +08:00
|
|
|
|
temp.devices.push({
|
2024-12-21 12:41:06 +08:00
|
|
|
|
deviceId: deviceList[i].deviceId,
|
2024-12-20 18:19:18 +08:00
|
|
|
|
deviceName: deviceList[i].deviceName,
|
2024-12-20 10:19:58 +08:00
|
|
|
|
chnResult: tempChnResult
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
checkResult.push(temp)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// 更新检测结果(详细到通道)
|
2024-12-20 18:19:18 +08:00
|
|
|
|
const updateCheckResult = (data: CheckData.ScriptChnItem) => {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
const {scriptType} = {...data}
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
|
|
|
|
|
checkResult.forEach(item => {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
if (item.scriptType == scriptType) {
|
2024-12-20 10:19:58 +08:00
|
|
|
|
item.devices.forEach((device, index) => {
|
|
|
|
|
|
device.chnResult = [...data.devices[index].chnResult]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-21 23:02:43 +08:00
|
|
|
|
const scrollToBottom = () => {
|
2024-12-27 13:36:20 +08:00
|
|
|
|
if (scrollContainerRef.value) {
|
|
|
|
|
|
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight;
|
2024-12-18 18:53:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2024-11-21 23:02:43 +08:00
|
|
|
|
|
|
|
|
|
|
function getRandomInt(max: number): number {
|
2024-12-20 10:19:58 +08:00
|
|
|
|
return Math.floor(Math.random() * max)
|
2024-11-21 23:02:43 +08:00
|
|
|
|
}
|
2024-12-11 17:46:59 +08:00
|
|
|
|
|
|
|
|
|
|
//判断该检测项(例如 频率准确度检测)是否全部合格(所有设备所有通道所有子检测项目全部合格为合格,否则为不合格)
|
2025-01-02 18:00:58 +08:00
|
|
|
|
function getItemCheckResult(scriptType: string): boolean {
|
|
|
|
|
|
let items = errorCheckItem.filter((item) => item.scriptType === scriptType)
|
2024-12-18 18:53:55 +08:00
|
|
|
|
if (items.length > 0) {
|
2024-12-11 17:46:59 +08:00
|
|
|
|
return true
|
2024-12-27 10:31:15 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
2024-12-20 10:19:58 +08:00
|
|
|
|
}
|
2024-12-11 17:46:59 +08:00
|
|
|
|
}
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
|
|
|
|
|
function getTimeDifference(timeDifference: number): string {
|
2024-12-11 17:46:59 +08:00
|
|
|
|
// 将时间差转换为天、小时、分钟、秒
|
|
|
|
|
|
const millisecondsPerDay = 1000 * 60 * 60 * 24;
|
|
|
|
|
|
const millisecondsPerHour = 1000 * 60 * 60;
|
|
|
|
|
|
const millisecondsPerMinute = 1000 * 60;
|
|
|
|
|
|
const millisecondsPerSecond = 1000;
|
|
|
|
|
|
|
|
|
|
|
|
const days = Math.floor(timeDifference / millisecondsPerDay);
|
|
|
|
|
|
const hours = Math.floor((timeDifference % millisecondsPerDay) / millisecondsPerHour);
|
|
|
|
|
|
const minutes = Math.floor((timeDifference % millisecondsPerHour) / millisecondsPerMinute);
|
|
|
|
|
|
const seconds = Math.floor((timeDifference % millisecondsPerMinute) / millisecondsPerSecond);
|
2024-12-18 18:53:55 +08:00
|
|
|
|
if (days > 0) {
|
2024-12-11 18:48:54 +08:00
|
|
|
|
return `: ${days} 天, ${hours} 小时, ${minutes} 分钟, ${seconds} 秒`
|
2024-12-18 18:53:55 +08:00
|
|
|
|
} else if (hours > 0) {
|
2024-12-11 18:48:54 +08:00
|
|
|
|
return `: ${hours} 小时, ${minutes} 分钟, ${seconds} 秒`
|
2024-12-18 18:53:55 +08:00
|
|
|
|
} else {
|
2024-12-11 18:48:54 +08:00
|
|
|
|
return `: ${minutes} 分钟, ${seconds} 秒`
|
|
|
|
|
|
}
|
2024-12-11 17:46:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 更新日志
|
2024-12-27 10:31:15 +08:00
|
|
|
|
const updateLog = (isStart: boolean) => {
|
2024-11-21 23:02:43 +08:00
|
|
|
|
const currentTime = ref(new Date().toLocaleString());
|
2024-12-20 10:19:58 +08:00
|
|
|
|
let timeDifferenceItem = 0
|
2024-11-21 23:02:43 +08:00
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
if (activeIndex === 1 && isStart) {
|
|
|
|
|
|
timeDifference.value = 0;
|
2025-01-02 18:00:58 +08:00
|
|
|
|
//testLogList.length = 0; // 清空数组
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
// debugger
|
|
|
|
|
|
if (activeIndex < checkTotal) {
|
|
|
|
|
|
if (isStart) {
|
|
|
|
|
|
startData.value = new Date();
|
|
|
|
|
|
testLogList.push({
|
2024-11-21 23:02:43 +08:00
|
|
|
|
type: 'info',
|
2024-12-27 10:31:15 +08:00
|
|
|
|
log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测:开始`,
|
2024-11-21 23:02:43 +08:00
|
|
|
|
})
|
2024-12-27 10:31:15 +08:00
|
|
|
|
} else {
|
2024-12-11 18:48:54 +08:00
|
|
|
|
endData.value = new Date();
|
2024-12-20 10:19:58 +08:00
|
|
|
|
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
|
|
|
|
|
timeDifference.value += timeDifferenceItem
|
2024-12-27 10:31:15 +08:00
|
|
|
|
|
|
|
|
|
|
if (getItemCheckResult(scriptData[activeIndex - 1].id)) {
|
|
|
|
|
|
testLogList.push({
|
2024-12-18 18:53:55 +08:00
|
|
|
|
type: 'error',
|
2024-12-27 10:31:15 +08:00
|
|
|
|
log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测结束:不符合,用时` + getTimeDifference(timeDifferenceItem),
|
2024-12-18 18:53:55 +08:00
|
|
|
|
})
|
|
|
|
|
|
} else {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
testLogList.push({
|
2024-12-18 18:53:55 +08:00
|
|
|
|
type: 'info',
|
2024-12-27 10:31:15 +08:00
|
|
|
|
log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测结束:符合,用时` + getTimeDifference(timeDifferenceItem),
|
2024-12-18 18:53:55 +08:00
|
|
|
|
})
|
2024-12-11 18:48:54 +08:00
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
testLogList.push({
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
|
|
|
|
|
})
|
2024-12-18 18:53:55 +08:00
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
scrollToBottom();
|
2024-11-21 23:02:43 +08:00
|
|
|
|
}
|
2024-12-05 22:15:12 +08:00
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 动态获取表格单元格样式
|
2024-12-27 10:31:15 +08:00
|
|
|
|
// function tableCell({row, columnIndex}) {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
// let items = errorCheckItem.filter((item) => item === row.scriptType)
|
2024-12-27 10:31:15 +08:00
|
|
|
|
//
|
|
|
|
|
|
// if (columnIndex === 0 && items.length > 0) {
|
|
|
|
|
|
// return 'warning-row'
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (columnIndex === 0) {
|
|
|
|
|
|
// return 'header-row'
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2024-11-20 21:30:05 +08:00
|
|
|
|
|
2024-12-26 10:49:55 +08:00
|
|
|
|
const updateCheckResultView = (scriptCode: string, isStart: boolean) => {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
// debugger
|
2025-01-02 18:00:58 +08:00
|
|
|
|
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
2024-12-26 10:49:55 +08:00
|
|
|
|
let temp = null
|
|
|
|
|
|
if (isStart) {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
temp = getLoadingResult(scriptType)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
} else {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
temp = getCheckResult(scriptType)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
}
|
2024-12-20 10:19:58 +08:00
|
|
|
|
updateCheckResult(temp)
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-26 10:49:55 +08:00
|
|
|
|
// 获取loading状态的结果
|
2025-01-02 18:00:58 +08:00
|
|
|
|
const getLoadingResult = (scriptType: string) => {
|
2024-12-26 10:49:55 +08:00
|
|
|
|
let devices = []
|
|
|
|
|
|
|
|
|
|
|
|
devices = deviceList.map(item => {
|
|
|
|
|
|
|
|
|
|
|
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
|
|
|
|
|
for (let i = 0; i < item.chnNum; i++) {
|
|
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.LOADING)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
deviceId: item.deviceId,
|
|
|
|
|
|
deviceName: item.deviceName,
|
|
|
|
|
|
chnResult: tempChnResult,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
let tempScriptChnItem: CheckData.ScriptChnItem = {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
scriptType,
|
2024-12-26 10:49:55 +08:00
|
|
|
|
devices,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tempScriptChnItem
|
|
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 模拟检测 todo 可移除
|
2025-01-02 18:00:58 +08:00
|
|
|
|
const getCheckResult = (scriptType: string) => {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
// debugger
|
2024-12-20 10:19:58 +08:00
|
|
|
|
let devices = []
|
|
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
if (activeIndex === randomErrorDataRaw) {
|
|
|
|
|
|
devices = deviceList.map(item => {
|
|
|
|
|
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
|
|
|
|
|
if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
|
|
|
|
|
|
for (let i = 0; i < item.chnNum; i++) {
|
|
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
2025-01-02 18:00:58 +08:00
|
|
|
|
//errorCheckItem.push({scriptType,type:'warning'})
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (let i = 0; i < item.chnNum; i++) {
|
|
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.ERRORDATA)
|
2025-01-02 18:00:58 +08:00
|
|
|
|
//errorCheckItem.push({scriptType,type:'warning'})
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
return {
|
|
|
|
|
|
deviceId: item.deviceId,
|
|
|
|
|
|
deviceName: item.deviceName,
|
|
|
|
|
|
chnResult: tempChnResult,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
devices = deviceList.map(item => {
|
|
|
|
|
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
|
|
|
|
|
if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
|
|
|
|
|
|
for (let i = 0; i < item.chnNum; i++) {
|
|
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
2025-01-02 18:00:58 +08:00
|
|
|
|
//errorCheckItem.push({scriptType,type:'warning'})
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (let i = 0; i < item.chnNum; i++) {
|
|
|
|
|
|
tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
|
|
|
|
|
|
}
|
|
|
|
|
|
let randomNum = getRandomInt(item.chnNum * 2)
|
2024-12-27 13:36:20 +08:00
|
|
|
|
if (randomNum < item.chnNum && activeIndex >= 4 && activeIndex <= 8) {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
|
2025-01-02 18:00:58 +08:00
|
|
|
|
errorCheckItem.push({scriptType, type: 'error'})
|
2024-12-27 10:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
return {
|
|
|
|
|
|
deviceId: item.deviceId,
|
|
|
|
|
|
deviceName: item.deviceName,
|
|
|
|
|
|
chnResult: tempChnResult,
|
2024-11-21 23:02:43 +08:00
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2024-11-20 21:30:05 +08:00
|
|
|
|
|
2024-12-20 18:19:18 +08:00
|
|
|
|
let tempScriptChnItem: CheckData.ScriptChnItem = {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
scriptType,
|
2024-12-20 10:19:58 +08:00
|
|
|
|
devices,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tempScriptChnItem
|
|
|
|
|
|
}
|
2024-11-20 21:30:05 +08:00
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
// 处理暂停、继续按钮点击事件
|
|
|
|
|
|
const handlePauseOrContinue = () => {
|
2024-12-11 19:12:04 +08:00
|
|
|
|
const currentTime = ref(new Date().toLocaleString());
|
2024-11-20 21:30:05 +08:00
|
|
|
|
|
2024-12-20 20:34:39 +08:00
|
|
|
|
if (testStatus.value == "paused") {
|
2024-12-11 19:12:04 +08:00
|
|
|
|
endData.value = new Date();
|
|
|
|
|
|
const Pausetime = endData.value.getTime() - startData.value.getTime();
|
|
|
|
|
|
timeDifference.value += Pausetime
|
|
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
testLogList.push({
|
2024-12-18 18:53:55 +08:00
|
|
|
|
type: 'info',
|
|
|
|
|
|
log: currentTime.value + ':暂停检测',
|
|
|
|
|
|
})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
console.log('暂停中')
|
2024-12-20 20:34:39 +08:00
|
|
|
|
}
|
2024-12-24 11:29:31 +08:00
|
|
|
|
if (testStatus.value == "process") {
|
2024-12-11 19:12:04 +08:00
|
|
|
|
startData.value = new Date();
|
2024-12-27 10:31:15 +08:00
|
|
|
|
testLogList.push({
|
2024-12-18 18:53:55 +08:00
|
|
|
|
type: 'info',
|
|
|
|
|
|
log: currentTime.value + ':继续检测',
|
|
|
|
|
|
})
|
2024-12-26 10:49:55 +08:00
|
|
|
|
startTimer()
|
|
|
|
|
|
console.log('开始继续检测')
|
2024-11-18 22:04:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-18 15:56:59 +08:00
|
|
|
|
// 点击查看(设备)通道检测详情。参数1:设备信息,参数2:通道号,-1:代表查看全部通道
|
2025-01-02 18:00:58 +08:00
|
|
|
|
const handleClick = (item: any, chnNum: string, scriptType: string) => {
|
|
|
|
|
|
let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
|
|
|
|
|
|
let chnResult = checkResultItem?.devices.find(obj => obj.deviceId === item.deviceId)?.chnResult
|
|
|
|
|
|
let flag = -1
|
|
|
|
|
|
if (chnNum === '-1') {
|
|
|
|
|
|
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.UNCONNECTED) !== -1) {
|
|
|
|
|
|
flag = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) {
|
|
|
|
|
|
flag = 1
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.UNCONNECTED) {
|
|
|
|
|
|
flag = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) {
|
|
|
|
|
|
flag = 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (flag === 0) {
|
|
|
|
|
|
ElMessageBox.alert('设备通讯中断,请检查设备通讯是否正常', '通讯中断', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'warning',
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
if (flag === 1) {
|
|
|
|
|
|
ElMessageBox.alert('该测试项数据异常', '数据异常', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'warning',
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
if (flag === -1) {
|
|
|
|
|
|
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum, scriptType);
|
|
|
|
|
|
}
|
2024-11-19 19:34:00 +08:00
|
|
|
|
};
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2024-12-26 10:49:55 +08:00
|
|
|
|
// todo 可移除
|
2024-11-25 21:11:10 +08:00
|
|
|
|
const startTimer = () => {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
console.log('开始检测第' + activeIndex + '项')
|
|
|
|
|
|
switch (activeIndex) {
|
2024-12-26 10:49:55 +08:00
|
|
|
|
case 1:
|
2025-01-02 18:00:58 +08:00
|
|
|
|
setTimeout(() => {
|
2024-12-26 10:49:55 +08:00
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 18:00:58 +08:00
|
|
|
|
requestId: 'yjc_ytxjy',
|
|
|
|
|
|
operateCode: "INIT_GATHER",
|
|
|
|
|
|
code: "2222"
|
|
|
|
|
|
})},2000)
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
|
|
|
|
|
requestId: 'yjc_sbtxjy',
|
|
|
|
|
|
operateCode: "INIT_GATHER$01",
|
|
|
|
|
|
code: "2222",
|
|
|
|
|
|
data:'240003'
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 4000);
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
|
|
|
|
|
requestId: 'YJC_xujy',
|
|
|
|
|
|
operateCode: "DATA_REQUEST$02"
|
|
|
|
|
|
})
|
|
|
|
|
|
},6000)
|
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
|
emit('update:webMsgSend', {
|
|
|
|
|
|
requestId: 'FREQ_Start',
|
|
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
},9000)
|
2024-12-26 10:49:55 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2024-12-30 20:55:11 +08:00
|
|
|
|
requestId: 'FREQ_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
2025-01-02 18:00:58 +08:00
|
|
|
|
}, 12000);
|
2024-12-26 10:49:55 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'V_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'V_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HV_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HV_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HI_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HI_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HP_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HP_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HSV_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HSV_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HSI_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'HSI_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'VOLTAGE_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'VOLTAGE_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 9:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'I_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'I_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 10:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'IMBV_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'IMBV_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 11:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'IMBA_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'IMBA_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
})
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 12:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'F_Start',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
requestId: 'F_End',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 13:
|
|
|
|
|
|
emit('update:webMsgSend', {
|
2024-12-30 20:55:11 +08:00
|
|
|
|
requestId: 'Quit',
|
2024-12-26 10:49:55 +08:00
|
|
|
|
params: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
break;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-30 14:41:34 +08:00
|
|
|
|
const handlePauseTest = () => {
|
|
|
|
|
|
// 发送暂停指令
|
|
|
|
|
|
emit('sendPause')
|
|
|
|
|
|
};
|
2024-12-26 10:49:55 +08:00
|
|
|
|
|
2024-12-30 14:41:34 +08:00
|
|
|
|
const handleResumeTest = () => {
|
|
|
|
|
|
// 发送继续检测指令
|
|
|
|
|
|
emit('sendResume')
|
|
|
|
|
|
};
|
2024-11-25 21:11:10 +08:00
|
|
|
|
|
2024-12-20 20:34:39 +08:00
|
|
|
|
//完成检测
|
|
|
|
|
|
const handleFinishTest = () => {
|
|
|
|
|
|
resultDialogVisible.value = true
|
|
|
|
|
|
ElMessage.success("完成检测");
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-24 11:29:31 +08:00
|
|
|
|
const handleReCheck = () => {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
activeIndex = 1;
|
2024-12-24 11:29:31 +08:00
|
|
|
|
percentage.value = 0;
|
2024-12-27 10:31:15 +08:00
|
|
|
|
testLogList.length = 0;
|
2024-12-24 11:29:31 +08:00
|
|
|
|
errorCheckItem.length = 0;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
// resumeTimer()
|
2024-12-24 11:29:31 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function clear() {
|
2024-12-27 10:31:15 +08:00
|
|
|
|
errorCheckItem.length = 0;
|
2024-12-24 11:29:31 +08:00
|
|
|
|
}
|
2024-12-27 10:31:15 +08:00
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
clear,
|
|
|
|
|
|
})
|
2024-11-25 21:11:10 +08:00
|
|
|
|
</script>
|
2024-12-20 10:19:58 +08:00
|
|
|
|
|
2024-11-25 21:11:10 +08:00
|
|
|
|
<style scoped lang="scss">
|
2024-12-18 15:56:59 +08:00
|
|
|
|
|
2024-12-05 21:33:52 +08:00
|
|
|
|
:deep(.el-table .header-row) {
|
2024-11-25 21:11:10 +08:00
|
|
|
|
// background-color:var(--el-color-warning-light-9);
|
2024-12-18 18:53:55 +08:00
|
|
|
|
background-color: #f5f7fa;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
// color:red;
|
|
|
|
|
|
// font-size:30px;
|
|
|
|
|
|
// --el-table-tr-bg-color: var(--el-color-warning-light-9);
|
|
|
|
|
|
}
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
2024-12-05 21:33:52 +08:00
|
|
|
|
:deep(.el-table .warning-row) {
|
|
|
|
|
|
// background-color:var(--el-color-warning-light-9);
|
2024-12-06 09:10:39 +08:00
|
|
|
|
//background-color:#bed96557;
|
2024-12-18 18:53:55 +08:00
|
|
|
|
color: red;
|
2024-12-05 21:33:52 +08:00
|
|
|
|
// font-size:30px;
|
|
|
|
|
|
// --el-table-tr-bg-color: var(--el-color-warning-light-9);
|
2024-12-06 15:06:38 +08:00
|
|
|
|
// background-color:#f5f7fa;
|
|
|
|
|
|
// position: relative;
|
2024-12-05 21:33:52 +08:00
|
|
|
|
}
|
2024-12-06 15:06:38 +08:00
|
|
|
|
|
|
|
|
|
|
// :deep(.el-table .warning-row::before) {
|
|
|
|
|
|
// content: '*'; /* 必须设置content属性 */
|
|
|
|
|
|
// position: absolute;
|
|
|
|
|
|
// color:red;
|
|
|
|
|
|
// background-color:#f5f7fa;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2024-11-25 21:11:10 +08:00
|
|
|
|
.el-table .success-row {
|
|
|
|
|
|
--el-table-tr-bg-color: var(--el-color-success-light-9);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
.dialog {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
|
overflow-x: hidden;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
.dialog-title {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
margin-bottom: 10px;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
}
|
2024-12-11 19:12:04 +08:00
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
.dialog-content {
|
2024-12-05 15:22:46 +08:00
|
|
|
|
max-height: 450px;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
overflow-y: hidden;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
:deep(.el-collapse-item__header) {
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
}
|
2024-12-11 19:12:04 +08:00
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
.dialog-log {
|
2024-12-11 19:12:04 +08:00
|
|
|
|
height: 50px;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
overflow-y: hidden;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
// flex-grow: 1;
|
|
|
|
|
|
// display: flex;
|
|
|
|
|
|
// flex-direction: column-reverse;
|
|
|
|
|
|
|
2024-12-11 19:12:04 +08:00
|
|
|
|
p {
|
|
|
|
|
|
margin: 5px 0;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-26 10:49:55 +08:00
|
|
|
|
|
|
|
|
|
|
.drawer-container {
|
|
|
|
|
|
:deep(header.el-drawer__header) {
|
2024-12-24 19:21:43 +08:00
|
|
|
|
color: #fff !important;
|
|
|
|
|
|
background-color: #003078 !important;
|
|
|
|
|
|
|
|
|
|
|
|
.el-drawer__close-btn svg:hover {
|
|
|
|
|
|
color: #ccc !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-26 10:49:55 +08:00
|
|
|
|
.el-drawer__title {
|
2024-12-24 19:21:43 +08:00
|
|
|
|
color: #fff !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
.loading-box {
|
|
|
|
|
|
animation: loading 1.5s linear infinite;
|
2024-12-26 10:49:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-27 10:31:15 +08:00
|
|
|
|
@keyframes loading {
|
|
|
|
|
|
from {
|
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-24 19:21:43 +08:00
|
|
|
|
//:deep(.el-drawer .el-drawer__title){
|
|
|
|
|
|
// background-color: #003078 !important;
|
|
|
|
|
|
//}
|
2024-11-21 23:02:43 +08:00
|
|
|
|
|
2024-11-18 22:04:59 +08:00
|
|
|
|
</style>
|
2024-12-18 20:26:18 +08:00
|
|
|
|
|
2024-12-05 15:22:46 +08:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
:deep(.el-button--small) {
|
2024-12-18 18:53:55 +08:00
|
|
|
|
height: 20px !important;
|
|
|
|
|
|
width: 20px !important;
|
2024-12-05 15:22:46 +08:00
|
|
|
|
}
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
|
|
|
|
|
:deep(.el-table--default td ) {
|
2024-12-05 15:22:46 +08:00
|
|
|
|
padding: 5px 0 !important;
|
|
|
|
|
|
}
|
2024-12-20 10:21:36 +08:00
|
|
|
|
|
2024-12-24 19:21:43 +08:00
|
|
|
|
|
2024-12-05 15:22:46 +08:00
|
|
|
|
</style>
|