Merge pull request 'pc-master' (#61) from pc-master into portal

Reviewed-on: #61
pull/69/head^2
xiaomeng 2023-12-02 03:19:48 +00:00
commit fe76509110
3 changed files with 264 additions and 11218 deletions

11068
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,55 @@
<template>
<div class="set-params collapse scroll">
<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 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
@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>
<div
@click="toRouter(item)"
:class="routerNow == item.router ? 'active' : ''"
class="no-list"
v-else
>
{{ item.name }}
</div>
</template>
</el-collapse>
</div>
@ -38,123 +59,153 @@ export default {
data() {
return {
routerList: [],
routerNow: 'skylight',
routerNow: "skylight",
routerIndex: 1,
purview: [], //
}
};
},
watch: {
"$route"(newName, oldName) {
$route(newName, oldName) {
this.gerRouter();
},
"$store.state.equipmentIndex"(newName, oldName) {
this.dataInit()
this.dataInit();
console.log(11);
},
},
mounted() {
this.gerRouter();
this.dataInit()
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 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` })
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` });
}
}
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: "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, },)
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 },
],
}
})
);
}
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 })
this.$router.push({ path: `/status?eqbyIndex=` + index });
},
gerRouter() {
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) {
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 == "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 })
this.$router.push({ name: item.router });
}
}
},
},
}
};
</script>
<style lang="scss" scoped>
.set-params {
width: 280px;
height: 100%;
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 {
font-size: 20px;
font-family: Microsoft YaHei;
font-weight: bold;
color: #FFFFFF;
color: #ffffff;
width: 100%;
padding-left: 20px;
display: flex;
@ -168,14 +219,13 @@ export default {
}
}
.el-collapse-item {
&.active {}
&.active {
}
}
.no-list {
color: #A8B6C8;
color: #a8b6c8;
&.active {
background: rgba(255, 255, 255, 0.1);

View File

@ -15,9 +15,9 @@
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
<div class="btn" @click="changeOpen(4)" :class="openIndex == 4 ? 'blue' : 'green'">
<!-- <div class="btn" @click="changeOpen(4)" :class="openIndex == 4 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div>
</div> -->
</div>
</div>