|
@ -1,5 +1,5 @@ |
|
|
// package/pointsStatus/pointsStatus.js
|
|
|
// package/pointsStatus/pointsStatus.js
|
|
|
import { getProjectGraph, getDeployPoints, getProjectPoints } from "../../utils/getApiUrl"; |
|
|
import { getProjectGraph, getDeployPoints, getProjectPoints, getdPointCurPatrolRecord } from "../../utils/getApiUrl"; |
|
|
import { Request } from "../../common"; |
|
|
import { Request } from "../../common"; |
|
|
|
|
|
|
|
|
Page({ |
|
|
Page({ |
|
@ -9,6 +9,7 @@ Page({ |
|
|
*/ |
|
|
*/ |
|
|
data: { |
|
|
data: { |
|
|
imgUrl: getApp().globalData.imgUrl, |
|
|
imgUrl: getApp().globalData.imgUrl, |
|
|
|
|
|
describe: '', |
|
|
image: '', |
|
|
image: '', |
|
|
allPoints: [], |
|
|
allPoints: [], |
|
|
setedPoints: [], |
|
|
setedPoints: [], |
|
@ -41,28 +42,44 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
calcTooltip(e) { |
|
|
calcTooltip(e) { |
|
|
|
|
|
const that = this; |
|
|
const pointNodeId = e.currentTarget.id; |
|
|
const pointNodeId = e.currentTarget.id; |
|
|
const pointId = e.currentTarget.dataset.id; |
|
|
const { id: pointId, show } = e.currentTarget.dataset; |
|
|
const windowWidth = wx.getSystemInfoSync().windowWidth; |
|
|
const windowWidth = wx.getSystemInfoSync().windowWidth; |
|
|
const query = this.createSelectorQuery().in(this); |
|
|
const setTooltip = (status) => { |
|
|
|
|
|
const query = that.createSelectorQuery().in(that); |
|
|
query.select('#' + pointNodeId).boundingClientRect(data => { |
|
|
query.select('#' + pointNodeId).boundingClientRect(data => { |
|
|
const sub = windowWidth - data.left < 100 ? 100 - (windowWidth - data.left) : 0; |
|
|
const sub = windowWidth - data.left < 100 ? 100 - (windowWidth - data.left) : 0; |
|
|
const nextSetedPoints = this.data.setedPoints.map(p => { |
|
|
const nextSetedPoints = that.data.setedPoints.map(p => { |
|
|
if (p.id == pointId) { |
|
|
if (p.pointId == pointId) { |
|
|
p.sub = sub; |
|
|
p.sub = sub; |
|
|
p.show = !p.show; |
|
|
p.show = !p.show; |
|
|
|
|
|
if (status) { |
|
|
|
|
|
p.status = status; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return p; |
|
|
return p; |
|
|
}) |
|
|
}) |
|
|
this.setData({ setedPoints: nextSetedPoints }) |
|
|
that.setData({ setedPoints: nextSetedPoints }) |
|
|
}).exec() |
|
|
}).exec() |
|
|
|
|
|
} |
|
|
|
|
|
if (!show) { |
|
|
|
|
|
wx.showLoading({ title: '加载中...' }); |
|
|
|
|
|
Request.get(getdPointCurPatrolRecord(pointId)).then(res => { |
|
|
|
|
|
wx.hideLoading(); |
|
|
|
|
|
setTooltip(res.length ? res[0].alarm ? '异常' : '正常' : '--'); |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
setTooltip(); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面加载 |
|
|
* 生命周期函数--监听页面加载 |
|
|
*/ |
|
|
*/ |
|
|
onLoad(options) { |
|
|
onLoad(options) { |
|
|
const { projectId } = options; |
|
|
const { projectId, describe } = options; |
|
|
|
|
|
this.setData({ describe }); |
|
|
this.getData(projectId); |
|
|
this.getData(projectId); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|