|
@@ -0,0 +1,344 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-dialog v-model="dialogVisible" title="装置端子关系配置" width="60%" @close="handleClose">
|
|
|
+ <div class="masBox">
|
|
|
+ <div class="leftBox">
|
|
|
+ <h1 style="
|
|
|
+ border-bottom: 1px solid #7484AB;
|
|
|
+ width: 73%;
|
|
|
+ margin: 25px auto;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ ">{{ startTxt }}</h1>
|
|
|
+ <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>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="middleBox">
|
|
|
+ <p class="background" :style="{ 'background-image': `url(${setBackground})`, 'color': setColor }">{{
|
|
|
+ setGooseOrSv }}</p>
|
|
|
+ </div>
|
|
|
+ <div class="rightBox">
|
|
|
+ <h1 style="
|
|
|
+ border-bottom: 1px solid #7484AB;
|
|
|
+ width: 73%;
|
|
|
+ margin: 25px auto;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ ">{{ endTxt }}</h1>
|
|
|
+ <div>
|
|
|
+ <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="visibleItems.includes(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>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="cancels">取消</el-button>
|
|
|
+ <el-button type="primary" @click="sureClick">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { ref, onMounted, watch, toRefs, computed } from 'vue';
|
|
|
+import flow from '@/api/flow/flow';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ ldModal: {
|
|
|
+ type: Boolean,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ startTarget: {
|
|
|
+ type: Object,
|
|
|
+ required: true
|
|
|
+ },//开始数据
|
|
|
+ endTarget: {
|
|
|
+ type: Object,
|
|
|
+ required: true,
|
|
|
+ },//结尾数据
|
|
|
+ modelId: {
|
|
|
+ type: String,
|
|
|
+ required: true,
|
|
|
+ },//模型id
|
|
|
+ numCase: {
|
|
|
+ type: Number,
|
|
|
+ required: true
|
|
|
+ },//用于判断goose还是sv,0为sv,1为goose
|
|
|
+ startText: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ },//开始节点文本
|
|
|
+ endText: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ },//结束文本
|
|
|
+ },
|
|
|
+ setup(props, { emit }) {
|
|
|
+ let dialogVisible = ref(false)//模态框开关
|
|
|
+ let starts = ref({})//开始装置数据
|
|
|
+ let ends = ref({})//结束装置数据
|
|
|
+ let modelIds = ref("")//本组件的模型id
|
|
|
+ let startTxt = ref("")//本组件开始文本
|
|
|
+ let endTxt = ref("")//本组件结束文本
|
|
|
+ let curList = ref([])//箭头开始list
|
|
|
+ let outList = ref([])//箭头结束list
|
|
|
+ let numStatus = ref(0)//判断goose还是sv
|
|
|
+ let visibleItems = ref([])//选择的数组
|
|
|
+ let fcdaIds = ref("")//需要的fcda_ids
|
|
|
+ let leftIndex = ref(0)//左侧选择的输出下标
|
|
|
+ let leftFcda = ref("")//左侧的fcdaid
|
|
|
+ watch(() => props.modelId, (newVal) => {
|
|
|
+ modelIds.value = newVal
|
|
|
+ })
|
|
|
+ watch(() => props.startText, (newVal) => {
|
|
|
+ startTxt.value = newVal
|
|
|
+ })
|
|
|
+ watch(() => props.endText, (newVal) => {
|
|
|
+ endTxt.value = newVal
|
|
|
+ })
|
|
|
+ watch(() => props.numCase, (newVal) => {
|
|
|
+ numStatus.value = newVal
|
|
|
+ })
|
|
|
+ // 初始化函数
|
|
|
+ function reload() {
|
|
|
+ dialogVisible.value = props.ldModal
|
|
|
+ modelIds.value = props.modelId
|
|
|
+ starts.value = props.startTarget
|
|
|
+ ends.value = props.endTarget
|
|
|
+ startTxt.value = props.startText
|
|
|
+ endTxt.value = props.endText
|
|
|
+ numStatus.value = props.numCase
|
|
|
+ flow.getModelAndIed({
|
|
|
+ model_id: modelIds.value - 0,
|
|
|
+ ied_type: starts.value.ied_type,
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 0){
|
|
|
+ curList.value = res.data
|
|
|
+ }else{
|
|
|
+ ElMessage({
|
|
|
+ message:res.msg,
|
|
|
+ type:"error"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ flow.getModelAndIed({
|
|
|
+ model_id: modelIds.value - 0,
|
|
|
+ ied_type: ends.value.ied_type,
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 0){
|
|
|
+ outList.value = res.data
|
|
|
+ }else{
|
|
|
+ ElMessage({
|
|
|
+ message:res.msg,
|
|
|
+ type:"error"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 关闭模态框
|
|
|
+ function closeModal() {
|
|
|
+ dialogVisible.value = false
|
|
|
+ emit("lineBack", dialogVisible.value)
|
|
|
+ }
|
|
|
+ // 确认关闭模态框
|
|
|
+ function sureClose() {
|
|
|
+ flow.saveModelOn({
|
|
|
+ model_id: modelIds.value - 0,
|
|
|
+ from_ied_type: starts.value.ied_type,
|
|
|
+ to_ied_type: ends.value.ied_type,
|
|
|
+ from_fcda_id: leftFcda.value - 0,
|
|
|
+ to_fcda_ids: fcdaIds.value,
|
|
|
+ goosesv: setGooseOrSv.value,
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res, '设置');
|
|
|
+ })
|
|
|
+ dialogVisible.value = false
|
|
|
+ emit("lineBack", dialogVisible.value)
|
|
|
+ }
|
|
|
+ // 返回goose还是sv
|
|
|
+ const setGooseOrSv = computed(() => {
|
|
|
+ if (numStatus.value == 0) {
|
|
|
+ return "SV"
|
|
|
+ } else if (numStatus.value == 1) {
|
|
|
+ return "GOOSE"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 返回图片
|
|
|
+ const setBackground = computed(() => {
|
|
|
+ if (numStatus.value == 0) {
|
|
|
+ return require("../../../assets/image/sv_orange.png")
|
|
|
+ } else if (numStatus.value == 1) {
|
|
|
+ return require("../../../assets/image/goose_blue.png")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 返回文字颜色
|
|
|
+ const setColor = computed(() => {
|
|
|
+ if (numStatus.value == 0) {
|
|
|
+ return 'orange'
|
|
|
+ } else if (numStatus.value == 1) {
|
|
|
+ return 'blue'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 获取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 setIndex(row, num) {
|
|
|
+ leftFcda.value = row.id
|
|
|
+ leftIndex.value = num
|
|
|
+ }
|
|
|
+ // 设置多选span的class
|
|
|
+ function getClass(index) {
|
|
|
+ const item = outList.value[index];
|
|
|
+ return visibleItems.value.includes(item) ? 'results' : 'anthers';
|
|
|
+ }
|
|
|
+ onMounted(() => {
|
|
|
+ reload()
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ dialogVisible,//模态框开关
|
|
|
+ reload,//初始化函数
|
|
|
+ starts,//开始节点数据
|
|
|
+ ends,//结束节点数据
|
|
|
+ handleClose: closeModal,//关闭模态框
|
|
|
+ cancels: closeModal,//关闭模态框
|
|
|
+ sureClick: sureClose,//确认关闭模态框
|
|
|
+ modelIds,//本组件的模型id
|
|
|
+ startTxt,//本组件开始文本
|
|
|
+ endTxt,//本组件结束文本
|
|
|
+ curList,//渲染list
|
|
|
+ setGooseOrSv,//判断显示goose还是sv
|
|
|
+ setBackground,//判断显示背景图
|
|
|
+ setColor,//判断文字颜色
|
|
|
+ visibleItems,//选择的数组
|
|
|
+ toggleVisibility,//模拟多选框方法
|
|
|
+ fcdaIds,//需要的fcda_ids
|
|
|
+ leftIndex,//左侧下标选择
|
|
|
+ setIndex,//下标选择函数
|
|
|
+ getClass,//设置多选span的class函数
|
|
|
+ leftFcda,//左侧单选的fcdaid
|
|
|
+ outList,//箭头指向端list
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.masBox {
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100vh - 400px);
|
|
|
+ /* border: 1px solid red; */
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.leftBox {
|
|
|
+ width: 33%;
|
|
|
+ height: calc(100vh - 420px);
|
|
|
+ text-align: center;
|
|
|
+ background-color: #F7F8FB;
|
|
|
+ border: 2px dashed #A3ADE0;
|
|
|
+}
|
|
|
+
|
|
|
+.middleBox {
|
|
|
+ width: 32%;
|
|
|
+ height: calc(100vh - 420px);
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.rightBox {
|
|
|
+ width: 33%;
|
|
|
+ height: calc(100vh - 420px);
|
|
|
+ text-align: center;
|
|
|
+ background-color: #EDF3FF;
|
|
|
+ border: 2px dashed #A3ADE0;
|
|
|
+}
|
|
|
+
|
|
|
+.result {
|
|
|
+ display: inline-block;
|
|
|
+ width: 11%;
|
|
|
+ height: 40px;
|
|
|
+ border: 1px solid blue;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 40px;
|
|
|
+ background-color: #D9E6FE;
|
|
|
+ color: blue;
|
|
|
+ margin-right: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.anther {
|
|
|
+ display: inline-block;
|
|
|
+ width: 11%;
|
|
|
+ height: 40px;
|
|
|
+ border: 1px solid black;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 40px;
|
|
|
+ background-color: #F5FAFE;
|
|
|
+ color: black;
|
|
|
+ margin-right: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.results {
|
|
|
+ display: inline-block;
|
|
|
+ width: 55%;
|
|
|
+ height: 40px;
|
|
|
+ border: 1px solid blue;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 40px;
|
|
|
+ background-color: #D9E6FE;
|
|
|
+ color: blue;
|
|
|
+}
|
|
|
+
|
|
|
+.anthers {
|
|
|
+ display: inline-block;
|
|
|
+ width: 55%;
|
|
|
+ height: 40px;
|
|
|
+ border: 1px solid black;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 40px;
|
|
|
+ background-color: #F5FAFE;
|
|
|
+ color: black;
|
|
|
+}
|
|
|
+
|
|
|
+.background {
|
|
|
+ width: 90%;
|
|
|
+ height: calc(100vh - 850px);
|
|
|
+ /* background-position: 100%; */
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100%;
|
|
|
+ text-align: center;
|
|
|
+ background-position: 100% 50%;
|
|
|
+ line-height: calc(100vh - 850px);
|
|
|
+}
|
|
|
+</style>
|