修改线流动逻辑
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="add-element">
|
<div class="add-element">
|
||||||
<el-dialog v-model="open" title="新增图元" width="500px" destroy-on-close @close="closeDialog">
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
v-model="open"
|
||||||
|
title="新增图元"
|
||||||
|
width="500px"
|
||||||
|
destroy-on-close
|
||||||
|
@close="closeDialog"
|
||||||
|
>
|
||||||
<el-form :model="element" ref="ruleFormRef" :rules="rules" label-width="120px">
|
<el-form :model="element" ref="ruleFormRef" :rules="rules" label-width="120px">
|
||||||
<el-form-item label="图元分类:" prop="elementSonType">
|
<el-form-item label="图元分类:" prop="elementSonType">
|
||||||
<el-select v-model="element.elementSonType" placeholder="请选择图元分类" style="width: 100%">
|
<el-select v-model="element.elementSonType" placeholder="请选择图元分类" style="width: 100%">
|
||||||
@@ -93,7 +100,7 @@
|
|||||||
>
|
>
|
||||||
<el-button type="primary">上传</el-button>
|
<el-button type="primary">上传</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-dialog v-model="dialogVisible">
|
<el-dialog :close-on-click-modal="false" v-model="dialogVisible">
|
||||||
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -36,7 +36,14 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 新增/修改 -->
|
<!-- 新增/修改 -->
|
||||||
<el-dialog draggable v-model="dialogFormVisible" :title="dialog_title" width="500px" destroy-on-close>
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable
|
||||||
|
v-model="dialogFormVisible"
|
||||||
|
:title="dialog_title"
|
||||||
|
width="500px"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
<el-form :model="form" ref="formRef" :rules="rules">
|
<el-form :model="form" ref="formRef" :rules="rules">
|
||||||
<el-form-item label="图纸名称" :label-width="formLabelWidth" prop="name">
|
<el-form-item label="图纸名称" :label-width="formLabelWidth" prop="name">
|
||||||
<el-input v-model="form.name" autocomplete="off" placeholder="请输入图纸名称" />
|
<el-input v-model="form.name" autocomplete="off" placeholder="请输入图纸名称" />
|
||||||
|
|||||||
@@ -64,7 +64,13 @@
|
|||||||
<div class="h-[calc(10%-1px)] flex justify-center items-center ct-border" style="padding-top: 10px">
|
<div class="h-[calc(10%-1px)] flex justify-center items-center ct-border" style="padding-top: 10px">
|
||||||
<el-button class="w-80/100" @click="onManageClick">管理</el-button>
|
<el-button class="w-80/100" @click="onManageClick">管理</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="manage_dialog_visiable" title="图库管理" width="50%" destroy-on-close>
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
v-model="manage_dialog_visiable"
|
||||||
|
title="图库管理"
|
||||||
|
width="50%"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" plain round @click="dialogVisible = true">点击编辑</el-button>
|
<el-button type="primary" plain round @click="dialogVisible = true">点击编辑</el-button>
|
||||||
<el-dialog v-model="dialogVisible" title="配置编辑" width="60%">
|
<el-dialog :close-on-click-modal="false" v-model="dialogVisible" title="配置编辑" width="60%">
|
||||||
<v-ace-editor
|
<v-ace-editor
|
||||||
v-model:value="content"
|
v-model:value="content"
|
||||||
lang="json"
|
lang="json"
|
||||||
|
|||||||
@@ -342,7 +342,6 @@ const handleSelectUID = (uid: []) => {
|
|||||||
let nodes = []
|
let nodes = []
|
||||||
if (indexRef.value) {
|
if (indexRef.value) {
|
||||||
nodes = indexRef.value.getCheckedNodes()
|
nodes = indexRef.value.getCheckedNodes()
|
||||||
console.log('🚀 ~ handleSelectUID ~ indexRef.value.getCheckedNodes():', indexRef.value.getCheckedNodes())
|
|
||||||
name = nodes[0]?.pathLabels || []
|
name = nodes[0]?.pathLabels || []
|
||||||
}
|
}
|
||||||
if (selectItemSettingProps.itemJson) {
|
if (selectItemSettingProps.itemJson) {
|
||||||
@@ -354,7 +353,6 @@ const handleSelectUID = (uid: []) => {
|
|||||||
selectItemSettingProps.itemJson.UIDName = name.join('/')
|
selectItemSettingProps.itemJson.UIDName = name.join('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (is2DArray(uid)) {
|
if (is2DArray(uid)) {
|
||||||
selectItemSettingProps.itemJson.UIDNames = name.join(' / ')
|
selectItemSettingProps.itemJson.UIDNames = name.join(' / ')
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -222,7 +222,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<el-dialog v-model="dialog_visiable" :title="dialog_title" :before-close="onDialogClose">
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
v-model="dialog_visiable"
|
||||||
|
:title="dialog_title"
|
||||||
|
:before-close="onDialogClose"
|
||||||
|
>
|
||||||
<v-ace-editor
|
<v-ace-editor
|
||||||
v-model:value="dialog_code"
|
v-model:value="dialog_code"
|
||||||
lang="javascript"
|
lang="javascript"
|
||||||
|
|||||||
@@ -72,13 +72,23 @@
|
|||||||
<footer-panel></footer-panel>
|
<footer-panel></footer-panel>
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</el-container>
|
</el-container>
|
||||||
<el-dialog v-model="import_visible" title="数据导入" @close="mainPanelRef?.beginListenerKeyDown()">
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
v-model="import_visible"
|
||||||
|
title="数据导入"
|
||||||
|
@close="mainPanelRef?.beginListenerKeyDown()"
|
||||||
|
>
|
||||||
<import-json ref="importJsonRef"></import-json>
|
<import-json ref="importJsonRef"></import-json>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button type="primary" @click="onImportYes">确定</el-button>
|
<el-button type="primary" @click="onImportYes">确定</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog v-model="export_visible" title="数据导出" @close="mainPanelRef?.beginListenerKeyDown()">
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
v-model="export_visible"
|
||||||
|
title="数据导出"
|
||||||
|
@close="mainPanelRef?.beginListenerKeyDown()"
|
||||||
|
>
|
||||||
<export-json
|
<export-json
|
||||||
:done-json="objectDeepClone(globalStore.done_json)"
|
:done-json="objectDeepClone(globalStore.done_json)"
|
||||||
:canvas-cfg="globalStore.canvasCfg"
|
:canvas-cfg="globalStore.canvasCfg"
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ const tableData = [
|
|||||||
// }
|
// }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const targetKeywords = ['开关', '器', '阀门', '控制']
|
||||||
|
|
||||||
const showDetail = ref(false)
|
const showDetail = ref(false)
|
||||||
|
|
||||||
const showDetailClick = () => {
|
const showDetailClick = () => {
|
||||||
@@ -581,7 +583,7 @@ const setImportJson = (exportJson: IExportJson) => {
|
|||||||
addClickEventsToElements()
|
addClickEventsToElements()
|
||||||
|
|
||||||
// 首页初始化的时候
|
// 首页初始化的时候
|
||||||
setTimeout(() => {
|
nextTick(() => {
|
||||||
done_json.value.forEach(item => {
|
done_json.value.forEach(item => {
|
||||||
//报警设备闪烁
|
//报警设备闪烁
|
||||||
if (findTransmissionDeviceIdsByKeyList(list.value).includes(item.id)) {
|
if (findTransmissionDeviceIdsByKeyList(list.value).includes(item.id)) {
|
||||||
@@ -644,7 +646,7 @@ const setImportJson = (exportJson: IExportJson) => {
|
|||||||
// item.props.ani_color.val = '#8c0ae2'
|
// item.props.ani_color.val = '#8c0ae2'
|
||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
}, 1000)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!useData.loading) {
|
if (!useData.loading) {
|
||||||
@@ -691,7 +693,7 @@ const findSwitchByLineEndpoint = (lineId: string): string | null => {
|
|||||||
const startId = bindAnchors.start?.id
|
const startId = bindAnchors.start?.id
|
||||||
if (startId) {
|
if (startId) {
|
||||||
const startElement = savedExportJson.value.json.find(item => item.id === 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!
|
return startElement.id!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -700,7 +702,7 @@ const findSwitchByLineEndpoint = (lineId: string): string | null => {
|
|||||||
const endId = bindAnchors.end?.id
|
const endId = bindAnchors.end?.id
|
||||||
if (endId) {
|
if (endId) {
|
||||||
const endElement = savedExportJson.value.json.find(item => item.id === 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!
|
return endElement.id!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -777,6 +779,7 @@ const handleElementClick = (elementId: string) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const bindList = ref<string[]>([])
|
||||||
const searchDevicesConnect = (transmissionDeviceIds: string[]) => {
|
const searchDevicesConnect = (transmissionDeviceIds: string[]) => {
|
||||||
// 确保 savedExportJson.value 存在
|
// 确保 savedExportJson.value 存在
|
||||||
if (!savedExportJson.value?.json) {
|
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)
|
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
|
// 存储连接线的ID
|
||||||
const connectedLineIds: string[] = []
|
const connectedLineIds: string[] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user