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

Reviewed-on: #81
portal
xiaomeng 2023-12-22 07:53:16 +00:00
commit 2b03b4db24
2 changed files with 49 additions and 45 deletions

View File

@ -40,6 +40,7 @@ export default {
},
watch: {
"$route.name"(newName, oldName) {
console.log(newName,oldName);
this.gerRouter();
},
},

View File

@ -62,7 +62,7 @@ export default {
headerList: [
{ 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: ['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-img2.png') },
// history history
@ -79,7 +79,7 @@ export default {
activeNames: [3],
leftList: [
{ 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: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },],
routerNow: 'realTime',
@ -89,8 +89,8 @@ export default {
userInfo: null,
loading: true,//
IDTimer: null,
deviceId:'',
limitUserId:[]
deviceId: '',
limitUserId: []
}
},
watch: {
@ -103,7 +103,7 @@ export default {
this.getTime()
var router = this.$route.query
if (router.token && router.userid) {
this.deviceId=router.deviceId?router.deviceId:''
this.deviceId = router.deviceId ? router.deviceId : ''
localStorage.setItem('token', router.token)
this.api.getUser({ userId: router.userid }).then(res => {
@ -143,13 +143,13 @@ export default {
this.limitUserId = res.data.data;
const foundObject = this.limitUserId.find(item => item.id == 3);
const foundName = this.headerList.findIndex(item => item.name == '二维码追溯');
if(foundObject){
if(foundName==-1){
if (foundObject) {
if (foundName == -1) {
this.headerList.push({ name: '二维码追溯', router: 'setsuyuan', index: 1, routerList: ['setsuyuan'], img: require('../assets/image/header-img4.png') })
}
}else{
if(foundName!=-1){
this.headerList.splice(foundName,1)
} else {
if (foundName != -1) {
this.headerList.splice(foundName, 1)
}
}
@ -181,7 +181,7 @@ export default {
let value2 = b[property];
return value1 - value2;
};
},
},
//
getEqbyid() {
var userInfo = JSON.parse(localStorage.getItem('userInfo'))
@ -198,8 +198,8 @@ export default {
this.leftList[2].list = []
this.$store.state.equipmentList.forEach((el, index) => {
//deviceId
if(this.deviceId&&this.deviceId==el.deviceId){
this.$store.state.equipmentIndex = index+1
if (this.deviceId && this.deviceId == el.deviceId) {
this.$store.state.equipmentIndex = index + 1
}
if (el.deviceName == 1) {
this.leftList.forEach((el1, index1) => {
@ -230,12 +230,12 @@ export default {
})
},
gerRouter() {
var store=this.$store.state
var store = this.$store.state
this.routerIndex = this.$route.query.index ? this.$route.query.index : store.equipmentIndex
this.routerNow = this.$route.name;
if(store.equipmentList.length){
this.deviceName =store.equipmentList[this.routerIndex - 1].deviceName
}else{
if (store.equipmentList.length) {
this.deviceName = store.equipmentList[this.routerIndex - 1].deviceName
} else {
}
@ -279,13 +279,16 @@ export default {
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
} else if (item.router != this.routerNow && !item.http) {
} else if (item.router == 'largeScreen') {
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 })
}
} else {
@ -313,10 +316,10 @@ export default {
} else if (item.router == 'formula') {
this.$store.state.equipmentIndex = item.index
this.routerIndex=item.index
this.routerIndex = item.index
if (item.deviceName == 10) {
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}` })
}
}