pc-master #124

Merged
xiaomeng merged 2 commits from pc-master into portal 2024-03-05 07:58:59 +00:00
3 changed files with 315 additions and 300 deletions

View File

@ -9,8 +9,8 @@
</div>
<el-collapse v-model="$store.state.activeNames">
<template v-for="(item, index) in routerList">
<el-collapse-item :class="routerNow == item.router||item.router.indexOf(routerNow)!=-1 ? 'active' : ''" :name="index + 1" :key="index"
v-if="!item.isRouter">
<el-collapse-item :class="routerNow == item.router || item.router.indexOf(routerNow) != -1 ? 'active' : ''"
:name="index + 1" :key="index" v-if="!item.isRouter">
<template slot="title" class="collapse-title">
<span class="name">{{ item.name }}</span>
</template>
@ -34,6 +34,7 @@
</el-collapse>
</div>
</template>
<script>
export default {
data() {
@ -78,47 +79,165 @@ export default {
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); //
var isParamInArray5 = this.purview.some((obj) => obj["id"] === 1); //
var isParamInArray6 = this.purview.some((obj) => obj["id"] === 3); //
var isParamInArray7 = this.purview.some((obj) => obj["id"] === 4); //
var isParamInArray8 = this.purview.some((obj) => obj["id"] === 11); //1
var isParamInArray9 = this.purview.some((obj) => obj["id"] === 12); //2
var isParamInArray10 = this.purview.some((obj) => obj["id"] === 13); //3
var isParamInArray11 = this.purview.some((obj) => obj["id"] === 14); //4
var isParamInArray12 = this.purview.some((obj) => obj["id"] === 15); //5
var isParamInArray13 = this.purview.some((obj) => obj["id"] === 16); //6
var isParamInArray14 = this.purview.some((obj) => obj["id"] === 17); //7
var isParamInArray15 = this.purview.some((obj) => obj["id"] === 18); //8
var isParamInArray16 = this.purview.some((obj) => obj["id"] === 19); //
var isParamInArray17 = this.purview.some((obj) => obj["id"] === 20); //
var isParamInArray18 = this.purview.some((obj) => obj["id"] === 21); //
var isParamInArray19 = this.purview.some((obj) => obj["id"] === 22); //
var isParamInArray20 = this.purview.some((obj) => obj["id"] === 23);//
var isParamInArray21 = this.purview.some((obj) => obj["id"] === 24);//
var isParamInArray22 = this.purview.some((obj) => obj["id"] === 25);//
var isParamInArray23 = this.purview.some((obj) => obj["id"] === 26);//湿
var isParamInArray24 = this.purview.some((obj) => obj["id"] === 2);//
var isParamInArray25 = this.purview.some((obj) => obj["id"] === 27);//
if (isParamInArray) {
this.purview.forEach((el, index) => {
if (el.id == 1) {
this.routerList.push(
{ name: "加热水泵", list: [], router: "waterPump", isRouter: true },
{
id: el.id, sort: el.sort,
name: el.nickName,
router: "targetTemperature",
list: [
{ name: "目标温度", list: [], router: "targetTemperature", isRouter: true, index: 1 },
{ name: "目标湿度", list: [], router: "targetHumidity", isRouter: true, index: 2 },
{ name: "目标CO2", list: [], router: "targetCo2", isRouter: true, index: 3 }
],
},
);
} else if (el.id == 3) {
this.routerList.push(
{
id: el.id, sort: el.sort,
name: el.nickName,
router: "alarmSettings",
list: [],
isRouter: true
},
);
} else if (el.id == 19) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '通风窗1', status: -1, router: 'sunroofControl', index: 1 },
{ name: '通风窗2', status: -1, router: 'sunroofControl', index: 2 },
{ name: '通风窗3', status: -1, router: 'sunroofControl', index: 3 },
{ name: '通风窗4', status: -1, router: 'sunroofControl', index: 4 },
], router: "sunroofControl",
});
} else if (el.id == 25) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '外遮阳1', status: -1, router: 'outsizeSunshade', index: 1 },
{ name: '外遮阳2', status: -1, router: 'outsizeSunshade', index: 2 },
], router: "outsizeSunshade",
});
} else if (el.id == 24) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '内遮阳1', status: -1, router: 'insizeSunshade', index: 1 },
{ name: '内遮阳2', status: -1, router: 'insizeSunshade', index: 2 },
], router: "insizeSunshade",
});
} else if (el.id == 27) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '内保温1', status: -1, router: 'internalInsulation', index: 1 },
{ name: '内保温2', status: -1, router: 'internalInsulation', index: 2 },
], router: "internalInsulation",
});
} else if (el.id == 26) {
this.routerList.push({
id: el.id, sort: el.sort, name: el.nickName, list: [
{ name: '风机', status: -1, router: 'wetFan', index: 1 },
{ name: '湿帘泵', status: -1, router: 'wetFan', index: 2 },
{ name: '湿帘外翻窗', status: -1, router: 'wetFan', index: 3 },
], router: "wetFan"
});
} else if (el.id == 21) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '环流风扇1', status: -1, router: 'circulationCan', index: 1 },
{ name: '环流风扇2', status: -1, router: 'circulationCan', index: 2 },
], router: "circulationCan",
});
} else if (el.id == 20) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [], router: "LED",
isRouter: true,
});
} else if (el.id == 23) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '高压微雾1', status: -1, router: 'coercionMist', index: 1 },
{ name: '高压微雾2', status: -1, router: 'coercionMist', index: 2 },
], router: "coercionMist"
});
} else if (el.id == 11 || el.id == 12 || el.id == 13 || el.id == 14 || el.id == 15 || el.id == 16 || el.id == 17 || el.id == 18) {
if (!this.routerList.some(item => item.router === "electromagneticControl")) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName,
list: [],
router: "electromagneticControl"
});
}
let targetObject = this.routerList.find(item => item.router === 'electromagneticControl');
if (el.id == 11) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 1 });
} else if (el.id == 12) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 2 });
} else if (el.id == 13) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 3 });
} else if (el.id == 14) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 4 });
} else if (el.id == 15) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 5 });
} else if (el.id == 16) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 6 });
} else if (el.id == 17) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 7 });
} else if (el.id == 18) {
targetObject.list.push({name: el.nickName, status: -1, router: 'electromagneticControl', index: 8 });
}
} else if (el.id == 5) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName,
list: [],
router: "sensorSet-con",
isRouter: true,
});
} else if (el.id == 6) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName,
list: [],
router: "synthesis-con",
isRouter: true,
});
} else if (el.id == 7) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName,
list: [],
router: "upload-con",
isRouter: true,
});
} else if (el.id == 2) {
this.routerList.push({ id: el.id, sort: el.sort, name: el.nickName, list: [], router: "forceOutput", isRouter: true });
} else if (el.id == 4) {
this.routerList.push({ id: el.id, sort: el.sort, name: el.nickName, list: [], router: "intrinsicParameter", isRouter: true });
} else if (el.id == 22) {
this.routerList.push({ name: el.nickName, list: [], router: "parameterSet", isRouter: true });
} else if (el.id == 8) {
this.routerList.push(
{ id: el.id, sort: el.sort, name: "加热水泵", list: [], router: "waterPump", isRouter: true },
{
id: el.id, sort: el.sort,
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 }
{ id: el.id, sort: el.sort, name: "上风口", list: [], router: "uptake", isRouter: true },
{ id: el.id, sort: el.sort, name: "下风口", list: [], router: "downtake", isRouter: true },
{ id: el.id, sort: el.sort, name: "卷被", list: [], router: "rollByRoll", isRouter: true },
{ id: el.id, sort: el.sort, name: "除雪", list: [], router: "snowRemoval", isRouter: true }
);
if (
this.routerNow != "/waterPump" &&
@ -163,11 +282,10 @@ export default {
});
}
}
if (isParamInArray1) {
} else if (el.id == 9) {
this.routerList.push(
{
id: el.id, sort: el.sort,
name: "日光温室特殊参数(丽水项目)",
router: "skylight",
list: [
@ -178,6 +296,7 @@ export default {
],
},
{
id: el.id, sort: el.sort,
name: "风机(丽水项目)",
router: "fan",
list: [
@ -190,171 +309,14 @@ export default {
}
);
}
if (isParamInArray2) {
this.routerList.push({
name: "传感器输入合成",
list: [],
router: "synthesis-con",
isRouter: true,
});
}
})
// this.routerList.sort((a, b) => a.sort - b.sort);
if (isParamInArray3) {
this.routerList.push({
name: "传感器通道配置",
list: [],
router: "sensorSet-con",
isRouter: true,
});
}
if (isParamInArray4) {
this.routerList.push({
name: "数据上传",
list: [],
router: "upload-con",
isRouter: true,
});
}
if (isParamInArray5) {
this.routerList.push(
{
name: "目标值",
router: "targetTemperature,targetHumidity,targetCo2",
list: [
{ name: "目标温度", list: [], router: "targetTemperature", isRouter: true, index: 1 },
{ name: "目标湿度", list: [], router: "targetHumidity", isRouter: true, index: 2 },
{ name: "目标CO2", list: [], router: "targetCo2", isRouter: true, index: 3 }
],
},
);
}
if (isParamInArray6) {
this.routerList.push(
{
name: "报警设置",
router: "alarmSettings",
list: [],
isRouter: true
},
);
}
if (isParamInArray7) {
this.routerList.push({ name: "设备固有参数", list: [], router: "intrinsicParameter", isRouter: true });
}
if (isParamInArray8 || isParamInArray9 || isParamInArray10 || isParamInArray11 || isParamInArray12 || isParamInArray13 || isParamInArray14 || isParamInArray15) {
this.routerList.push({
name: "电磁自动控制", list: [], router: "electromagneticControl"
},);
let targetObject = this.routerList.find(item => item.name === '电磁自动控制');
if (isParamInArray8) {
targetObject.list.push({ name: '1#电磁阀', status: -1, router: 'electromagneticControl', index: 1 });
}
if (isParamInArray9) {
targetObject.list.push({ name: '2#电磁阀', status: -1, router: 'electromagneticControl', index: 2 });
}
if (isParamInArray10) {
targetObject.list.push({ name: '3#电磁阀', status: -1, router: 'electromagneticControl', index: 3 });
}
if (isParamInArray11) {
targetObject.list.push({ name: '4#电磁阀', status: -1, router: 'electromagneticControl', index: 4 });
}
if (isParamInArray12) {
targetObject.list.push({ name: '5#电磁阀', status: -1, router: 'electromagneticControl', index: 5 });
}
if (isParamInArray13) {
targetObject.list.push({ name: '6#电磁阀', status: -1, router: 'electromagneticControl', index: 6 });
}
if (isParamInArray14) {
targetObject.list.push({ name: '7#电磁阀', status: -1, router: 'electromagneticControl', index: 7 });
}
if (isParamInArray15) {
targetObject.list.push({ name: '8#电磁阀', status: -1, router: 'electromagneticControl', index: 8 });
}
}
if (isParamInArray16) {
this.routerList.push({
name: "通风窗控制", list: [
{ name: '通风窗1', status: -1, router: 'sunroofControl', index: 1 },
{ name: '通风窗2', status: -1, router: 'sunroofControl', index: 2 },
{ name: '通风窗3', status: -1, router: 'sunroofControl', index: 3 },
{ name: '通风窗4', status: -1, router: 'sunroofControl', index: 4 },
], router: "sunroofControl",
});
}
if (isParamInArray17) {
this.routerList.push({
name: "补光灯", list: [], router: "LED",
isRouter: true,
});
}
if (isParamInArray18) {
this.routerList.push({
name: "环流风扇", list: [
{ name: '环流风扇1', status: -1, router: 'circulationCan', index: 1 },
{ name: '环流风扇2', status: -1, router: 'circulationCan', index: 2 },
], router: "circulationCan",
});
}
if (isParamInArray19) {
this.routerList.push({ name: "厂家内部参数配置", list: [], router: "parameterSet", isRouter: true });
}
if (isParamInArray20) {
this.routerList.push({
name: "高压微雾", list: [
{ name: '高压微雾1', status: -1, router: 'coercionMist', index: 1 },
{ name: '高压微雾2', status: -1, router: 'coercionMist', index: 2 },
], router: "coercionMist"
});
}
if (isParamInArray21) {
this.routerList.push({
name: "内遮阳控制", list: [
{ name: '内遮阳1', status: -1, router: 'insizeSunshade', index: 1 },
{ name: '内遮阳2', status: -1, router: 'insizeSunshade', index: 2 },
], router: "insizeSunshade",
});
}
if (isParamInArray22) {
this.routerList.push({
name: "外遮阳控制", list: [
{ name: '外遮阳1', status: -1, router: 'outsizeSunshade', index: 1 },
{ name: '外遮阳2', status: -1, router: 'outsizeSunshade', index: 2 },
], router: "outsizeSunshade",
});
}
if (isParamInArray23) {
this.routerList.push({ name: "风机湿帘", list: [
{ name: '风机', status: -1, router: 'wetFan', index: 1 },
{ name: '湿帘泵', status: -1, router: 'wetFan', index: 2 },
{ name: '湿帘外翻窗', status: -1, router: 'wetFan', index: 3 },
], router: "wetFan" });
}
if (isParamInArray24) {
this.routerList.push({ name: "强制输出参数", list: [], router: "forceOutput", isRouter: true });
}
if (isParamInArray25) {
this.routerList.push({
name: "内保温", list: [
{ name: '内保温1', status: -1, router: 'internalInsulation', index: 1 },
{ name: '内保温2', status: -1, router: 'internalInsulation', index: 2 },
], router: "internalInsulation",
});
}
this.routerList.push( { name: '系统参数配置', list: [], router: 'systemSet-con', isRouter: true, },);
this.routerList.push({ name: '系统参数配置', list: [], router: 'systemSet-con', isRouter: true, },);
console.log(this.routerList);
setTimeout(() => {
var router = this.$route.query
if (router.token && router.userid){
if (router.token && router.userid) {
return
}
this.$router.push({ path: `/${this.routerList[0].router}` });
@ -416,6 +378,7 @@ export default {
},
};
</script>
<style lang="scss" scoped>
.set-params {
width: 280px;
@ -476,4 +439,3 @@ export default {
}
}
</style>

View File

@ -83,7 +83,7 @@ export default {
activeNames: [3],
leftList: [
{ name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, },
{ name: '温室', routerList: ['realTime','historyData','exitSettings','videoMonitoring', 'skylight', 'control','systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con','alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img0.png'), list: [] },
{ name: '温室', routerList: ['realTime','dataAnalysis','historyData','exitSettings','videoMonitoring', 'skylight', 'control','systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con','alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img0.png'), list: [] },
// { name: '', img: require('../assets/image/left-img1.png'), list: [] },
{ name: '施肥机', routerList: ['formula','historyData', 'irrigateSet','videoMonitoring', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },
{ name: '生态气象站', routerList: ['realTime','historyData','exitSettings', 'skylight', 'control','systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con','alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img3.png'), list: [] },

View File

@ -10,11 +10,11 @@
<div class="search-right">
<span>时间段</span>
<el-date-picker v-model="value1" unlink-panels type="daterange" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期">
<el-date-picker v-model="dateRange" type="datetimerange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间">
</el-date-picker>
<div class="input-btn">
<div class="btn blue">
<div class="btn blue" @click="search">
查询
</div>
@ -28,6 +28,7 @@
</div>
</div>
</template>
<script>
import { realTimeLine } from '@/assets/js/charts'
export default {
@ -35,32 +36,84 @@ export default {
return {
value1: '',
indexs: 1,
dateRange: [],
}
},
watch:{
$route(newVal, oldVal) {
const that = this;
const store = this.$store.state
this.dataInit()
},
},
mounted() {
this.indexs = this.$route.query.index ? this.$route.query.index : 1;
this.dataInit()
},
methods: {
dataInit() {
var store = this.$store.state
var equipmentId=store.equipmentList[this.indexs - 1].deviceId
var data1 = store.equipmentList[this.indexs - 1].deviceId
getTime(time) {
//
var chinaTime = new Date(time);
this.api.postFsdata(data1).then(res => {
// UTC
var utcTime = new Date(chinaTime.getTime() - chinaTime.getTimezoneOffset() * 60000);
// UTC2024-02-17 00:00:00
var formattedTime = utcTime.toISOString().slice(0, 19).replace('T', ' ');
return formattedTime
},
search() {
this.getData()
},
timeInit() {
const start = new Date()
start.setHours(0, 0, 0, 0)
const end = new Date()
this.dateRange = [start, end]
},
dataInit() {
this.timeInit()
setTimeout(() => {
this.getData()
}, 0);
},
getData() {
var store = this.$store.state
var index = store.equipmentIndex;
var data = {
equipmentId: store.equipmentList[index - 1].deviceId,
startTime: this.getTime(this.dateRange[0]),
endTime: this.getTime(this.dateRange[1]),
page: 1,
pageSize: 999,
isEquipment: store.equipmentList[index - 1].deviceName == 30 ? 1 : 0
}
this.api.selFsTime(data).then(res => {
if (res.data.code == 200) {
var chartsData = res.data.data
var chartsData = res.data.data.data.map(item => {
return {
time: item.updateTime,
value: item.equipment.map(equipmentItem => {
return {
name: equipmentItem.environmentDataId,
value: equipmentItem.environmentData,
time: equipmentItem.updateTime
};
})
};
});
realTimeLine('realTime-line', chartsData)
} else {
this.$message.error(res.data.msg);
}
})
}
},
},
}
</script>
<style lang="scss"></style>