|
|
@ -2,7 +2,7 @@ |
|
|
|
const { QueryTypes } = require('sequelize'); |
|
|
|
const moment = require('moment'); |
|
|
|
|
|
|
|
async function reportList (ctx) { |
|
|
|
async function reportList(ctx) { |
|
|
|
try { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '', codeRoad } = ctx.query |
|
|
@ -46,7 +46,7 @@ async function reportList (ctx) { |
|
|
|
}, |
|
|
|
attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'performerId', 'roadSectionEnd', 'reportType', 'address', |
|
|
|
'content', 'longitude', 'latitude', 'projectName', 'handleState', 'codeRoad', 'handleContent', 'handlePic', 'videoUrl', |
|
|
|
'scenePic'], |
|
|
|
'scenePic'], |
|
|
|
include: [{ |
|
|
|
model: models.User, |
|
|
|
attributes: ['name'] |
|
|
@ -148,7 +148,7 @@ async function reportList (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function reportPosition (ctx) { |
|
|
|
async function reportPosition(ctx) { |
|
|
|
try { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
const { startTime, endTime, userId, reportType } = ctx.query |
|
|
@ -198,7 +198,7 @@ async function reportPosition (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function reportDetail (ctx) { |
|
|
|
async function reportDetail(ctx) { |
|
|
|
try { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
const { reportId } = ctx.params |
|
|
@ -220,7 +220,7 @@ async function reportDetail (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function reportHandle (ctx) { |
|
|
|
async function reportHandle(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
|
@ -250,7 +250,7 @@ async function reportHandle (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function createReport (ctx) { |
|
|
|
async function createReport(ctx) { |
|
|
|
try { |
|
|
|
const { userId } = ctx.fs.api |
|
|
|
const models = ctx.fs.dc.models; |
|
|
@ -272,7 +272,7 @@ async function createReport (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function deleteReport (ctx) { |
|
|
|
async function deleteReport(ctx) { |
|
|
|
try { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
const { reportId } = ctx.params; |
|
|
@ -295,7 +295,7 @@ async function deleteReport (ctx) { |
|
|
|
|
|
|
|
// TODO 小程序填写道路名称的时候的道路筛选 是一起都返回 还是不断传关键字搜索返回
|
|
|
|
|
|
|
|
async function spotPrepare (ctx) { |
|
|
|
async function spotPrepare(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const sequelize = ctx.fs.dc.orm; |
|
|
@ -367,7 +367,7 @@ async function spotPrepare (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function spotCheck (ctx) { |
|
|
|
async function spotCheck(ctx) { |
|
|
|
const transaction = await ctx.fs.dc.orm.transaction(); |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
@ -469,7 +469,7 @@ async function spotCheck (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
async function spotCheckDetail (ctx) { |
|
|
|
async function spotCheckDetail(ctx) { |
|
|
|
const { models } = ctx.fs.dc |
|
|
|
const { startTime, endTime } = ctx.query |
|
|
|
try { |
|
|
@ -477,15 +477,17 @@ async function spotCheckDetail (ctx) { |
|
|
|
where: { |
|
|
|
checked: 'true' |
|
|
|
}, |
|
|
|
order: [['date', 'DESC']], |
|
|
|
include: [{ |
|
|
|
model: models.Department, |
|
|
|
attributes: ['name'] |
|
|
|
}, { |
|
|
|
model: models.ReportSpotCheck, |
|
|
|
where: { spotDate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } }, |
|
|
|
order: [['id', 'DESC']], |
|
|
|
order: [['spot_date', 'DESC']], |
|
|
|
include: [{ |
|
|
|
model: models.Report, |
|
|
|
order: [['date', 'DESC']], |
|
|
|
include: [{ |
|
|
|
model: models.User, |
|
|
|
attributes: ['name'] |
|
|
|