pull/61/head
home孙 2023-12-02 11:12:43 +08:00
parent a6fbcf1e2b
commit afbe11382c
1 changed files with 230 additions and 180 deletions

View File

@ -1,34 +1,55 @@
<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>
<div class="set-tips"> <div class="set-tips">
<!-- <div @click="toHome($store.state.equipmentIndex)"> <!-- <div @click="toHome($store.state.equipmentIndex)">
日光温室特殊参数丽水项目</div> --> 日光温室特殊参数丽水项目</div> -->
</div> </div>
<el-collapse v-model="$store.state.activeNames"> <el-collapse v-model="$store.state.activeNames">
<template v-for="item, index in routerList"> <template v-for="(item, index) in routerList">
<el-collapse-item :class="routerNow == item.router ? 'active' : ''" :name="index + 1" :key="index" <el-collapse-item
v-if="!item.isRouter"> :class="routerNow == item.router ? 'active' : ''"
:name="index + 1"
:key="index"
v-if="!item.isRouter"
>
<template slot="title" class="collapse-title"> <template slot="title" class="collapse-title">
<span class="name">{{ item.name }}</span> <span class="name">{{ item.name }}</span>
</template> </template>
<!-- --> <!-- -->
<ul class="table-ul"> <ul class="table-ul">
<li @click="toRouter(item1)" <li
:class="routerNow == item1.router && routerIndex == index1 + 1 ? 'active' : ''" class="table-li" @click="toRouter(item1)"
v-for="item1, index1 in item.list" :key="index1">{{ :class="
item1.name }} <div class="status" :class="item1.status == 0 ? 'outline' : 'online'" routerNow == item1.router && routerIndex == index1 + 1
v-if="item1.status >= 0">{{ item1.status ? 'active'
== 0 : ''
? '离线' : '在线' }}</div> "
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> </li>
</ul> </ul>
</el-collapse-item> </el-collapse-item>
<div @click="toRouter(item)" :class="routerNow == item.router ? 'active' : ''" class="no-list" v-else>{{ <div
item.name @click="toRouter(item)"
}}</div> :class="routerNow == item.router ? 'active' : ''"
class="no-list"
v-else
>
{{ item.name }}
</div>
</template> </template>
</el-collapse> </el-collapse>
</div> </div>
@ -38,123 +59,153 @@ export default {
data() { data() {
return { return {
routerList: [], routerList: [],
routerNow: 'skylight', routerNow: "skylight",
routerIndex: 1, routerIndex: 1,
purview: [],// purview: [], //
};
}
}, },
watch: { watch: {
"$route"(newName, oldName) { $route(newName, oldName) {
this.gerRouter(); this.gerRouter();
}, },
"$store.state.equipmentIndex"(newName, oldName) { "$store.state.equipmentIndex"(newName, oldName) {
this.dataInit() this.dataInit();
console.log(11); console.log(11);
}, },
}, },
mounted() { mounted() {
this.gerRouter(); this.gerRouter();
this.dataInit() this.dataInit();
}, },
methods: { methods: {
dataInit() { dataInit() {
var store = this.$store.state var store = this.$store.state;
var data = store.equipmentList[store.equipmentIndex - 1].deviceId var data = store.equipmentList[store.equipmentIndex - 1].deviceId;
this.api.getcontrol_cpermission(data).then(res => { this.api.getcontrol_cpermission(data).then((res) => {
this.routerList = [] this.routerList = [];
this.purview = res.data.data this.purview = res.data.data;
var isParamInArray = this.purview.some(obj => obj['id'] === 8);//
var isParamInArray1 = this.purview.some(obj => obj['id'] === 9);//
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) { if (isParamInArray) {
this.routerList.push({ name: '加热水泵', list: [], router: 'waterPump', isRouter: true, }, this.routerList.push(
{ name: '地热风机', list: [], router: 'geothermalFan', isRouter: true, }, { name: "加热水泵", list: [], router: "waterPump", isRouter: true },
{ name: '上风口', list: [], router: 'uptake', isRouter: true, }, {
{ name: '下风口', list: [], router: 'downtake', isRouter: true, }, name: "地热风机",
{ name: '卷被', list: [], router: 'rollByRoll', isRouter: true, }, list: [],
{ name: '除雪', list: [], router: 'snowRemoval', isRouter: true, }, router: "geothermalFan",
) isRouter: true,
if (this.routerNow != '/waterPump' },
&& this.routerNow != '/geothermalFan' { name: "上风口", list: [], router: "uptake", isRouter: true },
&& this.routerNow != '/uptake' { name: "下风口", list: [], router: "downtake", isRouter: true },
&& this.routerNow != '/downtake' { name: "卷被", list: [], router: "rollByRoll", isRouter: true },
&& this.routerNow != '/rollByRoll' { name: "除雪", list: [], router: "snowRemoval", isRouter: true }
&& this.routerNow != '/snowRemoval') { );
this.$router.push({ path: `/waterPump` }) if (
this.routerNow != "/waterPump" &&
this.routerNow != "/geothermalFan" &&
this.routerNow != "/uptake" &&
this.routerNow != "/downtake" &&
this.routerNow != "/rollByRoll" &&
this.routerNow != "/snowRemoval"
) {
this.$router.push({ path: `/waterPump` });
} }
} }
if (isParamInArray1) { if (isParamInArray1) {
this.routerList.push( this.routerList.push(
{ {
name: '日光温室特殊参数(丽水项目)', router: 'skylight', list: [ name: "日光温室特殊参数(丽水项目)",
{ name: '顶卷膜1', status: -1, router: 'skylight', index: 1 }, router: "skylight",
{ name: '顶卷膜2', status: -1, router: 'skylight', index: 2 }, list: [
{ name: '顶卷膜3', status: -1, router: 'skylight', index: 3 }, { name: "顶卷膜1", status: -1, router: "skylight", index: 1 },
{ name: '顶卷膜4', status: -1, router: 'skylight', index: 4 }, { 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: "风机(丽水项目)",
{ name: '风机1', status: -1, router: 'fan', index: 1 }, router: "fan",
{ name: '风机2', status: -1, router: 'fan', index: 2 }, list: [
{ name: '风机3', status: -1, router: 'fan', index: 3 }, { name: "风机1", status: -1, router: "fan", index: 1 },
{ name: '风机4', status: -1, router: 'fan', index: 4 }, { name: "风机2", status: -1, router: "fan", index: 2 },
{ name: '风机5', status: -1, router: 'fan', index: 5 }, { 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, },)
} }
);
}) }
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) { toHome(index) {
this.$router.push({ path: `/status?eqbyIndex=` + index }) this.$router.push({ path: `/status?eqbyIndex=` + index });
}, },
gerRouter() { gerRouter() {
this.routerNow = this.$route.name; this.routerNow = this.$route.name;
this.routerIndex = this.$route.query.id ? this.$route.query.id : 1 this.routerIndex = this.$route.query.id ? this.$route.query.id : 1;
}, },
toRouter(item) { toRouter(item) {
if (item.router) { if (item.router) {
if (item.http) { if (item.http) {
window.location.href = item.http; window.location.href = item.http;
} else if (item.router == 'skylight' && this.$route.query.id != item.index) { } else if (
this.$router.push({ path: `/skylight?id=${item.index}` }) item.router == "skylight" &&
} else if (item.router == 'fan' && this.$route.query.id != item.index) { this.$route.query.id != item.index
this.$router.push({ path: `/fan?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) { } else if (item.router != this.routerNow && !item.http) {
this.$router.push({ name: item.router });
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;
@ -168,14 +219,13 @@ export default {
} }
} }
.el-collapse-item { .el-collapse-item {
&.active {} &.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);
@ -192,7 +242,7 @@ export default {
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);