巴林闲侠 1 year ago
parent
commit
969323de0b
  1. 57
      api/app/lib/controllers/report/index.js
  2. 5
      api/app/lib/routes/report/index.js
  3. 1
      scripts/1.3.0/schema/4.insert_resource .sql
  4. 5
      scripts/1.3.0/schema/5.update_statistic.sql
  5. 110
      weapp/src/packages/patrol/index.jsx
  6. 42
      web/client/src/sections/fillion/actions/extract.js
  7. 5
      web/client/src/sections/fillion/actions/index.js
  8. 42
      web/client/src/sections/fillion/components/feedback/nominateModal.js
  9. 131
      web/client/src/sections/fillion/components/feedback/nominateModalcopy.js
  10. 4
      web/client/src/sections/fillion/components/highwaysTable.js
  11. 143
      web/client/src/sections/fillion/components/maintenanceTable.js
  12. 165
      web/client/src/sections/fillion/components/patrolTable.js
  13. 3
      web/client/src/sections/fillion/containers/index.js
  14. 499
      web/client/src/sections/fillion/containers/maintenanceSpotCheck.js
  15. 7
      web/client/src/sections/fillion/nav-item.js
  16. 11
      web/client/src/sections/fillion/routes.js
  17. 2
      web/client/src/sections/organization/containers/authority.js
  18. 3
      web/client/src/utils/webapi.js

57
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
};

5
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)
}

1
scripts/1.3.0/schema/4.insert_resource .sql

@ -0,0 +1 @@
INSERT INTO resource (code, name, parent_resource) VALUES ('MAINTENANCESPOTCHECK', '养护抽查', 'ALLSELECT')

5
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

110
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,8 @@ const Index = () => {
unit: '块',
},
})
const [otherDescription, setOtherDescription] = useState('') //
const [isBeforeReport, setIsBeforeReport] = useState(false) // V1.1.0
const prjType =
isAnomaly ?
@ -286,7 +289,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') {
@ -310,10 +313,12 @@ const Index = () => {
if (data[key]) nextContent[key].value = data[key]
})
setConserveContent(nextContent)
setOtherDescription(data.otherDescription)
}
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' })
}
@ -399,10 +404,6 @@ const Index = () => {
}
}, [])
useEffect(() => {
setRoadStartSel(sourceRoadStartSel)
setRoadEndSel(sourceRoadEndSel)
}, [sourceRoadStartSel, sourceRoadEndSel])
useEffect(() => {
setTypeList([
{
@ -423,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() === '')))
&& (Object.values(conserveInfo).every(c => c.value === '')
|| (Object.values(conserveContent).every(c => c.value === '') && !otherDescription)))
) {
Taro.showToast({ title: '请完善必填信息', icon: 'none' })
return
@ -483,6 +486,7 @@ const Index = () => {
Object.keys(conserveContent).forEach(key => {
data[key] = Number(conserveContent[key].value)
})
data.otherDescription = otherDescription
}
}
@ -576,12 +580,23 @@ 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 => {
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) {
@ -599,8 +614,6 @@ const Index = () => {
setPatrolContentEdit(true)
}
})
break;
}
}
}
break;
@ -611,9 +624,17 @@ 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;
case "otherDescription":
setOtherDescription(value)
break;
case "contentCheck":
let nextCheck = { ...patrolContent }
Object.keys(patrolContent).forEach(key => {
@ -890,7 +911,7 @@ const Index = () => {
{
isPatrol ? <>
<View className='code-choice'>
{!(isView && isBeforeReport) && <View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>线路编码
<RadioGroup onChange={(e) => {
setRoadCodeHead(e.detail.value[0]);
@ -902,18 +923,25 @@ const Index = () => {
</RadioGroup>
<Input
type='text'
placeholder={isView ? '' : '请输入线路编号'}
placeholder={isView ? '' : '输入后9位线路编码'}
value={roadCodeEnd}
maxlength={10}
onInput={e => handleInput(e, 'roadCodeEnd')}
disabled={isView}
/>
</View>
</View>}
<View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>道路类型
<Input
style={{ width: '30%' }}
type='text'
value={roadCodeHead === 'X' ? '县道' : roadCodeHead === 'Y' ? '乡道' : '村道'}
value={isView
? projectType
: roadCodeHead === 'X'
? '县道'
: roadCodeHead === 'Y'
? '乡道'
: '村道'}
onInput={() => { }}
disabled={true}
/>
@ -994,7 +1022,7 @@ const Index = () => {
/> : ''
}
{
isAnomaly ?
isAnomaly || (isView && isBeforeReport) ?
<InputPickers
key={456} // keyselector
title='线路编码:'
@ -1063,7 +1091,7 @@ const Index = () => {
/>
</View>
{
kind === 'patrol' && <View className='patrol-content'>
kind === 'patrol' && !(isView && isBeforeReport) && <View className='patrol-content'>
<View className='title'>
<View><Text style={{ color: 'red' }}>*&nbsp;</Text>巡查内容</View>
</View>
@ -1088,7 +1116,7 @@ const Index = () => {
</View >
}
{
kind === 'conserve' && <View>
kind === 'conserve' && !(isView && isBeforeReport) && <View>
<View className='conserve-info'>
<View className='title'>
<View><Text style={{ color: 'red' }}>*&nbsp;</Text>养护基本信息</View>
@ -1145,12 +1173,23 @@ const Index = () => {
<Text>{conserveContent[key].unit}</Text>
</View>)
}
<View className='item'>
<Text>其他</Text>
<Input
style={{ width: '80%' }}
type='text'
placeholder={'其他养护内容'}
value={otherDescription}
onInput={e => handleInput(e, 'otherDescription')}
disabled={isView}
/>
</View>
</View>
</View>
</View>
}
{
!isPatrol ? <AtTextarea
!isPatrol || (isView && isBeforeReport) ? <AtTextarea
title='巡查内容:'
placeholder={isView ? '' : '请输入具体内容'}
value={content}
@ -1241,26 +1280,27 @@ const Index = () => {
/>
}
{/* <View className='horizontal-line hl-two'>
{
isView && isBeforeReport ? <>
<View className='horizontal-line hl-two'>
<View className='circle c-two'></View>
<View className='text t-two'>养护中</View>
</View>
{
isView ?
<View className='img-box'>
{conserveUnderwayPic.map(item => (
<Image className='img' src={item.url} onClick={() => handleImgClick(undefined, item)} />
))}
</View> :
<AtImagePicker
className='img-picker'
count={3 - conserveUnderwayPic.length}
showAddBtn={conserveUnderwayPic.length >= 3 ? false : true}
files={conserveUnderwayPic}
onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')}
onImageClick={handleImgClick}
/>
} */}
</View>
</> : null
// <AtImagePicker
// className='img-picker'
// count={3 - conserveUnderwayPic.length}
// showAddBtn={conserveUnderwayPic.length >= 3 ? false : true}
// files={conserveUnderwayPic}
// onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')}
// onImageClick={handleImgClick}
// />
}
<View className='horizontal-line hl-three'>
<View className='circle c-three'></View>

42
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: '查询随机抽查明细失败' },
});
}

5
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
}

42
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 (
<Spin spinning={false}>
<ModalForm
ref={formRef}
title='指派'
visible={visible}
onVisibleChange={onVisibleChange}
onFinish={handleFinish}
destroyOnClose
initialValues={{ departmentId: null, name: null }}
modalProps={{
destroyOnClose: true,
}}
//initialValues={{ departmentId: null, name: null }}
>
<ProForm.Group>
<ProFormTreeSelect
@ -103,10 +99,10 @@ const NominateModal = (props) => {
}}
expandedKeys={["title"]}
/>
{depUsers && depUsers.length ? <ProFormSelect
key={selectKey} // 改变 key 值
ref={selectRef}
value={null} // 设置输入框的值为null
{depUsers && depUsers.length && depUsers.some(item => item.isAdmin === true) ? <ProFormSelect
// key={selectKey} // 改变 key 值
// ref={selectRef}
// value={null} // 设置输入框的值为null
//onValuesChange={(values) => { 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)
}

131
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 (
<Spin spinning={false}>
<Modal
title='指派'
visible={visible}
onVisibleChange={onVisibleChange}
onCancel={cancelHandler}
destroyOnClose onOk={handleFinish}>
<Form form={form}>
<div style={{ display: 'flex' }}>
<div style={{ marginRight: 30 }}>
<Form.Item label='部门:' name='departmentId' rules={[{ required: true, message: '请选择部门' }]}>
<TreeSelect
style={{ width: '160px' }}
// value={value}
dropdownStyle={{
maxHeight: 400,
overflow: 'auto',
}}
placeholder="选择部门"
//allowClear
treeDefaultExpandAll={false}
treeData={depData}
onSelect={handleTreeSelectChange}
/>
</Form.Item>
</div>
<div>
<Form.Item label='指派人:' name='nameId' rules={[{ required: true, message: '选择指派人' }]}>
<Select placeholder="请选择指派人" style={{
width: '160px',
}} options={depUsers}
onChange={(value) => setSelectedUserId(value)}
>
</Select>
</Form.Item>
</div>
</div>
</Form>
</Modal>
</Spin>
)
}
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);

4
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

143
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,10 +59,54 @@ const DetailForm = (props) => {
{ key: '养护后', name: 'conserveAfterPic' },
];
const renderContent = (data) => {
if (data) {
if (new Date(data.time) > new Date('2023-08-01')) {
return keyList.map(obj => {
return <div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
<span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
{
obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ?
<Input
style={{ width: '70%' }}
value={
obj.name == 'id' ?
moment(data.time).format("YYYYMMDD") * 10000 + data.id
:
obj.name == 'projectType' || obj.name == 'reportType' ?
reportTypeText(data[obj.name]) : obj.name == 'inspectionNoException' ? changeBoolean(data[obj.name]) :
data[obj.name]
}
disabled
/>
: obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ?
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
</div> : obj.name != 'videoUrl' ? <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
<Input style={{ width: '100%' }} disabled value={data[obj.name] + '-' + data['roadSectionEnd']} />
</div> : <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => {
return <div style={{ width: '44%', margin: 6 }}>
<video src={qndmn + '/' + videoUrl} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无视频'
}
</div>
}
</div>
})
} else {
return keyListOld.map(obj => {
return <div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
<span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
{
@ -64,6 +137,9 @@ const DetailForm = (props) => {
}
</div>
})
}
} 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,19 +556,21 @@ const MaintenanceTable = (props) => {
// if (record) {
queryData()
// }
}, [record, dateRange])
}, [record, dateRange, allDepUsers, user])
const queryData = () => {
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 = record
} else if (user?.username !== 'SuperAdmin' && record === 1) {
userId = user?.id
} 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,
@ -502,7 +581,8 @@ const MaintenanceTable = (props) => {
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 || []
};
}

165
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,11 +88,63 @@ 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 => {
// })
if ((new Date(data.time + '') > new Date('2023-8-1'))) {
return keyList.map(obj => {
return (
obj.skip ? null :
<div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
<span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
{
obj.name != 'scenePic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ?
<Input
style={{ width: '70%' }}
value={
obj.name == 'id' ?
moment(data.time).format("YYYYMMDD") * 10000 + data.id
:
obj.name == 'projectType' || obj.name == 'reportType' ?
reportTypeText(data[obj.name]) : obj.name == 'inspectionNoException' ? changeBoolean(data[obj.name]) :
data[obj.name]
}
disabled
/>
: obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ?
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
</div> : obj.name != 'videoUrl' ? <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
<Input style={{ width: '100%' }} disabled value={data[obj.name] + '-' + data['roadSectionEnd']} />
</div> : <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => {
return <div style={{ width: '44%', margin: 6 }}>
<video src={qndmn + '/' + videoUrl} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无视频'
}
</div>
}
</div>
)
})
} else {
return keyListOld.map(obj => {
return (
obj.skip ? null :
<div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
@ -93,8 +179,12 @@ const DetailForm = (props) => {
</div>
)
})
}
} 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}
/>
<NominateModal queryData={queryData} hanldeChange={setBtnVis} recordId={recordId} dispatch={dispatch} visible={vis} onCancel={onCancel} onVisibleChange={setVis}></NominateModal>
{/* <NominateModal queryData={queryData} hanldeChange={setBtnVis} recordId={recordId} dispatch={dispatch} visible={vis} onCancel={onCancel} onVisibleChange={setVis}></NominateModal> */}
<NominateModalcopy queryData={queryData} hanldeChange={setBtnVis} recordId={recordId} dispatch={dispatch} visible={vis} onCancel={onCancel} onVisibleChange={setVis}></NominateModalcopy>
</div>
)
};
@ -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')
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 = record
} else if (user?.username !== 'SuperAdmin' && record === 1) {
userId = user?.id
} 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: 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')
}
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,

3
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
};

499
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 <div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
<span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
{
obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ?
<Input
style={{ width: '70%' }}
value={
obj.name == 'id' ?
moment(data.time).format("YYYYMMDD") * 10000 + data.id
:
obj.name == 'projectType' || obj.name == 'reportType' ?
reportTypeText(data[obj.name]) : obj.name == 'inspectionNoException' ? changeBoolean(data[obj.name]) :
data[obj.name]
}
disabled
/>
: obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ?
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
</div> : obj.name != 'videoUrl' ? <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
<Input style={{ width: '100%' }} disabled value={data[obj.name] + '-' + data['roadSectionEnd']} />
</div> : <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => {
return <div style={{ width: '44%', margin: 6 }}>
<video src={qndmn + '/' + videoUrl} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无视频'
}
</div>
}
</div>
})
} else {
return keyListOld.map(obj => {
return <div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
<span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
{
obj.name != 'scenePic' && obj.name.indexOf('conserve') == -1 ?
<Input
style={{ width: '70%' }}
value={
obj.name == 'id' ?
moment(data.time).format("YYYYMMDD") * 10000 + data.id
:
obj.name == 'projectType' ?
reportTypeText(data[obj.name]) :
data[obj.name]
}
disabled
/>
:
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
</div>
}
</div>
})
}
} 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 (
// <div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
// <span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
// {
// obj.name === 'scenePic' && data[obj.name] instanceof Array ?
// <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
// {
// data[obj.name].map(imgSrc => {
// return <div style={{ width: '44%', margin: 6 }}>
// <Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
// </div>
// })
// }
// </div>
// : obj.name === 'roadSectionStart' ?
// <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
// <Input style={{ width: '100%' }} disabled value={data[obj.name] + '-' + data['roadSectionEnd']} />
// </div>
// :
// <Input
// style={{ width: '70%' }}
// value={
// obj.name === 'inspectionNoException' ?
// '无异常'
// :
// obj.name === 'id'
// ? moment(data.time).format("YYYYMMDD") * 10000 + data.id
// : obj.name === 'projectType' || obj.name === 'reportType'
// ? reportTypeText(data[obj.name])
// : data[obj.name]
// }
// disabled
// />
// }
// </div>
// );
// } else {
// return null; // 不渲染异常相关字段
// }
// });
// } else {
// // 当'无异常'字段为false或未定义时,显示其他异常相关字段
// return keyList.map(obj => {
// if (obj.name !== 'inspectionNoException') {
// return (
// <div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', margin: '12px 0' }}>
// <span style={{ fontSize: 16, color: 'gray', minWidth: '26%' }}>{obj.key}</span>
// {
// obj.name !== 'scenePic' && obj.name !== 'roadSectionStart' && obj.name.indexOf('conserve') === -1 ?
// <Input
// style={{ width: '70%' }}
// value={
// obj.name === 'id'
// ? moment(data.time).format("YYYYMMDD") * 10000 + data.id
// : obj.name === 'projectType' || obj.name === 'reportType'
// ? reportTypeText(data[obj.name])
// : data[obj.name]
// }
// disabled
// />
// : obj.name !== 'roadSectionStart' ?
// <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
// {
// data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
// return <div style={{ width: '44%', margin: 6 }}>
// <Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
// </div>
// }) : '暂无图片'
// }
// </div>
// : <div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}>
// <Input style={{ width: '100%' }} disabled value={data[obj.name] + '-' + data['roadSectionEnd']} />
// </div>
// }
// </div>
// );
// } else {
// return null; // 不渲染其他异常字段
// }
// });
// }
// } else {
// return '暂无数据';
// }
// }
return (
<Modal
visible={visible}
footer={null}
onCancel={handleClose}
title={'养护管理详情'}
>
<Spin spinning={loading}>
{renderContent(data)}
</Spin>
</Modal>
)
}
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 <Button
onClick={() => { checkDetail(record); handleOpen() }}
style={{ marginRight: 10 }}>查看</Button>
}
}
]
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 (
<div>
<Button onClick={addHanler} type='primary' style={{ marginRight: '50px' }}> 新增 </Button>
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} style={{ marginRight: '50px' }} />
<Button onClick={lookhandler} > 查询 </Button>
<Divider />
<ProTable
columns={columns}
dataSource={reportData}
loading={loading}
pagination={{
pageSize: 10,
defaultPageSize: 10,
showSizeChanger: false,
}}
rowKey="key"
toolBarRender={false}
search={false}
/>
<Modal visible={vis} onCancel={cancelHandler} title='养护抽查' onOk={okHandler}>
<Form form={form}>
<Form.Item
label="抽取比例"
// name="percent"
rules={[{ required: true, message: '请填写抽取比例' }]}
>
<Input.Group compact>
<Form.Item
name="percentValue"
noStyle
rules={[
{ required: true, message: '请填写抽取比例' },
{
pattern: /^(100|\d{1,2})(\.\d{1,2})?$/,
message: '请输入有效的比例',
},
]}
>
<Input style={{ width: '80%' }} placeholder="请输入抽取比例" />
</Form.Item>
<Form.Item
// name="percentSign"
noStyle
style={{ width: '20%', textAlign: 'center' }}
>
%
</Form.Item>
</Input.Group>
</Form.Item>
<Form.Item className="ant-row" >
<div style={{ display: 'flex', justifyContent: 'center' }}>
<Button type='primary' onClick={extractHandler}>开始抽取</Button>
</div>
</Form.Item>
<Form.Item label='抽查结果' name='result'>
<Input disabled />
</Form.Item>
<Form.Item label='抽查乡镇' name='village'>
<Input disabled />
</Form.Item>
<Form.Item label='抽查条数' name='total'>
<Input disabled />
</Form.Item>
</Form>
</Modal>
<DetailForm visible={detailVisible}
handleClose={handleClose}
data={reportDetail}
loading={reportDetailLoading} />
</div>
)
}
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);

7
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) {
<Menu.Item key="fillionvideoCenter">
<Link to="/fillion/videoCenter">视频中心</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCESPOTCHECK') ?
<Menu.Item key="maintenanceSpotCheck">
<Link to="/fillion/maintenanceSpotCheck">养护抽查</Link>
</Menu.Item> : ''}
</SubMenu> : null
);
}

11
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'
}
]
}

2
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([])

3
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',

Loading…
Cancel
Save