From 2911823934465935f9885c3ca9bda651219d5e99 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Wed, 2 Aug 2023 14:49:53 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 62 +++++++++++++++++------------ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 319ae94f..2916ca25 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -399,10 +399,6 @@ const Index = () => { } }, []) - useEffect(() => { - setRoadStartSel(sourceRoadStartSel) - setRoadEndSel(sourceRoadEndSel) - }, [sourceRoadStartSel, sourceRoadEndSel]) useEffect(() => { setTypeList([ { @@ -576,32 +572,41 @@ const Index = () => { case "roadCodeEnd": setRoadCodeEnd(value) if (value.length >= 9) { + let routeCode = '' + let roadStart = [] + let roadEnd = [] + let routeName = '' for (const r of roadList) { if (r.routeCode === roadCodeHead + value) { - setRoad(r.routeName) - setRoadSectionStart(r.startingPlaceName) - setRoadSectionEnd(r.stopPlaceName) - request.get(getReportList(), { limit: 1, page: 0, codeRoad: r.routeCode }).then(res => { - if (res.statusCode === 200 && res.data.length) { - request.get(getReportDetail(res.data[0].id)).then(detailRes => { - if (res.statusCode === 200) { - let nextInfo = { ...conserveInfo } - Object.keys(conserveInfo).forEach(key => { - if (detailRes.data[key]) nextInfo[key].value = detailRes.data[key] - }) - setConserveInfo(nextInfo) - setPatrolContentEdit(false) - } else { - setPatrolContentEdit(true) - } - }) - } else { - setPatrolContentEdit(true) - } - }) - break; + roadStart.push(r.startingPlaceName) + roadEnd.push(r.stopPlaceName) + routeCode = r.routeCode + routeName = r.routeName } } + setRoadStartSel(roadStart) + setRoadEndSel(roadEnd) + if (routeName) setRoad(routeName) + if (kind === 'conserve' && routeCode) { + request.get(getReportList(), { limit: 1, page: 0, codeRoad: routeCode }).then(res => { + if (res.statusCode === 200 && res.data.length) { + request.get(getReportDetail(res.data[0].id)).then(detailRes => { + if (res.statusCode === 200) { + let nextInfo = { ...conserveInfo } + Object.keys(conserveInfo).forEach(key => { + if (detailRes.data[key]) nextInfo[key].value = detailRes.data[key] + }) + setConserveInfo(nextInfo) + setPatrolContentEdit(false) + } else { + setPatrolContentEdit(true) + } + }) + } else { + setPatrolContentEdit(true) + } + }) + } } break; case "conserveInfo": @@ -611,6 +616,11 @@ const Index = () => { break; case "conserveContent": let nextContent = { ...conserveContent } + if (value.split('.')[1] && value.split('.')[1].length > 3) { + setConserveContent(nextContent) + Taro.showToast({ title: '最多输入三位小数', icon: 'none', duration: 1500 }) + return; + } nextContent[key].value = value setConserveContent(nextContent) break; From 539050b3dbf895663466359142578c37db59b020 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Wed, 2 Aug 2023 15:53:03 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=B7=A1=E6=9F=A5/?= =?UTF-8?q?=E5=85=BB=E6=8A=A4=E4=B8=8A=E6=8A=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 2916ca25..fa5b153e 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -11,6 +11,7 @@ import { getState } from '../../store/globalState'; import { postReport, getReportList, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle } from '@/services/api'; import './index.scss'; import arrowIcon from '../../static/img/patrol/arrow-down.svg'; +import dayjs from 'dayjs'; const { baseUrl, imgUrl } = environment; @@ -197,6 +198,7 @@ const Index = () => { unit: '块', }, }) + const [isBeforeReport, setIsBeforeReport] = useState(false) // V1.1.0上报内容修改,查看时根据时间判断展示逻辑) const prjType = isAnomaly ? @@ -286,7 +288,7 @@ const Index = () => { setConserveUnderwayPic(data.conserveUnderwayPic ? data.conserveUnderwayPic.map(item => ({ url: imgUrl + item })) : []) setConserveAfterPic(data.conserveAfterPic ? data.conserveAfterPic.map(item => ({ url: imgUrl + item })) : []) setHandleId(data.id) - setVideo(data.videoUrl[0] ? imgUrl + data.videoUrl[0] : '') + setVideo((data.videoUrl && data.videoUrl[0]) ? imgUrl + data.videoUrl[0] : '') setRoadCodeHead(data.codeRoad ? data.codeRoad.slice(0, 1) : '') setRoadCodeEnd(data.codeRoad ? data.codeRoad.slice(1) : '') if (data.reportType === 'patrol') { @@ -314,6 +316,7 @@ const Index = () => { if (data.handleContent) { setHandleCenter(data.handleContent) } + setIsBeforeReport(dayjs(data.time).diff('2023-08-02', 'd') < 0) } else { Taro.showToast({ title: res.data.message || '请求出错', icon: 'none' }) } @@ -900,7 +903,7 @@ const Index = () => { { isPatrol ? <> - + {!(isView && isBeforeReport) && 线路编码: { setRoadCodeHead(e.detail.value[0]); @@ -917,13 +920,19 @@ const Index = () => { onInput={e => handleInput(e, 'roadCodeEnd')} disabled={isView} /> - + } 道路类型: { }} disabled={true} /> @@ -1004,7 +1013,7 @@ const Index = () => { /> : '' } { - isAnomaly ? + isAnomaly || (isView && isBeforeReport) ? { /> { - kind === 'patrol' && + (kind === 'patrol' && !(isView && isBeforeReport)) && 巡查内容 @@ -1160,7 +1169,7 @@ const Index = () => { } { - !isPatrol ? Date: Wed, 2 Aug 2023 16:10:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=85=BB=E6=8A=A4=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B6=E4=BB=96=E5=85=BB=E6=8A=A4=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index fa5b153e..08fc96bc 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -198,6 +198,7 @@ const Index = () => { unit: '块', }, }) + const [otherDescription, setOtherDescription] = useState('') // 其他养护内容 const [isBeforeReport, setIsBeforeReport] = useState(false) // V1.1.0上报内容修改,查看时根据时间判断展示逻辑) const prjType = @@ -312,6 +313,7 @@ const Index = () => { if (data[key]) nextContent[key].value = data[key] }) setConserveContent(nextContent) + setOtherDescription(data.otherDescription) } if (data.handleContent) { setHandleCenter(data.handleContent) @@ -425,7 +427,7 @@ const Index = () => { || (kind === 'patrol' && Object.values(patrolContent).every(c => c.value.trim() === '') && !patrolContent.巡查结果无异常.selected) || (kind === 'conserve' && (Object.values(conserveInfo).every(c => c.value.trim() === '') - || Object.values(conserveContent).every(c => c.value.trim() === ''))) + || (Object.values(conserveContent).every(c => c.value.trim() === '') && !otherDescription))) ) { Taro.showToast({ title: '请完善必填信息', icon: 'none' }) return @@ -482,6 +484,7 @@ const Index = () => { Object.keys(conserveContent).forEach(key => { data[key] = Number(conserveContent[key].value) }) + data.otherDescription = otherDescription } } @@ -627,6 +630,9 @@ const Index = () => { nextContent[key].value = value setConserveContent(nextContent) break; + case "otherDescription": + setOtherDescription(value) + break; case "contentCheck": let nextCheck = { ...patrolContent } Object.keys(patrolContent).forEach(key => { @@ -1164,6 +1170,17 @@ const Index = () => { {conserveContent[key].unit} ) } + + 其他: + handleInput(e, 'otherDescription')} + disabled={isView} + /> + From c893d5e305e6f8e8d40f2ad0cf82572a04922298 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Wed, 2 Aug 2023 16:55:38 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 42 ++++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 08fc96bc..d93ecb44 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -424,10 +424,12 @@ const Index = () => { if ( (isPatrol && (!projectType || !road || !roadCodeEnd)) || (isAnomaly && !road) - || (kind === 'patrol' && Object.values(patrolContent).every(c => c.value.trim() === '') && !patrolContent.巡查结果无异常.selected) + || (kind === 'patrol' + && (Object.values(patrolContent).every(c => c.value === '') && !patrolContent.inspectionNoException.selected + || Object.values(patrolContent).some(c => c.selected && c.value === ''))) || (kind === 'conserve' - && (Object.values(conserveInfo).every(c => c.value.trim() === '') - || (Object.values(conserveContent).every(c => c.value.trim() === '') && !otherDescription))) + && (Object.values(conserveInfo).every(c => c.value === '') + || (Object.values(conserveContent).every(c => c.value === '') && !otherDescription))) ) { Taro.showToast({ title: '请完善必填信息', icon: 'none' }) return @@ -921,8 +923,9 @@ const Index = () => { handleInput(e, 'roadCodeEnd')} disabled={isView} /> @@ -1277,26 +1280,27 @@ const Index = () => { /> } - {/* - - 养护中 - { - isView ? + isView && isBeforeReport ? <> + + + 养护中 + {conserveUnderwayPic.map(item => ( handleImgClick(undefined, item)} /> ))} - : - = 3 ? false : true} - files={conserveUnderwayPic} - onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')} - onImageClick={handleImgClick} - /> - } */} + + : null + // = 3 ? false : true} + // files={conserveUnderwayPic} + // onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')} + // onImageClick={handleImgClick} + // /> + } From d1d2df09185e02279360504c7273c21fa3ea9ea2 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Wed, 2 Aug 2023 17:01:06 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=85=BB?= =?UTF-8?q?=E6=8A=A4=E6=9F=A5=E7=9C=8B=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index d93ecb44..d9a094ee 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -1091,7 +1091,7 @@ const Index = () => { /> { - (kind === 'patrol' && !(isView && isBeforeReport)) && + kind === 'patrol' && !(isView && isBeforeReport) && 巡查内容 @@ -1116,7 +1116,7 @@ const Index = () => { } { - kind === 'conserve' && + kind === 'conserve' && !(isView && isBeforeReport) && 养护基本信息 From 0b3ccbe579a33ed94c12665c0c6b19374e337b79 Mon Sep 17 00:00:00 2001 From: zhaobing Date: Wed, 2 Aug 2023 17:31:41 +0800 Subject: [PATCH 6/6] =?UTF-8?q?feat:=E5=8E=86=E5=8F=B2bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8A=A0=E5=87=A0=E4=B8=AA=E8=8F=9C=E5=8D=95=E5=86=B2?= =?UTF-8?q?=E6=B4=97=E4=BD=A0=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 57 +- api/app/lib/models/report.js | 922 +++++++++--------- api/app/lib/routes/report/index.js | 5 +- scripts/1.3.0/schema/4.insert_resource .sql | 1 + scripts/1.3.0/schema/5.update_statistic.sql | 5 + .../src/sections/fillion/actions/extract.js | 42 + .../src/sections/fillion/actions/index.js | 5 +- .../components/feedback/nominateModal.js | 42 +- .../components/feedback/nominateModalcopy.js | 131 +++ .../fillion/components/highwaysTable.js | 4 +- .../fillion/components/maintenanceTable.js | 233 +++-- .../fillion/components/patrolTable.js | 259 +++-- .../src/sections/fillion/containers/index.js | 3 +- .../containers/maintenanceSpotCheck.js | 499 ++++++++++ web/client/src/sections/fillion/nav-item.js | 7 +- web/client/src/sections/fillion/routes.js | 11 +- .../organization/containers/authority.js | 2 +- web/client/src/utils/webapi.js | 3 + 18 files changed, 1560 insertions(+), 671 deletions(-) create mode 100644 scripts/1.3.0/schema/4.insert_resource .sql create mode 100644 scripts/1.3.0/schema/5.update_statistic.sql create mode 100644 web/client/src/sections/fillion/actions/extract.js create mode 100644 web/client/src/sections/fillion/components/feedback/nominateModalcopy.js create mode 100644 web/client/src/sections/fillion/containers/maintenanceSpotCheck.js diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 0e1067a8..478529e3 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -1,7 +1,8 @@ 'use strict'; const { QueryTypes } = require('sequelize'); -const moment = require('moment') -async function reportList (ctx) { +const moment = require('moment'); + +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 @@ -43,7 +44,7 @@ async function reportList (ctx) { where: { }, - attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'performerId', 'roadSectionEnd', 'reportType', + attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'performerId', 'roadSectionEnd', 'reportType', 'address', 'content', 'longitude', 'latitude', 'projectName', 'handleState', 'codeRoad', 'handleContent', 'handlePic', 'videoUrl'], include: [{ model: models.User, @@ -78,7 +79,7 @@ async function reportList (ctx) { } } if (userId) { - findOption.where.userId = userId + findOption.where.userId = { $in: userId.split(',').map(Number) } } if (findUsers.length) { findOption.where.userId = { $in: findUsers } @@ -145,7 +146,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 @@ -195,7 +196,7 @@ async function reportPosition (ctx) { } } -async function reportDetail (ctx) { +async function reportDetail(ctx) { try { const models = ctx.fs.dc.models; const { reportId } = ctx.params @@ -217,7 +218,7 @@ async function reportDetail (ctx) { } } -async function reportHandle (ctx) { +async function reportHandle(ctx) { try { const { models } = ctx.fs.dc; @@ -247,7 +248,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; @@ -269,7 +270,7 @@ async function createReport (ctx) { } } -async function deleteReport (ctx) { +async function deleteReport(ctx) { try { const models = ctx.fs.dc.models; const { reportId } = ctx.params; @@ -292,12 +293,11 @@ 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; const { percentage } = ctx.request.body; - const departmentIdRes = await models.Department.findAll({ attributes: ['id', 'name'], where: { @@ -365,7 +365,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; @@ -442,10 +442,41 @@ async function spotCheck (ctx) { } } } +async function spotCheckDetail(ctx) { + const { models } = ctx.fs.dc + console.log('txc1', ctx.query) + const { startTime, endTime } = ctx.query + try { + const res = await models.ReportSpotCheck.findAll({ + include: [{ + model: models.Report, + where: { reportType: 'conserve' },//只查养护数据 + 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 + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`) + ctx.status = 400 + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } + +} + module.exports = { reportList, reportPosition, reportDetail, createReport, deleteReport, reportHandle, - spotPrepare, spotCheck, + spotPrepare, spotCheck, spotCheckDetail }; \ No newline at end of file diff --git a/api/app/lib/models/report.js b/api/app/lib/models/report.js index cc5eacb2..eb532b72 100644 --- a/api/app/lib/models/report.js +++ b/api/app/lib/models/report.js @@ -3,465 +3,465 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Report = sequelize.define("report", { - id: { - index: 1, - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "report_id_uindex" - }, - reportType: { - index: 2, - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "上报类型", - primaryKey: false, - field: "report_type", - autoIncrement: false - }, - projectType: { - index: 3, - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "工程类型", - primaryKey: false, - field: "project_type", - autoIncrement: false - }, - road: { - index: 4, - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: '所属道路', - primaryKey: false, - field: "road", - autoIncrement: false - }, - roadSectionStart: { - index: 5, - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: '开始路段', - primaryKey: false, - field: "road_section_start", - autoIncrement: false - }, - roadSectionEnd: { - index: 6, - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: '结束路段', - primaryKey: false, - field: "road_section_end", - autoIncrement: false - }, - longitude: { - index: 7, - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: '经度', - primaryKey: false, - field: "longitude", - autoIncrement: false - }, - latitude: { - index: 8, - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: '纬度', - primaryKey: false, - field: "latitude", - autoIncrement: false - }, - content: { - index: 9, - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: '具体内容', - primaryKey: false, - field: "content", - autoIncrement: false - }, - scenePic: { - index: 10, - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "scene_pic", - autoIncrement: false - }, - conserveBeforePic: { - index: 11, - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "conserve_before_pic", - autoIncrement: false - }, - conserveUnderwayPic: { - index: 12, - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "conserve_underway_pic", - autoIncrement: false - }, - conserveAfterPic: { - index: 13, - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "conserve_after_pic", - autoIncrement: false - }, - userId: { - index: 14, - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "user_id", - autoIncrement: false - }, - time: { - index: 15, - type: DataTypes.DATE, - allowNull: false, - defaultValue: null, - comment: '创建日期', - primaryKey: false, - field: "time", - autoIncrement: false - }, - address: { - index: 16, - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: '具体位置', - primaryKey: false, - field: "address", - autoIncrement: false - }, - projectName: { - index: 17, - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "工程名称", - primaryKey: false, - field: "project_name", - autoIncrement: false - }, - handleState: { - index: 18, - type: DataTypes.STRING, - allowNull: false, - defaultValue: "已处理", - // comment: "处理状态", - primaryKey: false, - field: "handle_state", - autoIncrement: false - }, - codeRoad: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "code_road", - autoIncrement: false - }, - performerId: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "执行者", - primaryKey: false, - field: "performer_id", - autoIncrement: false - }, - handleContent: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "", - primaryKey: false, - field: "handle_content", - autoIncrement: false - }, - handlePic: { - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "handle_pic", - autoIncrement: false - }, - videoUrl: { - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "video_url", - autoIncrement: false - }, - roadType: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "路面类型", - primaryKey: false, - field: "road_type", - autoIncrement: false - }, - roadWidth: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "路面宽度", - primaryKey: false, - field: "road_width", - autoIncrement: false - }, - wrongLane: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "错车道", - primaryKey: false, - field: "wrong_lane", - autoIncrement: false - }, - roadsideTrees: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "行道树", - primaryKey: false, - field: "roadside_trees", - autoIncrement: false - }, - roadsideDitch: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "边沟", - primaryKey: false, - field: "roadside_ditch", - autoIncrement: false - }, - guardrail: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "护栏", - primaryKey: false, - field: "guardrail", - autoIncrement: false - }, - roadMarking: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "标线", - primaryKey: false, - field: "road_marking", - autoIncrement: false - }, - maintenanceStaffCount: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "养护人员人数", - primaryKey: false, - field: "maintenance_staff_count", - autoIncrement: false - }, - shoulderRepair: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "修整路肩", - primaryKey: false, - field: "shoulder_repair", - autoIncrement: false - }, - ditchCleaning: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "清理边沟", - primaryKey: false, - field: "ditch_cleaning", - autoIncrement: false - }, - asphaltRepair: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "修补沥青路面", - primaryKey: false, - field: "asphalt_repair", - autoIncrement: false - }, - concreteRepair: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "修补水泥路面", - primaryKey: false, - field: "concrete_repair", - autoIncrement: false - }, - grassMowing: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "除草", - primaryKey: false, - field: "grass_mowing", - autoIncrement: false - }, - treeWhitening: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "树刷白", - primaryKey: false, - field: "tree_whitening", - autoIncrement: false - }, - pileWhitening: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "桩刷白", - primaryKey: false, - field: "pile_whitening", - autoIncrement: false - }, - guardrailMaintenance: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "维护护栏", - primaryKey: false, - field: "guardrail_maintenance", - autoIncrement: false - }, - endHeadRepair: { - type: DataTypes.DOUBLE, - allowNull: true, - defaultValue: null, - comment: "修复端头", - primaryKey: false, - field: "end_head_repair", - autoIncrement: false - }, - inspectionNoException: { - type: DataTypes.BOOLEAN, - allowNull: true, - defaultValue: null, - comment: "巡查无异常", - primaryKey: false, - field: "inspection_no_exception", - autoIncrement: false - }, - roadDamage: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "路面损坏", - primaryKey: false, - field: "road_damage", - autoIncrement: false - }, - securityDamage: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "安防损坏", - primaryKey: false, - field: "security_damage", - autoIncrement: false - }, - bridgeDamage: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "桥梁损坏", - primaryKey: false, - field: "bridge_damage", - autoIncrement: false - }, - culvertDamage: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "涵洞损坏", - primaryKey: false, - field: "culvert_damage", - autoIncrement: false - }, - securityDeficiency: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "安防缺失", - primaryKey: false, - field: "security_deficiency", - autoIncrement: false - }, - encounteredEnvironment: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "路遇环境", - primaryKey: false, - field: "encountered_environment", - autoIncrement: false - }, - otherDescription: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "其他描述", - primaryKey: false, - field: "other_description", - autoIncrement: false - } - }, { - tableName: "report", - comment: "", - indexes: [] - }); - dc.models.Report = Report; - return Report; + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const Report = sequelize.define("report", { + id: { + index: 1, + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "report_id_uindex" + }, + reportType: { + index: 2, + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "上报类型", + primaryKey: false, + field: "report_type", + autoIncrement: false + }, + projectType: { + index: 3, + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "工程类型", + primaryKey: false, + field: "project_type", + autoIncrement: false + }, + road: { + index: 4, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '所属道路', + primaryKey: false, + field: "road", + autoIncrement: false + }, + roadSectionStart: { + index: 5, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '开始路段', + primaryKey: false, + field: "road_section_start", + autoIncrement: false + }, + roadSectionEnd: { + index: 6, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '结束路段', + primaryKey: false, + field: "road_section_end", + autoIncrement: false + }, + longitude: { + index: 7, + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: '经度', + primaryKey: false, + field: "longitude", + autoIncrement: false + }, + latitude: { + index: 8, + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: '纬度', + primaryKey: false, + field: "latitude", + autoIncrement: false + }, + content: { + index: 9, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '具体内容', + primaryKey: false, + field: "content", + autoIncrement: false + }, + scenePic: { + index: 10, + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "scene_pic", + autoIncrement: false + }, + conserveBeforePic: { + index: 11, + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "conserve_before_pic", + autoIncrement: false + }, + conserveUnderwayPic: { + index: 12, + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "conserve_underway_pic", + autoIncrement: false + }, + conserveAfterPic: { + index: 13, + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "conserve_after_pic", + autoIncrement: false + }, + userId: { + index: 14, + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "user_id", + autoIncrement: false + }, + time: { + index: 15, + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + comment: '创建日期', + primaryKey: false, + field: "time", + autoIncrement: false + }, + address: { + index: 16, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '具体位置', + primaryKey: false, + field: "address", + autoIncrement: false + }, + projectName: { + index: 17, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "工程名称", + primaryKey: false, + field: "project_name", + autoIncrement: false + }, + handleState: { + index: 18, + type: DataTypes.STRING, + allowNull: false, + defaultValue: "已处理", + // comment: "处理状态", + primaryKey: false, + field: "handle_state", + autoIncrement: false + }, + codeRoad: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "code_road", + autoIncrement: false + }, + performerId: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: "执行者", + primaryKey: false, + field: "performer_id", + autoIncrement: false + }, + handleContent: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "", + primaryKey: false, + field: "handle_content", + autoIncrement: false + }, + handlePic: { + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "handle_pic", + autoIncrement: false + }, + videoUrl: { + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "video_url", + autoIncrement: false + }, + roadType: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "路面类型", + primaryKey: false, + field: "road_type", + autoIncrement: false + }, + roadWidth: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "路面宽度", + primaryKey: false, + field: "road_width", + autoIncrement: false + }, + wrongLane: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "错车道", + primaryKey: false, + field: "wrong_lane", + autoIncrement: false + }, + roadsideTrees: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "行道树", + primaryKey: false, + field: "roadside_trees", + autoIncrement: false + }, + roadsideDitch: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "边沟", + primaryKey: false, + field: "roadside_ditch", + autoIncrement: false + }, + guardrail: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "护栏", + primaryKey: false, + field: "guardrail", + autoIncrement: false + }, + roadMarking: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "标线", + primaryKey: false, + field: "road_marking", + autoIncrement: false + }, + maintenanceStaffCount: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: "养护人员人数", + primaryKey: false, + field: "maintenance_staff_count", + autoIncrement: false + }, + shoulderRepair: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "修整路肩", + primaryKey: false, + field: "shoulder_repair", + autoIncrement: false + }, + ditchCleaning: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "清理边沟", + primaryKey: false, + field: "ditch_cleaning", + autoIncrement: false + }, + asphaltRepair: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "修补沥青路面", + primaryKey: false, + field: "asphalt_repair", + autoIncrement: false + }, + concreteRepair: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "修补水泥路面", + primaryKey: false, + field: "concrete_repair", + autoIncrement: false + }, + grassMowing: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "除草", + primaryKey: false, + field: "grass_mowing", + autoIncrement: false + }, + treeWhitening: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "树刷白", + primaryKey: false, + field: "tree_whitening", + autoIncrement: false + }, + pileWhitening: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "桩刷白", + primaryKey: false, + field: "pile_whitening", + autoIncrement: false + }, + guardrailMaintenance: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "维护护栏", + primaryKey: false, + field: "guardrail_maintenance", + autoIncrement: false + }, + endHeadRepair: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "修复端头", + primaryKey: false, + field: "end_head_repair", + autoIncrement: false + }, + inspectionNoException: { + type: DataTypes.BOOLEAN, + allowNull: true, + defaultValue: null, + comment: "巡查无异常", + primaryKey: false, + field: "inspection_no_exception", + autoIncrement: false + }, + roadDamage: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "路面损坏", + primaryKey: false, + field: "road_damage", + autoIncrement: false + }, + securityDamage: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "安防损坏", + primaryKey: false, + field: "security_damage", + autoIncrement: false + }, + bridgeDamage: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "桥梁损坏", + primaryKey: false, + field: "bridge_damage", + autoIncrement: false + }, + culvertDamage: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "涵洞损坏", + primaryKey: false, + field: "culvert_damage", + autoIncrement: false + }, + securityDeficiency: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "安防缺失", + primaryKey: false, + field: "security_deficiency", + autoIncrement: false + }, + encounteredEnvironment: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "路遇环境", + primaryKey: false, + field: "encountered_environment", + autoIncrement: false + }, + otherDescription: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "其他描述", + primaryKey: false, + field: "other_description", + autoIncrement: false + } + }, { + tableName: "report", + comment: "", + indexes: [] + }); + dc.models.Report = Report; + return Report; }; \ No newline at end of file diff --git a/api/app/lib/routes/report/index.js b/api/app/lib/routes/report/index.js index d4730072..d2d5afaf 100644 --- a/api/app/lib/routes/report/index.js +++ b/api/app/lib/routes/report/index.js @@ -29,5 +29,8 @@ module.exports = function (app, router, opts) { router.post('report/spot/prepare', report.spotPrepare); app.fs.api.logAttr['GET/report/spot/check'] = { content: '抽查', visible: false }; - router.get('report/spot/check', report.spotCheck); + router.get('report/spot/check', report.spotCheck) + + app.fs.api.logAttr['GET/report/spot/check/detail'] = { content: '抽查明细', visible: false }; + router.get('report/spot/check/detail', report.spotCheckDetail) } \ No newline at end of file diff --git a/scripts/1.3.0/schema/4.insert_resource .sql b/scripts/1.3.0/schema/4.insert_resource .sql new file mode 100644 index 00000000..f8e571c3 --- /dev/null +++ b/scripts/1.3.0/schema/4.insert_resource .sql @@ -0,0 +1 @@ +INSERT INTO resource (code, name, parent_resource) VALUES ('MAINTENANCESPOTCHECK', '养护抽查', 'ALLSELECT') \ No newline at end of file diff --git a/scripts/1.3.0/schema/5.update_statistic.sql b/scripts/1.3.0/schema/5.update_statistic.sql new file mode 100644 index 00000000..947fc38d --- /dev/null +++ b/scripts/1.3.0/schema/5.update_statistic.sql @@ -0,0 +1,5 @@ +UPDATE statistic SET name = '边沟' WHERE id = 3 + +UPDATE statistic SET name = '行道树' WHERE id = 6 + +UPDATE statistic SET name = '错车道' WHERE id = 7 \ No newline at end of file diff --git a/web/client/src/sections/fillion/actions/extract.js b/web/client/src/sections/fillion/actions/extract.js new file mode 100644 index 00000000..39790bfc --- /dev/null +++ b/web/client/src/sections/fillion/actions/extract.js @@ -0,0 +1,42 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getReportSpotPrepare(data) { + return dispatch => basicAction({ + type: 'post', + dispatch: dispatch, + data, + actionType: 'GET_REPORT_SPOT_PREPARE', + url: `${ApiTable.getReportSpotPrepare}`, + msg: { error: '查询随机乡镇失败' }, + }); +} + +export function getSpotCheck(data) { + return dispatch => basicAction({ + type: 'get', + query: data, + dispatch: dispatch, + actionType: 'GET_SPOT_CHECK', + url: `${ApiTable.getSpotCheck}`, + msg: { error: '随机抽查失败' }, + }); +} + + +export function getSpotCheckDetail(data) { + return dispatch => basicAction({ + type: 'get', + query: data, + dispatch: dispatch, + actionType: 'GET_SPOT_CHECK_Detail', + url: `${ApiTable.getSpotCheckDetail}`, + reducer: { name: 'spotCheckDetail' }, + msg: { error: '查询随机抽查明细失败' }, + }); +} + + + diff --git a/web/client/src/sections/fillion/actions/index.js b/web/client/src/sections/fillion/actions/index.js index cde430de..3eb40f1e 100644 --- a/web/client/src/sections/fillion/actions/index.js +++ b/web/client/src/sections/fillion/actions/index.js @@ -5,11 +5,12 @@ import * as patrol from './patrol' import * as file from './file' import * as assess from './assess' import * as allDepUsers from './allDepUsers' - +import * as getReportSpotPrepare from './extract' export default { ...infor, ...patrol, ...file, ...assess, - ...allDepUsers + ...allDepUsers, + ...getReportSpotPrepare } \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/feedback/nominateModal.js b/web/client/src/sections/fillion/components/feedback/nominateModal.js index c14a2ca3..3291cbb8 100644 --- a/web/client/src/sections/fillion/components/feedback/nominateModal.js +++ b/web/client/src/sections/fillion/components/feedback/nominateModal.js @@ -14,28 +14,23 @@ const NominateModal = (props) => { const { queryData, recordId, visible, user, onCancel, depMessage, loading, depUser, clientHeight, depData, onVisibleChange, dispatch } = props const [depId, setDepId] = useState(null) const [depUsers, setDepUsers] = useState() - const selectRef = useRef(null); - const formRef = useRef(); - const [selectKey, setSelectKey] = useState(0); const handleTreeSelectChange = async (value) => { //console.log('recordId', recordId) setDepId(value) // 根据选择的部门ID获取对应的用户数据 - setDepUsers(null) + setDepUsers([]) const res = await dispatch(getDepUser(value)); setDepUsers(res?.payload.data); //setSelectKey(selectKey + 1) // 清空第二个输入框的值 - if (selectRef.current) { - selectRef.current.reset(); - } + } - useEffect(() => { - setSelectKey(selectKey + 1) - }, [depUsers]) + // useEffect(() => { + // setSelectKey(selectKey + 1) + // }, [depUsers]) const handleFinish = async (values) => { const { name } = values; // 在这里使用第二个框的值进行网络请求或其他操作 @@ -60,13 +55,14 @@ const NominateModal = (props) => { return ( { }} expandedKeys={["title"]} /> - {depUsers && depUsers.length ? item.isAdmin === true) ? { console.log('values1', values) }} name={'name'} label="指派人" @@ -115,21 +111,17 @@ const NominateModal = (props) => { const res = await dispatch(getDepUser(depId)); const copy = res?.payload.data.filter((user) => { if (user.isAdmin) { - return { - label: user.name, // 使用用户的名字作为选项的显示文本 - value: user.id, // 使用用户的id作为选项的值 - } + return user } } ) let processedUsers = copy.map((item) => { return { - label: item.name, // 使用用户的名字作为选项的显示文本 - value: item.id, // 使用用户的id作为选项的值 + label: item.name, + value: item.id, } }) - console.log('processedUsers', copy) - console.log('processedUsers', processedUsers) + return Promise.resolve(processedUsers) } diff --git a/web/client/src/sections/fillion/components/feedback/nominateModalcopy.js b/web/client/src/sections/fillion/components/feedback/nominateModalcopy.js new file mode 100644 index 00000000..516b662e --- /dev/null +++ b/web/client/src/sections/fillion/components/feedback/nominateModalcopy.js @@ -0,0 +1,131 @@ +'use strict'; +import React, { useState, useEffect, useCallback, useRef } from 'react'; +import { connect } from 'react-redux'; +import { Spin, TreeSelect, Modal, Form, Select } from 'antd'; +import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect, ProFormSelect } from '@ant-design/pro-form'; +import { getDepUser } from '../../../organization/actions/user' +import { appointTask } from '../../actions/appointTask' +import moment from 'moment'; +import { v4 as uuidv4 } from 'uuid'; + + +const NominateModal = (props) => { + const { queryData, recordId, visible, user, onCancel, depMessage, loading, depUser, clientHeight, depData, onVisibleChange, dispatch } = props + const [depId, setDepId] = useState(0) + const [depUsers, setDepUsers] = useState() + // const [value, setValue] = useState(undefined); + const [selectedUserId, setSelectedUserId] = useState(null); + const [form] = Form.useForm(); + + const handleTreeSelectChange = async (value) => { + setSelectedUserId(null) + setDepId(value) + // 根据选择的部门ID获取对应的用户数据 + //setDepUsers([]) + const res = await dispatch(getDepUser(value)) + const copy = res.payload.data.filter(user => { + if (user.isAdmin) { + return user + } + }) + let processedUsers = copy.map((item) => { + return { + label: item.name, + value: item.id, + } + }) + setDepUsers(processedUsers) + } + const handleFinish = () => { + form.validateFields().then(values => { + dispatch(appointTask({ recordId: recordId, performerId: values.nameId })).then((res) => { + if (res.success) { + setSelectedUserId(null) + queryData() + onCancel() + setDepUsers([]) + form.resetFields() + } + }) + }) + + } + + const cancelHandler = () => { + // form.resetFields() + // setDepUsers([]) + onCancel() + } + return ( + + +
+
+
+ + + + +
+
+ + + +
+
+
+
+
+ ) +} + +function mapStateToProps(state) { + const { auth, depMessage, depUser, global } = state + const pakData = (dep) => { + // console.log(dep); + return dep.map((d) => { + return { + title: d.name, + value: d.id, + // key: d.id, + children: pakData(d.subordinate) + } + }) + } + let depData = pakData(depMessage.data || []) + // return { + // loading: depMessage.isRequesting, + // depData, + // }; + return { + user: auth.user, + clientHeight: global.clientHeight, + loading: depMessage.isRequesting, + //depMessage: depMessage.data || [], + depUser: depUser.data || [], + depData + } +} +export default connect(mapStateToProps)(NominateModal); \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/highwaysTable.js b/web/client/src/sections/fillion/components/highwaysTable.js index d8785c18..4fce5c9d 100644 --- a/web/client/src/sections/fillion/components/highwaysTable.js +++ b/web/client/src/sections/fillion/components/highwaysTable.js @@ -316,9 +316,7 @@ const TransporTationTable = (props) => { } setRowSelected([]); const res = await dispatch(getHighways(query)); - // console.log(res) - - setCounts(res.payload.data) + setCounts(res.payload.data.filter(item => item.name !== '路牌名')) return { ...res, total: res.payload.data ? res.payload.data.count : 0 diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js index 97c4c786..c98ed09a 100644 --- a/web/client/src/sections/fillion/components/maintenanceTable.js +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -18,6 +18,35 @@ const DetailForm = (props) => { const { visible, data, handleClose, loading } = props; const [qndmn] = useState(localStorage.getItem('qndmn')); const keyList = [ + { key: '道路类型', name: 'reportType' }, + { key: '其他', name: 'projectType' }, + { key: '路线名称', name: 'road' }, + { key: '养护路段', name: 'roadSectionStart' }, + { key: '具体位置', name: 'address' }, + { key: '路面类型', name: 'roadType' }, + { key: '路面宽度', name: 'roadWidth' }, + { key: '错车道', name: 'wrongLane' }, + { key: '行道树', name: 'roadsideTrees' }, + { key: '边沟', name: 'roadsideDitch' }, + { key: '护栏', name: 'guardrail' }, + { key: '标线', name: 'roadMarking' }, + { 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' }, + { key: '养护前图片', name: 'conserveBeforePic' }, + { key: '养护后图片', name: 'conserveAfterPic' }, + { key: '上报视频', name: 'videoUrl' }, + + ]; + const keyListOld = [ // { key: '编号', name: 'id' }, { key: '工程类型', name: 'projectType' }, { key: '所在路段', name: 'road' }, @@ -30,40 +59,87 @@ const DetailForm = (props) => { { key: '养护后', name: 'conserveAfterPic' }, ]; - const renderContent = (data) => { if (data) { - return keyList.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
- -
- }) : '暂无图片' - } -
+ if (new Date(data.time) > new Date('2023-08-01')) { + 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 '暂无数据' } @@ -113,25 +189,26 @@ const DetailList = (props) => { let counter = 0; const columns = [ + // { + // title: '编号', + // key: 'id', + // dataIndex: 'id', + // align: 'center', + // render: (text, record) => { + // let day = moment(record.time).format("YYYYMMDD") + // if (!basicDate) { + // basicDate = day; + // counter += 1; + // } else if (basicDate == day) { + // counter += 1; + // } else if (basicDate != day) { + // basicDate = day; + // counter = 1; + // } + // return moment(record.time).format("YYYYMMDD") * 10000 + counter; + // } + // }, { - title: '编号', - key: 'id', - dataIndex: 'id', - align: 'center', - render: (text, record) => { - let day = moment(record.time).format("YYYYMMDD") - if (!basicDate) { - basicDate = day; - counter += 1; - } else if (basicDate == day) { - counter += 1; - } else if (basicDate != day) { - basicDate = day; - counter = 1; - } - return moment(record.time).format("YYYYMMDD") * 10000 + counter; - } - }, { title: '工程类型', key: 'projectType', dataIndex: 'projectType', @@ -154,9 +231,9 @@ const DetailList = (props) => { } }, { - title: '具体内容', - key: 'content', - dataIndex: 'content', + title: '具体位置', + key: 'address', + dataIndex: 'address', align: 'center' }, { @@ -457,13 +534,13 @@ const PatrolNameList = (props) => { const MaintenanceTable = (props) => { - const { userList, user, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, depMessage, depUser, clientHeight } = props; + const { userList, user, reportList, dispatch, allDepUsers, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, depMessage, depUser, clientHeight } = props; const [record, setRecord] = useState(1); const [dateRange, setDateRange] = useState(); const [detailVisible, setDetailVisible] = useState(false) const { RangePicker } = DatePicker; - + // console.log('allDepUsers', allDepUsers) useEffect(() => { queryData() }, []) @@ -479,30 +556,33 @@ const MaintenanceTable = (props) => { // if (record) { queryData() // } - }, [record, dateRange]) + }, [record, dateRange, allDepUsers, user]) const queryData = () => { - let userId = null - if (user?.username === 'SuperAdmin' && record === 1) { - userId = undefined - } else if (user?.username === 'SuperAdmin' && record !== 1) { - userId = record - } else if (user?.username !== 'SuperAdmin' && record === 1) { - userId = user?.id - } else if (user?.username !== 'SuperAdmin' && record !== 1) { - userId = record - } - //: user?.username === 'SuperAdmin' && record === 1 ? record?.id : record ? record : user?.id - let query = { - userId, - reportType: 'conserve', - asc: true - } - if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { - query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') - query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') + if (allDepUsers && allDepUsers.length && user) { + //console.log('ssssss',) + const userL = allDepUsers.find(item => item.depId === user.departmentId)?.users?.map(child => { return child.id }) + let userId = null + if (user?.username === 'SuperAdmin' && record === 1) { + userId = undefined + } else if (user?.username !== 'SuperAdmin' && record === 1) { + userId = userL && userL.length ? userL + '' : undefined + } else { + userId = record + } + + //: user?.username === 'SuperAdmin' && record === 1 ? record?.id : record ? record : user?.id + let query = { + userId, + reportType: 'conserve', + asc: true + } + if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { + query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') + query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') + } + dispatch(getReportList(query)) } - dispatch(getReportList(query)); } const handleClose = () => { @@ -560,7 +640,7 @@ const MaintenanceTable = (props) => { }; function mapStateToProps(state) { - const { auth, depMessage, userList, reportList, reportDetail, depUser, global } = state; + const { auth, depMessage, userList, reportList, reportDetail, depUser, global, allDepUsers } = state; const pakData = (dep) => { return dep.map((d) => { return { @@ -584,6 +664,7 @@ function mapStateToProps(state) { reportDetail: reportDetail.data, reportDetailLoading: reportDetail.isRequesting, depUser: depUser.data || [], + allDepUsers: allDepUsers.data || [] }; } diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index a411d36a..a36435ef 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -13,6 +13,7 @@ import NominateModal from '../components/feedback/nominateModal' //指派的模 // @ts-ignore import styles from './protable.less'; import moment from 'moment'; +import NominateModalcopy from './feedback/nominateModalcopy';//指派的模块 export const reportTypeText = (text) => { switch (text) { @@ -39,6 +40,39 @@ const DetailForm = (props) => { const [qndmn] = useState(localStorage.getItem('qndmn')); 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', skip: !isAnomaly && isPatrol }, + { key: '现场照片', name: 'scenePic', skip: isPatrol }, + { 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 keyListOld = [ // { key: '编号', name: 'id' }, // isPatrol ?'巡查管理详情' :isRoad ? '建设上报详情' : '异常反馈详情' { key: '工程类型', name: 'projectType', skip: !isPatrol }, @@ -54,47 +88,103 @@ const DetailForm = (props) => { { key: '处理人', name: 'performerName', skip: !isAnomaly } ]; + const changeBoolean = (bool) => { + //console.log('bool', bool) + return bool ? '无异常' : '有异常' + } const renderContent = (data) => { if (data) { // Object.keys(data).map(key => { // }) - return keyList.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
- -
- }) - : '暂无图片' - } -
+ if ((new Date(data.time + '') > new Date('2023-8-1'))) { + + return keyList.map(obj => { + return ( + obj.skip ? null : +
+ {obj.key} + { + 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' ? + + : +
+ { + data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + return
+ +
+ }) + : '暂无图片' + } +
+ + } +
+ ) + }) + } - } -
- ) - }) } else { + return '暂无数据' + } } @@ -151,27 +241,26 @@ const DetailList = (props) => { let basicDate = null; let counter = 0; //指派任务 - console.log('vis', vis) const columns = [ - isPatrol ? { - title: '编号', - key: 'id', - dataIndex: 'id', - align: 'center', - render: (text, record) => { - let day = moment(record.time).format("YYYYMMDD") - if (!basicDate) { - basicDate = day; - counter += 1; - } else if (basicDate == day) { - counter += 1; - } else if (basicDate != day) { - basicDate = day; - counter = 1; - } - return moment(record.time).format("YYYYMMDD") * 10000 + counter; - } - } : '', + // isPatrol ? { + // title: '编号1', + // key: 'id', + // dataIndex: 'id', + // align: 'center', + // render: (text, record) => { + // let day = moment(record.time).format("YYYYMMDD") + // if (!basicDate) { + // basicDate = day; + // counter += 1; + // } else if (basicDate == day) { + // counter += 1; + // } else if (basicDate != day) { + // basicDate = day; + // counter = 1; + // } + // return moment(record.time).format("YYYYMMDD") * 10000 + counter; + // } + // } : '', isPatrol || isAnomaly ? { title: isPatrol ? '工程类型' : '反馈类型', @@ -222,9 +311,9 @@ const DetailList = (props) => { } } : '', { - title: '具体内容', - key: 'content', - dataIndex: 'content', + title: '具体位置', + key: 'address', + dataIndex: 'address', align: 'center' }, { @@ -314,7 +403,8 @@ const DetailList = (props) => { toolBarRender={false} search={false} /> - + {/* */} + ) }; @@ -498,7 +588,6 @@ const PatrolNameList = (props) => { if (selected) { if (selectedKeys[0].split("-").length - 1 >= 2) { let id = selectedKeys[0].split('-')[selectedKeys[0].split('-').length - 1] - console.log('id1', id) onChange(id); } @@ -587,7 +676,7 @@ const PatrolNameList = (props) => { const PatrolTable = (props) => { - const { clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props; + const { allDepUsers, clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props; const [record, setRecord] = useState(1); const [dateRange, setDateRange] = useState(); const [selectProjectType, setSelectProjectType] = useState(''); @@ -599,11 +688,9 @@ const PatrolTable = (props) => { const isAnomaly = pathname.includes('anomaly') const isPatrol = !isRoad && !isAnomaly const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol'; - useEffect(() => { queryData(); }, []) - useEffect(() => { if (userList && userList instanceof Array && reportDetail && reportDetail instanceof Object) { setReportDetailCopy(Object.assign(reportDetail, { performerName: userList.find(item => item.id === reportDetail.performerId)?.name })) @@ -611,32 +698,31 @@ const PatrolTable = (props) => { }, [userList, reportDetail]) useEffect(() => { - queryData(); - }, [record, dateRange, selectProjectType]) + queryData() + }, [dateRange, selectProjectType, allDepUsers, user, record]) const queryData = () => { - //console.log(record, 'idididid') - let userId = null - if (user?.username === 'SuperAdmin' && record === 1) { - userId = undefined - } else if (user?.username === 'SuperAdmin' && record !== 1) { - userId = record - } else if (user?.username !== 'SuperAdmin' && record === 1) { - userId = user?.id - } else if (user?.username !== 'SuperAdmin' && record !== 1) { - userId = record - } - // user?.username === 'SuperAdmin' && record === 1 ? record?.id : record ? record : user?.id, - let query = { - userId, - reportType: reportType, projectType: selectProjectType, asc: true - } - //console.log(query, 'query1') - if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { - query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') - query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') + if (allDepUsers && allDepUsers.length && user) { + const userL = allDepUsers.find(item => item.depId === user.departmentId)?.users?.map(child => { return child.id }) + let userId = null + if (user?.username === 'SuperAdmin' && record === 1) { + userId = undefined + } else if (user?.username !== 'SuperAdmin' && record === 1) { + userId = userL && userL.length ? userL + '' : undefined + } else { + userId = record + } + let query = { + userId, + reportType: reportType, projectType: selectProjectType, asc: true + } + if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { + query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') + query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') + } + dispatch(getReportList(query)) } - dispatch(getReportList(query)); + } useEffect(() => { @@ -764,7 +850,7 @@ const PatrolTable = (props) => { }; function mapStateToProps(state) { - const { auth, depMessage, userList, reportList, reportDetail, global } = state; + const { auth, depMessage, userList, reportList, reportDetail, global, allDepUsers } = state; const pakData = (dep) => { return dep.map((d) => { return { @@ -776,6 +862,7 @@ function mapStateToProps(state) { } let depData = pakData(depMessage.data || []) return { + allDepUsers: allDepUsers.data || [], user: auth.user, depMessage: depMessage.data || [], depLoading: depMessage.isRequesting, diff --git a/web/client/src/sections/fillion/containers/index.js b/web/client/src/sections/fillion/containers/index.js index 4faaeb0a..eac6898f 100644 --- a/web/client/src/sections/fillion/containers/index.js +++ b/web/client/src/sections/fillion/containers/index.js @@ -17,9 +17,10 @@ import Task from './task' import Assess from './assess' import VideoCenter from './videoCenter'; import Building from './building' +import MaintenanceSpotCheck from './maintenanceSpotCheck' export { Infor, transportation, BridgeTable, HigHways, OperaTional, Enforce, Public, Videois, PromoTional, Maintenance, Patrol, File, Jiekouguanli, - Task, Building, Assess, VideoCenter + Task, Building, Assess, VideoCenter, MaintenanceSpotCheck }; \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js b/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js new file mode 100644 index 00000000..1a4a800a --- /dev/null +++ b/web/client/src/sections/fillion/containers/maintenanceSpotCheck.js @@ -0,0 +1,499 @@ +import { connect } from 'react-redux'; +import React, { useEffect, useState } from 'react'; +import { Button, Modal, Form, Input, Divider, Spin, Image, DatePicker } 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' + + + +const DetailForm = (props) => { + const { visible, data, handleClose, loading } = props + //console.log('data1', data) + const [qndmn] = useState(localStorage.getItem('qndmn')) + const changeBoolean = (bool) => { + // console.log('bool', bool) + return bool ? '无异常' : '有异常' + } + 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 keyList = [ + { key: '道路类型', name: 'reportType' }, + { key: '其他', name: 'projectType' }, + { key: '路线名称', name: 'road' }, + { key: '养护路段', name: 'roadSectionStart' }, + { key: '具体位置', name: 'address' }, + { key: '路面类型', name: 'roadType' }, + { key: '路面宽度', name: 'roadWidth' }, + { key: '错车道', name: 'wrongLane' }, + { key: '行道树', name: 'roadsideTrees' }, + { key: '边沟', name: 'roadsideDitch' }, + { key: '护栏', name: 'guardrail' }, + { key: '标线', name: 'roadMarking' }, + { 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' }, + { key: '养护前图片', name: 'conserveBeforePic' }, + { key: '养护后图片', name: 'conserveAfterPic' }, + { key: '上报视频', name: 'videoUrl' }, + + ]; + const keyListOld = [ + // { key: '编号', name: 'id' }, + { key: '工程类型', name: 'projectType' }, + { key: '所在路段', name: 'road' }, + { key: '具体位置', name: 'address' }, + { key: '巡查内容', name: 'content' }, + { key: '路线代码', name: 'codeRoad' }, + // { key: '病害照片', name: 'scenePic' }, + { key: '养护前', name: 'conserveBeforePic' }, + { key: '养护中', name: 'conserveUnderwayPic' }, + { key: '养护后', name: 'conserveAfterPic' }, + + ]; + const renderContent = (data) => { + if (data) { + if (new Date(data.time) > new Date('2023-08-01')) { + 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 '暂无数据' + } + } + // const renderContent = (data) => { + // if (data) { + // if (data['inspectionNoException']) { + // // 当'无异常'字段为true时,显示'无异常'和其他非异常相关字段 + // return keyList.map(obj => { + // if (obj.name === 'inspectionNoException' || obj.name === 'reportType' || obj.name === 'projectType' || obj.name === 'road' || obj.name === 'roadSectionStart' || obj.name === 'address' || obj.name === 'codeRoad' || obj.name === 'scenePic' || obj.name === 'videoUrl') { + // return ( + //
+ // {obj.key} + // { + // obj.name === 'scenePic' && data[obj.name] instanceof Array ? + //
+ // { + // data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) + // } + //
+ // : obj.name === 'roadSectionStart' ? + //
+ // + //
+ // : + // + // } + //
+ // ); + // } else { + // return null; // 不渲染异常相关字段 + // } + // }); + // } else { + // // 当'无异常'字段为false或未定义时,显示其他异常相关字段 + // return keyList.map(obj => { + // if (obj.name !== 'inspectionNoException') { + // return ( + //
+ // {obj.key} + // { + // obj.name !== 'scenePic' && obj.name !== 'roadSectionStart' && obj.name.indexOf('conserve') === -1 ? + // + // : obj.name !== 'roadSectionStart' ? + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
+ // :
+ // + //
+ // } + //
+ // ); + // } else { + // return null; // 不渲染其他异常字段 + // } + // }); + // } + // } else { + // return '暂无数据'; + // } + // } + return ( + + + {renderContent(data)} + + + ) +} +const MaintenanceSpotCheck = (props) => { + const { dispatch, user, loading, reportDetail, reportDetailLoading } = props + const [data, setData] = useState() + const [vis, setVis] = useState(false)//模态框的显示与隐藏变量 + const [count, setCount] = useState(0) + const [depId, setDepId] = useState(0) + const [depName, setDepName] = useState('') + const [total, setTotal] = useState(0) + const [previewId, setPreviewId] = useState(0) + const [reportData, setReportData] = useState([]) + const [detailVisible, setDetailVisible] = useState(false) + const [dateRange, setDateRange] = useState(); + const { RangePicker } = DatePicker + + //console.log('reportData', reportData) + const checkDetail = (record) => { + dispatch(getReportDetail(record.report?.id)) + } + const handleOpen = () => { + setDetailVisible(true) + } + const handleClose = () => { + setDetailVisible(false) + } + const columns = [ + { + title: '编号', + key: 'spotDate', + dataIndex: 'spotDate', + align: 'center', + // 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', + align: 'center', + render: (_, record) => { + return `${record?.report?.roadSectionStart || ''}-${record?.report?.roadSectionEnd || ''}` + } + }, + { + title: '具体位置', + key: 'address', + dataIndex: 'address', + 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', + 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 } + } + ) + setReportData(data) + } + }) + } + + useEffect(() => { + queryData() + }, []) + const [form] = Form.useForm() + const addHanler = () => { + setVis(true) + } + const extractHandler = () => { + 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) + setPreviewId(res?.payload.data?.previewId) + setTotal(((res?.payload.data?.reportCount) * Number(values.percentValue)) / 100) + form.setFieldsValue({ 'result': count, 'village': depName, 'total': total }) + } + }) + } + const cancelHandler = () => { + setVis(false) + form.resetFields() + } + const okHandler = async () => { + if (previewId !== 0) { + const res = await dispatch(getSpotCheck({ previewId })) + form.resetFields() + setVis(false) + } + } + 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]).startOf('day').format('YYYY-MM-DD HH:mm:ss') }) + } + } + return ( +
+ + { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> + + + + +
+ + + + + + + % + + + + +
+ +
+
+ + + + + + + + + +
+
+ +
+ ) +} +function mapStateToProps(state) { + const { auth, spotCheckDetail, reportDetail } = state + //('state1', state) + return { + user: auth.user, + loading: spotCheckDetail?.isRequesting, + reportDetailLoading: reportDetail.isRequesting, + reportDetail: reportDetail.data, + + } +} +export default connect(mapStateToProps)(MaintenanceSpotCheck); \ No newline at end of file diff --git a/web/client/src/sections/fillion/nav-item.js b/web/client/src/sections/fillion/nav-item.js index 0449594f..bc6306dc 100644 --- a/web/client/src/sections/fillion/nav-item.js +++ b/web/client/src/sections/fillion/nav-item.js @@ -19,7 +19,8 @@ export function getNavItem(user, dispatch) { i.resourceId === 'PATROLMANAGE' || i.resourceId === 'ASSESSMANAGE' || i.resourceId === 'VIDEOCENTER' || - i.resourceId === 'BUILDINGPROJECT' + i.resourceId === 'BUILDINGPROJECT' || + i.resourceId === 'MAINTENANCESPOTCHECK' ) return ( @@ -99,6 +100,10 @@ export function getNavItem(user, dispatch) { 视频中心 : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCESPOTCHECK') ? + + 养护抽查 + : ''} : null ); } diff --git a/web/client/src/sections/fillion/routes.js b/web/client/src/sections/fillion/routes.js index 37318966..2dc943df 100644 --- a/web/client/src/sections/fillion/routes.js +++ b/web/client/src/sections/fillion/routes.js @@ -14,7 +14,7 @@ import { File } from './containers'; import { Jiekouguanli } from './containers' import { Task, Assess, VideoCenter, } from './containers' import { Building } from './containers' - +import { MaintenanceSpotCheck } from './containers' export default [{ type: 'inner', route: { @@ -172,6 +172,15 @@ export default [{ breadcrumb: '视频中心', authCode: 'VIDEOCENTER' + }, + { + path: '/maintenanceSpotCheck', + key: 'maintenanceSpotCheck', + menuSelectKeys: ['maintenanceSpotCheck'], + component: MaintenanceSpotCheck, + breadcrumb: '养护抽查', + authCode: 'MAINTENANCESPOTCHECK' + } ] } diff --git a/web/client/src/sections/organization/containers/authority.js b/web/client/src/sections/organization/containers/authority.js index 46900017..66b8ab89 100644 --- a/web/client/src/sections/organization/containers/authority.js +++ b/web/client/src/sections/organization/containers/authority.js @@ -14,7 +14,7 @@ const Authority = (props) => { const r1 = ['USERMANAGE', 'AUTHORIMANAGE', 'OVERLOADMANAGE', 'ROADMANAGE', 'BRIDGEMANAGE', 'MAINTENANCEMANAGE', 'TRANSPORTATIONMANAGE', 'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE', 'ASSESSMANAGE', 'VIDEOCENTER', 'BUILDINGPROJECT', 'WXPATROLREPORT', 'WXMAINTENANCEREPORT', 'WXFEEDBACKMANAGE', 'WXBUILDINGROAD', - 'WXTODOANDONE' + 'WXTODOANDONE', 'MAINTENANCESPOTCHECK' ] const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员 const [depSelectedKeys, setDepSelectedKeys] = useState([]) diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index c45ebbad..30d943c8 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -151,6 +151,9 @@ export const ApiTable = { getReportList: 'report/list', getReportDetail: 'report/{reportId}/detail', handleReport: 'report/{reportId}/handle', + getReportSpotPrepare: 'report/spot/prepare', + getSpotCheck: '/report/spot/check', + getSpotCheckDetail: '/report/spot/check/detail', getUsers: 'user',