|
|
@ -11,6 +11,10 @@ import { |
|
|
|
const moment = require("../../utils/moment"); |
|
|
|
|
|
|
|
Page({ |
|
|
|
projectList: [], //结构物列表
|
|
|
|
timeoutId1: null, // 定时器1的ID
|
|
|
|
timeoutId2: null, // 定时器2的ID
|
|
|
|
deviceList:[],//设备列表
|
|
|
|
initECharts(option) { |
|
|
|
this.ecComponent.init((canvas, width, height, dpr) => { |
|
|
|
const chart = echarts.init(canvas, null, { |
|
|
@ -20,6 +24,8 @@ Page({ |
|
|
|
}); |
|
|
|
chart.setOption(option); |
|
|
|
this.chart = chart; |
|
|
|
wx.hideLoading() |
|
|
|
|
|
|
|
return chart; |
|
|
|
}); |
|
|
|
}, |
|
|
@ -32,6 +38,7 @@ Page({ |
|
|
|
}); |
|
|
|
chart.setOption(option); |
|
|
|
this.chart = chart; |
|
|
|
wx.hideLoading() |
|
|
|
return chart; |
|
|
|
}); |
|
|
|
}, |
|
|
@ -40,25 +47,22 @@ Page({ |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
ec: {}, |
|
|
|
dataList: [], //巡检记录的列表
|
|
|
|
// dataList: [], //巡检记录的列表
|
|
|
|
guaranteedRate: 0, //过保率
|
|
|
|
warrantyPeriod: 0, //质保期
|
|
|
|
projectList: [], //结构物列表
|
|
|
|
count: 0, //设备总数
|
|
|
|
deviceList:[],//设备列表
|
|
|
|
// normalCount: 0, //正常数量
|
|
|
|
// abnormalCount: 0, //异常数量
|
|
|
|
// unknownCount: 0, //未知数量
|
|
|
|
}, |
|
|
|
navigator(e) { |
|
|
|
const res = JSON.stringify(this.data.deviceList) |
|
|
|
const patrolRecord=JSON.stringify(this.data.dataList) |
|
|
|
const res = JSON.stringify(this.deviceList) |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/package/deviceBigdataGraph/statusDetail/statusDetail?arrayData=${encodeURIComponent(res)}`, |
|
|
|
}) |
|
|
|
}, |
|
|
|
navigatorToLifeWarning(e) { |
|
|
|
const res = JSON.stringify(this.data.projectList.rows) |
|
|
|
const res = JSON.stringify(this.projectList.rows) |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/package/deviceBigdataGraph/lifeWarning/lifeWarning?arrayData=${encodeURIComponent(res)}`, |
|
|
|
}) |
|
|
@ -67,6 +71,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
wx.showLoading({ title: '加载中...' }); |
|
|
|
const that = this |
|
|
|
that.ecComponent = that.selectComponent('#mychart-dom-pie'); |
|
|
|
that.ecDeviceComponent = that.selectComponent('#mychart-device-pie'); |
|
|
@ -94,11 +99,11 @@ Page({ |
|
|
|
} |
|
|
|
typeGroups[type].push(item) |
|
|
|
}); |
|
|
|
this.deviceList=res |
|
|
|
that.setData({ |
|
|
|
guaranteedRate: Math.round((guaranteedRate / count) * 100), |
|
|
|
warrantyPeriod: Math.round((warrantyPeriod / count) * 100), |
|
|
|
count: res.length, |
|
|
|
deviceList:res |
|
|
|
}) |
|
|
|
// 格式转换成指定格式
|
|
|
|
const result = Object.keys(typeGroups).map((type) => ({ |
|
|
@ -136,7 +141,7 @@ Page({ |
|
|
|
|
|
|
|
}] |
|
|
|
}; |
|
|
|
setTimeout(() => { |
|
|
|
that.timeoutId1= setTimeout(() => { |
|
|
|
that.initECharts(option); |
|
|
|
}, 1000) |
|
|
|
} else { |
|
|
@ -168,7 +173,7 @@ Page({ |
|
|
|
return inspectionTime == maxInspectionTimeByPointId[pointId] |
|
|
|
}); |
|
|
|
//获取设备信息
|
|
|
|
const devices=that.data.deviceList.map(item=>{return {id:item.id,name:item.name,status:'unknown'}}) |
|
|
|
const devices=that.deviceList.map(item=>{return {id:item.id,name:item.name,status:'unknown'}}) |
|
|
|
filteredData?.forEach((item) => { |
|
|
|
const inspectContent =item.alarm?(item?.points?.inspectContent || []):[]; |
|
|
|
if (inspectContent && inspectContent.length&&Array.isArray(inspectContent)&&inspectContent.some(o=>o.deviceId)) { |
|
|
@ -224,7 +229,7 @@ Page({ |
|
|
|
break; |
|
|
|
} |
|
|
|
}); |
|
|
|
that.setData({dataList:res}) |
|
|
|
// that.setData({dataList:res})
|
|
|
|
var optionDevice = { |
|
|
|
tooltip: { |
|
|
|
trigger: 'item' |
|
|
@ -260,7 +265,7 @@ Page({ |
|
|
|
|
|
|
|
}] |
|
|
|
}; |
|
|
|
setTimeout(() => { |
|
|
|
that.timeoutId2= setTimeout(() => { |
|
|
|
that.initDeviceECharts(optionDevice); |
|
|
|
}, 1000) |
|
|
|
} else { |
|
|
@ -269,9 +274,11 @@ Page({ |
|
|
|
}) |
|
|
|
Request.get(getProjectList()).then(res => { |
|
|
|
if (res) { |
|
|
|
that.setData({ |
|
|
|
projectList: res |
|
|
|
}) |
|
|
|
|
|
|
|
this.projectList=res |
|
|
|
// that.setData({
|
|
|
|
// projectList: res
|
|
|
|
// })
|
|
|
|
} else { |
|
|
|
wx.hideLoading() |
|
|
|
|
|
|
@ -291,7 +298,8 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -305,7 +313,14 @@ Page({ |
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
*/ |
|
|
|
onUnload() { |
|
|
|
|
|
|
|
// 清除定时器1
|
|
|
|
if (this.timeoutId1) { |
|
|
|
clearTimeout(this.timeoutId1); |
|
|
|
} |
|
|
|
// 清除定时器2
|
|
|
|
if (this.timeoutId2) { |
|
|
|
clearTimeout(this.timeoutId2); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|