pull/81/head
parent
882eefb00e
commit
3fd7594de0
|
@ -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
|
||||||
|
@ -72,14 +72,14 @@ export default {
|
||||||
{ name: '设备菜单', router: '', routerList: [], img: require('../assets/image/header-img5.png') },
|
{ name: '设备菜单', router: '', routerList: [], img: require('../assets/image/header-img5.png') },
|
||||||
//systemManage systemManage
|
//systemManage systemManage
|
||||||
{ name: '管理', router: '', routerList: [''], img: require('../assets/image/header-img6.png') },
|
{ name: '管理', router: '', routerList: [''], img: require('../assets/image/header-img6.png') },
|
||||||
|
|
||||||
{ name: '大数据', router: 'largeScreen', routerList: ['largeScreen'], img: require('../assets/image/header-img8.png') }
|
{ name: '大数据', router: 'largeScreen', routerList: ['largeScreen'], img: require('../assets/image/header-img8.png') }
|
||||||
],
|
],
|
||||||
|
|
||||||
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 => {
|
||||||
|
@ -137,22 +137,22 @@ export default {
|
||||||
// 获取用户id权限
|
// 获取用户id权限
|
||||||
get_user_getjurisdiction() {
|
get_user_getjurisdiction() {
|
||||||
let userInfo = JSON.parse(localStorage.getItem("userInfo"));
|
let userInfo = JSON.parse(localStorage.getItem("userInfo"));
|
||||||
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) {
|
||||||
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -176,12 +176,12 @@ export default {
|
||||||
},
|
},
|
||||||
//排序
|
//排序
|
||||||
compare(property) {
|
compare(property) {
|
||||||
return function (a, b) {
|
return function (a, b) {
|
||||||
let value1 = a[property];
|
let value1 = a[property];
|
||||||
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) => {
|
||||||
|
@ -216,12 +216,12 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.leftList.forEach((el1, index1) => {
|
this.leftList.forEach((el1, index1) => {
|
||||||
if (el1.name == '温室') {
|
if (el1.name == '温室') {
|
||||||
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
|
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
|
||||||
}
|
}
|
||||||
if (el1.name == '施肥机') {
|
if (el1.name == '施肥机') {
|
||||||
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
|
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.gerRouter()
|
this.gerRouter()
|
||||||
this.getByid()
|
this.getByid()
|
||||||
|
@ -230,15 +230,15 @@ 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 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
loginOut() {
|
loginOut() {
|
||||||
this.api.loginOut().then((res) => {
|
this.api.loginOut().then((res) => {
|
||||||
|
@ -276,16 +276,19 @@ export default {
|
||||||
} else if (this.routerNow == 'realTime' && item.router == 'status' && this.deviceName == '10') {
|
} else if (this.routerNow == 'realTime' && item.router == 'status' && this.deviceName == '10') {
|
||||||
this.$router.push({ path: `/control` })
|
this.$router.push({ path: `/control` })
|
||||||
} else if (item.router == 'realTime') {
|
} else if (item.router == 'realTime') {
|
||||||
|
|
||||||
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 == 'largeScreen') {
|
||||||
|
const foundObject = this.limitUserId.find(item => item.id == 2);
|
||||||
|
if (!foundObject) return this.$message('您当前没有权限查看!')
|
||||||
|
|
||||||
|
} else if (item.router != this.routerNow && !item.http) {
|
||||||
|
|
||||||
} else if (item.router != this.routerNow && !item.http) {
|
|
||||||
const foundObject = this.limitUserId.find(item => item.id == 2);
|
|
||||||
if( !foundObject) return this.$message('您当前没有权限查看!')
|
|
||||||
this.$router.push({ name: item.router })
|
this.$router.push({ name: item.router })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -299,24 +302,24 @@ export default {
|
||||||
} else if (item.router == 'formula' && this.$route.query.index != item.index) {
|
} else if (item.router == 'formula' && this.$route.query.index != item.index) {
|
||||||
|
|
||||||
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') {
|
} else if (this.routerNow == 'formula') {
|
||||||
this.$store.state.equipmentIndex = item.index
|
this.$store.state.equipmentIndex = item.index
|
||||||
this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` })
|
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 (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