diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index d14c28c3..0dffcbea 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -406,7 +406,7 @@ async function spotCheck (ctx) { }) let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) - const reportRes = findUsers.length && checkCount ? await models.Report.findAll({ + const reportRes = await findUsers.length && checkCount ? await models.Report.findAll({ where: { reportType: 'conserve', userId: { $in: findUsers }, @@ -436,10 +436,30 @@ async function spotCheck (ctx) { } })) } - + const rslt = findUsers.length && checkCount ? await models.ReportSpotCheckPreview.findAll({ + where: { + checked: 'true', + id: previewId + }, + include: [{ + model: models.Department, + attributes: ['name'] + }, { + model: models.ReportSpotCheck, + include: [{ + model: models.Report, + include: [{ + model: models.User, + attributes: ['name'] + }], + }] + } + ], + }) : [] + console.log('rslt111', rslt) await transaction.commit(); ctx.status = 200; - ctx.body = reportRes + ctx.body = rslt } catch (error) { await transaction.rollback(); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); @@ -453,19 +473,26 @@ async function spotCheckDetail (ctx) { const { models } = ctx.fs.dc const { startTime, endTime } = ctx.query try { - const res = await models.ReportSpotCheck.findAll({ + const res = await models.ReportSpotCheckPreview.findAll({ + where: { + checked: 'true' + }, include: [{ - model: models.Report, - where: { reportType: 'conserve' },//只查养护数据 + 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']], include: [{ - model: models.User, - attributes: ['name'] + model: models.Report, + include: [{ + model: models.User, + attributes: ['name'] + }], }] - }], - // offset: pageSize * currentIndex, - // limit: Number(pageSize), - where: { spotDate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } }, - order: [['id', 'DESC']] + } + ], }) ctx.body = res ctx.status = 200 diff --git a/api/app/lib/index.js b/api/app/lib/index.js index d6b9be07..97a86002 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -63,6 +63,9 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq ReportSpotCheck.belongsTo(Report, { foreignKey: 'reportId', targetKey: 'id' }); Report.hasMany(ReportSpotCheck, { foreignKey: 'reportId', sourceKey: 'id' }); + + ReportSpotCheck.belongsTo(ReportSpotCheckPreview, { foreignKey: 'prepareId', targetKey: 'id' }); + ReportSpotCheckPreview.hasMany(ReportSpotCheck, { foreignKey: 'prepareId', sourceKey: 'id' }); }; diff --git a/web/client/src/sections/fillion/components/fileTable.js b/web/client/src/sections/fillion/components/fileTable.js index 2982d33a..dd8464c1 100644 --- a/web/client/src/sections/fillion/components/fileTable.js +++ b/web/client/src/sections/fillion/components/fileTable.js @@ -67,7 +67,17 @@ const DetailList = (props) => { }, }); } + //处理预览的逻辑 + const preview = (url) => { + let link = encodeURI(url) || '' + if (link) + if (url.indexOf("pdf") !== -1 || url.indexOf("csv") !== -1 || url.indexOf("jpg") !== -1 || url.indexOf("png") !== -1) { + window.open(link) + } else { + window.open(`https://view.officeapps.live.com/op/view.aspx?src=${link}`) + } + } const columns = [ { title: '资料名称', @@ -140,12 +150,14 @@ const DetailList = (props) => { { showDeleteConfirm(record, filePath) }} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : ''} >删除 - { + + { preview(path) }}>预览 + {/* { ['.png', '.jpg'].some(item => item == record.fileExt) ? [, { setImgSrc({ imageView: true, imgSrc: path }) }}>预览] : '' - } + } */} {/* { ['.pdf'].some(item => item == record.fileExt) ? [, diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js index 6f3e83ad..4ab2e550 100644 --- a/web/client/src/sections/fillion/components/maintenanceTable.js +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import './protable.less' -import { Card, Button, DatePicker, Input, Modal, Spin, Image, message, Popover, Tree, Tooltip } from 'antd'; +import { Card, Button, DatePicker, Input, Modal, Spin, Image, message, Popover, Tree, Descriptions } from 'antd'; import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons'; import ProTable from '@ant-design/pro-table'; import { getReportList, getReportDetail } from '../actions/patrol'; @@ -13,6 +13,7 @@ import moment from 'moment'; import { getAllDepUsers } from '../actions/allDepUsers' import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../../organization/actions/user' import { reportTypeText } from './patrolTable' +import './maintenanceTable.less' const DetailForm = (props) => { const { visible, data, handleClose, loading } = props; @@ -61,87 +62,202 @@ const DetailForm = (props) => { { key: '养护后', name: 'conserveAfterPic' }, ]; + const roadInfo = [ + { key: '路面类型', name: 'roadType' }, + { key: '路面宽度/米', name: 'roadWidth' }, + { key: '错车道/个', name: 'wrongLane' }, + { key: '行道树/棵', name: 'roadsideTrees' }, + { key: '边沟/米', name: 'roadsideDitch' }, + { key: '护栏/米', name: 'guardrail' }, + { key: '标线/米', name: 'roadMarking' }, + ]; + const mantenanceInfo = [ + { key: '养护人员人数/人', name: 'maintenanceStaffCount' }, + { key: '修整路肩/平方米', name: 'shoulderRepair' }, + { key: '开挖、清理边沟/米', name: 'ditchCleaning' }, + { key: '修补沥青路面/平米', name: 'asphaltRepair' }, + { key: '修补水泥路面/平米', name: 'concreteRepair' }, + { key: '除草/米', name: 'grassMowing' }, + { key: '行道树刷白/株/公里', name: 'treeWhitening' }, + { key: '公里桩/百米桩刷漆/个', name: 'pileWhitening' }, + { key: '维修护栏/米', name: 'guardrailMaintenance' }, + { key: '修复端头/块', name: 'endHeadRepair' }, + { key: '其他', name: 'otherDescription' }, + ]; + const mantenancePic = [ + { key: '养护前图片', name: 'conserveBeforePic' }, + { key: '养护中图片', name: 'conserveUnderwayPic' }, + { key: '养护后图片', name: 'conserveAfterPic' }, + ]; const renderContent = (data) => { if (data) { + console.log('data1111', data) if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { - return keyList.map(obj => { - return
- {obj.key} - { - obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? - - : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? -
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { - return
- -
- }) : '暂无图片' - } -
: obj.name != 'videoUrl' ?
- - -
:
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { - return
-
- }) : '暂无视频' - } + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {reportTypeText(data['projectType']) || ''} + {data['codeRoad'] || ''} + {data['road'] || ''} + {data['roadSectionStart'] && data['roadSectionEnd'] ? data['roadSectionStart'] + '-' + data['roadSectionEnd'] : ''} + {data['address'] || ''} + + + {roadInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenanceInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenancePic.map(item => ( + +
+ {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'} +
+
+ ))} +
+ + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
- } + }) || '暂无视频'} +
+
+
+
+ -
- }) + // keyList.map(obj => { + // return
+ // {obj.key} + // { + // obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? + // + // : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
: obj.name != 'videoUrl' ?
+ // + + //
:
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { + // return
+ //
+ // }) : '暂无视频' + // } + //
+ // } + + //
+ // }) + + // } else { + // return keyListOld.map(obj => { + // return
+ // {obj.key} + // { + // obj.name != 'scenePic' && obj.name.indexOf('conserve') == -1 ? + // + // : + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
+ + // } + //
+ // }) + + // } } else { - return keyListOld.map(obj => { - return
- {obj.key} - { - obj.name != 'scenePic' && obj.name.indexOf('conserve') == -1 ? - - : + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {data['roadSectionStart'] && data['roadSectionEnd'] ? (data['roadSectionStart'] + '-' + data['roadSectionEnd']) : ''} + {data['codeRoad'] || ''} + {/* {data['code'] || ''} */} + {data['address'] || ''} + {data['content'] || ''} + + + {mantenancePic.map(item => ( +
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { - return
- -
- }) : '暂无图片' - } + {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'}
- - } -
- }) - + + ))} + + + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
+ }) || '暂无视频'} +
+
+
+
} } else { @@ -151,6 +267,8 @@ const DetailForm = (props) => { return ( { {renderContent(data)} - + ) } @@ -218,7 +336,7 @@ const DetailList = (props) => { dataIndex: 'projectType', align: 'center', render: (text, record) => { - return record.projectType?.length > 0 ? reportTypeText(text) : (record.codeRoad && record.codeRoad.length > 0) + return (record.codeRoad && record.codeRoad.length > 0) ? record.codeRoad[0] === 'X' ? '县道' : record.codeRoad[0] === 'Y' @@ -678,4 +796,4 @@ function mapStateToProps(state) { }; } -export default connect(mapStateToProps)(MaintenanceTable); \ No newline at end of file +export default connect(mapStateToProps)(MaintenanceTable) \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/maintenanceTable.less b/web/client/src/sections/fillion/components/maintenanceTable.less new file mode 100644 index 00000000..73351910 --- /dev/null +++ b/web/client/src/sections/fillion/components/maintenanceTable.less @@ -0,0 +1,19 @@ +.maintenanceNew { + .ant-descriptions-item-label { + width: 19%; + } + + .ant-descriptions-item-content { + width: 40px; + } +} + +.maintenanceOld { + .ant-descriptions-item-label { + width: 20%; + } + + .ant-descriptions-item-content { + width: 40px; + } +} diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index 78697ec5..62d58024 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import './protable.less' -import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select, Tree, Form } from 'antd'; +import { Card, Button, Popconfirm, Checkbox, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select, Tree, Form, Descriptions } from 'antd'; import ProTable from '@ant-design/pro-table'; import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { getReportList, getReportDetail, handleReport, getAnspectionNotificationPhone, addAnspectionNotificationPhone } from '../actions/patrol'; @@ -14,6 +14,7 @@ import NominateModal from '../components/feedback/nominateModal' //指派的模 import styles from './protable.less'; import moment from 'moment'; import NominateModalcopy from './feedback/nominateModalcopy';//指派的模块 +import './maintenanceTable.less' @@ -42,31 +43,60 @@ const DetailForm = (props) => { //('record12s', isAnomaly) const [qndmn] = useState(localStorage.getItem('qndmn')); - const keyList = [ - // { key: '编号', name: 'id' }, - // isPatrol ?'巡查管理详情' :isRoad ? '建设上报详情' : '异常反馈详情' - { key: '工程类型', name: 'projectType', skip: !isPatrol }, + // const keyList = [ + // // { key: '编号', name: 'id' }, + // // isPatrol ?'巡查管理详情' :isRoad ? '建设上报详情' : '异常反馈详情' + // { key: '工程类型', name: 'projectType', skip: !isPatrol }, + // { key: '反馈类型', name: 'projectType', skip: !isAnomaly }, + // { key: '工程名称', name: 'projectName', skip: !isRoad }, + // { key: '所在路段', name: 'road', skip: isPatrol }, + // { key: '具体位置', name: 'address', skip: isPatrol }, + // { key: '建设内容', name: 'content', skip: isPatrol }, + // { key: '路线代码', name: 'codeRoad', }, + // { key: '现场照片', name: 'scenePic', skip: isPatrol }, + // { key: '处理意见', name: 'handleOpinions', skip: !isAnomaly }, + // { key: '处理详情', name: 'handleContent', skip: !isAnomaly }, + // { key: '处理图片', name: 'handlePic', skip: !isAnomaly }, + // { key: '处理人', name: 'performerName', skip: !isAnomaly }, + // { key: '道路类型', name: 'reportType', skip: !isPatrol }, + // { key: '其他', name: 'projectType', skip: !isPatrol }, + // { key: '路线名称', name: 'road', skip: !isPatrol }, + // { key: '巡查路段', name: 'roadSectionStart', skip: !isPatrol }, + // { key: '具体位置', name: 'address', skip: !isPatrol }, + // { key: '巡查结果无异常', name: 'inspectionNoException', skip: !isPatrol }, + // // insectionNoException + // { key: '路面损坏', name: 'roadDamage', skip: !isPatrol }, + // { key: '安防损坏', name: 'securityDamage', skip: !isPatrol }, + // { key: '桥梁损坏', name: 'bridgeDamage', skip: !isPatrol }, + // { key: '涵洞损坏', name: 'culvertDamage', skip: !isPatrol }, + // { key: '安防缺失', name: 'ecurityDeficiency', skip: !isPatrol }, + // { key: '路域环境', name: 'encounteredEnvironment', skip: !isPatrol }, + // { key: '其他内容', name: 'otherDescription', skip: !isPatrol }, + // //{ key: '路线代码', name: 'codeRoad', skip: !isPatrol }, + // { key: '上报图片', name: 'scenePic', skip: !isPatrol }, + // { key: '上报视频', name: 'videoUrl', skip: !isPatrol }, + + + // ]; + + + const info = [ { key: '反馈类型', name: 'projectType', skip: !isAnomaly }, - { key: '工程名称', name: 'projectName', skip: !isRoad }, - { key: '所在路段', name: 'road', skip: isPatrol }, - { key: '具体位置', name: 'address', skip: isPatrol }, - { key: '巡查内容', name: 'content', skip: isPatrol }, - { key: '路线代码', name: 'codeRoad', skip: !isAnomaly && isPatrol }, - { key: '现场照片', name: 'scenePic', skip: isPatrol }, - { key: '处理意见', name: 'handleOpinions', skip: !isAnomaly }, - { key: '处理详情', name: 'handleContent', skip: !isAnomaly }, - { key: '处理图片', name: 'handlePic', skip: !isAnomaly }, - { key: '处理人', name: 'performerName', skip: !isAnomaly }, - { key: '路线代码', name: 'codeRoad', skip: !isPatrol }, - - + { key: '所在道路', name: 'road', skip: isRoad }, { key: '道路类型', name: 'reportType', skip: !isPatrol }, { key: '其他', name: 'projectType', skip: !isPatrol }, + { key: '路线代码', name: 'codeRoad', skip: isRoad }, { key: '路线名称', name: 'road', skip: !isPatrol }, + { key: '所属路段', name: 'roadSectionStart', skip: !isAnomaly }, { key: '巡查路段', name: 'roadSectionStart', skip: !isPatrol }, - { key: '具体位置', name: 'address', skip: !isPatrol }, + { key: '项目名称', name: 'projectName', skip: !isRoad }, + { key: '具体位置', name: 'address', }, + { key: '施工内容', name: 'content', skip: !isRoad }, + { key: '反馈内容', name: 'content', skip: !isAnomaly }, + + ] + const patrolContent = [ { key: '巡查结果无异常', name: 'inspectionNoException', skip: !isPatrol }, - // insectionNoException { key: '路面损坏', name: 'roadDamage', skip: !isPatrol }, { key: '安防损坏', name: 'securityDamage', skip: !isPatrol }, { key: '桥梁损坏', name: 'bridgeDamage', skip: !isPatrol }, @@ -74,127 +104,348 @@ const DetailForm = (props) => { { key: '安防缺失', name: 'ecurityDeficiency', skip: !isPatrol }, { key: '路域环境', name: 'encounteredEnvironment', skip: !isPatrol }, { key: '其他内容', name: 'otherDescription', skip: !isPatrol }, - //{ key: '路线代码', name: 'codeRoad', skip: !isPatrol }, - { key: '上报图片', name: 'scenePic', skip: !isPatrol }, - { key: '上报视频', name: 'videoUrl', skip: !isPatrol }, - - ]; - const keyListOld = [ - // { key: '编号', name: 'id' }, - // isPatrol ?'巡查管理详情' :isRoad ? '建设上报详情' : '异常反馈详情' - { key: '工程类型', name: 'projectType', skip: !isPatrol }, - { key: '反馈类型', name: 'projectType', skip: !isAnomaly }, - { key: '工程名称', name: 'projectName', skip: !isRoad }, - { key: '所在路段', name: 'road', skip: isRoad }, - { key: '具体位置', name: 'address' }, - { key: '巡查内容', name: 'content' }, - { key: '路线代码', name: 'codeRoad', skip: !isAnomaly && !isPatrol }, - { key: '现场照片', name: 'scenePic' }, - { key: '处理意见', name: 'handleAdvice', skip: !isAnomaly }, - { key: '处理详情', name: 'handleContent', skip: !isAnomaly }, - { key: '处理图片', name: 'handlePic', skip: !isAnomaly }, - { key: '处理人', name: 'performerName', skip: !isAnomaly } - ]; + ] + const pic = [ + { key: '现场图片', name: 'scenePic' }, + ] + const video = [ + { key: '视频', name: 'videoUrl' }, + + ] + + // const keyListOld = [ + // // { key: '编号', name: 'id' }, + // // isPatrol ?'巡查管理详情' :isRoad ? '建设上报详情' : '异常反馈详情' + // { key: '工程类型', name: 'projectType', skip: !isPatrol }, + // { key: '反馈类型', name: 'projectType', skip: !isAnomaly }, + // { key: '工程名称', name: 'projectName', skip: !isRoad }, + // { key: '所在路段', name: 'road', skip: isRoad }, + // { key: '具体位置', name: 'address' }, + // { key: '建设内容', name: 'content' }, + // { key: '路线代码', name: 'codeRoad', skip: !isAnomaly && !isPatrol }, + // { key: '现场照片', name: 'scenePic' }, + // { key: '处理意见', name: 'handleAdvice', skip: !isAnomaly }, + // { key: '处理详情', name: 'handleContent', skip: !isAnomaly }, + // { key: '处理图片', name: 'handlePic', skip: !isAnomaly }, + // { key: '处理人', name: 'performerName', skip: !isAnomaly } + // ]; const changeBoolean = (bool) => { return bool ? '无异常' : '有异常' } const renderContent = (data) => { if (data) { - // Object.keys(data).map(key => { - // }) - if ( - moment(data.time).isAfter(moment('2023-08-03 00:00:00')) - // (new Date(data.time + '') > new Date('2023-8-3')) - ) { - - return keyList.map(obj => { - return ( - obj.skip ? null : -
- {obj.key} - { - obj.name != 'handlePic' && obj.name != 'scenePic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? - - : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? -
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { - return
- -
- }) : '暂无图片' - } -
: obj.name != 'videoUrl' ?
- - -
:
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { - return
- -
- }) : '暂无视频' - } -
- } + if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { + return
+ {isPatrol ? + {info.map(obj => { + return ( + 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] || ''} + ) + })} + : null} + {isAnomaly ? + {info.map(obj => { + return ( + obj.skip ? null : { + obj.name === 'roadSectionStart' ? data[obj.name] + '-' + data['roadSectionEnd'] || '' : + obj.name === 'projectType' ? reportTypeText(data[obj.name]) + : data[obj.name] || ''} + ) + })} + : null} + {isRoad ? + {info.map(obj => { + return ( + obj.skip ? null : { + data[obj.name] || ''} + ) + })} + : null} + {isPatrol ? + { + patrolContent.map(obj => { + return ( + obj.skip ? null : + {obj.name === 'inspectionNoException' ? : data[obj.name] || ''} + + ) + }) + } + : null + } + + { + pic.map(obj => { + return ( + obj.skip ? null : +
+ {data[obj.name] && data[obj.name] instanceof Array && data[obj.name].length ? data[obj.name]?.map(videoSrc => { + return
+ +
+ }) : '暂无图片'} +
+
+ ) + }) + } +
+ {/* + { + pic.map(obj => { + return ( + +
+ {data[obj.name] && data[obj.name] instanceof Array && data[obj.name].length ? +
+ +
+ : '暂无图片'} +
+
+ ) + }) + } +
*/} + + { + video.map(obj => { + return ( + obj.skip ? null : +
+ {data[obj.name] && data[obj.name] instanceof Array ? data[obj.name]?.map(videoUrl => { + return
+ +
+ }) : '暂无视频'} +
+
+ ) + }) + } +
+ {isAnomaly ? + + {data['handleAdvice'] || ''} + + : ''} + {isAnomaly ? + + {data['performerName'] || ''} + + + {data['handleContent'] || ''} + + : ''} + {isAnomaly ? + +
+ {data['handlePic'] && data['handlePic'] instanceof Array && data['handlePic'].length ? data['handlePic']?.map(imgSrc => { + return
+ +
+ }) : '暂无图片'}
- ) - }) +
+
: ''} +
+ + // return keyList.map(obj => { + // return ( + // obj.skip ? null : + + //
+ // {obj.key} + // { + // obj.name != 'handlePic' && obj.name != 'scenePic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? + // + // : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
: obj.name != 'videoUrl' ?
+ // + + //
:
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { + // return
+ // + //
+ // }) : '暂无视频' + // } + //
+ // } + + //
+ // ) + // }) } else { - return keyListOld.map(obj => { - return ( - obj.skip ? null : -
- {obj.key} - { - obj.name != 'scenePic' && obj.name != 'handlePic' ? - - : + return
+ {isAnomaly ? + {[{ key: '反馈类型', name: 'projectType' }, + { key: '所属路段', name: 'roadSectionStart' }, + { key: '路线代码', name: 'codeRoad' }, + { key: '具体位置', name: 'address' }, + { key: '反馈内容', name: 'content' }].map(obj => { + return ( + { + obj.name === 'roadSectionStart' ? data[obj.name] + '-' + data['roadSectionEnd'] || '' : obj.name === 'projectType' ? reportTypeText(data[obj.name]) : data[obj.name] || ''} + ) + })} + : null} + {isPatrol ? + {[{ key: '道路类型', name: 'reportType' }, + { key: '巡查路段', name: 'roadSectionStart' }, + { key: '路线代码', name: 'codeRoad' }, + { key: '具体位置', name: 'address' }, + { key: '巡查内容', name: 'content' } + ].map(obj => { + return ( + { + obj.name === 'roadSectionStart' ? data[obj.name] + '-' + data['roadSectionEnd'] || '' : + obj.name === 'reportType' ? data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' + : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : '' + : data[obj.name] || ''} + ) + }) + } + : null} + {isRoad ? + {info.map(obj => { + return ( + obj.skip ? null : { + data[obj.name] || ''} + ) + })} + : null} + + { + pic.map(obj => { + return ( + obj.skip ? null :
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { - return
- -
- }) - : '暂无图片' - } + {data[obj.name] && data[obj.name] instanceof Array && data[obj.name].length ? data[obj.name]?.map(videoSrc => { + return
+ +
+ }) : '暂无图片'}
+
+ ) + }) + } +
+ + { + video.map(obj => { + return ( + obj.skip ? null : +
- } + {data[obj.name] && data[obj.name] instanceof Array ? data[obj.name]?.map(videoUrl => { + return
+ +
+ }) : '暂无视频'} +
+
+ ) + }) + } +
+ {isAnomaly ? + + {data['handleAdvice'] || ''} + + : ''} + {isAnomaly ? + + {data['performerName'] || ''} + + + {data['handleContent'] || ''} + + : ''} + {isAnomaly ? + +
+ {data['handlePic'] && data['handlePic'] instanceof Array && data['handlePic'].length ? data['handlePic']?.map(imgSrc => { + return
+ +
+ }) : '暂无图片'}
- ) - }) +
+
: ''} + +
+ // return keyListOld.map(obj => { + // return ( + // obj.skip ? null : + //
+ // {obj.key} + // { + // obj.name != 'scenePic' && obj.name != 'handlePic' ? + // + // : + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) + // : '暂无图片' + // } + //
+ + // } + //
+ // ) + // }) } } else { @@ -206,6 +457,7 @@ const DetailForm = (props) => { return ( { dataIndex: 'projectType', align: 'center', render: (text, record) => { - return record.projectType?.length > 0 ? reportTypeText(text) : (record.codeRoad && record.codeRoad.length > 0) + return record.projectType?.length > 0 ? reportTypeText(text) : (record.codeRoad && !isAnomaly && record.codeRoad.length > 0) ? record.codeRoad[0] === 'X' ? '县道' : record.codeRoad[0] === 'Y' @@ -335,12 +587,18 @@ const DetailList = (props) => { return `${record.roadSectionStart || ''}-${record.roadSectionEnd || ''}` } } : '', - { + isPatrol || isAnomaly ? { title: '具体位置', key: 'address', dataIndex: 'address', align: 'center' - }, + } : '', + isRoad ? { + title: '建设内容', + key: 'content', + dataIndex: 'content', + align: 'center' + } : '', { title: '上报人', width: 100, @@ -702,6 +960,7 @@ const PatrolNameList = (props) => { const PatrolTable = (props) => { const { allDepUsers, clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname, anspectionNotificationPhoneList } = props; const [record, setRecord] = useState(1); + // const [recordCopy, setRecordCopy] = useState(); const [dateRange, setDateRange] = useState(); const [selectProjectType, setSelectProjectType] = useState(''); const [detailVisible, setDetailVisible] = useState(false) @@ -724,6 +983,7 @@ const PatrolTable = (props) => { if (userList && userList instanceof Array && reportDetail && reportDetail instanceof Object) { setReportDetailCopy(Object.assign(reportDetail, { performerName: userList.find(item => item.id === reportDetail.performerId)?.name })) } + }, [userList, reportDetail]) useEffect(() => { @@ -761,7 +1021,6 @@ const PatrolTable = (props) => { // setRecord(userList[0]); } }, [activeTabKey1]) - const handelRefresh = () => { let query = { userId: record.id, reportType: reportType, asc: true } dispatch(getReportList(query)); diff --git a/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js b/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js index c14e948a..41c2eab7 100644 --- a/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js +++ b/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js @@ -1,11 +1,11 @@ import { connect } from 'react-redux'; import React, { useEffect, useState } from 'react'; -import { Button, Modal, Form, Input, Divider, Spin, Image, DatePicker } from 'antd' +import { Button, Modal, Form, Input, Divider, Spin, Image, DatePicker, Descriptions, Table } from 'antd' import ProTable from '@ant-design/pro-table'; import { getReportSpotPrepare, getSpotCheck, getSpotCheckDetail } from '../actions/extract' import { getReportDetail } from '../actions/patrol'; import moment from 'moment' - +import '../components/maintenanceTable.less' const DetailForm = (props) => { @@ -79,91 +79,205 @@ const DetailForm = (props) => { { key: '养护后', name: 'conserveAfterPic' }, ]; + const roadInfo = [ + { key: '路面类型', name: 'roadType' }, + { key: '路面宽度/米', name: 'roadWidth' }, + { key: '错车道/个', name: 'wrongLane' }, + { key: '行道树/棵', name: 'roadsideTrees' }, + { key: '边沟/米', name: 'roadsideDitch' }, + { key: '护栏/米', name: 'guardrail' }, + { key: '标线/米', name: 'roadMarking' }, + ]; + const mantenanceInfo = [ + { key: '养护人员人数/人', name: 'maintenanceStaffCount' }, + { key: '修整路肩/平方米', name: 'shoulderRepair' }, + { key: '开挖、清理边沟/米', name: 'ditchCleaning' }, + { key: '修补沥青路面/平米', name: 'asphaltRepair' }, + { key: '修补水泥路面/平米', name: 'concreteRepair' }, + { key: '除草/米', name: 'grassMowing' }, + { key: '行道树刷白/株/公里', name: 'treeWhitening' }, + { key: '公里桩/百米桩刷漆/个', name: 'pileWhitening' }, + { key: '维修护栏/米', name: 'guardrailMaintenance' }, + { key: '修复端头/块', name: 'endHeadRepair' }, + { key: '其他', name: 'otherDescription' }, + ]; + const mantenancePic = [ + { key: '养护前图片', name: 'conserveBeforePic' }, + { key: '养护中图片', name: 'conserveUnderwayPic' }, + { key: '养护后图片', name: 'conserveAfterPic' }, + ]; const renderContent = (data) => { if (data) { + console.log('data1111', data) if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { - return keyList.map(obj => { - return
- {obj.key} - { - obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? - - : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? -
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { - return
- -
- }) : '暂无图片' - } -
: obj.name != 'videoUrl' ?
- - -
:
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { - return
- -
- }) : '暂无视频' - } + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {reportTypeText(data['projectType']) || ''} + {data['codeRoad'] || ''} + {data['code'] || ''} + {data['roadSectionStart'] + '-' + data['roadSectionEnd'] || ''} + {data['address'] || ''} + + + {roadInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenanceInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenancePic.map(item => ( + +
+ {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'} +
+
+ ))} +
+ + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
- } + }) || '暂无视频'} +
+
+
+
+ // if (data) { + // if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { + // return keyList.map(obj => { + // return
+ // {obj.key} + // { + // obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? + // + // : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
: obj.name != 'videoUrl' ?
+ // -
- }) + //
:
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { + // return
+ // + //
+ // }) : '暂无视频' + // } + //
+ // } + + //
+ // }) + + // } else { + // return keyListOld.map(obj => { + // return
+ // {obj.key} + // { + // obj.name != 'scenePic' && obj.name.indexOf('conserve') == -1 ? + // + // : + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
+ + // } + //
+ // }) + + // } } else { - return keyListOld.map(obj => { - return
- {obj.key} - { - obj.name != 'scenePic' && obj.name.indexOf('conserve') == -1 ? - - : + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {data['roadSectionStart'] && data['roadSectionEnd'] ? (data['roadSectionStart'] + '-' + data['roadSectionEnd']) : ''} + {data['codeRoad'] || ''} + {/* {data['code'] || ''} */} + {data['address'] || ''} + {data['content'] || ''} + + + {mantenancePic.map(item => ( +
- { - data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { - return
- -
- }) : '暂无图片' - } + {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'}
- - } -
- }) - + + ))} + + + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
+ }) || '暂无视频'} +
+
+
+
} - } else { return '暂无数据' } @@ -261,6 +375,7 @@ const DetailForm = (props) => { // } return ( { } const MaintenanceSpotCheck = (props) => { const { dispatch, user, loading, reportDetail, reportDetailLoading } = props - const [data, setData] = useState() + const [data, setData] = useState()//外层表格的数据 const [vis, setVis] = useState(false)//模态框的显示与隐藏变量 const [count, setCount] = useState(0) const [depId, setDepId] = useState(0) @@ -285,10 +400,11 @@ const MaintenanceSpotCheck = (props) => { const [detailVisible, setDetailVisible] = useState(false) const [dateRange, setDateRange] = useState(['1970-1-1', '2099-12-31']); const { RangePicker } = DatePicker + const [expandedRowKeys, setExpandedRowKeys] = useState([]); //console.log('reportData', reportData) const checkDetail = (record) => { - dispatch(getReportDetail(record.report?.id)) + dispatch(getReportDetail(record?.id)) } const handleOpen = () => { setDetailVisible(true) @@ -296,6 +412,8 @@ const MaintenanceSpotCheck = (props) => { const handleClose = () => { setDetailVisible(false) } + + //里层列名 const columns = [ { title: '抽查日期', @@ -305,80 +423,46 @@ const MaintenanceSpotCheck = (props) => { // render: (_, record) => { // return // } - }, , - { - title: '工程类型', - key: 'projectType', - dataIndex: 'projectType', - align: 'center', - render: (_, record) => { - return '养护' - } - }, - { - title: '所属道路', - key: 'road', - dataIndex: 'road', - align: 'center', - render: (_, record) => { - return record?.report?.road - } }, { - title: '所在路段', - key: 'address', - dataIndex: 'address', + title: '抽查乡镇', + key: 'projectType', + dataIndex: 'depName', align: 'center', - render: (_, record) => { - return `${record?.report?.roadSectionStart || ''}-${record?.report?.roadSectionEnd || ''}` - } + }, { - title: '具体位置', - key: 'address', - dataIndex: 'address', + title: '抽查数量', + key: 'count', + dataIndex: 'count', align: 'center', - render: (_, record) => { - return record?.report?.address - } + }, { - title: '上报人', - width: 100, - key: 'userName', - dataIndex: 'userName', - align: 'center', - render: (text, record) => { - return record?.report?.user?.name || '' - } - }, { - title: '上报时间', - key: 'time', - dataIndex: 'time', - valueType: 'dateTime', + title: '抽查总数', + key: 'reportCount', + dataIndex: 'reportCount', align: 'center', - render: (_, record) => { - return moment(record?.report?.time).format('YYYY-MM-DD HH:mm:ss') - } + }, - { - title: '操作', - key: 'caozuo', - align: 'center', - render: (_, record) => { - return - } - } + ] const queryData = (query = { startTime: '1970-1-1', endTime: '2099-12-31' }) => { dispatch(getSpotCheckDetail(query)).then(res => { if (res.success) { - const data = res.payload.data?.map(item => { - return { report: item.report, spotDate: item.spotDate } - } - ) + const data = res?.payload.data?.map(item => { + return { + spotDate: moment(item.date).format('YYYY-MM-DD'), + depName: item.department?.name, + reportCount: item.reportCount, + count: Math.ceil((item.reportCount * item.percentage) / 100), + reportDetail: item.reportSpotChecks?.map(child => { + return child.report + }), + id: item.id + } + }) + console.log('data1', data) setReportData(data) } }) @@ -395,11 +479,12 @@ const MaintenanceSpotCheck = (props) => { form.validateFields(['percentValue']).then(async (values) => { if (Number(values.percentValue) > 0) { const res = await dispatch(getReportSpotPrepare({ percentage: Number(values.percentValue) })) - setCount(res?.payload.data?.reportCount) - setDepId(res?.payload.data?.lukyDepartment?.id) - setDepName(res?.payload.data?.lukyDepartment?.name) + // setCount(res?.payload.data?.reportCount) + // setDepId(res?.payload.data?.lukyDepartment?.id) + // setDepName(res?.payload.data?.lukyDepartment?.name) setPreviewId(res?.payload.data?.previewId) - setTotal(((res?.payload.data?.reportCount) * Number(values.percentValue)) / 100) + // setTotal(Math.ceil((res?.payload.data?.reportCount) * (Number(values.percentValue) / 100))) + form.setFieldsValue({ 'result': res?.payload.data?.reportCount, 'village': res?.payload.data?.lukyDepartment?.name, @@ -415,19 +500,31 @@ 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) + const rslt = res.payload.data.map(item => { + return { + spotDate: moment(item.date).format('YYYY-MM-DD'), + depName: item.department?.name, + reportCount: item.reportCount, + count: Math.ceil((item.reportCount * item.percentage) / 100), + reportDetail: item.reportSpotChecks?.map(child => { + return child.report + }), + id: item.id + } + }) || [] + setReportData(rslt) form.resetFields() setVis(false) } } + console.log('setReportData', reportData) + const lookhandler = () => { if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { queryData({ startTime: moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime: moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') }) } } + return (
@@ -438,12 +535,70 @@ const MaintenanceSpotCheck = (props) => { columns={columns} dataSource={reportData} loading={loading} + expandable={{ + //expandedRowKeys, // 控制哪些行展开,这里需要通过 state 管理 + defaultExpandedRowKeys: ['0'], + // onExpand: handleExpand, + expandedRowRender: (record) => ( + < Table + pagination={false} + dataSource={record?.reportDetail} + columns={ + [ + { title: '所属道路', dataIndex: 'road' }, + { + title: '所在路段', + key: 'address', + dataIndex: 'address', + align: 'center', + render: (_, r) => { + return `${r?.roadSectionStart || ''}-${r?.roadSectionEnd || ''}` + } + }, + { title: '具体位置', dataIndex: 'address' }, + { + title: '上报人', + width: 100, + key: 'userName', + dataIndex: 'userName', + align: 'center', + render: (text, r) => { + return r?.user?.name || '' + } + }, + { + title: '上报时间', + key: 'time', + dataIndex: 'time', + valueType: 'dateTime', + align: 'center', + render: (_, r) => { + return moment(r?.time).format('YYYY-MM-DD HH:mm:ss') + } + }, + { + title: '操作', + key: 'caozuo', + align: 'center', + render: (_, r) => { + return + } + } + // { title: '', dataIndex: 'subColumn1' }, + // { title: '', dataIndex: 'subColumn2' }, + // ... 其他子表格列配置 + ]} + /> + ), + }} pagination={{ pageSize: 10, defaultPageSize: 10, showSizeChanger: false, }} - rowKey="key" + rowKey={(record) => { return record.id }} toolBarRender={false} search={false} />