Browse Source

获取问题待办、已办事项

master
巴林闲侠 2 years ago
parent
commit
fd1e0d6ed9
  1. 26
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 1
      weapp/common.js
  3. 9
      weapp/package/troubleshooting/index.js

26
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;

1
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');

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

Loading…
Cancel
Save