正式检测-预检测提示及日志功能

This commit is contained in:
caozehui
2025-01-02 18:00:58 +08:00
parent 4031724fa9
commit 410cd53e51
8 changed files with 268 additions and 122 deletions

View File

@@ -43,13 +43,11 @@ export namespace CheckData {
}
// 用来描述检测脚本类型
export interface ScriptItem {
id: string,
code?: string,
export interface ScriptItem{
scriptName: string,
children?: ScriptItem[]
scriptType?: string,
children?: ScriptItem1[]
}
// 用来描述 通道检测结果
export enum ChnCheckResultEnum {
UNKNOWN = -1,
@@ -62,7 +60,7 @@ export namespace CheckData {
//用来描述 某个脚本测试项对所有通道的检测结果
export interface ScriptChnItem {
scriptId: string
scriptType: string
scriptName?: string //可以不要该属性,有点多余
// 设备
@@ -93,7 +91,7 @@ export namespace CheckData {
* 用于描述 脚本检测结果展示的按钮类型
*/
export interface ScriptChnViewItem {
scriptId: string,
scriptType: string,
scriptName?: string //脚本项名称,可以不要该属性,有点多余
// 设备

View File

@@ -9,7 +9,7 @@ export const getBigTestItem = (planId: string) => {
* @param params 当为scriptType为null时表示查询所有脚本类型否则只查询指定脚本类型。当为chnNum为-1时表示查询所有通道否则只查询指定通道。
*/
export const getFormData = (params: {
scriptId: string,
planId: string,
deviceId: string,
chnNum: string,
scriptType: string | null

View File

@@ -9,6 +9,7 @@ export const useCheckStore = defineStore("check", {
state: () => ({
devices: Array<CheckData.Device>(),
planId: String(""),
planCode: String(""),
scriptId: String(""),
}),
@@ -27,6 +28,10 @@ export const useCheckStore = defineStore("check", {
this.planId = planId
},
setPlanCode(planCode: string) {
this.planCode = planCode
},
setScriptId(scriptId: string) {
this.scriptId = scriptId
}

View File

@@ -34,14 +34,14 @@
</el-radio-group>
</div>
<div class="content-tree">
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="id"
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="scriptType"
:data="treeDataUnqualified" :props="defaultProps" @node-click="handleNodeClick"
class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
</template>
</el-tree>
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="id"
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="scriptType"
:data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick" class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
@@ -79,10 +79,11 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface";
import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check";
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean
}>(), {appendToBody: false})
}>(), {appendToBody: true})
const defaultProps = {
label: "scriptName",
@@ -115,7 +116,7 @@ let treeDataUnqualified: CheckData.ScriptItem[] = []
let treeDataAll: CheckData.ScriptItem[] = []
// 左侧树被选中的叶子节点id
const checkedScriptId = ref<string>('')
const checkedScriptType = ref<string>('')
const currentScriptDsc = ref('');
// 右侧Tab选中项
@@ -134,10 +135,10 @@ let defaultExpandedKeys: string[] = []
// 点击左侧树节点触发事件
const handleNodeClick = async (data: any) => {
if (!data.children) {
checkedScriptId.value = data.id
checkedScriptType.value = data.scriptType
currentScriptDsc.value = data.scriptName
if (checkedScriptId.value) {
if (checkedScriptType.value) {
await updateTableData()
}
}
@@ -155,36 +156,33 @@ const handleSwitchChange = async (data: any) => {
if (data === 0) {
// 发起请求,查询该测试项的检测结果
// const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,0})
// const result = await getTreeData({scriptId:checkStore.scriptId,deviceId, chnNum: formContent.chnNum+'', scriptType,0})
treeDataUnqualified = [{
"id": "1",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-2",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
"scriptName": "输入:频率 50.05Hz Ua =10%Un...",
"scriptType": '2346adafdf'
},
{
"id": "1-2-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
"scriptName": "输入:频率 51.05Hz Ua =10%Un...",
"scriptType": '1246adaafdf'
},
{
"id": "1-2-3",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
"scriptName": "输入:频率 52.05Hz Ua =10%Un...",
"scriptType": '2136ada3fdf'
}
]
},
{
"id": "1-3",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
"scriptName": "输入:频率 50.05Hz Ua =100%Un...",
"scriptType": '234246adafdf'
}
]
}
@@ -192,60 +190,56 @@ const handleSwitchChange = async (data: any) => {
}]
} else {
// 发起请求,查询该测试项的检测结果
// const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,1})
// const result = await getTreeData({scriptId:checkStore.scriptId,deviceId, chnNum: formContent.chnNum+'', scriptType,1})
treeDataAll = [
{
"id": "1",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-1",
"scriptName": "额定工作条件下的检测",
"children": [
{
"id": "1-1-1",
"scriptName": "输入:频率 42.5Hz..."
"scriptName": "输入:频率 42.5Hz...",
"scriptType": '2246ada2fdf'
},
{
"id": "1-1-2",
"scriptName": "输入:频率 50.0Hz..."
"scriptName": "输入:频率 50.0Hz...",
"scriptType": '2246a3dafdf'
},
{
"id": "1-1-3",
"scriptName": "输入:频率 50.05Hz...."
"scriptName": "输入:频率 50.05Hz....",
"scriptType": '22246adafdf'
}
]
},
{
"id": "1-2",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
"scriptName": "输入:频率 50.05Hz Ua =10%Un...",
"scriptType": '224a6adafdf'
},
{
"id": "1-2-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
"scriptName": "输入:频率 51.05Hz Ua =10%Un...",
"scriptType": '2246aadafdf'
},
{
"id": "1-2-3",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
"scriptName": "输入:频率 52.05Hz Ua =10%Un...",
"scriptType": '2246adaffdf'
}
]
},
{
"id": "1-3",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
"scriptName": "输入:频率 50.05Hz Ua =100%Un...",
"scriptType": '2246aadafdf'
}
]
}
]
},
}
]
}
@@ -263,12 +257,12 @@ const defaultOperate = () => {
node = getDefaultNode(treeDataAll)
}
currentScriptDsc.value = node?.scriptName
checkedScriptId.value = node?.id
defaultExpandedKeys = [node?.id]
checkedScriptType.value = node?.scriptType
defaultExpandedKeys = [node?.scriptType]
}
const updateTableData = async () => {
console.log("左侧树被选中的叶子节点id", checkedScriptId.value);
console.log("左侧树被选中的叶子节点scriptType", checkedScriptType.value);
// 发起请求,查询该测试项的检测结果
// const result = await getTableData({checkStore.scriptId,deviceId, formContent.chnNum, scriptType})
@@ -409,26 +403,26 @@ const updateTableData = async () => {
]
}
const open = (_deviceId: string, chnNum: string, _scriptType: string | null) => {
console.log(checkStore.scriptId, _deviceId, chnNum, _scriptType);
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
// console.log(checkStore.scriptId, _deviceId, chnNum, _scriptType);
deviceId = _deviceId
scriptType = _scriptType
// 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号
//const resFormContent = await getFormData({checkStore.scriptId,deviceId, chnNum,scriptType})
const {data: resFormContent} = await getFormData({planId: checkStore.planId, deviceId, chnNum, scriptType})
// 数据处理
let resFormContent = {
scriptName: 'Q/GDW 10650.4-2021 模拟式',
errorSysName: 'Q/GDW 10650.2-2021',
dataRule: '505f063f9f91ab108d895a9fe96b5dce',
deviceName: '被检设备1',
chnList: [
{value: '1', label: '1'},
{value: '2', label: '0'},
{value: '3', label: '1'},
{value: '4', label: '0'}],
}
// let resFormContent = {
// scriptName: 'Q/GDW 10650.4-2021 模拟式',
// errorSysName: 'Q/GDW 10650.2-2021',
// dataRule: '505f063f9f91ab108d895a9fe96b5dce',
// deviceName: '被检设备1',
// chnList: [
// {value: '1', label: '1'},
// {value: '2', label: '0'},
// {value: '3', label: '1'},
// {value: '4', label: '0'}],
// }
chnList = resFormContent.chnList.map(item => ({
value: item.value,
label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)`
@@ -436,7 +430,11 @@ const open = (_deviceId: string, chnNum: string, _scriptType: string | null) =>
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
Object.assign(formContent, {...resFormContent, dataRule: dataRuleName, chnNum: chnList[0].value})
Object.assign(formContent, {
...resFormContent,
dataRule: dataRuleName,
chnNum: chnList[0].value
})
visible.value = true;
@@ -453,7 +451,7 @@ const close = () => {
})
treeDataUnqualified = []
treeDataAll = []
checkedScriptId.value = ''
checkedScriptType.value = ''
activeTab.value = 'rawDataTab'
currentScriptDsc.value = ''
switchItem.value = 0

View File

@@ -573,13 +573,9 @@ const handleSelectionChange = (selection: any[]) => {
if(selection.length > 0){
checkStore.clearDevices()
checkStore.addDevices(devices)
checkStore.setPlanId(selection[0].planId)
}else{
checkStore.clearDevices()
checkStore.setPlanId('')
}
}
//查询

View File

@@ -13,6 +13,19 @@
:icon="VideoPause"
@click="handlePauseTest">停止检测
</el-button>
<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>
<el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button>
@@ -38,7 +51,7 @@
</div>
<div class="dialog-content">
<el-table :data="checkResultView" row-key="scriptId" height="450px"
<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">
@@ -57,7 +70,7 @@
: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.deviceId,chnItem+'',row.scriptId)"
@click="handleClick(item,chnItem+'',row.scriptType)"
style="align-self: center;"
>
<el-icon v-if="row.devices[index1].chnResult[index2].icon==='Loading'" class="loading-box"
@@ -86,7 +99,7 @@
: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.deviceId,'-1',row.scriptId)"
@click="handleClick(item,'-1',row.scriptType)"
>
<el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"
style="color: #fff">
@@ -127,7 +140,7 @@
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</template>
<script lang="tsx" setup name="test">
import {Check, InfoFilled, Loading, Refresh, VideoPause} from '@element-plus/icons-vue'
import {Check, InfoFilled, Loading, Refresh, VideoPause, Failed} from '@element-plus/icons-vue'
import resultPopup from './resultPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue";
@@ -178,7 +191,7 @@ const timeDifference = ref(0)
// 真正的检测结果(详细到通道)
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格则该检测项的id会被加入该数组。
let errorCheckItem: Array<{ scriptId: string, type: 'info' | 'warning' | 'error' }> = []
let errorCheckItem: Array<{ scriptType: string, type: 'info' | 'warning' | 'error' }> = []
// 用来存放检测日志
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
@@ -200,11 +213,11 @@ const chnSum = computed(() => {
})
// 用来展示的检测结果
const checkResultView = computed(() => {
const checkResultView: any[] = computed(() => {
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
let temp: CheckData.ScriptChnViewItem = {
scriptId: item.scriptId,
scriptType: item.scriptType,
scriptName: item.scriptName,
devices: []
}
@@ -279,8 +292,11 @@ const checkResultView = computed(() => {
watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') {
//startTimer() // todo 可移除
emit('update:testStatus', 'process')
ElMessage.success('预检测开始!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测开始!`})
emit('update:testStatus', 'preTest_process')
startTimer() // todo 可移除
//emit('update:testStatus', 'process') // todo 可移除
}
if (newValue == 'paused' && oldValue == 'process') {
handlePauseOrContinue()
@@ -294,16 +310,80 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) {
if (activeIndex <= checkTotal) {
switch (newValue.requestId) {
case 'PreTest_Success':
ElMessage.success('预检成功!')
break;
case 'PreTest_Fail':
ElMessageBox.alert('预检测失败,请检查设备连接情况', '预检测失败', {
// 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',
}).then(() => {
emit('update:testStatus', 'success')
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯中断!`})
emit('update:testStatus', 'preTest_fail')
}
break;
}
break;
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
}
break;
case 'Pause_Success':
ElMessage.success('暂停成功')
@@ -559,7 +639,7 @@ const initCheckResult = () => {
scriptData.forEach(item => {
// 处理当前节点的数据
let temp: CheckData.ScriptChnItem = {
scriptId: item.id,
scriptType: item.id,
scriptName: item.scriptName,
devices: []
}
@@ -579,10 +659,10 @@ const initCheckResult = () => {
}
// 更新检测结果(详细到通道)
const updateCheckResult = (data: CheckData.ScriptChnItem) => {
const {scriptId} = {...data}
const {scriptType} = {...data}
checkResult.forEach(item => {
if (item.scriptId == scriptId) {
if (item.scriptType == scriptType) {
item.devices.forEach((device, index) => {
device.chnResult = [...data.devices[index].chnResult]
})
@@ -601,8 +681,8 @@ function getRandomInt(max: number): number {
}
//判断该检测项(例如 频率准确度检测)是否全部合格(所有设备所有通道所有子检测项目全部合格为合格,否则为不合格)
function getItemCheckResult(scriptId: string): boolean {
let items = errorCheckItem.filter((item) => item.scriptId === scriptId)
function getItemCheckResult(scriptType: string): boolean {
let items = errorCheckItem.filter((item) => item.scriptType === scriptType)
if (items.length > 0) {
return true
} else {
@@ -637,7 +717,7 @@ const updateLog = (isStart: boolean) => {
if (activeIndex === 1 && isStart) {
timeDifference.value = 0;
testLogList.length = 0; // 清空数组
//testLogList.length = 0; // 清空数组
}
// debugger
if (activeIndex < checkTotal) {
@@ -676,7 +756,7 @@ const updateLog = (isStart: boolean) => {
// 动态获取表格单元格样式
// function tableCell({row, columnIndex}) {
// let items = errorCheckItem.filter((item) => item === row.scriptId)
// let items = errorCheckItem.filter((item) => item === row.scriptType)
//
// if (columnIndex === 0 && items.length > 0) {
// return 'warning-row'
@@ -688,18 +768,18 @@ const updateLog = (isStart: boolean) => {
const updateCheckResultView = (scriptCode: string, isStart: boolean) => {
// debugger
let scriptId = scriptData.filter(item => item.code === scriptCode)[0]?.id
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
let temp = null
if (isStart) {
temp = getLoadingResult(scriptId)
temp = getLoadingResult(scriptType)
} else {
temp = getCheckResult(scriptId)
temp = getCheckResult(scriptType)
}
updateCheckResult(temp)
};
// 获取loading状态的结果
const getLoadingResult = (scriptId: string) => {
const getLoadingResult = (scriptType: string) => {
let devices = []
devices = deviceList.map(item => {
@@ -717,7 +797,7 @@ const getLoadingResult = (scriptId: string) => {
})
let tempScriptChnItem: CheckData.ScriptChnItem = {
scriptId,
scriptType,
devices,
}
@@ -726,7 +806,7 @@ const getLoadingResult = (scriptId: string) => {
// 模拟检测 todo 可移除
const getCheckResult = (scriptId: string) => {
const getCheckResult = (scriptType: string) => {
// debugger
let devices = []
@@ -736,12 +816,12 @@ const getCheckResult = (scriptId: string) => {
if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
for (let i = 0; i < item.chnNum; i++) {
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
//errorCheckItem.push({scriptId,type:'warning'})
//errorCheckItem.push({scriptType,type:'warning'})
}
} else {
for (let i = 0; i < item.chnNum; i++) {
tempChnResult.push(CheckData.ChnCheckResultEnum.ERRORDATA)
//errorCheckItem.push({scriptId,type:'warning'})
//errorCheckItem.push({scriptType,type:'warning'})
}
}
@@ -757,7 +837,7 @@ const getCheckResult = (scriptId: string) => {
if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
for (let i = 0; i < item.chnNum; i++) {
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
//errorCheckItem.push({scriptId,type:'warning'})
//errorCheckItem.push({scriptType,type:'warning'})
}
} else {
for (let i = 0; i < item.chnNum; i++) {
@@ -766,7 +846,7 @@ const getCheckResult = (scriptId: string) => {
let randomNum = getRandomInt(item.chnNum * 2)
if (randomNum < item.chnNum && activeIndex >= 4 && activeIndex <= 8) {
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
errorCheckItem.push({scriptId, type: 'error'})
errorCheckItem.push({scriptType, type: 'error'})
}
}
@@ -779,7 +859,7 @@ const getCheckResult = (scriptId: string) => {
}
let tempScriptChnItem: CheckData.ScriptChnItem = {
scriptId,
scriptType,
devices,
}
@@ -813,8 +893,40 @@ const handlePauseOrContinue = () => {
};
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (deviceId: string, chnNum: string, scriptType: string) => {
dataCheckSingleChannelSingleTestPopupRef.value?.open(deviceId, chnNum, scriptType);
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);
}
};
// todo 可移除
@@ -822,16 +934,38 @@ const startTimer = () => {
console.log('开始检测第' + activeIndex + '项')
switch (activeIndex) {
case 1:
setTimeout(() => {
emit('update:webMsgSend', {
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)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'FREQ_End',
params: {}
})
}, 2000);
}, 12000);
break;
case 2:
emit('update:webMsgSend', {

View File

@@ -26,8 +26,12 @@
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit">停止检测</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" :icon="Right" v-if="ActiveStatue === 'success'" @click="nextStep">{{nextStepText}}</el-button>
<el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'preTest_process'" disabled>预检测中</el-button>
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
v-if="ActiveStatue === 'success'||ActiveStatue==='preTest_fail'" @click="nextStep">
{{ nextStepText }}
</el-button>
</div>
</template>
</el-dialog>
@@ -50,7 +54,8 @@
Right,
SuccessFilled,
UploadFilled,
VideoPlay
VideoPlay,
RefreshLeft
} from '@element-plus/icons-vue'
import preTest from './preTest.vue'
import timeTest from './timeTest.vue'
@@ -248,20 +253,20 @@ const detectionOptions = ref([
// break;
case 2:
if (TestStatus.value == "waiting") {
startTest({
userPageId: "cdf",
devIds:deviceIds,
planId:planId,
operateType:'1' // '0'为预检测、1为正式检测
}).then(res => {
console.log(res)
// startTest({
// userPageId: "cdf",
// devIds:deviceIds,
// planId:planId,
// operateType:'1' // '0'为预检测、1为正式检测
// }).then(res => {
// console.log(res)
// if (res.code === 20000) {
// TestStatus.value = 'start'
// webMsgSend.value = ''
// } else {
// ElMessage.error(res.message)
// }
})
// })
TestStatus.value = 'start'
} else if (TestStatus.value == 'process') {
// 发送暂停指令
@@ -332,6 +337,12 @@ const detectionOptions = ref([
stepsActiveIndex.value++;
nextStepText.value = '检测完成'
}
if(newValue === 'preTest_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '预检测失败'
}
})
const sendPause = () => {

View File

@@ -58,6 +58,8 @@ const getTreeData = (val: any) => {
if (data.value.length > 0 && data.value[0].children.length > 0) {
defaultChecked.value.push(data.value[0].children[0].id as number)
}
checkStore.setPlanId(defaultChecked.value[0])
checkStore.setPlanCode(data.value[0].code)
}
const filterText = ref('')
const treeRef = ref()
@@ -74,6 +76,8 @@ watch(
},
)
const handleNodeClick = (data: Plan.ResPlan) => {
checkStore.setPlanId(data.id)
checkStore.setPlanCode(data.code)
checkStore.setScriptId(data.scriptId)
updateSelectedTreeNode(data.id)
}