pull/61/head
parent
a6fbcf1e2b
commit
afbe11382c
|
@ -1,208 +1,258 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="set-params collapse scroll">
|
<div class="set-params collapse scroll">
|
||||||
<div class="set-top">
|
<div class="set-top">
|
||||||
<img src="../assets/image/set-icon.png" alt="">设定值参数
|
<img src="../assets/image/set-icon.png" alt="" />设定值参数
|
||||||
</div>
|
|
||||||
<div class="set-tips">
|
|
||||||
<!-- <div @click="toHome($store.state.equipmentIndex)">
|
|
||||||
日光温室特殊参数(丽水项目)</div> -->
|
|
||||||
</div>
|
|
||||||
<el-collapse v-model="$store.state.activeNames">
|
|
||||||
<template v-for="item, index in routerList">
|
|
||||||
<el-collapse-item :class="routerNow == item.router ? 'active' : ''" :name="index + 1" :key="index"
|
|
||||||
v-if="!item.isRouter">
|
|
||||||
<template slot="title" class="collapse-title">
|
|
||||||
<span class="name">{{ item.name }}</span>
|
|
||||||
</template>
|
|
||||||
<!-- -->
|
|
||||||
<ul class="table-ul">
|
|
||||||
<li @click="toRouter(item1)"
|
|
||||||
:class="routerNow == item1.router && routerIndex == index1 + 1 ? 'active' : ''" class="table-li"
|
|
||||||
v-for="item1, index1 in item.list" :key="index1">{{
|
|
||||||
item1.name }} <div class="status" :class="item1.status == 0 ? 'outline' : 'online'"
|
|
||||||
v-if="item1.status >= 0">{{ item1.status
|
|
||||||
== 0
|
|
||||||
? '离线' : '在线' }}</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</el-collapse-item>
|
|
||||||
<div @click="toRouter(item)" :class="routerNow == item.router ? 'active' : ''" class="no-list" v-else>{{
|
|
||||||
item.name
|
|
||||||
}}</div>
|
|
||||||
</template>
|
|
||||||
</el-collapse>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="set-tips">
|
||||||
|
<!-- <div @click="toHome($store.state.equipmentIndex)">
|
||||||
|
日光温室特殊参数(丽水项目)</div> -->
|
||||||
|
</div>
|
||||||
|
<el-collapse v-model="$store.state.activeNames">
|
||||||
|
<template v-for="(item, index) in routerList">
|
||||||
|
<el-collapse-item
|
||||||
|
:class="routerNow == item.router ? 'active' : ''"
|
||||||
|
:name="index + 1"
|
||||||
|
:key="index"
|
||||||
|
v-if="!item.isRouter"
|
||||||
|
>
|
||||||
|
<template slot="title" class="collapse-title">
|
||||||
|
<span class="name">{{ item.name }}</span>
|
||||||
|
</template>
|
||||||
|
<!-- -->
|
||||||
|
<ul class="table-ul">
|
||||||
|
<li
|
||||||
|
@click="toRouter(item1)"
|
||||||
|
:class="
|
||||||
|
routerNow == item1.router && routerIndex == index1 + 1
|
||||||
|
? 'active'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
|
class="table-li"
|
||||||
|
v-for="(item1, index1) in item.list"
|
||||||
|
:key="index1"
|
||||||
|
>
|
||||||
|
{{ item1.name }}
|
||||||
|
<div
|
||||||
|
class="status"
|
||||||
|
:class="item1.status == 0 ? 'outline' : 'online'"
|
||||||
|
v-if="item1.status >= 0"
|
||||||
|
>
|
||||||
|
{{ item1.status == 0 ? "离线" : "在线" }}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</el-collapse-item>
|
||||||
|
<div
|
||||||
|
@click="toRouter(item)"
|
||||||
|
:class="routerNow == item.router ? 'active' : ''"
|
||||||
|
class="no-list"
|
||||||
|
v-else
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-collapse>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
routerList: [],
|
routerList: [],
|
||||||
routerNow: 'skylight',
|
routerNow: "skylight",
|
||||||
routerIndex: 1,
|
routerIndex: 1,
|
||||||
purview: [],//权限数组
|
purview: [], //权限数组
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
$route(newName, oldName) {
|
||||||
|
this.gerRouter();
|
||||||
|
},
|
||||||
|
"$store.state.equipmentIndex"(newName, oldName) {
|
||||||
|
this.dataInit();
|
||||||
|
console.log(11);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.gerRouter();
|
||||||
|
this.dataInit();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
dataInit() {
|
||||||
|
var store = this.$store.state;
|
||||||
|
var data = store.equipmentList[store.equipmentIndex - 1].deviceId;
|
||||||
|
this.api.getcontrol_cpermission(data).then((res) => {
|
||||||
|
this.routerList = [];
|
||||||
|
this.purview = res.data.data;
|
||||||
|
|
||||||
|
var isParamInArray = this.purview.some((obj) => obj["id"] === 8); //五防
|
||||||
|
var isParamInArray1 = this.purview.some((obj) => obj["id"] === 9); //金华
|
||||||
|
var isParamInArray2 = this.purview.some((obj) => obj["id"] === 6); //传感器输入合成
|
||||||
|
var isParamInArray3 = this.purview.some((obj) => obj["id"] === 5); //传感器通道
|
||||||
|
var isParamInArray4 = this.purview.some((obj) => obj["id"] === 7); //数据上传
|
||||||
|
if (isParamInArray) {
|
||||||
|
this.routerList.push(
|
||||||
|
{ name: "加热水泵", list: [], router: "waterPump", isRouter: true },
|
||||||
|
{
|
||||||
|
name: "地热风机",
|
||||||
|
list: [],
|
||||||
|
router: "geothermalFan",
|
||||||
|
isRouter: true,
|
||||||
|
},
|
||||||
|
{ name: "上风口", list: [], router: "uptake", isRouter: true },
|
||||||
|
{ name: "下风口", list: [], router: "downtake", isRouter: true },
|
||||||
|
{ name: "卷被", list: [], router: "rollByRoll", isRouter: true },
|
||||||
|
{ name: "除雪", list: [], router: "snowRemoval", isRouter: true }
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
this.routerNow != "/waterPump" &&
|
||||||
|
this.routerNow != "/geothermalFan" &&
|
||||||
|
this.routerNow != "/uptake" &&
|
||||||
|
this.routerNow != "/downtake" &&
|
||||||
|
this.routerNow != "/rollByRoll" &&
|
||||||
|
this.routerNow != "/snowRemoval"
|
||||||
|
) {
|
||||||
|
this.$router.push({ path: `/waterPump` });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
"$route"(newName, oldName) {
|
|
||||||
this.gerRouter();
|
|
||||||
},
|
|
||||||
"$store.state.equipmentIndex"(newName, oldName) {
|
|
||||||
this.dataInit()
|
|
||||||
console.log(11);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.gerRouter();
|
|
||||||
this.dataInit()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
dataInit() {
|
|
||||||
var store = this.$store.state
|
|
||||||
var data = store.equipmentList[store.equipmentIndex - 1].deviceId
|
|
||||||
this.api.getcontrol_cpermission(data).then(res => {
|
|
||||||
this.routerList = []
|
|
||||||
this.purview = res.data.data
|
|
||||||
|
|
||||||
var isParamInArray = this.purview.some(obj => obj['id'] === 8);//五防
|
if (isParamInArray1) {
|
||||||
var isParamInArray1 = this.purview.some(obj => obj['id'] === 9);//金华
|
this.routerList.push(
|
||||||
|
{
|
||||||
if (isParamInArray) {
|
name: "日光温室特殊参数(丽水项目)",
|
||||||
this.routerList.push({ name: '加热水泵', list: [], router: 'waterPump', isRouter: true, },
|
router: "skylight",
|
||||||
{ name: '地热风机', list: [], router: 'geothermalFan', isRouter: true, },
|
list: [
|
||||||
{ name: '上风口', list: [], router: 'uptake', isRouter: true, },
|
{ name: "顶卷膜1", status: -1, router: "skylight", index: 1 },
|
||||||
{ name: '下风口', list: [], router: 'downtake', isRouter: true, },
|
{ name: "顶卷膜2", status: -1, router: "skylight", index: 2 },
|
||||||
{ name: '卷被', list: [], router: 'rollByRoll', isRouter: true, },
|
{ name: "顶卷膜3", status: -1, router: "skylight", index: 3 },
|
||||||
{ name: '除雪', list: [], router: 'snowRemoval', isRouter: true, },
|
{ name: "顶卷膜4", status: -1, router: "skylight", index: 4 },
|
||||||
)
|
],
|
||||||
if (this.routerNow != '/waterPump'
|
},
|
||||||
&& this.routerNow != '/geothermalFan'
|
{
|
||||||
&& this.routerNow != '/uptake'
|
name: "风机(丽水项目)",
|
||||||
&& this.routerNow != '/downtake'
|
router: "fan",
|
||||||
&& this.routerNow != '/rollByRoll'
|
list: [
|
||||||
&& this.routerNow != '/snowRemoval') {
|
{ name: "风机1", status: -1, router: "fan", index: 1 },
|
||||||
this.$router.push({ path: `/waterPump` })
|
{ name: "风机2", status: -1, router: "fan", index: 2 },
|
||||||
}
|
{ name: "风机3", status: -1, router: "fan", index: 3 },
|
||||||
|
{ name: "风机4", status: -1, router: "fan", index: 4 },
|
||||||
}
|
{ name: "风机5", status: -1, router: "fan", index: 5 },
|
||||||
|
],
|
||||||
if (isParamInArray1) {
|
|
||||||
this.routerList.push(
|
|
||||||
{
|
|
||||||
name: '日光温室特殊参数(丽水项目)', router: 'skylight', list: [
|
|
||||||
{ name: '顶卷膜1', status: -1, router: 'skylight', index: 1 },
|
|
||||||
{ name: '顶卷膜2', status: -1, router: 'skylight', index: 2 },
|
|
||||||
{ name: '顶卷膜3', status: -1, router: 'skylight', index: 3 },
|
|
||||||
{ name: '顶卷膜4', status: -1, router: 'skylight', index: 4 },
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '风机(丽水项目)', router: 'fan', list: [
|
|
||||||
{ name: '风机1', status: -1, router: 'fan', index: 1 },
|
|
||||||
{ name: '风机2', status: -1, router: 'fan', index: 2 },
|
|
||||||
{ name: '风机3', status: -1, router: 'fan', index: 3 },
|
|
||||||
{ name: '风机4', status: -1, router: 'fan', index: 4 },
|
|
||||||
{ name: '风机5', status: -1, router: 'fan', index: 5 },
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ name: '传感器输入合成', list: [], router: 'synthesis-con', isRouter: true, },
|
|
||||||
{ name: '传感器通道配置', list: [], router: 'sensorSet-con', isRouter: true, },
|
|
||||||
{ name: '数据上传', list: [], router: 'upload-con', isRouter: true, },)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
//去首页
|
|
||||||
toHome(index) {
|
|
||||||
this.$router.push({ path: `/status?eqbyIndex=` + index })
|
|
||||||
},
|
|
||||||
gerRouter() {
|
|
||||||
this.routerNow = this.$route.name;
|
|
||||||
this.routerIndex = this.$route.query.id ? this.$route.query.id : 1
|
|
||||||
},
|
|
||||||
toRouter(item) {
|
|
||||||
if (item.router) {
|
|
||||||
if (item.http) {
|
|
||||||
window.location.href = item.http;
|
|
||||||
} else if (item.router == 'skylight' && this.$route.query.id != item.index) {
|
|
||||||
this.$router.push({ path: `/skylight?id=${item.index}` })
|
|
||||||
} else if (item.router == 'fan' && this.$route.query.id != item.index) {
|
|
||||||
this.$router.push({ path: `/fan?id=${item.index}` })
|
|
||||||
} else if (item.router != this.routerNow && !item.http) {
|
|
||||||
|
|
||||||
this.$router.push({ name: item.router })
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
);
|
||||||
|
}
|
||||||
|
if (isParamInArray2) {
|
||||||
|
this.routerList.push({
|
||||||
|
name: "传感器输入合成",
|
||||||
|
list: [],
|
||||||
|
router: "synthesis-con",
|
||||||
|
isRouter: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (isParamInArray3) {
|
||||||
|
this.routerList.push({
|
||||||
|
name: "传感器通道配置",
|
||||||
|
list: [],
|
||||||
|
router: "sensorSet-con",
|
||||||
|
isRouter: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (isParamInArray4) {
|
||||||
|
this.routerList.push({
|
||||||
|
name: "数据上传",
|
||||||
|
list: [],
|
||||||
|
router: "upload-con",
|
||||||
|
isRouter: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
//去首页
|
||||||
}
|
toHome(index) {
|
||||||
|
this.$router.push({ path: `/status?eqbyIndex=` + index });
|
||||||
|
},
|
||||||
|
gerRouter() {
|
||||||
|
this.routerNow = this.$route.name;
|
||||||
|
this.routerIndex = this.$route.query.id ? this.$route.query.id : 1;
|
||||||
|
},
|
||||||
|
toRouter(item) {
|
||||||
|
if (item.router) {
|
||||||
|
if (item.http) {
|
||||||
|
window.location.href = item.http;
|
||||||
|
} else if (
|
||||||
|
item.router == "skylight" &&
|
||||||
|
this.$route.query.id != item.index
|
||||||
|
) {
|
||||||
|
this.$router.push({ path: `/skylight?id=${item.index}` });
|
||||||
|
} else if (item.router == "fan" && this.$route.query.id != item.index) {
|
||||||
|
this.$router.push({ path: `/fan?id=${item.index}` });
|
||||||
|
} else if (item.router != this.routerNow && !item.http) {
|
||||||
|
this.$router.push({ name: item.router });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.set-params {
|
.set-params {
|
||||||
width: 280px;
|
width: 280px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgba(0, 92, 178, 0.15);
|
background: rgba(0, 92, 178, 0.15);
|
||||||
border: 2px solid rgba(0, 186, 255, 0.20);
|
border: 2px solid rgba(0, 186, 255, 0.2);
|
||||||
|
|
||||||
.set-top {
|
.set-top {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-family: Microsoft YaHei;
|
font-family: Microsoft YaHei;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #FFFFFF;
|
color: #ffffff;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-collapse-item {
|
||||||
|
&.active {
|
||||||
.el-collapse-item {
|
|
||||||
&.active {}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.no-list {
|
.no-list {
|
||||||
color: #A8B6C8;
|
color: #a8b6c8;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgba(255, 255, 255, 0.1);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.set-tips {
|
.set-tips {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-bottom: 1px solid rgba(168, 182, 200, 0.2);
|
border-bottom: 1px solid rgba(168, 182, 200, 0.2);
|
||||||
margin-top: 17px;
|
margin-top: 17px;
|
||||||
padding-bottom: 17px;
|
padding-bottom: 17px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
>div {
|
> div {
|
||||||
width: 260px;
|
width: 260px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
// background: rgba(255, 255, 255, 0.1);
|
// background: rgba(255, 255, 255, 0.1);
|
||||||
// border: 1px solid rgba(255, 255, 255, 0.3);
|
// border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue