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' + }); }, /**