This commit is contained in:
sjl
2025-10-21 10:43:27 +08:00
parent f1b76376c6
commit b2db5622bc
8 changed files with 96 additions and 47 deletions

View File

@@ -11,7 +11,8 @@
show-checkbox
:default-checked-keys="checkedKeysRef"
ref="treeRef"
>
>
</el-tree>
</el-form>
@@ -209,4 +210,4 @@ const getAllIds = (functions: Function.ResFunction[]): string[] => {
refreshTable: (() => Promise<void>) | undefined;
}>()
</script>
</script>

View File

@@ -35,6 +35,7 @@ import { ElMessage, stepProps } from 'element-plus'
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
import { jwtUtil } from '@/utils/jwtUtil'
import { useCheckStore } from '@/stores/modules/check'
import { ipc } from '@/utils/ipcRenderer'
const vueFlowElement = ref(442)
const checkStore = useCheckStore()
const dialogVisible = ref(false)
@@ -79,7 +80,8 @@ const onPaneReady = () => {
}
// 提取公共的label渲染函数
const createLabel = (text: string, type: string, Key: number) => {
const createLabel = (device:any, Key: number) => {
console.log('-=-=',device)
return h(
'div',
{
@@ -117,7 +119,13 @@ const createLabel = (text: string, type: string, Key: number) => {
// filter: 'invert(35%) sepia(65%) saturate(300%) hue-rotate(210deg)'
}
}),
h('div', { style: { textAlign: 'left' } }, ['设备名称:' + text, h('br'), '设备类型:' + type])
h('div', { style: { textAlign: 'left' } }, ['设备名称:' + device.name,
h('br'),
'设备类型:' + device.deviceType,
h('br'),
'Ip地址' + device.ip,
])
// h('div', null, '设备名称:' + text),
// h('div', null, '设备类型:' + type)
]
@@ -211,10 +219,10 @@ const standardDevIds = ref<string[]>()
const open = async () => {
edges.value = []
devIds.value = prop.devIdList.map(d => d.id)
standardDevIds.value = prop.pqStandardDevList.map(d => d.id)
planId.value = prop.planIdKey
nodes.value = createNodes(prop.devIdList, prop.pqStandardDevList, prop.deviceMonitor)
dialogVisible.value = true
onPaneReady()
@@ -368,9 +376,12 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
id: d.id,
name: d.name,
type: 'normal',
deviceType: d.devType
deviceType: d.devType,
ip: d.ip,
monitorResults:d.monitorResults
}))
const channelCounts2: Record<string, number> = {}
standardDev.forEach(dev => {
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
@@ -381,7 +392,8 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
id: d.id,
name: d.name,
type: 'normal',
deviceType: d.devType
deviceType: d.devType,
ip: d.ip
}))
const newNodes: any[] = []
@@ -413,6 +425,12 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
Object.entries(channelCounts).forEach(([deviceId, count]) => {
// 从deviceMonitor中获取实际通道信息
let actualChannels = []; // 存储实际的通道号
let deviceMonitorResults: number[] = []; // 存储该设备的监控结果
// 获取该设备的monitorResults
const deviceInfo = inspectionDevices.find(d => d.id === deviceId);
if (deviceInfo && deviceInfo.monitorResults) {
deviceMonitorResults = deviceInfo.monitorResults;
}
// 如果deviceMonitor中有该设备的数据则使用实际监测点信息
if (deviceMonitor.has(deviceId)) {
@@ -429,13 +447,24 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
// 遍历实际通道号而不是连续的数字
actualChannels.forEach((channelNum, index) => {
const channelId = `被检通道-${deviceId}-${channelNum}`;
const channelResult = deviceMonitorResults[index]
let statusText = '';
if (channelResult === 0) {
statusText = '(不符合)';
} else if (channelResult === 1) {
statusText = '(符合)';
} else if (channelResult === 2) {
statusText = '(未检)';
}
newNodes.push({
id: channelId,
type: 'input',
data: { label: createLabel3(`被检通道${channelNum}`) },
data: { label: createLabel3(`被检通道${channelNum}`+ statusText) },
position: { x: inputChannelX, y: yPosition + index * 50 },
sourcePosition: 'right',
style: { width: '120px', border: 'none', boxShadow: 'none' }
style: { width: '160px', border: 'none', boxShadow: 'none' }
});
deviceChannelGroups.push({
@@ -508,7 +537,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
const deviceCenterY = deviceCurrentYPosition + (actualChannelCount * 50) / 2 - 50
newNodes.push({
id: device.id,
data: { label: createLabel(device.name, device.deviceType, 1) },
data: { label: createLabel(device, 1) },
position: { x: deviceWidth, y: deviceCenterY },
class: 'no-handle-node',
style: { width: '300px', border: 'none', boxShadow: 'none' }
@@ -539,7 +568,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
const deviceCenterY = standardDeviceCurrentYPosition + (channelCount * 50) / 2 - 50
newNodes.push({
id: device.id,
data: { label: createLabel(device.name, device.deviceType, 2) },
data: { label: createLabel(device, 2) },
position: { x: standardWidth, y: deviceCenterY },
class: 'no-handle-node',
style: { width: '300px', border: 'none', boxShadow: 'none' }

View File

@@ -282,6 +282,7 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
log: '录波校验时,设备连接异常!',
});
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
@@ -291,10 +292,12 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
log: newValue.data,
})
} else if (newValue.code == 25003) { //最终失败
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
}
break;
case 'yjc_mxyzxjy':

View File

@@ -285,7 +285,7 @@ watch(testStatus, function (newValue, oldValue) {
startData.value = new Date()
timeDifference.value = 0
} else if (newValue == 'error') {
stopTimeCount()
stopTimeCount(0)
}
})
@@ -300,13 +300,14 @@ watch(
break
case 25002:
setLogList('error', newValue.data)
stopTimeCount(0)
break
case 25003:
ElMessageBox.alert('录波数据异常!', {
ElMessageBox.alert('录波数据异常!','检测失败',{
confirmButtonText: '确定',
type: 'error'
})
stopTimeCount()
stopTimeCount(0)
break
case 25001: {
// 当录波校验完成时,更新录波项目的按钮状态
@@ -345,7 +346,7 @@ watch(
}
// 触发响应式更新
checkResult.splice(0, 0)
stopTimeCount()
stopTimeCount(1)
updatePercentage()
break
}
@@ -355,13 +356,14 @@ watch(
switch (newValue.code) {
case 25002:
setLogList('error', newValue.data)
stopTimeCount(0)
break
case 25003:
ElMessageBox.alert('闪变收集失败!', {
ElMessageBox.alert('闪变收集失败!','检测失败', {
confirmButtonText: '确定',
type: 'error'
})
stopTimeCount()
stopTimeCount(0)
break
case 25001: {
// 当录波校验完成时,更新录波项目的按钮状态
@@ -394,7 +396,7 @@ watch(
}
// 触发响应式更新
checkResult.splice(0, 0)
stopTimeCount()
stopTimeCount(1)
updatePercentage()
break
}
@@ -412,18 +414,19 @@ watch(
device.chnResult.fill(CheckData.ChnCheckResultEnum.UNKNOWN)
})
}
stopTimeCount()
stopTimeCount(0)
break
}
case 'connect':
switch (newValue.operateCode) {
case 'Contrast_Dev':
setLogList('error', '设备服务端连接失败!')
stopTimeCount()
stopTimeCount(0)
break
}
break
case 'unknown_operate':
stopTimeCount(0)
break
case 'error_flow_end':
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
@@ -431,7 +434,7 @@ watch(
type: 'error'
})
setLogList('error', '当前流程存在异常结束!')
stopTimeCount()
stopTimeCount(0)
break
case 'socket_timeout':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
@@ -439,7 +442,7 @@ watch(
type: 'error'
})
setLogList('error', '设备连接异常,请检查设备连接情况!')
stopTimeCount()
stopTimeCount(0)
break
case 'server_error':
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
@@ -447,7 +450,7 @@ watch(
type: 'error'
})
setLogList('error', '服务端主动关闭连接!')
stopTimeCount()
stopTimeCount(0)
break
case 'device_error':
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
@@ -455,12 +458,12 @@ watch(
type: 'error'
})
setLogList('error', '设备主动关闭连接!')
stopTimeCount()
stopTimeCount(0)
break
case 'yjc_xyjy' :
if(newValue.code == 10550){
setLogList('error', '协议校验时,设备连接异常!')
stopTimeCount()
stopTimeCount(0)
}
if (newValue.code == 10552) {
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
@@ -468,7 +471,7 @@ watch(
type: 'error',
})
setLogList('error', '重复的初始化操作!')
stopTimeCount()
stopTimeCount(0)
}
break;
case 'yjc_sbtxjy' :
@@ -478,7 +481,7 @@ watch(
type: 'error',
})
setLogList('error', '重复的初始化操作!')
stopTimeCount()
stopTimeCount(0)
}
break;
}
@@ -509,15 +512,12 @@ watch(
// 失败
if (newValue.data != undefined) return
setLogList('error', str + '失败!')
emit('update:testStatus', 'error')
stopTimeCount()
stopTimeCount(0)
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
break
case 10550:
setLogList('error', str +'时,设备连接异常!')
emit('update:testStatus', 'error')
stopTimeCount()
stopTimeCount(0)
break
}
@@ -621,7 +621,7 @@ watch(
if (newValue.code == 25001) {
setLogList('info', '检测完成!')
stopTimeCount()
stopTimeCount(1)
updatePercentage()
}
if(newValue.code == 25005){
@@ -634,12 +634,12 @@ watch(
}
case 25003:
setLogList('error', '检测失败!')
stopTimeCount()
stopTimeCount(0)
updatePercentage()
break
case 10550:
setLogList('error', '设备连接异常!')
stopTimeCount()
stopTimeCount(0)
updatePercentage()
break
default:
@@ -682,7 +682,7 @@ const updatePercentage = async () => {
// planCode: checkStore.plan.code + ''
// })
}
stopTimeCount()
stopTimeCount(1)
ElMessageBox.alert(
'检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作',
'检测完成',
@@ -712,10 +712,14 @@ const startTimeCount = () => {
}
// 停止计时
const stopTimeCount = () => {
const stopTimeCount = (type: number) => {
if (timer) {
clearInterval(timer)
timer = null
if(type === 0){
emit('update:testStatus', 'error')
}
}
}
@@ -977,9 +981,7 @@ defineExpose({
transform: rotate(360deg);
}
}
</style>
<style lang="scss" scoped>
:deep(.el-button--small) {
height: 20px !important;
width: 20px !important;

View File

@@ -9,6 +9,7 @@
:draggable="false"
width="1400px"
>
<div class="data-check-dialog">
<div class="data-check-head">
<el-form :model="formContent" label-width="auto" class="form-three">
@@ -73,6 +74,7 @@
class="custom-tree"
ref="treeRef"
>
<template #default="{ node, data }">
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
<span
@@ -137,6 +139,9 @@
</div>
</div>
</el-dialog>
</template>
<script setup lang="ts">
import { dialogBig } from '@/utils/elementBind'
@@ -161,7 +166,7 @@ import { ResultEnum } from '@/enums/httpEnum'
import { ElMessage } from 'element-plus'
import { useDictStore } from '@/stores/modules/dict'
import { useModeStore } from '@/stores/modules/mode'
import { CircleClose, Warning, SuccessFilled } from '@element-plus/icons-vue'
const dictStore = useDictStore()
const modeStore = useModeStore()
@@ -183,6 +188,8 @@ watch(searchValue, val => {
treeRef.value!.filter(val)
})
// 格式化数字
const fixed = 4
@@ -816,6 +823,10 @@ defineExpose({
</script>
<style lang="scss" scoped>
.dialog {
display: flex;
flex-direction: column;
@@ -856,11 +867,11 @@ defineExpose({
height: 100%;
margin-top: 10px;
.custom-tree-node {
overflow-x: hidden !important;
white-space: nowrap !important;
text-overflow: ellipsis !important;
}
// .custom-tree-node {
// overflow-x: hidden !important;
// white-space: nowrap !important;
// text-overflow: ellipsis !important;
// }
}
}
@@ -904,6 +915,8 @@ defineExpose({
}
}
}
</style>
<!--<style lang="scss">-->
<!--.el-popover.popover-class {-->

View File

@@ -226,6 +226,7 @@ const open = async (
planIsOnlyWave.value = isOnlyWave
CompareTestVisible.value = false
devIdList.value = device
devIdList.value = device
pqStandardDevList.value = standardDev
planIdKey.value = fatherPlanId
deviceMonitor.value = DeviceMonitoringMap

View File

@@ -845,7 +845,7 @@ const handleTest2 = async (val: string) => {
// 检查数组长度是否为1且唯一元素是'wave_data'
const isOnlyWave = targetPlan.datasourceIds.length === 1 && targetPlan.datasourceIds[0] === 'wave_data'
deviceConnectionPopupRef.value?.open(
filteredChannelsSelection,
pqStandardDevList.value,

View File

@@ -29,7 +29,7 @@
@node-click="handleNodeClick"
>
<template #default="{ node, data }">
<span class="custom-tree-node" style="display: flex; align-items: center">
<span class="custom-tree-node" style="display: flex; align-items: center;">
<!-- 父节点图标 -->
<Platform
v-if="!data.pid"