Browse Source

获取巡检记录排除 rslt 中为 null 的记录

master
巴林闲侠 2 years ago
parent
commit
81bd334202
  1. 3
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 32
      weapp/package/inspectionInput/inspectionInput.js

3
api/app/lib/controllers/patrolManage/patrolRecord.js

@ -119,6 +119,7 @@ async function findPatrolRecord (ctx, next) {
} }
} }
let userInfo = ctx.fs.api.userInfo; let userInfo = ctx.fs.api.userInfo;
rslt = rslt.filter(f => f)
if (userInfo.username != 'SuperAdmin') { if (userInfo.username != 'SuperAdmin') {
if (userInfo.structure) { if (userInfo.structure) {
rslt = rslt.filter(s => userInfo.structure.find(x => x == s.points.project.id)) rslt = rslt.filter(s => userInfo.structure.find(x => x == s.points.project.id))
@ -204,7 +205,7 @@ async function addPatrolRecord (ctx, next) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { ctx.body = {
"message": '新增巡检计划失败' "message": '新增巡检记录失败'
} }
} }
} }

32
weapp/package/inspectionInput/inspectionInput.js

@ -61,7 +61,7 @@ Page({
}, },
// 获取巡检模板 // 获取巡检模板
getPatrolTemplate(templateId) { getPatrolTemplate (templateId) {
Request.get(getPatrolTemplate(templateId)).then(res => { Request.get(getPatrolTemplate(templateId)).then(res => {
const checkItems = res.rows[0].checkItems; const checkItems = res.rows[0].checkItems;
const inspectContent = {}; const inspectContent = {};
@ -80,7 +80,7 @@ Page({
}) })
}, },
onPickerChange(e) { onPickerChange (e) {
const { key } = e.currentTarget.dataset; const { key } = e.currentTarget.dataset;
const { value } = e.detail; const { value } = e.detail;
@ -98,19 +98,19 @@ Page({
this.getPatrolTemplate(curPlan.templateId); this.getPatrolTemplate(curPlan.templateId);
}, },
onPickerCancel(e) { onPickerCancel (e) {
const { key } = e.currentTarget.dataset; const { key } = e.currentTarget.dataset;
this.setData({ this.setData({
[`${key}Visible`]: false, [`${key}Visible`]: false,
}); });
}, },
onPlanListPicker() { onPlanListPicker () {
this.setData({ planListVisible: true }); this.setData({ planListVisible: true });
}, },
// 获取当前位置 // 获取当前位置
selfLocation() { selfLocation () {
const that = this const that = this
wx.showLoading({ wx.showLoading({
title: '定位中', title: '定位中',
@ -142,7 +142,7 @@ Page({
}); });
}, },
handleChangeTwo(e) { handleChangeTwo (e) {
const isNormal = e.detail.value === 'normal'; const isNormal = e.detail.value === 'normal';
const inspectContent = this.data.inspectContent; const inspectContent = this.data.inspectContent;
inspectContent[e.currentTarget.dataset.item].isNormal = isNormal; inspectContent[e.currentTarget.dataset.item].isNormal = isNormal;
@ -156,7 +156,7 @@ Page({
}) })
}, },
handleChangeThree(e) { handleChangeThree (e) {
const inspectContent = this.data.inspectContent; const inspectContent = this.data.inspectContent;
inspectContent[e.currentTarget.dataset.item].level = e.detail.value; inspectContent[e.currentTarget.dataset.item].level = e.detail.value;
this.setData({ this.setData({
@ -296,7 +296,7 @@ Page({
}) })
}, },
bindCancel() { bindCancel () {
if (this.data.scenePointId) { if (this.data.scenePointId) {
wx.switchTab({ url: '/pages/index/index' }) wx.switchTab({ url: '/pages/index/index' })
} else { } else {
@ -379,7 +379,7 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad (options) {
const that = this; const that = this;
const scenePointId = options.scene; const scenePointId = options.scene;
if (scenePointId) { // 扫小程序码进入 if (scenePointId) { // 扫小程序码进入
@ -407,49 +407,49 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow () {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload () {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh () {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom () {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage () {
} }
}) })
Loading…
Cancel
Save