微调
This commit is contained in:
@@ -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' }
|
||||
|
||||
Reference in New Issue
Block a user