From e5b06404354f3480709401e1ee9e099f93c38526 Mon Sep 17 00:00:00 2001 From: zhaobing Date: Fri, 11 Aug 2023 11:40:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=8A=BD=E5=8F=96=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=B1=95=E7=A4=BA=E9=A1=BA=E5=BA=8F=EF=BC=8C=E5=B7=A1?= =?UTF-8?q?=E6=9F=A5=E7=9A=84=E5=9C=B0=E5=9D=80=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 24 ++++++++++--------- .../fillion/components/patrolTable.js | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 0dffcbea..e893273a 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -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'] diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index 70b803f6..1e2f92ae 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -140,7 +140,7 @@ const DetailForm = (props) => { {isPatrol ? {info.map(obj => { return ( - obj.skip ? null : {obj.name === 'projectType' ? + obj.skip ? null : {obj.name === 'projectType' ? reportTypeText(data[obj.name]) : obj.name === 'reportType' ? data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : '' : obj.name === 'roadSectionStart' ? data[obj.name] + '-' + data['roadSectionEnd'] || '' : data[obj.name] || ''} @@ -170,7 +170,7 @@ const DetailForm = (props) => { patrolContent.map(obj => { return ( obj.skip ? null : - {obj.name === 'inspectionNoException' ? : data[obj.name] || ''} + {obj.name === 'inspectionNoException' && data['inspectionNoException'] ? : data[obj.name] || ''} ) })