This commit is contained in:
白菜
2025-12-12 17:38:26 +08:00
parent 9b14d96e24
commit dd4fa36597
13 changed files with 851 additions and 679 deletions

View File

@ -13,7 +13,7 @@
<div class="bottom-arrows"></div>
</div>
<div class="computer">
<img src="@/assets/images/ems/computer.png" alt="" />
<img src="@/assets/images/ems/computer.png" alt=""/>
<span style="z-index: 2; position: relative">ems</span>
</div>
</div>
@ -22,27 +22,27 @@
<div class="row-lists-container" v-if="showDb">
<div class="row-title">电表({{ db.length }})</div>
<div
class="row-lists"
v-for="outter in Math.ceil(db.length / 3)"
:key="outter + 'row'"
class="row-lists"
v-for="outter in Math.ceil(db.length / 3)"
:key="outter + 'row'"
>
<template v-for="(item, index) in handlerList('db', outter)">
<div :key="index" class="row-items">
<div
style="position: relative; z-index: 2; background-color: #fff"
style="position: relative; z-index: 2; background-color: #fff"
>
<div
class="status"
:class="
item.runningStatus === '2' ? 'status-running' : ''
class="status"
:class="
item.deviceStatus === '2' ? 'status-running' : ''
"
>
{{ deviceStatusOptions[item.runningStatus] }}
{{ deviceStatusOptions[item.deviceStatus] }}
</div>
<div class="row-items-img">
<img
class="img-db"
:src="require('@/assets/images/ems/db.png')"
class="img-db"
:src="require('@/assets/images/ems/db.png')"
/>
<div class="name">{{ item.deviceName }}</div>
</div>
@ -56,27 +56,27 @@
<div class="row-lists-container" v-if="showLq">
<div class="row-title">冷却({{ lq.length }})</div>
<div
class="row-lists"
v-for="outter in Math.ceil(lq.length / 3)"
:key="outter + 'row'"
class="row-lists"
v-for="outter in Math.ceil(lq.length / 3)"
:key="outter + 'row'"
>
<template v-for="(item, index) in handlerList('lq', outter)">
<div :key="index" class="row-items">
<div
style="position: relative; z-index: 2; background-color: #fff"
style="position: relative; z-index: 2; background-color: #fff"
>
<div
class="status"
:class="
item.runningStatus === '2' ? 'status-running' : ''
class="status"
:class="
item.deviceStatus === '2' ? 'status-running' : ''
"
>
{{ deviceStatusOptions[item.runningStatus] }}
{{ deviceStatusOptions[item.deviceStatus] }}
</div>
<div class="row-items-img">
<img
class="img-lq"
:src="require('@/assets/images/ems/lq.png')"
class="img-lq"
:src="require('@/assets/images/ems/lq.png')"
/>
<div class="name">{{ item.deviceName }}</div>
</div>
@ -88,37 +88,37 @@
<!-- 没有上级设备的bms -->
<div
class="row-lists-container"
v-if="bmsHasParentLength !== bms.length"
class="row-lists-container"
v-if="bmsHasParentLength !== bms.length"
>
<div class="row-title">BMS({{ bmsNoParent.length }})</div>
<div
class="row-lists"
v-for="outter in Math.ceil(bmsNoParent.length / 3)"
:key="outter + 'row'"
class="row-lists"
v-for="outter in Math.ceil(bmsNoParent.length / 3)"
:key="outter + 'row'"
>
<template
v-for="(item, index) in handlerList('bmsNoParent', outter)"
v-for="(item, index) in handlerList('bmsNoParent', outter)"
>
<div :key="index" class="row-items">
<div
style="position: relative; z-index: 2; background-color: #fff"
style="position: relative; z-index: 2; background-color: #fff"
>
<div
class="status"
:class="
item.runningStatus === '2' ? 'status-running' : ''
class="status"
:class="
item.deviceStatus === '2' ? 'status-running' : ''
"
>
{{ deviceStatusOptions[item.runningStatus] }}
{{ deviceStatusOptions[item.deviceStatus] }}
</div>
<div class="row-items-img row-items-img-bms">
<div style="position:relative;">
<img
class="img-bms"
:src="require('@/assets/images/ems/bms.png')"
class="img-bms"
:src="require('@/assets/images/ems/bms.png')"
/>
<div class="num">{{item.batteryNum || 0}}</div>
<div class="num">{{ item.batteryNum || 0 }}</div>
</div>
<div class="name">{{ item.deviceName }}</div>
</div>
@ -130,8 +130,8 @@
<!-- pcs -->
<div
class="row-lists-container row-lists-container-with-children"
v-if="showPcs"
class="row-lists-container row-lists-container-with-children"
v-if="showPcs"
>
<div class="row-title">
PCS({{ pcs.length }}){{
@ -139,56 +139,56 @@
}}
</div>
<div
class="row-lists"
v-for="outter in Math.ceil(pcs.length / 3)"
:key="outter + 'row'"
class="row-lists"
v-for="outter in Math.ceil(pcs.length / 3)"
:key="outter + 'row'"
>
<template v-for="(item, index) in handlerList('pcs', outter)">
<div :key="index" class="row-items">
<!-- 上级设备 -->
<div class="parent-dash">
<div
class="status"
:class="
item.runningStatus === '2' ? 'status-running' : ''
class="status"
:class="
item.deviceStatus === '2' ? 'status-running' : ''
"
>
{{ deviceStatusOptions[item.runningStatus] }}
{{ deviceStatusOptions[item.deviceStatus] }}
</div>
<div class="row-items-img">
<img
class="img-pcs"
:src="require('@/assets/images/ems/pcs.png')"
class="img-pcs"
:src="require('@/assets/images/ems/pcs.png')"
/>
<div class="name">{{ item.deviceName }}</div>
</div>
</div>
<!-- 下级设备 -->
<div
class="children-dash"
v-if="item.children && item.children.length > 0"
class="children-dash"
v-if="item.children && item.children.length > 0"
>
<div
class="status"
:class="
item.children[0].runningStatus === '2'
class="status"
:class="
item.children[0].deviceStatus === '2'
? 'status-running'
: ''
"
>
{{
deviceStatusOptions[
item.children[0].runningStatus
]
item.children[0].deviceStatus
]
}}
</div>
<div class="row-items-img row-items-img-bms">
<div style="position: relative">
<img
class="img-bms"
:src="require('@/assets/images/ems/bms.png')"
class="img-bms"
:src="require('@/assets/images/ems/bms.png')"
/>
<div class="num">{{item.batteryNum || 0}}</div>
<div class="num">{{ item.batteryNum || 0 }}</div>
</div>
<div class="name">{{ item.children[0].deviceName }}</div>
</div>
@ -204,9 +204,10 @@
</template>
<script>
import { getDeviceList } from "@/api/ems/site";
import {getDeviceList} from "@/api/ems/site";
import getQuerySiteId from "@/mixins/ems/getQuerySiteId";
import { mapState } from "vuex";
import {mapState} from "vuex";
export default {
name: "DzjkZxlt",
mixins: [getQuerySiteId],
@ -223,7 +224,7 @@ export default {
computed: {
...mapState({
deviceStatusOptions: (state) =>
state.ems.deviceStatusOptions,
state.ems.deviceStatusOptions,
}),
showPcs() {
@ -245,7 +246,7 @@ export default {
},
pcsHasChildren() {
return this.pcs.filter(
(item) => item.children && item.children.length > 0
(item) => item.children && item.children.length > 0
);
},
empty() {
@ -270,46 +271,46 @@ export default {
this.bmsNoParent = [];
this.loading = true;
getDeviceList(this.siteId)
.then((response) => {
const data = JSON.parse(JSON.stringify(response?.data || []));
let pcs = [],
bms = [],
db = [],
lq = [],
bmsNoParent = [];
data.forEach((item) => {
// 电表
if (item.deviceCategory === "AMMETER") {
db.push({ ...item, children: [] });
} else if (item.deviceCategory === "PCS") {
// pcs
pcs.push({ ...item, children: [] });
} else if (item.deviceCategory === "STACK") {
// bms
bms.push({ ...item, children: [] });
} else if (item.deviceCategory === "COOLING") {
// 液冷
lq.push({ ...item, children: [] });
}
.then((response) => {
const data = JSON.parse(JSON.stringify(response?.data || []));
let pcs = [],
bms = [],
db = [],
lq = [],
bmsNoParent = [];
data.forEach((item) => {
// 电表
if (item.deviceCategory === "AMMETER") {
db.push({...item, children: []});
} else if (item.deviceCategory === "PCS") {
// pcs
pcs.push({...item, children: []});
} else if (item.deviceCategory === "STACK") {
// bms
bms.push({...item, children: []});
} else if (item.deviceCategory === "COOLING") {
// 液冷
lq.push({...item, children: []});
}
});
bms.forEach((item, index) => {
if (item.parentId) {
pcs
.find((pcsItem) => pcsItem.deviceId === item.parentId)
.children.push(item);
} else {
bmsNoParent.push(item);
}
});
this.pcs = pcs;
this.bms = bms;
this.lq = lq;
this.db = db;
this.bmsNoParent = bmsNoParent;
})
.finally(() => {
this.loading = false;
});
bms.forEach((item, index) => {
if (item.parentId) {
pcs
.find((pcsItem) => pcsItem.deviceId === item.parentId)
.children.push(item);
} else {
bmsNoParent.push(item);
}
});
this.pcs = pcs;
this.bms = bms;
this.lq = lq;
this.db = db;
this.bmsNoParent = bmsNoParent;
})
.finally(() => {
this.loading = false;
});
},
},
};
@ -329,6 +330,7 @@ $lineColor: #86bcc7;
display: flex;
position: relative;
}
//云 、计算机 、箭头
.top {
z-index: 2;
@ -343,6 +345,7 @@ $lineColor: #86bcc7;
//云 样式
.cloud-container {
margin: 0 auto;
.cloud {
width: 60px;
height: 26px;
@ -354,6 +357,7 @@ $lineColor: #86bcc7;
font-size: 14px;
line-height: 26px;
}
.cloud:before,
.cloud:after {
content: "";
@ -363,20 +367,24 @@ $lineColor: #86bcc7;
height: 30px;
border-radius: 100%;
}
.cloud:before {
top: -9px;
left: 8px;
}
.cloud:after {
top: -6px;
right: 9px;
}
}
//双箭头
.double-arrows {
height: fit-content;
margin: 0 10px;
text-align: center;
.top-arrows,
.bottom-arrows {
height: 4px;
@ -384,6 +392,7 @@ $lineColor: #86bcc7;
background-color: #5ea9df;
margin: 0 10px;
position: relative;
&::after {
content: "";
position: absolute;
@ -392,9 +401,11 @@ $lineColor: #86bcc7;
height: 0;
}
}
.top-arrows {
vertical-align: super;
}
.top-arrows::after {
top: -4px;
border-bottom: 6px solid transparent;
@ -403,8 +414,10 @@ $lineColor: #86bcc7;
border-top: 6px solid transparent;
left: -11px;
}
.bottom-arrows {
margin-top: 8px;
&::after {
top: -4px;
border-top: 6px solid transparent;
@ -425,6 +438,7 @@ $lineColor: #86bcc7;
font-weight: bold;
position: relative;
background: #fff;
img {
width: 80px;
height: auto;
@ -432,6 +446,7 @@ $lineColor: #86bcc7;
}
}
}
.outer-border {
position: relative;
width: fit-content;
@ -448,11 +463,11 @@ $lineColor: #86bcc7;
&:not(:first-child) {
background: linear-gradient(
to top,
transparent 0%,
transparent 50%,
#ccc 50%,
#ccc 100%
to top,
transparent 0%,
transparent 50%,
#ccc 50%,
#ccc 100%
);
background-size: 1px 10px;
background-repeat: repeat-y;
@ -467,8 +482,10 @@ $lineColor: #86bcc7;
color: #000;
font-weight: bolder;
}
.row-lists {
position: relative;
.row-items {
position: relative;
padding: 5px 0;
@ -503,17 +520,21 @@ $lineColor: #86bcc7;
border-radius: 2px;
background: #aaaaaa;
color: #ffffff;
&.status-running {
background: #00c69c;
}
}
// 图片+设备名称
.row-items-img {
position: relative;
padding-top: 12px;
&.row-items-img-bms{
&.row-items-img-bms {
padding-top: 14px;
.num{
.num {
position: absolute;
top: -2px;
right: -2px;
@ -526,21 +547,26 @@ $lineColor: #86bcc7;
color: #fff;
}
}
img {
width: 80px;
height: auto;
display: block;
position: relative;
&.img-lq {
width: 50px;
}
&.img-pcs {
width: 50px;
}
&.img-db {
width: 56px;
}
}
.name {
position: absolute;
top: 1px;
@ -559,19 +585,24 @@ $lineColor: #86bcc7;
&:not(:last-child) {
margin-right: 30px;
}
.row-items {
display: flex;
&::after {
display: none;
}
.parent-dash {
position: relative;
z-index: 2;
background-color: #fff;
> div {
z-index: 2;
position: inherit;
}
&::after {
z-index: 1;
content: "";
@ -585,16 +616,19 @@ $lineColor: #86bcc7;
transform: scale(0.4, 1);
}
}
.children-dash {
position: relative;
z-index: 2;
background-color: #fff;
margin: -20px 0 0 26px;
height: fit-content;
> div {
z-index: 2;
position: inherit;
}
&::after {
z-index: 1;
content: "";