diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index dff093c8..0119c34f 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -401,12 +401,17 @@ async function spotCheck (ctx) { let findUsers = [] findUsers = userRes.map(item => { return item.id - }) - let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) + }) + let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) + const reportRes = findUsers.length && checkCount ? await models.Report.findAll({ where: { reportType: 'conserve', - userId: { $in: findUsers } + userId: { $in: findUsers }, + include: [{ + model: models.User, + attributes: ['name'] + }] }, order: sequelize.random(), // 随机排序 limit: checkCount, // 限制返回的记录数 @@ -419,7 +424,6 @@ async function spotCheck (ctx) { id: previewId } }) - if (reportRes.length) { let spotDate = moment().format('YYYY-MM-DD') await models.ReportSpotCheck.bulkCreate(reportRes.map(r => { diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js index fcd312af..3081015f 100644 --- a/web/client/src/sections/fillion/components/maintenanceTable.js +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -20,6 +20,7 @@ const DetailForm = (props) => { const keyList = [ { key: '道路类型', name: 'reportType' }, { key: '其他', name: 'projectType' }, + { key: '路线代码', name: 'codeRoad' }, { key: '路线名称', name: 'road' }, { key: '养护路段', name: 'roadSectionStart' }, { key: '具体位置', name: 'address' }, @@ -215,8 +216,9 @@ const DetailList = (props) => { key: 'projectType', dataIndex: 'projectType', align: 'center', - render: (text, record) => { - return reportTypeText(text) + render: (text, record) => { + return record.projectType.length > 0 ? reportTypeText(text) : record.codeRoad.length > 0 ? record.codeRoad[0] === 'X' ? '县道' + : record.codeRoad[0] === 'Y' ? '乡道' : '村道' : '' } }, { title: '所属道路', diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index c75e360f..ab6d56e6 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -53,6 +53,7 @@ const DetailForm = (props) => { { key: '处理详情', name: 'handleContent', skip: !isAnomaly }, { key: '处理图片', name: 'handlePic', skip: !isAnomaly }, { key: '处理人', name: 'performerName', skip: !isAnomaly }, + { key: '路线代码', name: 'codeRoad', skip: !isPatrol }, { key: '道路类型', name: 'reportType', skip: !isPatrol }, @@ -72,6 +73,7 @@ const DetailForm = (props) => { //{ key: '路线代码', name: 'codeRoad', skip: !isPatrol }, { key: '上报图片', name: 'scenePic', skip: !isPatrol }, { key: '上报视频', name: 'videoUrl', skip: !isPatrol }, + ]; const keyListOld = [ // { key: '编号', name: 'id' }, @@ -248,6 +250,24 @@ const DetailList = (props) => { let basicDate = null; let counter = 0; //指派任务 + const reportTypeText = (text) => { + switch (text) { + case 'road': return '道路'; + // + case 'countyRoad': return '县道'; + case 'villageRoad': return '乡道'; + case 'rusticRoad': return '村道'; + // + case 'bridge': return '桥梁'; + case 'culvert': return '涵洞'; + case 'other': return '其他'; + // + case 'conserve': return '养护'; + case 'patrol': return '巡查'; + case 'construction': return '在建'; + default: return text; + } + } const columns = [ // isPatrol ? { // title: '编号1', @@ -275,22 +295,8 @@ const DetailList = (props) => { dataIndex: 'projectType', align: 'center', render: (text, record) => { - switch (text) { - case 'road': return '道路'; - // - case 'countyRoad': return '县道'; - case 'villageRoad': return '乡道'; - case 'rusticRoad': return '村道'; - // - case 'bridge': return '桥梁'; - case 'culvert': return '涵洞'; - case 'other': return '其他'; - // - case 'conserve': return '养护'; - case 'patrol': return '巡查'; - case 'construction': return '在建'; - default: return text; - } + return record.projectType.length > 0 ? reportTypeText(text) : record.codeRoad.length > 0 ? record.codeRoad[0] === 'X' ? '县道' + : record.codeRoad[0] === 'Y' ? '乡道' : '村道' : '' } } : '', isRoad ? diff --git a/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js b/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js index 3e1b430f..a0d52294 100644 --- a/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js +++ b/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js @@ -39,6 +39,7 @@ const DetailForm = (props) => { { key: '其他', name: 'projectType' }, { key: '道路类型', name: 'reportType' }, { key: '路线名称', name: 'road' }, + { key: '路线代码', name: 'codeRoad' }, { key: '养护路段', name: 'roadSectionStart' }, { key: '具体位置', name: 'address' }, { key: '路面类型', name: 'roadType' }, @@ -413,6 +414,10 @@ const MaintenanceSpotCheck = (props) => { const okHandler = async () => { if (previewId !== 0) { const res = await dispatch(getSpotCheck({ previewId })) + const data = res.payload.data?.map(item => { + return { report: item } + }) + setReportData(data) form.resetFields() setVis(false) } @@ -476,7 +481,7 @@ const MaintenanceSpotCheck = (props) => { -