This commit is contained in:
caozehui
2025-01-08 09:46:47 +08:00
parent 87c46e8477
commit de5548bbbd
2 changed files with 30 additions and 24 deletions

View File

@@ -249,9 +249,9 @@ const defaultOperate = () => {
currentDesc.value = node.sourceDesc
checkIndex.value = node.index
defaultExpandedKeys = [node.index]
// nextTick(() => {
// treeRef.value?.setCurrentKey(node.index);
// });
treeRef.value?.setCurrentKey(node.index);
} else {
currentScriptTypeName.value = ''
currentDesc.value = ''

View File

@@ -70,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,chnItem+'',row.scriptType)"
@click="handleClick(item,chnItem,row.scriptType)"
style="align-self: center;"
>
<el-icon v-if="row.devices[index1].chnResult[index2].icon==='Loading'" class="loading-box"
@@ -98,7 +98,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,'-1',row.scriptType)"
@click="handleClick(item,-1,row.scriptType)"
>
<el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"
style="color: #fff">
@@ -794,18 +794,18 @@ const setErrorCheckItem = (scriptType: string, devices: any) => {
}
}
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => {
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any[] = []) => {
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
// devices = [{
// chnResult: [2, 2],
// chnResult: [1, 1],
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
// deviceName: "240002"
// }]
setErrorCheckItem(scriptType, devices)
let temp = null
if (isStart) {
temp = getLoadingResult(scriptType)
} else {
setErrorCheckItem(scriptType, devices)
temp = {
scriptType,
devices
@@ -902,25 +902,31 @@ const getCheckResult = (scriptType: string) => {
}
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (item: any, chnNum: string, scriptType: string) => {
const handleClick = (item: any, chnNum: number, 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 (checkResultItem) {
let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
if (device) {
let chnResult = device.chnResult
if (chnNum === -1) {
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.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: '确定',
@@ -934,7 +940,7 @@ const handleClick = (item: any, chnNum: string, scriptType: string) => {
})
}
if (flag === -1) {
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum, scriptType);
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
}
};