pull/127/head
孙萌 2024-03-06 11:31:40 +08:00
parent 7a684e3d73
commit 679ab7e1e5
2 changed files with 39 additions and 43 deletions

View File

@ -200,7 +200,7 @@ export function realTimeLine(id, data,pageId) {
return item.name === el1.name; return item.name === el1.name;
}); });
if (containsIndex == -1) { if (containsIndex == -1) {
dataList.push({ name: el1.name, value: [] }) dataList.push({ name: el1.name, value: [el1.value] })
} else { } else {
dataList[containsIndex].value.push(el1.value) dataList[containsIndex].value.push(el1.value)
} }
@ -568,7 +568,7 @@ export function realTimeLine1(id, data,pageId) {
return item.name === el1.name; return item.name === el1.name;
}); });
if (containsIndex == -1) { if (containsIndex == -1) {
dataList.push({ name: el1.name, value: [] }) dataList.push({ name: el1.name, value: [el1.value] })
} else { } else {
dataList[containsIndex].value.push(el1.value) dataList[containsIndex].value.push(el1.value)
} }
@ -581,7 +581,6 @@ export function realTimeLine1(id, data,pageId) {
// selList[el.name]=(index==0?true:false) // selList[el.name]=(index==0?true:false)
// }) // })
// } // }
dataList.forEach((el, index) => { dataList.forEach((el, index) => {
list.push({ list.push({
name: el.name, name: el.name,

View File

@ -4,11 +4,11 @@
<div class="header-left"> <div class="header-left">
<img src="../assets/image/logo.png" alt=""> <img src="../assets/image/logo.png" alt="">
</div> </div>
<div class="header-center"> <div class="header-center">
<div class="header-warning" v-if="statusData[1114]"> <div class="header-warning" v-if="statusData[1114]">
<img src="../assets/img/warning.gif" alt=""> <img src="../assets/img/warning.gif" alt="">
</div> </div>
<div @click="toRouter(item)" :class="item.routerList.indexOf(routerNow) != -1 ? 'active' : ''" <div @click="toRouter(item)" :class="item.routerList.indexOf(routerNow) != -1 ? 'active' : ''"
v-for="item, index in headerList" :key="index"> v-for="item, index in headerList" :key="index">
<div class="img"> <img :src="item.img" alt=""></div> <div class="img"> <img :src="item.img" alt=""></div>
@ -38,7 +38,7 @@
v-for="item1, index1 in item.list" :key="index1">{{ item1.deviceTypeName }} <div v-for="item1, index1 in item.list" :key="index1">{{ item1.deviceTypeName }} <div
class="status" :class="item1.deviceState == 0 ? 'outline' : 'online'" class="status" :class="item1.deviceState == 0 ? 'outline' : 'online'"
v-if="item1.deviceState >= 0">{{ v-if="item1.deviceState >= 0">{{
item1.deviceState == 0 ? '离线' : '在线' }}</div> item1.deviceState == 0 ? '离线' : '在线' }}</div>
</li> </li>
</ul> </ul>
</el-collapse-item> </el-collapse-item>
@ -56,6 +56,7 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getnowtime } from '../assets/js/nowTime' import { getnowtime } from '../assets/js/nowTime'
export default { export default {
@ -66,7 +67,7 @@ export default {
headerList: [ headerList: [
{ name: '实时数据', router: 'realTime', routerList: ['realTime'], img: require('../assets/image/header-img1.png') }, { name: '实时数据', router: 'realTime', routerList: ['realTime'], img: require('../assets/image/header-img1.png') },
// { name: '', router: 'status', index: 1, routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet'], img: require('../assets/image/header-img0.png') }, // { name: '', router: 'status', index: 1, routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet'], img: require('../assets/image/header-img0.png') },
{ name: '设定值参数', router: 'status', index: 1, routerList: ['status','exitSettings', 'skylight','systemSet-con', 'fan', 'upload-con', 'sensorSet-con','alarmSettings', 'synthesis-con','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/header-img0.png') }, { name: '设定值参数', router: 'formula', index: 1, routerList: ['formula', 'status', 'exitSettings', 'skylight', 'systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'alarmSettings', 'synthesis-con', '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/header-img0.png') },
{ name: '图库数据', router: '', routerList: [], img: require('../assets/image/header-img1.png') }, { name: '图库数据', router: '', routerList: [], img: require('../assets/image/header-img1.png') },
{ name: '视频监控', router: 'videoMonitoring', routerList: ['videoMonitoring'], img: require('../assets/image/header-img2.png') }, { name: '视频监控', router: 'videoMonitoring', routerList: ['videoMonitoring'], img: require('../assets/image/header-img2.png') },
// history history // history history
@ -83,12 +84,12 @@ export default {
activeNames: [3], activeNames: [3],
leftList: [ leftList: [
{ name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, }, { name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, },
{ 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: '温室', 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: '', 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: ['formula', 'dataAnalysis', '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: [] }, { 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: [] },
], ],
routerNow: 'realTime', routerNow: 'realTime',
deviceName: 1, deviceName: 1,
routerIndex: 1, routerIndex: 1,
@ -98,7 +99,7 @@ export default {
IDTimer: null, IDTimer: null,
deviceId: '', deviceId: '',
limitUserId: [], limitUserId: [],
statusData:[] statusData: []
} }
}, },
watch: { watch: {
@ -144,7 +145,7 @@ export default {
methods: { methods: {
// id // id
get_user_getjurisdiction() { get_user_getjurisdiction() {
let userInfo = localStorage.getItem("userInfo")?JSON.parse(localStorage.getItem("userInfo")):{userid:-1}; let userInfo = localStorage.getItem("userInfo") ? JSON.parse(localStorage.getItem("userInfo")) : { userid: -1 };
let userId = userInfo.userid let userId = userInfo.userid
this.api.user_getjurisdiction(userId).then(res => { this.api.user_getjurisdiction(userId).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
@ -192,9 +193,9 @@ export default {
}, },
// //
getEqbyid(selTrue) { getEqbyid(selTrue) {
var userInfo =localStorage.getItem('userInfo')? JSON.parse(localStorage.getItem('userInfo')):{userid:-1} var userInfo = localStorage.getItem('userInfo') ? JSON.parse(localStorage.getItem('userInfo')) : { userid: -1 }
var store=this.$store.state var store = this.$store.state
this.api.getEqbyid(userInfo.userid).then((res) => { this.api.getEqbyid(userInfo.userid).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$store.state.equipmentList = res.data.data.map((item, index) => { this.$store.state.equipmentList = res.data.data.map((item, index) => {
return { return {
@ -203,7 +204,7 @@ export default {
index: index + 1, index: index + 1,
}; };
}); });
if(!localStorage.getItem('equipmentSelList')){ if (!localStorage.getItem('equipmentSelList')) {
localStorage.setItem('equipmentSelList', JSON.stringify(res.data.data)) localStorage.setItem('equipmentSelList', JSON.stringify(res.data.data))
// this.$store.state.equipmentSelList=res.data.data // this.$store.state.equipmentSelList=res.data.data
} }
@ -221,13 +222,13 @@ export default {
this.leftList[index1].list.push(el) this.leftList[index1].list.push(el)
} }
}) })
} else if (el.deviceName == 10) { } else if (el.deviceName == 10) {
this.leftList.forEach((el1, index1) => { this.leftList.forEach((el1, index1) => {
if (el1.name == '温室') { if (el1.name == '温室') {
this.leftList[index1].list.push(el) this.leftList[index1].list.push(el)
} }
}) })
}else{ } else {
this.leftList.forEach((el1, index1) => { this.leftList.forEach((el1, index1) => {
if (el1.name == '生态气象站') { if (el1.name == '生态气象站') {
this.leftList[index1].list.push(el) this.leftList[index1].list.push(el)
@ -248,15 +249,15 @@ export default {
}) })
this.gerRouter() this.gerRouter()
this.getByid() this.getByid()
var data = { var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
}; };
this.api.getControlGetState(data).then(res=>{ this.api.getControlGetState(data).then(res => {
if(res.data.code==200){ if (res.data.code == 200) {
this.statusData = res.data.data; this.statusData = res.data.data;
} }
}) })
} }
}) })
}, },
@ -303,9 +304,9 @@ export default {
this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` })
} else if (item.router == 'dataAnalysis' && this.$route.query.index != item.index) { } else if (item.router == 'dataAnalysis' && this.$route.query.index != item.index) {
this.$router.push({ path: `/dataAnalysis?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/dataAnalysis` })
} else if (item.router == 'status' && (this.deviceName == '10'||this.deviceName == '30')) { } else if (item.router == 'status' && (this.deviceName == '10' || this.deviceName == '30')) {
this.$router.push({ path: `/control` }) this.$router.push({ path: `/control` })
} else if (item.router == 'realTime') { } else if (item.router == 'realTime') {
@ -343,25 +344,21 @@ export default {
if (this.routerNow == 'realTime') { if (this.routerNow == 'realTime') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}&name=${item.deviceName}` }) this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}&name=${item.deviceName}` })
} else if (this.routerNow == 'formula') {
this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` })
} else if (this.routerNow == 'history') { } else if (this.routerNow == 'history') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` })
} else if (this.routerNow == 'dataAnalysis') { } else if (this.routerNow == 'dataAnalysis') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/dataAnalysis?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/dataAnalysis?index=${item.index ? item.index : 1}` })
} else if (this.routerNow == 'historyData') { } else if (this.routerNow == 'historyData') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/historyData?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/historyData?index=${item.index ? item.index : 1}` })
} else if (item.router == 'formula') { } else if (item.router == 'formula') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index this.routerIndex = item.index
if (item.deviceName == 10||item.deviceName == 30) { if (item.deviceName == 10 || item.deviceName == 30) {
// //
if(this.routerNow!='skylight'&&this.leftList[1].routerList.indexOf(this.$route.name)!=-1){ if (this.routerNow != 'skylight' && this.leftList[1].routerList.indexOf(this.$route.name) != -1) {
return return
} }
this.$router.push({ path: `/control?change=${item.index}` }) this.$router.push({ path: `/control?change=${item.index}` })
@ -370,7 +367,7 @@ export default {
} }
} }
} else if (item.router == 'formula' && this.$route.query.index == item.index) { } else if (item.router == 'formula' && this.$route.query.index == item.index) {
return return
} 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 })
} }
@ -389,5 +386,5 @@ export default {
} }
</script> </script>
<style lang="scss"></style>
<style lang="scss"></style>