手动检测功能修改、一键检测功能修改(均未完成)

This commit is contained in:
caozehui
2025-02-25 10:17:33 +08:00
parent a0c7f79302
commit 280289af37
11 changed files with 1793 additions and 833 deletions

View File

@@ -1,159 +1,163 @@
<template>
<div class="dialog" v-bind="dialogBig">
<div class="dialog-title">
<div class="timeView">
<el-icon style="margin: 0px 5px;"><Clock /></el-icon>
<span>检测用时{{ timeView }}</span>
</div>
<el-progress
style="width: 50%; margin-right: 15px;"
:percentage="percentage"
:color="customColors"/>
<div style="width: 12%">
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
<div>
<div class="dialog" v-bind="dialogBig">
<div class="dialog-title">
<div class="timeView">
<el-icon style="margin: 0px 5px;">
<Clock/>
</el-icon>
初始化中
</el-button>
<span>检测用时{{ timeView }}</span>
</div>
<el-progress
style="width: 50%; margin-right: 15px;"
:percentage="percentage"
:color="customColors"/>
<el-button
type="primary"
v-if="testStatus=='process' && percentage < 100"
:icon="VideoPause"
@click="handlePause()">停止检测
</el-button>
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>
<el-icon class="loading-box" style="margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
暂停中
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- v-if="testStatus=='test_init'"-->
<!-- :icon="VideoPause"-->
<!-- disabled>初始化中-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='test_init_fail'"-->
<!-- :icon="Failed"-->
<!-- disabled>初始化失败-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='connect_timeout'"-->
<!-- :icon="Failed"-->
<!-- disabled>连接超时-->
<!-- </el-button>-->
<el-button
type="primary"
:icon="RefreshLeft"
v-if="testStatus === 'test_recheck'"
@click="emit('sendReCheck')">重新检测
</el-button>
<div style="width: 12%">
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
初始化中
</el-button>
<el-button
type="primary"
v-if="testStatus=='process' && percentage < 100"
:icon="VideoPause"
@click="handlePause()">停止检测
</el-button>
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>
<el-icon class="loading-box" style="margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
暂停中
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- v-if="testStatus=='test_init'"-->
<!-- :icon="VideoPause"-->
<!-- disabled>初始化中-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='test_init_fail'"-->
<!-- :icon="Failed"-->
<!-- disabled>初始化失败-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='connect_timeout'"-->
<!-- :icon="Failed"-->
<!-- disabled>连接超时-->
<!-- </el-button>-->
<el-button
type="primary"
:icon="RefreshLeft"
v-if="testStatus === 'test_recheck'"
@click="emit('sendReCheck')">重新检测
</el-button>
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>
<el-button
type="warning"
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"
:icon="VideoPlay"
:disabled="testStatus === 'pause_timeout'"
@click="emit('sendResume')"
>继续检测
</el-button>
<el-button
type="warning"
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"
:icon="VideoPlay"
:disabled="testStatus === 'pause_timeout'"
@click="emit('sendResume')"
>继续检测
</el-button>
</div>
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div>
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div>
<div class="dialog-content">
<el-table :data="checkResultView" row-key="scriptType" height="450px"
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
border>
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
</el-table-column>
<template v-if="chnSum<=MAX_CHN_SUM">
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName"
:min-width="110" align="center">
<el-table-column v-for="(chnItem,index2) in item.chnNum" :key="`${item.deviceId}${chnItem}`"
:label="'通道'+chnItem" align="center">
<template #default="{row}">
<el-tooltip
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
placement="top">
<el-button
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
:color="row.devices[index1].chnResult[index2].color"
size="small"
@click="handleClick(item,chnItem,row.scriptType)"
style="align-self: center;"
>
<el-icon v-if="row.devices[index1].chnResult[index2].icon==='Loading'" class="loading-box"
style="color: #fff">
<component :is="Loading"/>
</el-icon>
<el-icon v-else style="color: #fff">
<component :is="row.devices[index1].chnResult[index2].icon"/>
</el-icon>
</el-button>
</el-tooltip>
</template>
</el-table-column>
<div class="dialog-content">
<el-table :data="checkResultView" row-key="scriptType" height="450px"
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
border>
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
</el-table-column>
</template>
<!-- <template v-else>-->
<!-- <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[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"-->
<!-- placement="top">-->
<!-- <el-button-->
<!-- :disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"-->
<!-- :color="row.devices[index1].chnResult[0].color"-->
<!-- size="small"-->
<!-- @click="handleClick(item,-1,row.scriptType)"-->
<!-- >-->
<!-- <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>-->
<!-- </template>-->
<template v-if="chnSum<=MAX_CHN_SUM">
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName"
:min-width="110" align="center">
<el-table-column v-for="(chnItem,index2) in item.chnNum" :key="`${item.deviceId}${chnItem}`"
:label="'通道'+chnItem" align="center">
<template #default="{row}">
<el-tooltip
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
placement="top">
<el-button
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
:color="row.devices[index1].chnResult[index2].color"
size="small"
@click="handleClick(item,chnItem,row.scriptType)"
style="align-self: center;"
>
<el-icon v-if="row.devices[index1].chnResult[index2].icon==='Loading'" class="loading-box"
style="color: #fff">
<component :is="Loading"/>
</el-icon>
<el-icon v-else style="color: #fff">
<component :is="row.devices[index1].chnResult[index2].icon"/>
</el-icon>
</el-button>
</el-table>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
</template>
<!-- <template v-else>-->
<!-- <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[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"-->
<!-- placement="top">-->
<!-- <el-button-->
<!-- :disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"-->
<!-- :color="row.devices[index1].chnResult[0].color"-->
<!-- size="small"-->
<!-- @click="handleClick(item,-1,row.scriptType)"-->
<!-- >-->
<!-- <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>-->
<!-- </template>-->
</el-table>
</div>
</div>
<div class="drawer-container">
<el-drawer v-model="drawer" title="检测项进度" direction="btt">
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
<p v-for="(item, index) in testLogList"
:key="index"
:style="{color:item.type==='error'?'#F56C6C': item.type==='warning'?'#e6a23c':'var(--el-text-color-regular)'}">
{{ item.log }}<br/>
</p>
</div>
</el-drawer>
</div>
<resultPopup
:visible="resultDialogVisible"
@update:visible="resultDialogVisible = $event"
></resultPopup>
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</div>
<div class="drawer-container">
<el-drawer v-model="drawer" title="检测项进度" direction="btt">
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
<p v-for="(item, index) in testLogList"
:key="index"
:style="{color:item.type==='error'?'#F56C6C': item.type==='warning'?'#e6a23c':'var(--el-text-color-regular)'}">
{{ item.log }}<br/>
</p>
</div>
</el-drawer>
</div>
<resultPopup
:visible="resultDialogVisible"
@update:visible="resultDialogVisible = $event"
></resultPopup>
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</template>
<script lang="tsx" setup name="test">
import {Check, Failed, InfoFilled, Loading, Timer, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
@@ -469,25 +473,25 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
}
break;
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', 'test_init_fail')
break;
// 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', 'test_init_fail')
// break;
case 'yjc_ytxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER':
@@ -715,7 +719,7 @@ const showTestLog = () => {
// 初始化检测脚本数据
const initScriptData = async () => {
let response: any = await getBigTestItem(checkStore.planId)
let response: any = await getBigTestItem(checkStore.plan.id)
let temp = response.data.map(item => {
return {
@@ -782,7 +786,7 @@ const updateCheckResult = (data: CheckData.ScriptChnItem) => {
const scrollToBottom = () => {
if (scrollContainerRef.value) {
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight+70;
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight + 70;
}
};
@@ -929,28 +933,28 @@ function getErrorCheckItem(scriptType: string) {
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: CheckData.DeviceCheckResult[] = []) => {
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
// devices = [
// {
// chnResult: [3, 4],
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
// deviceName: "240002"
// },
// {
// chnResult: [1, 1, 1, 1],
// deviceId: "df23a4178d194467a432ddf45e835e48",
// deviceName: "240003"
// },
// {
// chnResult: [1, 1, 1, 1],
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
// deviceName: "240004"
// }
// {
// chnResult: [1, 1, 1, 1],
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
// deviceName: "25011407"
// }
// ]
devices = [
{
chnResult: [1, 1, 1, 1],
deviceId: "3250a0ff180845cc8885da4ff628261e",
deviceName: "测试装置-0122-02"
},
// {
// chnResult: [1, 1, 1, 1],
// deviceId: "df23a4178d194467a432ddf45e835e48",
// deviceName: "240003"
// },
// {
// chnResult: [1, 1, 1, 1],
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
// deviceName: "240004"
// }
// {
// chnResult: [1, 1, 1, 1],
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
// deviceName: "25011407"
// }
]
let temp = null
if (isStart) {
temp = getLoadingResult(scriptType)
@@ -1178,46 +1182,46 @@ const startTimer = () => {
case 8:
todoItem('HSI')
break;
// case 9:
// emit('update:webMsgSend', {
// requestId: 'I_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'I_End'
// })
// }, 2000)
// break;
// case 10:
// emit('update:webMsgSend', {
// requestId: 'IMBV_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'IMBV_End'
// })
// }, 2000)
// break;
// case 11:
// emit('update:webMsgSend', {
// requestId: 'IMBA_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'IMBA_End'
// })
// }, 2000)
// break;
// case 12:
// emit('update:webMsgSend', {
// requestId: 'F_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'F_End'
// })
// }, 2000)
// break;
// case 9:
// emit('update:webMsgSend', {
// requestId: 'I_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'I_End'
// })
// }, 2000)
// break;
// case 10:
// emit('update:webMsgSend', {
// requestId: 'IMBV_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'IMBV_End'
// })
// }, 2000)
// break;
// case 11:
// emit('update:webMsgSend', {
// requestId: 'IMBA_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'IMBA_End'
// })
// }, 2000)
// break;
// case 12:
// emit('update:webMsgSend', {
// requestId: 'F_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'F_End'
// })
// }, 2000)
// break;
case 9:
emit('update:webMsgSend', {
requestId: 'Quit'
@@ -1262,8 +1266,8 @@ const todoItem = (code: string) => {
desc: '输入频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "461813a4f30f4a34a1a273ecd0379458",
deviceName: "25011407"
deviceId: "3250a0ff180845cc8885da4ff628261e",
deviceName: "测试装置-0122-02"
}]
})
}
@@ -1283,8 +1287,8 @@ const todoItem = (code: string) => {
desc: '输入频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "461813a4f30f4a34a1a273ecd0379458",
deviceName: "25011407"
deviceId: "3250a0ff180845cc8885da4ff628261e",
deviceName: "测试装置-0122-02"
}]
})
}
@@ -1303,9 +1307,9 @@ const todoItem = (code: string) => {
requestId: `${code}_End`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 2, 1, 1],
deviceId: "461813a4f30f4a34a1a273ecd0379458",
deviceName: "25011407"
chnResult: [1, 1, 1, 1],
deviceId: "3250a0ff180845cc8885da4ff628261e",
deviceName: "测试装置-0122-02"
}]
})
}
@@ -1316,8 +1320,8 @@ const todoItem = (code: string) => {
requestId: `${code}_End`,
data: [{
chnResult: [1, 2, 1, 1],
deviceId: "461813a4f30f4a34a1a273ecd0379458",
deviceName: "25011407"
deviceId: "3250a0ff180845cc8885da4ff628261e",
deviceName: "测试装置-0122-02"
}]
})
}
@@ -1331,7 +1335,7 @@ const handleResumeTest = () => {
type: 'info',
log: `${new Date().toLocaleString()}:继续检测`,
})
//startTimer()
startTimer()
resumeTimeCount()
console.log('开始继续检测')
};