pull/133/head
孙萌 2024-03-14 11:05:08 +08:00
parent ad6ce056b1
commit 58287af3bd
2 changed files with 80 additions and 31 deletions

View File

@ -119,7 +119,10 @@ export default {
getEqbyid(data) {
return sendGetRequest("/sel/eqbyid/" + data, '');
},
//气象站显示
geteqetdata(data) {
return sendGetRequest(`/getcontrol/geteqetdata?userId=`+data ,"")
},
//测试施肥机读取设备状态信息 //读取数据 根据文档编号读取 所有数据展示都出自这个接口
postReg(data) {
return sendPostRequest("/readFs/reg", data);
@ -387,6 +390,8 @@ cameraStart(cameraSerialNumber,cameraChannelNumber,num) {
cameraStop(cameraSerialNumber,cameraChannelNumber,num) {
return sendPostRequest(`/camera/stop?cameraid=${cameraSerialNumber}&channelid=${cameraChannelNumber}&direction=${num}`)
},
//二维码溯源
//查看农事作物信息
getAgriculturalInformation(data) {

View File

@ -37,7 +37,7 @@
:class="item.routerList.indexOf(routerNow) != -1 && routerIndex == item1.index ? 'active' : ''"
v-for="item1, index1 in item.list" :key="index1">{{ item1.deviceTypeName }} <div
class="status" :class="item1.deviceState == 0 ? 'outline' : 'online'"
v-if="item1.deviceState >= 0">{{
v-if="item1.deviceState >= 0 && item1.deviceState">{{
item1.deviceState == 0 ? '离线' : '在线' }}</div>
</li>
</ul>
@ -106,10 +106,10 @@ export default {
"$route"(newName, oldName) {
this.gerRouter();
var store = this.$store.state
if(!store.equipmentName){
if (!store.equipmentName) {
this.getByid()
}
},
},
mounted() {
@ -241,35 +241,63 @@ export default {
})
}
})
this.leftList.forEach((el1, index1) => {
if (el1.name == '温室') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
if (el1.name == '施肥机') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
if (el1.name == '生态气象站') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
})
this.gerRouter()
this.getByid()
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.getControlGetState(data).then(res => {
this.api.geteqetdata(userInfo.userid).then((res) => {
if (res.data.code == 200) {
this.statusData = res.data.data;
var list = this.$store.state.equipmentList
this.$store.state.equipmentList = list.concat(res.data.data.map(function (item, index) {
return {
deviceId: item.deviceId,
userId: item.userId,
deviceTypeName: item.deviceName,
index: list[list.length - 1].index + index + 1,
router: 'formula',
deviceName: '30'
};
}))
this.$store.state.equipmentList.forEach((el, index) => {
if (el.deviceName == '30') {
this.leftList.forEach((el1, index1) => {
if (el1.name == '生态气象站') {
this.leftList[index1].list.push(el)
}
})
}
})
this.leftList.forEach((el1, index1) => {
if (el1.name == '温室') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
if (el1.name == '施肥机') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
if (el1.name == '生态气象站') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
})
this.gerRouter()
this.getByid()
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.getControlGetState(data).then(res => {
if (res.data.code == 200) {
this.statusData = res.data.data;
}
})
}
})
}
})
},
gerRouter() {
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 {
@ -312,16 +340,27 @@ export default {
this.$router.push({ path: `/dataAnalysis` })
} else if (item.router == 'status') {
if(this.deviceName == '10' || this.deviceName == '30'){
this.$router.push({ path: `/control` })
}else{
this.$router.push({ path: `/formula` })
if (this.deviceName == '30') {
this.$message('气象站无当前页面');
return
}
if (this.deviceName == '10') {
this.$router.push({ path: `/control` })
} else {
this.$router.push({ path: `/formula` })
}
} else if (item.router == 'realTime') {
this.$router.push({ path: `/realTime` })
} else if (item.router == 'videoMonitoring') {
if (this.deviceName == '30') {
this.$message('气象站无当前页面');
return
}
this.$router.push({ path: `/videoMonitoring` })
} else if (item.router == 'status' && item.routerList.indexOf(this.routerNow) != -1) {
return
@ -363,17 +402,22 @@ export default {
} else if (this.routerNow == 'historyData') {
this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/historyData?index=${item.index ? item.index : 1}` })
} else{
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
if (item.deviceName == 10 || item.deviceName == 30) {
} else {
if (item.deviceName == 10) {
//
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
if (this.routerNow != 'skylight' && this.leftList[1].routerList.indexOf(this.$route.name) != -1) {
return
}
this.$router.push({ path: `/control?change=${item.index}` })
} else if (item.deviceName == 1 && this.routerNow != 'irrigateSet') {
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
this.$router.push({ path: `/irrigateSet?change=${item.index}` })
} else if (item.deviceName == 30) {
this.$message('气象站无当前页面');
}
}
} else if (item.router == 'formula' && this.$route.query.index == item.index) {