处理正式检测bug
This commit is contained in:
@@ -52,8 +52,8 @@ export namespace CheckData {
|
||||
export enum ChnCheckResultEnum {
|
||||
UNKNOWN = -1,
|
||||
LOADING = 0,
|
||||
FAIL = 1,
|
||||
SUCCESS = 2,
|
||||
SUCCESS = 1,
|
||||
FAIL = 2,
|
||||
UNCONNECTED=3,
|
||||
ERRORDATA = 4
|
||||
}
|
||||
@@ -71,12 +71,20 @@ export namespace CheckData {
|
||||
}>
|
||||
}
|
||||
|
||||
export enum ButtonColorEnum {
|
||||
INFO = '#909399',
|
||||
LOADING = '#607eab',
|
||||
SUCCESS = '#67c23a',
|
||||
WARNING ='#e6a23c',
|
||||
DANGER = '#f56c6c',
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于描述 (设备)通道检测结果展示的按钮类型
|
||||
*/
|
||||
export interface ButtonResult {
|
||||
resultType: 'info' | 'info' | 'danger' | 'success' | 'warning'
|
||||
resultIcon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'WarnTriangleFilled'
|
||||
color: ButtonColorEnum
|
||||
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +107,7 @@ export namespace CheckData {
|
||||
* 定义检测日志类型
|
||||
*/
|
||||
export interface LogItem {
|
||||
type: 'info' | 'error'
|
||||
type: 'info' | 'warning' | 'error'
|
||||
log: string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dialog-content">
|
||||
<el-table :data="checkResultView" :cell-class-name="tableCell" row-key="scriptId" height="450px"
|
||||
<el-table :data="checkResultView" row-key="scriptId" height="450px"
|
||||
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
|
||||
border>
|
||||
<el-table-column fixed prop="scriptName" label="检测项目" width="140px" align="center">
|
||||
@@ -51,16 +51,24 @@
|
||||
:label="'通道'+chnItem" align="center">
|
||||
<template #default="{row}">
|
||||
<el-tooltip
|
||||
:content="row.devices[index1].chnResult[index2].resultType==='info' ? '暂无数据' : '点击查看详情'"
|
||||
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
||||
placement="top">
|
||||
<el-button
|
||||
:disabled="row.devices[index1].chnResult[index2].resultType=='info'"
|
||||
:type="row.devices[index1].chnResult[index2].resultType"
|
||||
:disabled="row.devices[index1].chnResult[index2].color==CheckData.ButtonColorEnum.INFO"
|
||||
:color="row.devices[index1].chnResult[index2].color"
|
||||
size="small"
|
||||
@click="handleClick(row.scriptId,item.deviceId,chnItem)"
|
||||
style="align-self: center; "
|
||||
:icon="row.devices[index1].chnResult[index2].resultIcon"
|
||||
/>
|
||||
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>
|
||||
@@ -68,18 +76,26 @@
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<el-table-column v-for="(item,index) in deviceList" :key="item.deviceId" :label="item.deviceName"
|
||||
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName"
|
||||
:min-width="110" align="center">
|
||||
<template #default="{row}">
|
||||
<el-tooltip :content="row.devices[index].chnResult[0].resultType==='info' ? '暂无数据' : '点击查看详情'"
|
||||
<el-tooltip
|
||||
:content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
||||
placement="top">
|
||||
<el-button
|
||||
:disabled="row.devices[index].chnResult[0].resultType=='info'"
|
||||
:type="row.devices[index].chnResult[0].resultType"
|
||||
:disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO"
|
||||
:color="row.devices[index1].chnResult[0].color"
|
||||
size="small"
|
||||
@click="handleClick(row.scriptId,item.deviceId,-1)"
|
||||
:icon="row.devices[index1].chnResult[index2].resultIcon"
|
||||
/>
|
||||
>
|
||||
<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>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -97,7 +113,7 @@
|
||||
<div ref="scrollContainer">
|
||||
<p v-for="(item, index) in testLogList"
|
||||
:key="index"
|
||||
:style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
|
||||
:style="{color:item.type==='error'?'#F56C6C': item.type==='warning'?'#e6a23c':'var(--el-text-color-regular)'}">
|
||||
{{ item.log }}<br/>
|
||||
</p>
|
||||
</div>
|
||||
@@ -111,7 +127,18 @@
|
||||
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
||||
</template>
|
||||
<script lang="tsx" setup name="test">
|
||||
import {Check, InfoFilled, Refresh, VideoPause} from '@element-plus/icons-vue'
|
||||
import {
|
||||
Check,
|
||||
InfoFilled,
|
||||
Refresh,
|
||||
VideoPause,
|
||||
Minus,
|
||||
Close,
|
||||
CircleCheckFilled,
|
||||
WarnTriangleFilled,
|
||||
Loading,
|
||||
Link
|
||||
} from '@element-plus/icons-vue'
|
||||
import resultPopup from './resultPopup.vue'
|
||||
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||
import {reactive, ref, watch} from "vue";
|
||||
@@ -122,10 +149,10 @@ import {useCheckStore} from "@/stores/modules/check";
|
||||
const checkStore = useCheckStore()
|
||||
|
||||
// 最大通道数
|
||||
const MAX_CHN_SUM = 10
|
||||
const MAX_CHN_SUM = 8
|
||||
|
||||
// 总测试项数
|
||||
const checkTotal = ref(0)
|
||||
let checkTotal = 0
|
||||
|
||||
const props = defineProps({
|
||||
testStatus: {
|
||||
@@ -149,7 +176,7 @@ const scriptData = reactive<CheckData.ScriptItem[]>([])
|
||||
// 用来保存被检设备
|
||||
const deviceList = reactive<CheckData.Device[]>([])
|
||||
// 当前进行的测试项索引
|
||||
const activeIndex = ref(0)
|
||||
let activeIndex = 1
|
||||
// 百分比
|
||||
const percentage = ref(0);
|
||||
//测试项开始检测时间(或继续检测时间)
|
||||
@@ -160,9 +187,9 @@ const timeDifference = ref(0)
|
||||
// 真正的检测结果(详细到通道)
|
||||
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
|
||||
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格,则该检测项的id会被加入该数组。
|
||||
const errorCheckItem = reactive<string[]>([]);
|
||||
let errorCheckItem:Array<{ scriptId: string, type: 'info' | 'warning' | 'error' }> = []
|
||||
// 用来存放检测日志
|
||||
const testLogList = ref<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
||||
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
||||
|
||||
const testStatus = toRef(props, 'testStatus')
|
||||
const webMsgSend = toRef(props, 'webMsgSend')
|
||||
@@ -198,19 +225,22 @@ const checkResultView = computed(() => {
|
||||
for (let j = 0; j < device.chnResult.length; j++) {
|
||||
switch (device.chnResult[j]) {
|
||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||
tempChnBtnResult.push({resultType: 'info', resultIcon: 'Minus'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.LOADING:
|
||||
tempChnBtnResult.push({resultType: 'info', resultIcon: 'Loading'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.FAIL:
|
||||
tempChnBtnResult.push({resultType: 'danger', resultIcon: 'Close'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Loading'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.SUCCESS:
|
||||
tempChnBtnResult.push({resultType: 'success', resultIcon: 'CircleCheckFilled'})
|
||||
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.UNCONNECTED:
|
||||
tempChnBtnResult.push({resultType: 'warning', resultIcon: 'WarnTriangleFilled'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -223,19 +253,22 @@ const checkResultView = computed(() => {
|
||||
}
|
||||
switch (tempChnResult) {
|
||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||
tempChnBtnResult.push({resultType: 'info', resultIcon: 'Minus'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.LOADING:
|
||||
tempChnBtnResult.push({resultType: 'info', resultIcon: 'Loading'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.FAIL:
|
||||
tempChnBtnResult.push({resultType: 'danger', resultIcon: 'Close'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Loading'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.SUCCESS:
|
||||
tempChnBtnResult.push({resultType: 'success', resultIcon: 'CircleCheckFilled'})
|
||||
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.UNCONNECTED:
|
||||
tempChnBtnResult.push({resultType: 'warning', resultIcon: 'WarnTriangleFilled'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -250,7 +283,6 @@ const checkResultView = computed(() => {
|
||||
})
|
||||
return temp
|
||||
})
|
||||
|
||||
return result
|
||||
})
|
||||
|
||||
@@ -263,142 +295,184 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
handlePauseOrContinue()
|
||||
}
|
||||
if (newValue === 'process' && oldValue == 'paused') {
|
||||
activeIndex++
|
||||
handlePauseOrContinue()
|
||||
}
|
||||
})
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
if (activeIndex.value <= checkTotal.value) {
|
||||
if (activeIndex <= checkTotal) {
|
||||
switch (newValue.requestId) {
|
||||
case 'Test_Freq_Start':
|
||||
updateCheckResultView("Freq", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_Freq_End':
|
||||
updateCheckResultView("Freq", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_VOL_Start':
|
||||
updateCheckResultView("VOL", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_VOL_End':
|
||||
updateCheckResultView("VOL", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_Harm_V_Start':
|
||||
updateCheckResultView("Harm_V", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_Harm_V_End':
|
||||
updateCheckResultView("Harm_V", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_Harm_I_Start':
|
||||
updateCheckResultView("Harm_I", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_Harm_I_End':
|
||||
updateCheckResultView("Harm_I", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_Harm_P_Start':
|
||||
updateCheckResultView("Harm_P", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_Harm_P_End':
|
||||
updateCheckResultView("Harm_P", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_InHarm_V_Start':
|
||||
updateCheckResultView("InHarm_V", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_InHarm_V_End':
|
||||
updateCheckResultView("InHarm_V", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_InHarm_I_Start':
|
||||
updateCheckResultView("InHarm_I", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_InHarm_I_End':
|
||||
updateCheckResultView("InHarm_I", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_Dip_Start':
|
||||
updateCheckResultView("Dip", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_Dip_End':
|
||||
updateCheckResultView("Dip", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_CUR_Start':
|
||||
updateCheckResultView("CUR", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_CUR_End':
|
||||
updateCheckResultView("CUR", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_MSQI_U_Start':
|
||||
updateCheckResultView("MSQI_U", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_MSQI_U_End':
|
||||
updateCheckResultView("MSQI_U", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_MSQI_I_Start':
|
||||
updateCheckResultView("MSQI_I", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_MSQI_I_End':
|
||||
updateCheckResultView("MSQI_I", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_Flicker_Start':
|
||||
updateCheckResultView("Flicker", true)
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'Test_Flicker_End':
|
||||
updateCheckResultView("Flicker", false)
|
||||
activeIndex.value++;
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Test_Quit':
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
console.log('检测结束')
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, {deep: true})
|
||||
|
||||
updateLog()
|
||||
|
||||
if (percentage.value < 100) {
|
||||
percentage.value = Math.trunc(activeIndex.value / checkTotal.value * 100);
|
||||
// 更新进度条
|
||||
const updatePercentage = () => {
|
||||
console.log('updatePercentage',activeIndex, checkTotal)
|
||||
if (activeIndex < checkTotal) {
|
||||
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
|
||||
} else {
|
||||
percentage.value = 100;
|
||||
emit('update:testStatus', 'success')
|
||||
@@ -410,16 +484,27 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
})
|
||||
clear();
|
||||
}
|
||||
} else {
|
||||
emit('update:testStatus', 'success')
|
||||
scrollToBottom();
|
||||
}
|
||||
}, {deep: true})
|
||||
}
|
||||
|
||||
// todo 可移除start
|
||||
let randomUnConnectedRaw = -1
|
||||
let randomUnConnectedDeviceId = -1
|
||||
let randomErrorDataRaw = -1
|
||||
// todo 可移除end
|
||||
|
||||
onBeforeMount(() => {
|
||||
initScriptData()
|
||||
initDeviceList()
|
||||
initCheckResult()
|
||||
|
||||
// todo 可移除start
|
||||
randomUnConnectedRaw = getRandomInt(scriptData.length) + 1
|
||||
randomUnConnectedDeviceId = deviceList[getRandomInt(deviceList.length)].deviceId
|
||||
randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
||||
while (randomErrorDataRaw === randomUnConnectedRaw) {
|
||||
randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
||||
}
|
||||
// todo 可移除end
|
||||
})
|
||||
|
||||
const showTestLog = () => {
|
||||
@@ -465,7 +550,7 @@ const initScriptData = () => {
|
||||
})
|
||||
|
||||
scriptData.push(...temp)
|
||||
checkTotal.value = scriptData.length + 1
|
||||
checkTotal = scriptData.length + 1
|
||||
}
|
||||
// 初始化设备列表
|
||||
const initDeviceList = () => {
|
||||
@@ -526,11 +611,11 @@ function getRandomInt(max: number): number {
|
||||
|
||||
//判断该检测项(例如 频率准确度检测)是否全部合格(所有设备所有通道所有子检测项目全部合格为合格,否则为不合格)
|
||||
function getItemCheckResult(scriptId: string): boolean {
|
||||
let items = errorCheckItem.filter((item) => item === scriptId)
|
||||
let items = errorCheckItem.filter((item) => item.scriptId === scriptId)
|
||||
if (items.length > 0) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,245 +640,63 @@ function getTimeDifference(timeDifference: number): string {
|
||||
}
|
||||
|
||||
// 更新日志
|
||||
const updateLog = () => {
|
||||
const updateLog = (isStart: boolean) => {
|
||||
const currentTime = ref(new Date().toLocaleString());
|
||||
let timeDifferenceItem = 0
|
||||
|
||||
switch (activeIndex.value) {
|
||||
case 1:
|
||||
if (activeIndex === 1 && isStart) {
|
||||
timeDifference.value = 0;
|
||||
testLogList.value.length = 0; // 清空数组
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':检测开始',
|
||||
})
|
||||
testLogList.length = 0; // 清空数组
|
||||
}
|
||||
// debugger
|
||||
if (activeIndex < checkTotal) {
|
||||
if (isStart) {
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 2:
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测:开始`,
|
||||
})
|
||||
} else {
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':频率准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
|
||||
if (getItemCheckResult(scriptData[activeIndex - 1].id)) {
|
||||
testLogList.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测结束:不符合,用时` + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':频率准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测结束:符合,用时` + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 3:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':电压准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':电压准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 4:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':谐波电压准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':谐波电压准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 5:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':谐波电流准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':谐波电流准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 6:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':谐波有功功率准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':谐波有功功率准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 7:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':间谐波电压准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':间谐波电压准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 8:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':间谐波电流准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':间谐波电流准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 9:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':暂态准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':暂态准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 10:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':电流准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':电流准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 11:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':电压不平衡度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':电压不平衡度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 12:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':电流不平衡度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':电流不平衡度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
}
|
||||
startData.value = new Date();
|
||||
break;
|
||||
case 13:
|
||||
endData.value = new Date();
|
||||
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += timeDifferenceItem
|
||||
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':闪变准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
})
|
||||
} else {
|
||||
testLogList.value.push({
|
||||
type: 'error',
|
||||
log: currentTime.value + ':闪变准确度检测不合格,用时' + getTimeDifference(timeDifferenceItem),
|
||||
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
||||
})
|
||||
}
|
||||
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':检测结束,总用时' + getTimeDifference(timeDifference.value),
|
||||
})
|
||||
break;
|
||||
}
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
// 动态获取表格单元格样式
|
||||
function tableCell({row, columnIndex}) {
|
||||
let items = errorCheckItem.filter((item) => item === row.scriptId)
|
||||
|
||||
if (columnIndex === 0 && items.length > 0) {
|
||||
return 'warning-row'
|
||||
}
|
||||
if (columnIndex === 0) {
|
||||
return 'header-row'
|
||||
}
|
||||
}
|
||||
// function tableCell({row, columnIndex}) {
|
||||
// let items = errorCheckItem.filter((item) => item === row.scriptId)
|
||||
//
|
||||
// if (columnIndex === 0 && items.length > 0) {
|
||||
// return 'warning-row'
|
||||
// }
|
||||
// if (columnIndex === 0) {
|
||||
// return 'header-row'
|
||||
// }
|
||||
// }
|
||||
|
||||
const updateCheckResultView = (scriptCode: string, isStart: boolean) => {
|
||||
// debugger
|
||||
let scriptId = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
||||
let temp = null
|
||||
if (isStart) {
|
||||
@@ -829,23 +732,25 @@ const getLoadingResult = (scriptId: string) => {
|
||||
|
||||
return tempScriptChnItem
|
||||
}
|
||||
|
||||
|
||||
// 模拟检测 todo 可移除
|
||||
const getCheckResult = (scriptId: string) => {
|
||||
// debugger
|
||||
let devices = []
|
||||
|
||||
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.SUCCESS)
|
||||
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
||||
//errorCheckItem.push({scriptId,type:'warning'})
|
||||
}
|
||||
|
||||
let randomNum = getRandomInt(item.chnNum * 2)
|
||||
if (activeIndex.value >= 2 && activeIndex.value <= 8) {
|
||||
if (randomNum < item.chnNum) {
|
||||
tempChnResult[randomNum] = (randomNum % 2 === 0 ? 1 : 3)
|
||||
|
||||
errorCheckItem.push(scriptId)
|
||||
} else {
|
||||
for (let i = 0; i < item.chnNum; i++) {
|
||||
tempChnResult.push(CheckData.ChnCheckResultEnum.ERRORDATA)
|
||||
//errorCheckItem.push({scriptId,type:'warning'})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,6 +760,61 @@ const getCheckResult = (scriptId: string) => {
|
||||
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)
|
||||
//errorCheckItem.push({scriptId,type:'warning'})
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < item.chnNum; i++) {
|
||||
tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
|
||||
}
|
||||
let randomNum = getRandomInt(item.chnNum * 2)
|
||||
if (randomNum < item.chnNum) {
|
||||
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
|
||||
errorCheckItem.push({scriptId, type: 'error'})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
deviceId: item.deviceId,
|
||||
deviceName: item.deviceName,
|
||||
chnResult: tempChnResult,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// devices = deviceList.map(item => {
|
||||
//
|
||||
// let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||
// for (let i = 0; i < item.chnNum; i++) {
|
||||
// tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
|
||||
// }
|
||||
//
|
||||
// let randomNum = getRandomInt(item.chnNum * 2)
|
||||
// if (activeIndex >= 2 && activeIndex <= 8) {
|
||||
// if (randomNum % 3 === 0) {
|
||||
// let a = getRandomInt(2) === 1 ? CheckData.ChnCheckResultEnum.ERRORDATA : CheckData.ChnCheckResultEnum.UNCONNECTED
|
||||
// tempChnResult.splice(tempChnResult.length - 1 - item.chnNum, item.chnNum, CheckData.ChnCheckResultEnum.ERRORDATA)
|
||||
// }else{
|
||||
// if (randomNum < item.chnNum) {
|
||||
// tempChnResult[randomNum] = (randomNum % 2) + 1
|
||||
//
|
||||
// errorCheckItem.push(scriptId)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return {
|
||||
// deviceId: item.deviceId,
|
||||
// deviceName: item.deviceName,
|
||||
// chnResult: tempChnResult,
|
||||
// }
|
||||
// })
|
||||
|
||||
let tempScriptChnItem: CheckData.ScriptChnItem = {
|
||||
scriptId,
|
||||
@@ -873,7 +833,7 @@ const handlePauseOrContinue = () => {
|
||||
const Pausetime = endData.value.getTime() - startData.value.getTime();
|
||||
timeDifference.value += Pausetime
|
||||
|
||||
testLogList.value.push({
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':暂停检测',
|
||||
})
|
||||
@@ -882,7 +842,7 @@ const handlePauseOrContinue = () => {
|
||||
}
|
||||
if (testStatus.value == "process") {
|
||||
startData.value = new Date();
|
||||
testLogList.value.push({
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ':继续检测',
|
||||
})
|
||||
@@ -899,12 +859,8 @@ const handleClick = (scriptId: string, deviceId: any, chnNum: number) => {
|
||||
|
||||
// todo 可移除
|
||||
const startTimer = () => {
|
||||
if (activeIndex.value === 0) {
|
||||
console.log('检测开始')
|
||||
activeIndex.value++;
|
||||
}
|
||||
console.log('开始检测第' + activeIndex.value + '项')
|
||||
switch (activeIndex.value) {
|
||||
console.log('开始检测第' + activeIndex + '项')
|
||||
switch (activeIndex) {
|
||||
case 1:
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'Test_Freq_Start',
|
||||
@@ -1080,15 +1036,20 @@ const handleFinishTest = () => {
|
||||
};
|
||||
|
||||
const handleReCheck = () => {
|
||||
activeIndex.value = 0;
|
||||
activeIndex = 1;
|
||||
percentage.value = 0;
|
||||
testLogList.value.length = 0;
|
||||
testLogList.length = 0;
|
||||
errorCheckItem.length = 0;
|
||||
// resumeTimer()
|
||||
};
|
||||
|
||||
function clear() {
|
||||
errorCheckItem.length = 0;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
clear,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -1174,12 +1135,20 @@ function clear() {
|
||||
}
|
||||
}
|
||||
|
||||
.custom-icon {
|
||||
width: 16px; /* 调整宽度 */
|
||||
height: 16px; /* 调整高度 */
|
||||
color: #409EFF; /* 调整颜色 */
|
||||
.loading-box {
|
||||
animation: loading 1.5s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//:deep(.el-drawer .el-drawer__title){
|
||||
// background-color: #003078 !important;
|
||||
//}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"></test>
|
||||
<test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"></test>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
@@ -146,6 +146,7 @@ const detectionOptions = ref([
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
const preTestRef = ref(null);
|
||||
const testRef = ref(null);
|
||||
|
||||
const devIdArr = ref([])
|
||||
const planId = ref('')
|
||||
@@ -396,7 +397,7 @@ const getIcon = (index: number) => {
|
||||
const handleCancel = () => {
|
||||
// clearData()
|
||||
// emit('update:visible', false); // 关闭对话框
|
||||
|
||||
testRef.value?.clear()
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user