Browse Source

点位请求修改

master
liujiangyong 2 years ago
parent
commit
813604a4c4
  1. 15
      weapp/package/pointsStatus/pointsStatus.js
  2. 3
      weapp/utils/getApiUrl.js

15
weapp/package/pointsStatus/pointsStatus.js

@ -1,5 +1,5 @@
// package/pointsStatus/pointsStatus.js // package/pointsStatus/pointsStatus.js
import { getProjectGraph, getDeployPoints } from "../../utils/getApiUrl"; import { getProjectGraph, getDeployPoints, getProjectPoints } from "../../utils/getApiUrl";
import { Request } from "../../common"; import { Request } from "../../common";
Page({ Page({
@ -19,21 +19,24 @@ Page({
wx.showLoading({ title: '加载中...' }); wx.showLoading({ title: '加载中...' });
Request.get(getProjectGraph(projectId)).then(res => { Request.get(getProjectGraph(projectId)).then(res => {
if (res) { if (res) {
Request.get(getDeployPoints(res.id)).then(pointsRes => { Request.get(getDeployPoints(res.id)).then(deployPointsRes => {
Request.get(getProjectPoints(projectId)).then(allPointRes => {
wx.hideLoading();
that.setData({ that.setData({
image: res.graph, image: res.graph,
allPoints: pointsRes.allPoints, allPoints: allPointRes,
setedPoints: pointsRes.setedPoints.map(p => ({ setedPoints: deployPointsRes.map(p => ({
...p, ...p,
position: JSON.parse(p.position), position: JSON.parse(p.position),
pointInfo: pointsRes.allPoints.find(a => a.id === p.pointId), pointInfo: allPointRes.find(a => a.id === p.pointId),
})), })),
}) })
}) })
})
} else { } else {
wx.hideLoading();
// 未布设 // 未布设
} }
wx.hideLoading()
}) })
}, },

3
weapp/utils/getApiUrl.js

@ -20,6 +20,9 @@ exports.getProjectGraph = (projectId) => {
exports.getDeployPoints = (pictureId) => { exports.getDeployPoints = (pictureId) => {
return `/picture/${pictureId}/deploy/points` return `/picture/${pictureId}/deploy/points`
} }
exports.getProjectPoints = (projectId) => {
return `/project/${projectId}/all/points`
}
// 获取巡检计划 // 获取巡检计划
exports.getPatrolPlan = () => { exports.getPatrolPlan = () => {

Loading…
Cancel
Save