Browse Source

(*) 非巡检人不能进行巡检操作

master
liujiangyong 2 years ago
parent
commit
bc3c84f47d
  1. 7
      api/app/lib/controllers/patrolPlan/patrolPlan.js
  2. 3
      weapp/package/polling/polling.js
  3. 3
      weapp/package/startInspection/startInspection.js

7
api/app/lib/controllers/patrolPlan/patrolPlan.js

@ -3,12 +3,14 @@
async function getPatrolPlan(ctx, next) {
try {
const models = ctx.fs.dc.models;
const { limit, page } = ctx.query;
const { limit, page, userId } = ctx.query;
let userWhere = {};
let options = {
include: [{
required: true,
model: models.User,
attributes: ['id', 'name'],
where: userWhere,
include: [{
required: true,
model: models.Department,
@ -26,6 +28,9 @@ async function getPatrolPlan(ctx, next) {
if (page && limit) {
options.offset = Number(page) * Number(limit);
}
if (userId) {
userWhere.id = userId;
}
let res = await models.PatrolPlan.findAndCountAll(options);
ctx.status = 200;
ctx.body = res;

3
weapp/package/polling/polling.js

@ -43,7 +43,8 @@ Page({
wx.showLoading({
title: '加载中',
})
Request.get(getPatrolPlan(), { limit, page }).then(res => {
const userInfo = wx.getStorageSync('userInfo');
Request.get(getPatrolPlan(), { limit, page, userId: userInfo.id }).then(res => {
if (res.rows.length == 0) {
that.setData({
dataList: res.rows,

3
weapp/package/startInspection/startInspection.js

@ -395,7 +395,8 @@ Page({
wx.showLoading({
title: '加载中',
})
Request.get(getPatrolPlan(), {}).then(res => {
const userInfo = wx.getStorageSync('userInfo');
Request.get(getPatrolPlan(), { userId: userInfo.id }).then(res => {
wx.hideLoading();
const pointPlan = res.rows.filter(plan => {
for (const point of plan.points) {

Loading…
Cancel
Save