Browse Source

reportList 添加 handleState、performerId 筛选项

dev
巴林闲侠 2 years ago
parent
commit
a75716b803
  1. 12
      api/app/lib/controllers/report/index.js

12
api/app/lib/controllers/report/index.js

@ -4,7 +4,7 @@ const { QueryTypes } = require('sequelize');
async function reportList (ctx) { async function reportList (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType } = ctx.query const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '' } = ctx.query
const { userInfo } = ctx.fs.api const { userInfo } = ctx.fs.api
const sequelize = ctx.fs.dc.orm; const sequelize = ctx.fs.dc.orm;
@ -14,7 +14,7 @@ async function reportList (ctx) {
&& userInfo.isAdmin && userInfo.isAdmin
&& userInfo.phone != 'SuperAdmin' && userInfo.phone != 'SuperAdmin'
) { ) {
// 是管理员但不是超管 查自己部门及下级部门的所有信息 // 是管理员但不是超管 查自己部门及下级部门的所有用户的信息
const sqlStr = ` const sqlStr = `
WITH RECURSIVE sub_departments AS ( WITH RECURSIVE sub_departments AS (
SELECT id, dependence SELECT id, dependence
@ -86,6 +86,14 @@ async function reportList (ctx) {
if (projectType) { if (projectType) {
findOption.where.projectType = projectType findOption.where.projectType = projectType
} }
if (performerId) {
let performerIds = performerId.split(',')
findOption.where.performerId = { $in: performerIds }
}
if (handleState) {
findOption.where.handleState = handleState
}
let reportRes = null; let reportRes = null;
if (isTop) { if (isTop) {

Loading…
Cancel
Save