Browse Source

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

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

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

@ -2,7 +2,7 @@
const { QueryTypes } = require('sequelize'); const { QueryTypes } = require('sequelize');
const moment = require('moment'); const moment = require('moment');
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, handleState = '', performerId = '', codeRoad } = ctx.query const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '', codeRoad } = ctx.query
@ -148,7 +148,7 @@ async function reportList (ctx) {
} }
} }
async function reportPosition (ctx) { async function reportPosition(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { startTime, endTime, userId, reportType } = ctx.query const { startTime, endTime, userId, reportType } = ctx.query
@ -198,7 +198,7 @@ async function reportPosition (ctx) {
} }
} }
async function reportDetail (ctx) { async function reportDetail(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { reportId } = ctx.params const { reportId } = ctx.params
@ -220,7 +220,7 @@ async function reportDetail (ctx) {
} }
} }
async function reportHandle (ctx) { async function reportHandle(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -250,7 +250,7 @@ async function reportHandle (ctx) {
} }
} }
async function createReport (ctx) { async function createReport(ctx) {
try { try {
const { userId } = ctx.fs.api const { userId } = ctx.fs.api
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
@ -272,7 +272,7 @@ async function createReport (ctx) {
} }
} }
async function deleteReport (ctx) { async function deleteReport(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { reportId } = ctx.params; const { reportId } = ctx.params;
@ -295,7 +295,7 @@ async function deleteReport (ctx) {
// TODO 小程序填写道路名称的时候的道路筛选 是一起都返回 还是不断传关键字搜索返回 // TODO 小程序填写道路名称的时候的道路筛选 是一起都返回 还是不断传关键字搜索返回
async function spotPrepare (ctx) { async function spotPrepare(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const sequelize = ctx.fs.dc.orm; 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(); const transaction = await ctx.fs.dc.orm.transaction();
try { try {
const { models } = ctx.fs.dc; 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 { models } = ctx.fs.dc
const { startTime, endTime } = ctx.query const { startTime, endTime } = ctx.query
try { try {
@ -477,15 +477,17 @@ async function spotCheckDetail (ctx) {
where: { where: {
checked: 'true' checked: 'true'
}, },
order: [['date', 'DESC']],
include: [{ include: [{
model: models.Department, model: models.Department,
attributes: ['name'] attributes: ['name']
}, { }, {
model: models.ReportSpotCheck, model: models.ReportSpotCheck,
where: { spotDate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } }, where: { spotDate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } },
order: [['id', 'DESC']], order: [['spot_date', 'DESC']],
include: [{ include: [{
model: models.Report, model: models.Report,
order: [['date', 'DESC']],
include: [{ include: [{
model: models.User, model: models.User,
attributes: ['name'] 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 }}> {isPatrol ? <Descriptions title="基础信息" bordered style={{ marginBottom: 20 }}>
{info.map(obj => { {info.map(obj => {
return ( 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' ? reportTypeText(data[obj.name]) : obj.name === 'reportType' ?
data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : '' 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> : obj.name === 'roadSectionStart' ? data[obj.name] + '-' + data['roadSectionEnd'] || '' : data[obj.name] || ''}</Descriptions.Item>
@ -170,7 +170,7 @@ const DetailForm = (props) => {
patrolContent.map(obj => { patrolContent.map(obj => {
return ( return (
obj.skip ? null : <Descriptions.Item label={obj.key}> 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> </Descriptions.Item>
) )
}) })

Loading…
Cancel
Save