|
|
|
|
@ -1,18 +1,20 @@ |
|
|
|
|
<template> |
|
|
|
|
<div style="height: 100%"> |
|
|
|
|
<div class="modelBox"> |
|
|
|
|
<div class="modelBox" :style="{ |
|
|
|
|
background: background |
|
|
|
|
}"> |
|
|
|
|
<Header v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<all v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<div class="box-two"> |
|
|
|
|
<load v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<dosage v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<dosage v-if="deptName" :deptName="deptName" /> |
|
|
|
|
</div> |
|
|
|
|
<div class="box-two"> |
|
|
|
|
<equipmentLoad v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<equipmentLoad v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<equipmentStatus v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<equipmentAnalyze v-if="deptName" :deptName="deptName" /> |
|
|
|
|
<equipmentAnalyze v-if="deptName" :deptName="deptName" /> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
@ -26,15 +28,20 @@ import dosage from "./component/dosage.vue"; |
|
|
|
|
import equipmentLoad from "./component/equipmentLoad.vue"; |
|
|
|
|
import equipmentStatus from "./component/equipmentStatus.vue"; |
|
|
|
|
import equipmentAnalyze from "./component/equipmentAnalyze.vue"; |
|
|
|
|
import {getDeptTree} from "@/api/system/dept" |
|
|
|
|
import { getDeptTree } from "@/api/system/dept" |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
|
|
|
|
|
import background12 from "../../../public/img/energySources/background12.jpg" |
|
|
|
|
import background13 from "../../../public/img/energySources/background13.jpg" |
|
|
|
|
import background14 from "../../../public/img/energySources/background14.jpg" |
|
|
|
|
import background15 from "../../../public/img/energySources/background15.jpg" |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
deptId:'', |
|
|
|
|
deptName:'' |
|
|
|
|
deptId: '', |
|
|
|
|
deptName: '', |
|
|
|
|
background: '' |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
@ -46,13 +53,13 @@ export default { |
|
|
|
|
equipmentStatus, |
|
|
|
|
equipmentAnalyze, |
|
|
|
|
}, |
|
|
|
|
computed:{ |
|
|
|
|
computed: { |
|
|
|
|
...mapGetters(["userInfo", "permission"]), |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.deptId = this.$route.query.deptId ? this.$route.query.deptId : this.userInfo.dept_id |
|
|
|
|
console.log('dep ===>',this.deptId) |
|
|
|
|
this.deptId = this.$route.query.deptId ? this.$route.query.deptId : this.userInfo.dept_id |
|
|
|
|
console.log('dep ===>', this.deptId) |
|
|
|
|
this.getDept() |
|
|
|
|
this.setRemPc(); |
|
|
|
|
window.addEventListener('resize', this.setRemPc);//浏览器窗口大小改变时调用rem换算方法 |
|
|
|
|
@ -70,33 +77,49 @@ export default { |
|
|
|
|
return data; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
deptName() { |
|
|
|
|
if (this.deptName.length <= 12) { |
|
|
|
|
this.background = `url(${background12}) 0 0 / 100% 100%` |
|
|
|
|
} |
|
|
|
|
if (this.deptName.length == 13) { |
|
|
|
|
this.background = `url(${background13}) 0 0 / 100% 100%` |
|
|
|
|
} |
|
|
|
|
if (this.deptName.length == 14) { |
|
|
|
|
this.background = `url(${background14}) 0 0 / 100% 100%` |
|
|
|
|
} |
|
|
|
|
if (this.deptName.length == 15) { |
|
|
|
|
this.background = `url(${background15}) 0 0 / 100% 100%` |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getDept(id){ |
|
|
|
|
getDept(id) { |
|
|
|
|
getDeptTree().then(res => { |
|
|
|
|
this.deptName = this.getAllIds(res.data.data,'id',this.deptId) |
|
|
|
|
this.deptName = this.getAllIds(res.data.data, 'id', this.deptId) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
getAllIds(data, key, value) { |
|
|
|
|
let result = null |
|
|
|
|
let fn = function (d) { |
|
|
|
|
if (Array.isArray(d)) { |
|
|
|
|
// 判断是否是数组 |
|
|
|
|
for (let i = 0; i < d.length; i++) { |
|
|
|
|
const e = d[i] |
|
|
|
|
console.log('e ===>',e) |
|
|
|
|
let result = null |
|
|
|
|
let fn = function (d) { |
|
|
|
|
if (Array.isArray(d)) { |
|
|
|
|
// 判断是否是数组 |
|
|
|
|
for (let i = 0; i < d.length; i++) { |
|
|
|
|
const e = d[i] |
|
|
|
|
console.log('e ===>', e) |
|
|
|
|
|
|
|
|
|
if (e[key] == value) { |
|
|
|
|
// 数据循环每个子项,并且判断子项下边是否有id值 |
|
|
|
|
result = e // 返回的结果等于每一项 |
|
|
|
|
break |
|
|
|
|
} else if (e.children) { |
|
|
|
|
fn(e.children) // 递归调用下边的子项 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (e[key] == value) { |
|
|
|
|
// 数据循环每个子项,并且判断子项下边是否有id值 |
|
|
|
|
result = e // 返回的结果等于每一项 |
|
|
|
|
break |
|
|
|
|
} else if (e.children) { |
|
|
|
|
fn(e.children) // 递归调用下边的子项 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
fn(data) // 调用一下 |
|
|
|
|
return result.title |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
fn(data) // 调用一下 |
|
|
|
|
return result.title |
|
|
|
|
}, |
|
|
|
|
setRemPc() { |
|
|
|
|
/** |
|
|
|
|
@ -125,9 +148,8 @@ export default { |
|
|
|
|
height: 10.8rem; |
|
|
|
|
position: relative; |
|
|
|
|
padding: 0.96rem 0.24rem 0 0.24rem; |
|
|
|
|
background: url("../../../public/img/energySources/background2.png"); |
|
|
|
|
background-size: 100% 100%; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
|
|
.box-two { |
|
|
|
|
display: flex; |
|
|
|
|
margin-top: 0.22rem; |
|
|
|
|
|