|
@@ -9,10 +9,11 @@
|
|
|
margin: 25px auto;
|
|
|
padding-bottom: 10px;
|
|
|
">{{ startTxt }}</h1>
|
|
|
- <div style="height: calc(100vh - 520px);overflow-y: auto;">
|
|
|
+ <div style="height: calc(100vh - 520px);">
|
|
|
<div style="margin-bottom: 10px;" v-for="(item, index) in curList" @click="setIndex(item, index)">
|
|
|
<span :class="index == leftIndex ? 'result' : 'anther'">{{ index + 1 }}</span>
|
|
|
- <span :class="index == leftIndex ? 'results' : 'anthers'">{{ item.fcda_name }}</span>
|
|
|
+ <span :class="index == leftIndex ? 'results' : 'anthers'" :id="item.id">{{ item.fcda_name
|
|
|
+ }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -27,30 +28,21 @@
|
|
|
margin: 25px auto;
|
|
|
padding-bottom: 10px;
|
|
|
">{{ endTxt }}</h1>
|
|
|
- <div style="height: calc(100vh - 520px);overflow-y: auto;">
|
|
|
- <!-- <div style="margin-bottom: 10px;" v-for="(item, index) in outList">
|
|
|
- <div
|
|
|
- style="width: 80%;display: flex;justify-content: space-around;align-items: center;margin: 0 auto;">
|
|
|
- <span style="display: block;border: 1px solid #2B5AE5;width: 42px;height: 42px;"
|
|
|
- @click="toggleVisibility(index)">
|
|
|
- <svg v-show="isVisible(item)" t="1704938867254" class="icon" viewBox="0 0 1024 1024"
|
|
|
- version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4269" width="40" height="40">
|
|
|
- <path
|
|
|
- d="M392.533333 806.4L85.333333 503.466667l59.733334-59.733334 247.466666 247.466667L866.133333 213.333333l59.733334 59.733334L392.533333 806.4z"
|
|
|
- fill="#2B5AE5" p-id="4270"></path>
|
|
|
- </svg>
|
|
|
- </span>
|
|
|
- <span style="display: block;" :class="getClass(index)">{{ item.fcda_name
|
|
|
- }}</span>
|
|
|
- </div>
|
|
|
+ <div style="height: calc(100vh - 520px);">
|
|
|
+ <div v-for="(item, index) in outList" :id="item.id">
|
|
|
+ <el-checkbox-group v-model="checkList" @change="checkChange">
|
|
|
+ <el-checkbox :label="item.id" :key="item.id">
|
|
|
+ {{ item.fcda_name }}
|
|
|
+ </el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </div>
|
|
|
+ <!-- <div style="margin-bottom: 10px;" v-for="(item, index) in outList" @click="setIndex(item, index)" :id="item.id">
|
|
|
+ <span class="result">{{ index + 1 }}</span>
|
|
|
+ <span class="results">{{ item.fcda_name }}</span>
|
|
|
</div> -->
|
|
|
- <el-checkbox-group v-model="checkList" @change="checkChange">
|
|
|
- <el-checkbox v-for="(item, index) in outList" :label="item.id" :key="item.id">
|
|
|
- {{ item.fcda_name }}
|
|
|
- </el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div id="wrapper"></div>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
@@ -59,13 +51,15 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { ref, onMounted, watch, toRefs, computed } from 'vue';
|
|
|
+import { ref, onMounted, watch, toRefs, computed, onBeforeUnmount } from 'vue';
|
|
|
import flow from '@/api/flow/flow';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
+import LeaderLine from "../../../../public/leader-line.min.js";
|
|
|
export default {
|
|
|
props: {
|
|
|
ldModal: {
|
|
@@ -121,6 +115,7 @@ export default {
|
|
|
let arrNew = ref([])//新的存储fdcdids
|
|
|
let gv = ref('')
|
|
|
let pastLoading = ref(false)
|
|
|
+ let leaderLineList = ref([])//组件leader-line数据,以方便离开组件时清除画线
|
|
|
watch(() => props.modelId, (newVal) => {
|
|
|
modelIds.value = newVal
|
|
|
})
|
|
@@ -149,6 +144,8 @@ export default {
|
|
|
await flow.getModelAndIed({
|
|
|
model_id: modelIds.value - 0,
|
|
|
ied_type: starts.value.ied_type,
|
|
|
+ sv_or_goose: gv.value,
|
|
|
+ in_or_out: "输出"
|
|
|
}).then(res => {
|
|
|
if (res.code == 0) {
|
|
|
curList.value = res.data
|
|
@@ -162,9 +159,31 @@ export default {
|
|
|
await flow.getModelAndIed({
|
|
|
model_id: modelIds.value - 0,
|
|
|
ied_type: ends.value.ied_type,
|
|
|
+ sv_or_goose: gv.value,
|
|
|
+ in_or_out: "接收"
|
|
|
}).then(res => {
|
|
|
if (res.code == 0) {
|
|
|
outList.value = res.data
|
|
|
+ setTimeout(() => {
|
|
|
+ res.data.map((item, index) => {
|
|
|
+ let line = {
|
|
|
+ start: item.from_fcda_id,
|
|
|
+ ending: item.id
|
|
|
+ }
|
|
|
+ let starts = document.getElementById(line.start)
|
|
|
+ let ends = document.getElementById(line.ending)
|
|
|
+ leaderLineList.value.push(new LeaderLine(starts, ends, {
|
|
|
+ color: "black",//连接线颜色
|
|
|
+ size: 2,//连接线宽度
|
|
|
+ path: "straight",//连接线样式
|
|
|
+ startSocket: "right",//开始链接元素位置
|
|
|
+ endSocket: "left",//结束链接元素位置
|
|
|
+ endPlug: 'arrow3',//结束箭头
|
|
|
+ endPlugSize: 2,//结束箭头size
|
|
|
+ }))
|
|
|
+ hiddenLine()
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
} else {
|
|
|
ElMessage({
|
|
|
message: res.msg,
|
|
@@ -175,6 +194,7 @@ export default {
|
|
|
}
|
|
|
// 关闭模态框
|
|
|
function closeModal() {
|
|
|
+ removeLine3()
|
|
|
dialogVisible.value = false
|
|
|
emit("lineBack", dialogVisible.value)
|
|
|
}
|
|
@@ -197,6 +217,7 @@ export default {
|
|
|
message: "关联成功!"
|
|
|
})
|
|
|
dialogVisible.value = false
|
|
|
+ removeLine3()
|
|
|
emit("lineBack", dialogVisible.value)
|
|
|
} else {
|
|
|
ElMessage({
|
|
@@ -274,48 +295,86 @@ export default {
|
|
|
loading.value = false
|
|
|
}
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ElMessage({
|
|
|
- type:"info",
|
|
|
- message:"您还没有配置装置"
|
|
|
+ type: "info",
|
|
|
+ message: "您还没有配置装置"
|
|
|
})
|
|
|
loading.value = false
|
|
|
}
|
|
|
}
|
|
|
+ // 循环curList获取应该链接的元素
|
|
|
+ // for (let index = 0; index < curList.value.length; index++) {
|
|
|
+ // flow.getModelOn({
|
|
|
+ // model_id: modelIds.value - 0,
|
|
|
+ // from_fcda_id: curList.value[index].id - 0
|
|
|
+ // }).then(res => {
|
|
|
+ // if (res.data != null) {
|
|
|
+ // // 连线出发元素
|
|
|
+ // let startCire = res.data[0].from_fcda_id
|
|
|
+ // // 获取连线开始元素节点
|
|
|
+ // let startTime = document.getElementById(startCire)
|
|
|
+ // // 连线结束元素
|
|
|
+ // let endCire = res.data.map(item => {
|
|
|
+ // return item.to_fcda_id
|
|
|
+ // })
|
|
|
+ // // 获取连接结束元素节点
|
|
|
+ // const divElements = endCire.map(id => document.getElementById(id))
|
|
|
+ // if (divElements.length > 1) {
|
|
|
+ // divElements.map((item, index) => {
|
|
|
+ // leaderLineList.value.push(new LeaderLine(startTime, divElements[index], {
|
|
|
+ // color: "black",//连接线颜色
|
|
|
+ // size: 2,//连接线宽度
|
|
|
+ // path: "straight",//连接线样式
|
|
|
+ // startSocket: "right",//开始链接元素位置
|
|
|
+ // endSocket: "left",//结束链接元素位置
|
|
|
+ // endPlug: 'arrow3',//结束箭头
|
|
|
+ // endPlugSize: 2,//结束箭头size
|
|
|
+ // }))
|
|
|
+ // hiddenLine()
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
}
|
|
|
- // function isVisible(item) {
|
|
|
- // if (together.value.length > 0) {
|
|
|
- // loading.value = false
|
|
|
- // return together.value.some((togetherItem) => togetherItem.to_fcda_id === item.id);
|
|
|
- // }
|
|
|
- // };
|
|
|
- // // 设置多选span的class
|
|
|
- // function getClass(index) {
|
|
|
- // const item = outList.value[index];
|
|
|
- // return visibleItems.value.includes(item) ? 'results' : 'anthers';
|
|
|
- // }
|
|
|
- // // 获取fcda_ids
|
|
|
- // function toggleVisibility(index) {
|
|
|
- // const item = outList.value[index];
|
|
|
- // const itemIndex = visibleItems.value.findIndex((i) => i === item);
|
|
|
- // if (itemIndex === -1) {
|
|
|
- // visibleItems.value.push(item);
|
|
|
- // } else {
|
|
|
- // visibleItems.value.splice(itemIndex, 1);
|
|
|
- // }
|
|
|
- // fcdaIds.value = visibleItems.value.map((item, index) => {
|
|
|
- // return item.id
|
|
|
- // }).join(",")
|
|
|
- // };
|
|
|
function checkChange(e) {
|
|
|
fcdaIds.value = e.join(",")
|
|
|
}
|
|
|
+ //弹窗打开后使得线条在指定区域中
|
|
|
+ function hiddenLine() {
|
|
|
+ const elmWrapper = document.getElementById("wrapper");
|
|
|
+ // 移动 line
|
|
|
+ document.body.querySelectorAll("body .leader-line").forEach((node) => {
|
|
|
+ elmWrapper.appendChild(node);
|
|
|
+ });
|
|
|
+ elmWrapper.style.transform = "none";
|
|
|
+ var rectWrapper = elmWrapper.getBoundingClientRect();
|
|
|
+ // Move to the origin of coordinates as the document
|
|
|
+ elmWrapper.style.transform = `translate(${(rectWrapper.left + window.scrollY) * -1
|
|
|
+ }px, ${(rectWrapper.top + window.scrollX) * -1}px)`;
|
|
|
+ };
|
|
|
+ // 稳定leader-line函数
|
|
|
+ function removeLine3() {
|
|
|
+ leaderLineList.value = [];
|
|
|
+ const elmWrapper = document.getElementById("wrapper");
|
|
|
+ if (elmWrapper) {
|
|
|
+ document.body.querySelectorAll("#wrapper .leader-line").forEach((node) => {
|
|
|
+ elmWrapper.removeChild(node);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
onMounted(async () => {
|
|
|
await reload()
|
|
|
pastLoading.value = true
|
|
|
setIndex()
|
|
|
pastLoading.value = false
|
|
|
})
|
|
|
+ onBeforeUnmount(() => {
|
|
|
+ leaderLineList.value.forEach(line => line.remove());//离开当前组件时清除连线
|
|
|
+ removeLine3()
|
|
|
+ })
|
|
|
return {
|
|
|
dialogVisible,//模态框开关
|
|
|
reload,//初始化函数
|
|
@@ -347,6 +406,9 @@ export default {
|
|
|
arrNew,//新的存储ids
|
|
|
gv,
|
|
|
pastLoading,//maxbox加载动画
|
|
|
+ leaderLineList,//组件库leader-line数据,以方便离开组件时清除画线
|
|
|
+ hiddenLine,//使leader-line显示在模态框内
|
|
|
+ removeLine3,// 稳定leader-line函数
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -360,11 +422,12 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: space-around;
|
|
|
align-items: center;
|
|
|
+ overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
.leftBox {
|
|
|
width: 33%;
|
|
|
- height: calc(100vh - 420px);
|
|
|
+ /* height: calc(100vh - 420px); */
|
|
|
text-align: center;
|
|
|
background-color: #F7F8FB;
|
|
|
border: 2px dashed #A3ADE0;
|
|
@@ -381,7 +444,7 @@ export default {
|
|
|
|
|
|
.rightBox {
|
|
|
width: 33%;
|
|
|
- height: calc(100vh - 420px);
|
|
|
+ /* height: calc(100vh - 420px); */
|
|
|
text-align: center;
|
|
|
background-color: #EDF3FF;
|
|
|
border: 2px dashed #A3ADE0;
|
|
@@ -476,4 +539,15 @@ export default {
|
|
|
line-height: 42px !important;
|
|
|
text-align: center;
|
|
|
}
|
|
|
+
|
|
|
+.leader-line {
|
|
|
+ z-index: 3000;
|
|
|
+}
|
|
|
+
|
|
|
+#wrapper {
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ position: relative;
|
|
|
+ /* Origin of coordinates for lines, and scrolled content (i.e. not `absolute`) */
|
|
|
+}
|
|
|
</style>
|