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