Browse Source

feat:抽取列表的展示顺序,巡查的地址换行

dev
zhaobing 1 year ago
parent
commit
e5b0640435
  1. 24
      api/app/lib/controllers/report/index.js
  2. 4
      web/client/src/sections/fillion/components/patrolTable.js

24
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']

4
web/client/src/sections/fillion/components/patrolTable.js

@ -140,7 +140,7 @@ const DetailForm = (props) => {
{isPatrol ? <Descriptions title="基础信息" bordered style={{ marginBottom: 20 }}>
{info.map(obj => {
return (
obj.skip ? null : <Descriptions.Item label={obj.key} span={obj.name === 'roadSectionStart' ? 3 : 1}> {obj.name === 'projectType' ?
obj.skip ? null : <Descriptions.Item label={obj.key} span={obj.name === 'roadSectionStart' || obj.name === 'address' ? 3 : 1}> {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] || ''}</Descriptions.Item>
@ -170,7 +170,7 @@ const DetailForm = (props) => {
patrolContent.map(obj => {
return (
obj.skip ? null : <Descriptions.Item label={obj.key}>
{obj.name === 'inspectionNoException' ? <Checkbox checked={data['inspectionNoException']} ></Checkbox> : data[obj.name] || ''}
{obj.name === 'inspectionNoException' && data['inspectionNoException'] ? <Checkbox checked={data['inspectionNoException']} ></Checkbox> : data[obj.name] || ''}
</Descriptions.Item>
)
})

Loading…
Cancel
Save