You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.3 KiB

// package/AIOTOverview/electricityMonitoring/electricityMonitoring.js
import { getProjectList,getRelationList,createInvoke} from "../../../utils/getApiUrl"
import {Request} from "../../../common"
Page({
/**
* 页面的初始数据
*/
data: {
structList:[ ],
curStruId: 'all', // 选中结构物id
list:[],//断路器设备list
listCopy:[],
},
onClose(e) {
// 获取报告
// this.getPatrolReport();
},
switch1Change(e){
wx.showLoading({ title: '加载中...' });
const item=e.currentTarget.dataset.item
let searchId={
deviceId:item.deviceId,
dimCapId:item.cid,
thingId:item.structId,
timeout: 300000,
param:e.detail.value?'开':'关'
}
Request.post(createInvoke(),{data:searchId}).then(res=>{
if(res){
wx.hideLoading()
}else{
wx.hideLoading()
}
})
},
onStruChange(e) {
if (e.detail) {
let data = []
if (e.detail === 'all') {
data = this.data.listCopy
} else {
data = this.data.listCopy.filter(item => item.xjId === e.detail)
}
this.setData({
curStruId: e.detail,
list: data
})
}
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
wx.showLoading({ title: '加载中...' });
const searchId= JSON.parse(decodeURIComponent(options.data2))
let data={
searchId
}
let listt=[]
//智能断路器的设备的状态
const res1 =await Request.post(createInvoke(),data)
1 year ago
// console.log('resss',res1)
//获取结构物列表(巡检)
// console.log('getProjectList',getProjectList)
const res=await Request.get(getProjectList())
const rslt=await Request.get(getRelationList())
if(res.rows.length&&rslt.rows.length){
const data=res.rows.map(item=>{
return {
1 year ago
value: item.id,
text:item.name
}
})
if(res1&&res1.length){
listt=res1.map(item=>{
const c=rslt.rows?.find(q => q.axyProjectId == item.structId)?.structureId
return {
...item,
structName: res.rows.find(p=>p.id==c)?.name,
xjId: rslt.rows?.find(q => q.axyProjectId == item.structId)?.structureId
}
})
}
data.unshift({text: '全部', value: 'all' })
this.setData({
structList:data,
list:listt,
listCopy:listt
})
}
wx.hideLoading()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})