1 #81
|
@ -40,6 +40,7 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"$route.name"(newName, oldName) {
|
"$route.name"(newName, oldName) {
|
||||||
|
console.log(newName,oldName);
|
||||||
this.gerRouter();
|
this.gerRouter();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -62,7 +62,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','skylight', 'fan','upload-con','sensorSet-con','waterPump','geothermalFan','uptake','downtake','rollByRoll','snowRemoval'], img: require('../assets/image/header-img0.png') },
|
{ name: '设定值参数', router: 'status', index: 1, routerList: ['status', 'skylight', 'fan', 'upload-con', 'sensorSet-con', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval'], 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: '', routerList: [], img: require('../assets/image/header-img2.png') },
|
{ name: '视频监控', router: '', routerList: [], img: require('../assets/image/header-img2.png') },
|
||||||
// history history
|
// history history
|
||||||
|
@ -79,7 +79,7 @@ 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', 'skylight', 'control','fan','upload-con','sensorSet-con','synthesis-con','waterPump','geothermalFan','uptake','downtake','rollByRoll','snowRemoval'], img: require('../assets/image/left-img0.png'), list: [] },
|
{ name: '温室', routerList: ['realTime', 'skylight', 'control', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval'], 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', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },],
|
{ name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },],
|
||||||
routerNow: 'realTime',
|
routerNow: 'realTime',
|
||||||
|
@ -89,8 +89,8 @@ export default {
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
loading: true,//页面加载
|
loading: true,//页面加载
|
||||||
IDTimer: null,
|
IDTimer: null,
|
||||||
deviceId:'',
|
deviceId: '',
|
||||||
limitUserId:[]
|
limitUserId: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -103,7 +103,7 @@ export default {
|
||||||
this.getTime()
|
this.getTime()
|
||||||
var router = this.$route.query
|
var router = this.$route.query
|
||||||
if (router.token && router.userid) {
|
if (router.token && router.userid) {
|
||||||
this.deviceId=router.deviceId?router.deviceId:''
|
this.deviceId = router.deviceId ? router.deviceId : ''
|
||||||
localStorage.setItem('token', router.token)
|
localStorage.setItem('token', router.token)
|
||||||
|
|
||||||
this.api.getUser({ userId: router.userid }).then(res => {
|
this.api.getUser({ userId: router.userid }).then(res => {
|
||||||
|
@ -143,13 +143,13 @@ export default {
|
||||||
this.limitUserId = res.data.data;
|
this.limitUserId = res.data.data;
|
||||||
const foundObject = this.limitUserId.find(item => item.id == 3);
|
const foundObject = this.limitUserId.find(item => item.id == 3);
|
||||||
const foundName = this.headerList.findIndex(item => item.name == '二维码追溯');
|
const foundName = this.headerList.findIndex(item => item.name == '二维码追溯');
|
||||||
if(foundObject){
|
if (foundObject) {
|
||||||
if(foundName==-1){
|
if (foundName == -1) {
|
||||||
this.headerList.push({ name: '二维码追溯', router: 'setsuyuan', index: 1, routerList: ['setsuyuan'], img: require('../assets/image/header-img4.png') })
|
this.headerList.push({ name: '二维码追溯', router: 'setsuyuan', index: 1, routerList: ['setsuyuan'], img: require('../assets/image/header-img4.png') })
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(foundName!=-1){
|
if (foundName != -1) {
|
||||||
this.headerList.splice(foundName,1)
|
this.headerList.splice(foundName, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ export default {
|
||||||
let value2 = b[property];
|
let value2 = b[property];
|
||||||
return value1 - value2;
|
return value1 - value2;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
//获取设备
|
//获取设备
|
||||||
getEqbyid() {
|
getEqbyid() {
|
||||||
var userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
var userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||||
|
@ -198,8 +198,8 @@ export default {
|
||||||
this.leftList[2].list = []
|
this.leftList[2].list = []
|
||||||
this.$store.state.equipmentList.forEach((el, index) => {
|
this.$store.state.equipmentList.forEach((el, index) => {
|
||||||
//链接中的deviceId
|
//链接中的deviceId
|
||||||
if(this.deviceId&&this.deviceId==el.deviceId){
|
if (this.deviceId && this.deviceId == el.deviceId) {
|
||||||
this.$store.state.equipmentIndex = index+1
|
this.$store.state.equipmentIndex = index + 1
|
||||||
}
|
}
|
||||||
if (el.deviceName == 1) {
|
if (el.deviceName == 1) {
|
||||||
this.leftList.forEach((el1, index1) => {
|
this.leftList.forEach((el1, index1) => {
|
||||||
|
@ -230,12 +230,12 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
gerRouter() {
|
gerRouter() {
|
||||||
var store=this.$store.state
|
var store = this.$store.state
|
||||||
this.routerIndex = this.$route.query.index ? this.$route.query.index : store.equipmentIndex
|
this.routerIndex = this.$route.query.index ? this.$route.query.index : store.equipmentIndex
|
||||||
this.routerNow = this.$route.name;
|
this.routerNow = this.$route.name;
|
||||||
if(store.equipmentList.length){
|
if (store.equipmentList.length) {
|
||||||
this.deviceName =store.equipmentList[this.routerIndex - 1].deviceName
|
this.deviceName = store.equipmentList[this.routerIndex - 1].deviceName
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,13 +279,16 @@ export default {
|
||||||
|
|
||||||
this.$router.push({ path: `/realTime` })
|
this.$router.push({ path: `/realTime` })
|
||||||
|
|
||||||
} else if (item.router == 'status'&&item.routerList.indexOf(this.routerNow)!=-1) {
|
} else if (item.router == 'status' && item.routerList.indexOf(this.routerNow) != -1) {
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
} else if (item.router != this.routerNow && !item.http) {
|
} else if (item.router == 'largeScreen') {
|
||||||
const foundObject = this.limitUserId.find(item => item.id == 2);
|
const foundObject = this.limitUserId.find(item => item.id == 2);
|
||||||
if( !foundObject) return this.$message('您当前没有权限查看!')
|
if (!foundObject) return this.$message('您当前没有权限查看!')
|
||||||
|
|
||||||
|
} else if (item.router != this.routerNow && !item.http) {
|
||||||
|
|
||||||
this.$router.push({ name: item.router })
|
this.$router.push({ name: item.router })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -313,10 +316,10 @@ export default {
|
||||||
} 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) {
|
if (item.deviceName == 10) {
|
||||||
this.$router.push({ path: `/skylight?change=${item.index}` })
|
this.$router.push({ path: `/skylight?change=${item.index}` })
|
||||||
} else if (item.deviceName == 1&&this.routerNow!='irrigateSet') {
|
} else if (item.deviceName == 1 && this.routerNow != 'irrigateSet') {
|
||||||
this.$router.push({ path: `/irrigateSet?change=${item.index}` })
|
this.$router.push({ path: `/irrigateSet?change=${item.index}` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue