修改线流动逻辑
This commit is contained in:
@@ -92,6 +92,8 @@ const tableData = [
|
||||
// }
|
||||
]
|
||||
|
||||
const targetKeywords = ['开关', '器', '阀门', '控制']
|
||||
|
||||
const showDetail = ref(false)
|
||||
|
||||
const showDetailClick = () => {
|
||||
@@ -581,7 +583,7 @@ const setImportJson = (exportJson: IExportJson) => {
|
||||
addClickEventsToElements()
|
||||
|
||||
// 首页初始化的时候
|
||||
setTimeout(() => {
|
||||
nextTick(() => {
|
||||
done_json.value.forEach(item => {
|
||||
//报警设备闪烁
|
||||
if (findTransmissionDeviceIdsByKeyList(list.value).includes(item.id)) {
|
||||
@@ -644,7 +646,7 @@ const setImportJson = (exportJson: IExportJson) => {
|
||||
// item.props.ani_color.val = '#8c0ae2'
|
||||
// }
|
||||
})
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
|
||||
if (!useData.loading) {
|
||||
@@ -691,7 +693,7 @@ const findSwitchByLineEndpoint = (lineId: string): string | null => {
|
||||
const startId = bindAnchors.start?.id
|
||||
if (startId) {
|
||||
const startElement = savedExportJson.value.json.find(item => item.id === startId)
|
||||
if (startElement && startElement.title?.includes('开关')) {
|
||||
if (startElement && targetKeywords.some(keyword => startElement.title?.includes(keyword))) {
|
||||
return startElement.id!
|
||||
}
|
||||
}
|
||||
@@ -700,7 +702,7 @@ const findSwitchByLineEndpoint = (lineId: string): string | null => {
|
||||
const endId = bindAnchors.end?.id
|
||||
if (endId) {
|
||||
const endElement = savedExportJson.value.json.find(item => item.id === endId)
|
||||
if (endElement && endElement.title?.includes('开关')) {
|
||||
if (endElement && targetKeywords.some(keyword => endElement.title?.includes(keyword))) {
|
||||
return endElement.id!
|
||||
}
|
||||
}
|
||||
@@ -777,6 +779,7 @@ const handleElementClick = (elementId: string) => {
|
||||
)
|
||||
}
|
||||
}
|
||||
const bindList = ref<string[]>([])
|
||||
const searchDevicesConnect = (transmissionDeviceIds: string[]) => {
|
||||
// 确保 savedExportJson.value 存在
|
||||
if (!savedExportJson.value?.json) {
|
||||
@@ -786,9 +789,23 @@ const searchDevicesConnect = (transmissionDeviceIds: string[]) => {
|
||||
|
||||
// 查找所有连线元素
|
||||
const lineElements = savedExportJson.value.json.filter(item => item.type === 'sys-line' && item.props?.bind_anchors)
|
||||
bindList.value = [
|
||||
...new Set(
|
||||
lineElements
|
||||
.map(item => {
|
||||
return [item.props?.bind_anchors.start?.id, item.props?.bind_anchors.end?.id]
|
||||
})
|
||||
.flat()
|
||||
)
|
||||
]
|
||||
|
||||
// 查找所有开关元素
|
||||
const switchElements = savedExportJson.value.json.filter(item => item.title?.includes('开关'))
|
||||
const switchElements = savedExportJson.value.json.filter(item => targetKeywords.some(keyword =>
|
||||
item.title?.includes(keyword)
|
||||
))
|
||||
// const switchElements = savedExportJson.value.json.filter(item =>
|
||||
// bindList.value.some(keyword => item.id?.includes(keyword) && item.lineId=='')
|
||||
// )
|
||||
|
||||
// 存储连接线的ID
|
||||
const connectedLineIds: string[] = []
|
||||
|
||||
Reference in New Issue
Block a user