From fd1e0d6ed90e48ab483d365aebf21da535ce3323 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 1 Mar 2023 17:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=97=AE=E9=A2=98=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E3=80=81=E5=B7=B2=E5=8A=9E=E4=BA=8B=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/patrolManage/patrolRecord.js | 26 ++++++++++++++----- weapp/common.js | 1 + weapp/package/troubleshooting/index.js | 9 +++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index d6a18cf..1c6cfcf 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/api/app/lib/controllers/patrolManage/patrolRecord.js @@ -192,7 +192,7 @@ async function getPatrolRecordIssueHandle (ctx) { let findOption = { where: { - + $or: [] }, include: [{ model: models.PatrolRecord @@ -201,22 +201,34 @@ async function getPatrolRecordIssueHandle (ctx) { if (type == 'backlog') { // 待办 - let stateArr = [] - if (userInfo) { - + // let stateArr = [] + if (userInfo && userInfo.userResources.includes('ZHIDINGJIHUA')) { + // stateArr.push(1) + findOption.where['$or'].push({ state: 1 }) + findOption.where['$or'].push({ state: 3 }) } + findOption.where['$or'].push({ state: 2, approvePerson: { id: userId } }) + findOption.where['$or'].push({ state: 4, repairPerson: { id: userId } }) + findOption.where['$or'].push({ state: 5, checkPerson: { id: userId } }) + findOption.where['$or'].push({ state: 7, repairPerson: { id: userId } }) findOption.where = { ...findOption.where, - } } else if (type == 'haveDone') { // 已办 + findOption.where['$or'].push({ state: { $notIn: [1, 2] }, creator: { id: userId } }) + findOption.where['$or'].push({ state: { $gt: 2 }, approvePerson: { id: userId } }) + findOption.where['$or'].push({ state: { $gt: 4, $ne: 7 }, repairPerson: { id: userId } }) + findOption.where['$or'].push({ state: { $gt: 5 }, checkPerson: { id: userId } }) + findOption.where = { + ...findOption.where, + } } - const res = await models.findAll(findOption) + const res = await models.PatrolRecordIssueHandle.findAll(findOption) ctx.status = 200; - ctx.body = {} + ctx.body = res } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; diff --git a/weapp/common.js b/weapp/common.js index a8abae1..3153dd6 100644 --- a/weapp/common.js +++ b/weapp/common.js @@ -3,6 +3,7 @@ const { baseUrl } = app.globalData; // 全局配置 请求拦截, 长时间 const buildRequest = (type, url, data) => { + console.log(type, url, data); return new Promise((resolve, reject) => { if (url.indexOf('token') == -1) { let token = wx.getStorageSync('token'); diff --git a/weapp/package/troubleshooting/index.js b/weapp/package/troubleshooting/index.js index dd2f714..537377b 100644 --- a/weapp/package/troubleshooting/index.js +++ b/weapp/package/troubleshooting/index.js @@ -41,7 +41,9 @@ Page({ }, getData (params) { - Request.get(getPatrolRecordIssueHandle, {}).then(res => { + Request.get(getPatrolRecordIssueHandle(), { + ...params, + }).then(res => { console.log(res); }) }, @@ -108,7 +110,10 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady () { - + console.log(123); + this.getData({ + type: 'backlog' + }); }, /**