diff --git a/web/client/src/sections/fillion/actions/index.js b/web/client/src/sections/fillion/actions/index.js index 8a48b86e..7b2f7462 100644 --- a/web/client/src/sections/fillion/actions/index.js +++ b/web/client/src/sections/fillion/actions/index.js @@ -7,12 +7,14 @@ import * as assess from './assess' import * as allDepUsers from './allDepUsers' import * as getReportSpotPrepare from './extract' import * as luzheng from './luzheng' +import * as spotCheck from './spotCheck' export default { - ...infor, - ...patrol, - ...file, - ...assess, - ...allDepUsers, - ...getReportSpotPrepare, - ...luzheng + ...infor, + ...patrol, + ...file, + ...assess, + ...allDepUsers, + ...getReportSpotPrepare, + ...luzheng, + ...spotCheck } \ No newline at end of file diff --git a/web/client/src/sections/fillion/actions/spotCheck.js b/web/client/src/sections/fillion/actions/spotCheck.js new file mode 100644 index 00000000..b7492f5f --- /dev/null +++ b/web/client/src/sections/fillion/actions/spotCheck.js @@ -0,0 +1,35 @@ +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +// export function getAssess (query) { +// return dispatch => basicAction({ +// type: 'get', +// dispatch: dispatch, +// query: query, +// actionType: 'GET_ASSESS', +// url: ApiTable.getAssess, +// msg: { error: '获取考核评分信息' }, +// reducer: { name: 'assess' } +// }); +// } + +// export function delAssess (query) { +// return dispatch => basicAction({ +// type: 'del', +// dispatch: dispatch, +// actionType: 'DEL_ASSESS', +// url: ApiTable.delAssess.replace("{assessId}", query?.id), +// msg: { option: '删除考核评分信息' }, +// }); +// } + +// export function editAssess (query) { +// return dispatch => basicAction({ +// type: 'put', +// dispatch: dispatch, +// data: query, +// actionType: 'PUT_ASSESS', +// url: ApiTable.editAssess, +// msg: { option: '编辑/新增考核评分信息' }, +// }); +// } \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/adjustLog.js b/web/client/src/sections/fillion/containers/adjustLog.js new file mode 100644 index 00000000..b42ddf46 --- /dev/null +++ b/web/client/src/sections/fillion/containers/adjustLog.js @@ -0,0 +1,669 @@ +import { connect } from 'react-redux'; +import React, { useEffect, useState } from 'react'; +import { Button, Modal, Form, Input, Divider, Spin, Image, DatePicker, Descriptions, Table } from 'antd' +import ProTable from '@ant-design/pro-table'; +import { getReportSpotPrepare, getSpotCheck, getSpotCheckDetail } from '../actions/extract' +import { getReportDetail } from '../actions/patrol'; +import moment from 'moment' +import '../components/maintenanceTable.less' + + +const DetailForm = (props) => { + 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: 'codeRoad' }, + { key: '其他', name: 'projectType' }, + { key: '道路类型', name: 'reportType' }, + { key: '路线名称', name: 'road' }, + { key: '路线代码', name: 'codeRoad' }, + { 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: 'conserveUnderwayPic' }, + { 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 roadInfo = [ + { key: '路面类型', name: 'roadType' }, + { key: '路面宽度/米', name: 'roadWidth' }, + { key: '错车道/个', name: 'wrongLane' }, + { key: '行道树/棵', name: 'roadsideTrees' }, + { key: '边沟/米', name: 'roadsideDitch' }, + { key: '护栏/米', name: 'guardrail' }, + { key: '标线/米', name: 'roadMarking' }, + ]; + const mantenanceInfo = [ + { key: '养护人员人数/人', name: 'maintenanceStaffCount' }, + { key: '修整路肩/平方米', name: 'shoulderRepair' }, + { key: '开挖、清理边沟/米', name: 'ditchCleaning' }, + { key: '修补沥青路面/平米', name: 'asphaltRepair' }, + { key: '修补水泥路面/平米', name: 'concreteRepair' }, + { key: '除草/米', name: 'grassMowing' }, + { key: '行道树刷白/株/公里', name: 'treeWhitening' }, + { key: '公里桩/百米桩刷漆/个', name: 'pileWhitening' }, + { key: '维修护栏/米', name: 'guardrailMaintenance' }, + { key: '修复端头/块', name: 'endHeadRepair' }, + { key: '其他', name: 'otherDescription' }, + ]; + const mantenancePic = [ + { key: '养护前图片', name: 'conserveBeforePic' }, + { key: '养护中图片', name: 'conserveUnderwayPic' }, + { key: '养护后图片', name: 'conserveAfterPic' }, + ]; + const renderContent = (data) => { + if (data) { + console.log('data1111', data) + if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {reportTypeText(data['projectType']) || ''} + {data['codeRoad'] || ''} + {data['code'] || ''} + {data['roadSectionStart'] + '-' + data['roadSectionEnd'] || ''} + {data['address'] || ''} + + + {roadInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenanceInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenancePic.map(item => ( + +
+ {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'} +
+
+ ))} +
+ + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
+ }) || '暂无视频'} +
+
+
+
+ // if (data) { + // if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { + // return keyList.map(obj => { + // return
+ // {obj.key} + // { + // obj.name != 'conserveBeforePic' && obj.name != 'conserveAfterPic' && obj.name != 'roadSectionStart' && obj.name != 'videoUrl' && obj.name.indexOf('conserve') == -1 ? + // + // : obj.name != 'roadSectionStart' && obj.name != 'videoUrl' ? + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
: obj.name != 'videoUrl' ?
+ // + + //
:
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(videoUrl => { + // return
+ // + //
+ // }) : '暂无视频' + // } + //
+ // } + + //
+ // }) + + // } else { + // return keyListOld.map(obj => { + // return
+ // {obj.key} + // { + // obj.name != 'scenePic' && obj.name.indexOf('conserve') == -1 ? + // + // : + //
+ // { + // data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { + // return
+ // + //
+ // }) : '暂无图片' + // } + //
+ + // } + //
+ // }) + + // } + + } else { + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {data['roadSectionStart'] && data['roadSectionEnd'] ? (data['roadSectionStart'] + '-' + data['roadSectionEnd']) : ''} + {data['codeRoad'] || ''} + {/* {data['code'] || ''} */} + {data['address'] || ''} + {data['content'] || ''} + + + {mantenancePic.map(item => ( + +
+ {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'} +
+
+ ))} +
+ + +
+ {data['videoUrl']?.map(videoSrc => { + 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(['1970-1-1', '2099-12-31']); + const { RangePicker } = DatePicker + const [expandedRowKeys, setExpandedRowKeys] = useState([]); + + //console.log('reportData', reportData) + const checkDetail = (record) => { + dispatch(getReportDetail(record?.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: 'depName', + align: 'center', + + }, + { + title: '抽查数量', + key: 'count', + dataIndex: 'count', + align: 'center', + + }, + { + title: '抽查总数', + key: 'reportCount', + dataIndex: 'reportCount', + align: 'center', + + }, + + ] + 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 { + spotDate: moment(item.date).format('YYYY-MM-DD'), + depName: item.department?.name, + reportCount: item.reportCount, + count: Math.ceil((item.reportCount * item.percentage) / 100), + reportDetail: item.reportSpotChecks?.map(child => { + return child.report + }), + id: item.id + } + }) + //console.log('data1', data) + setReportData(data) + } + }) + } + + 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(Math.ceil((res?.payload.data?.reportCount) * (Number(values.percentValue) / 100))) + + form.setFieldsValue({ + 'result': res?.payload.data?.reportCount, + 'village': res?.payload.data?.lukyDepartment?.name, + 'total': Math.ceil((res?.payload.data?.reportCount) * (Number(values.percentValue) / 100)) + }) + } + }) + } + const cancelHandler = () => { + setVis(false) + form.resetFields() + } + const okHandler = async () => { + if (previewId !== 0) { + const res = await dispatch(getSpotCheck({ previewId })) + const rslt = res.payload.data.map(item => { + return { + spotDate: moment(item.date).format('YYYY-MM-DD'), + depName: item.department?.name, + reportCount: item.reportCount, + count: Math.ceil((item.reportCount * item.percentage) / 100), + reportDetail: item.reportSpotChecks?.map(child => { + return child.report + }), + id: item.id + } + }) || [] + setReportData(rslt) + form.resetFields() + setVis(false) + } + } + //console.log('setReportData', reportData) + + const lookhandler = () => { + if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { + queryData({ startTime: moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime: moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') }) + } + } + + return ( +
+ + { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> + + + ( + < Table + pagination={false} + dataSource={record?.reportDetail} + columns={ + [ + { title: '所属道路', dataIndex: 'road' }, + { + title: '所在路段', + key: 'address', + dataIndex: 'address', + align: 'center', + render: (_, r) => { + return `${r?.roadSectionStart || ''}-${r?.roadSectionEnd || ''}` + } + }, + { title: '具体位置', dataIndex: 'address' }, + { + title: '上报人', + width: 100, + key: 'userName', + dataIndex: 'userName', + align: 'center', + render: (text, r) => { + return r?.user?.name || '' + } + }, + { + title: '上报时间', + key: 'time', + dataIndex: 'time', + valueType: 'dateTime', + align: 'center', + render: (_, r) => { + return moment(r?.time).format('YYYY-MM-DD HH:mm:ss') + } + }, + { + title: '操作', + key: 'caozuo', + align: 'center', + render: (_, r) => { + return + } + } + // { title: '', dataIndex: 'subColumn1' }, + // { title: '', dataIndex: 'subColumn2' }, + // ... 其他子表格列配置 + ]} + /> + ), + }} + pagination={{ + pageSize: 10, + defaultPageSize: 10, + showSizeChanger: false, + }} + rowKey={(record) => { return record.id }} + toolBarRender={false} + search={false} + /> + +
+ + + + + + {/* + % + */} + + + + + + + + + + + + + + +
+
+ +
+ ) +} +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/containers/index.js b/web/client/src/sections/fillion/containers/index.js index eac6898f..d58f7d32 100644 --- a/web/client/src/sections/fillion/containers/index.js +++ b/web/client/src/sections/fillion/containers/index.js @@ -18,9 +18,11 @@ import Assess from './assess' import VideoCenter from './videoCenter'; import Building from './building' import MaintenanceSpotCheck from './maintenanceSpotCheck' +import MaintenanceSpotCheckNew from './maintenanceSpotCheck-new' +import AdjustLog from './adjustLog' export { - Infor, transportation, BridgeTable, HigHways, - OperaTional, Enforce, Public, Videois, PromoTional, - Maintenance, Patrol, File, Jiekouguanli, - Task, Building, Assess, VideoCenter, MaintenanceSpotCheck + Infor, transportation, BridgeTable, HigHways, + OperaTional, Enforce, Public, Videois, PromoTional, + Maintenance, Patrol, File, Jiekouguanli, + Task, Building, Assess, VideoCenter, MaintenanceSpotCheck, MaintenanceSpotCheckNew, AdjustLog }; \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js b/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js new file mode 100644 index 00000000..bd5d2261 --- /dev/null +++ b/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js @@ -0,0 +1,466 @@ +import { connect } from 'react-redux'; +import React, { useEffect, useState } from 'react'; +import { Button, Modal, Form, Input, Divider, Spin, Image, DatePicker, Descriptions, Table } from 'antd' +import ProTable from '@ant-design/pro-table'; +import { getReportSpotPrepare, getSpotCheck, getSpotCheckDetail } from '../actions/extract' +import { getReportDetail } from '../actions/patrol'; +import moment from 'moment' +import '../components/maintenanceTable.less' + + +const DetailForm = (props) => { + 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 roadInfo = [ + { key: '路面类型', name: 'roadType' }, + { key: '路面宽度/米', name: 'roadWidth' }, + { key: '错车道/个', name: 'wrongLane' }, + { key: '行道树/棵', name: 'roadsideTrees' }, + { key: '边沟/米', name: 'roadsideDitch' }, + { key: '护栏/米', name: 'guardrail' }, + { key: '标线/米', name: 'roadMarking' }, + ]; + const mantenanceInfo = [ + { key: '养护人员人数/人', name: 'maintenanceStaffCount' }, + { key: '修整路肩/平方米', name: 'shoulderRepair' }, + { key: '开挖、清理边沟/米', name: 'ditchCleaning' }, + { key: '修补沥青路面/平米', name: 'asphaltRepair' }, + { key: '修补水泥路面/平米', name: 'concreteRepair' }, + { key: '除草/米', name: 'grassMowing' }, + { key: '行道树刷白/株/公里', name: 'treeWhitening' }, + { key: '公里桩/百米桩刷漆/个', name: 'pileWhitening' }, + { key: '维修护栏/米', name: 'guardrailMaintenance' }, + { key: '修复端头/块', name: 'endHeadRepair' }, + { key: '其他', name: 'otherDescription' }, + ]; + const mantenancePic = [ + { key: '养护前图片', name: 'conserveBeforePic' }, + { key: '养护中图片', name: 'conserveUnderwayPic' }, + { key: '养护后图片', name: 'conserveAfterPic' }, + ]; + const renderContent = (data) => { + if (data) { + if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) { + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {reportTypeText(data['projectType']) || ''} + {data['codeRoad'] || ''} + {data['code'] || ''} + {data['roadSectionStart'] + '-' + data['roadSectionEnd'] || ''} + {data['address'] || ''} + + + {roadInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenanceInfo.map(item => ( + + {data[item.name] || ''} + + ))} + + + {mantenancePic.map(item => ( + +
+ {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'} +
+
+ ))} +
+ + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
+ }) || '暂无视频'} +
+
+
+
+ + + } else { + return
+ + {data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''} + {data['roadSectionStart'] && data['roadSectionEnd'] ? (data['roadSectionStart'] + '-' + data['roadSectionEnd']) : ''} + {data['codeRoad'] || ''} + {/* {data['code'] || ''} */} + {data['address'] || ''} + {data['content'] || ''} + + + {mantenancePic.map(item => ( + +
+ {data[item.name]?.map(imgSrc => { + return
+ +
+ }) || '暂无图片'} +
+
+ ))} +
+ + +
+ {data['videoUrl']?.map(videoSrc => { + return
+
+ }) || '暂无视频'} +
+
+
+
+ } + } 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(['1970-1-1', '2099-12-31']); + const { RangePicker } = DatePicker + const [expandedRowKeys, setExpandedRowKeys] = useState([]); + + //console.log('reportData', reportData) + const checkDetail = (record) => { + dispatch(getReportDetail(record?.id)) + } + const handleOpen = () => { + setDetailVisible(true) + } + const handleClose = () => { + setDetailVisible(false) + } + + //里层列名 + const columns = [ + { + title: '抽查日期', + key: 'spotDate', + dataIndex: 'spotDate', + + }, + { + title: '抽查县道比率(%)', + key: 'projeType', + dataIndex: 'dName', + }, + { + title: '抽查县道', + key: 'proctType', + dataIndex: '', + }, + { + title: '抽查乡道', + key: 'prectTye', + dataIndex: 'depame', + }, + { + title: '抽查村道', + key: 'projeType', + dataIndex: 'dName', + }, + { + title: '操作', + key: 'operation', + dataIndex: 'operation', + // 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 { + spotDate: moment(item.date).format('YYYY-MM-DD'), + depName: item.department?.name, + reportCount: item.reportCount, + count: Math.ceil((item.reportCount * item.percentage) / 100), + reportDetail: item.reportSpotChecks?.map(child => { + return child.report + }), + id: item.id + } + }) + setReportData(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(Math.ceil((res?.payload.data?.reportCount) * (Number(values.percentValue) / 100))) + + form.setFieldsValue({ + 'result': res?.payload.data?.reportCount, + 'village': res?.payload.data?.lukyDepartment?.name, + 'total': Math.ceil((res?.payload.data?.reportCount) * (Number(values.percentValue) / 100)) + }) + } + }) + } + const cancelHandler = () => { + setVis(false) + form.resetFields() + } + const okHandler = async () => { + if (previewId !== 0) { + const res = await dispatch(getSpotCheck({ previewId })) + const rslt = res.payload.data.map(item => { + return { + spotDate: moment(item.date).format('YYYY-MM-DD'), + depName: item.department?.name, + reportCount: item.reportCount, + count: Math.ceil((item.reportCount * item.percentage) / 100), + reportDetail: item.reportSpotChecks?.map(child => { + return child.report + }), + id: item.id + } + }) || [] + setReportData(rslt) + form.resetFields() + setVis(false) + } + } + //console.log('setReportData', reportData) + + const lookhandler = () => { + if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { + queryData({ startTime: moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime: moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') }) + } + } + + return ( +
+ +
+ + +
+ { setDateRange(dateString) }} style={{ marginRight: 20 }} /> + + +
+
+ + + ( + < Table + pagination={false} + dataSource={record?.reportDetail} + columns={ + [ + { title: '所属道路', dataIndex: 'road' }, + { + title: '所在路段', + key: 'address', + dataIndex: 'address', + align: 'center', + render: (_, r) => { + return `${r?.roadSectionStart || ''}-${r?.roadSectionEnd || ''}` + } + }, + { title: '具体位置', dataIndex: 'address' }, + { + title: '上报人', + width: 100, + key: 'userName', + dataIndex: 'userName', + align: 'center', + render: (text, r) => { + return r?.user?.name || '' + } + }, + { + title: '上报时间', + key: 'time', + dataIndex: 'time', + valueType: 'dateTime', + align: 'center', + render: (_, r) => { + return moment(r?.time).format('YYYY-MM-DD HH:mm:ss') + } + }, + { + title: '操作', + key: 'caozuo', + align: 'center', + render: (_, r) => { + return + } + } + // { title: '', dataIndex: 'subColumn1' }, + // { title: '', dataIndex: 'subColumn2' }, + // ... 其他子表格列配置 + ]} + /> + ), + }} + pagination={{ + pageSize: 10, + defaultPageSize: 10, + showSizeChanger: false, + }} + rowKey={(record) => { return record.id }} + // toolBarRender={false} + // search={false} + /> + +
+ + + + + + {/* + % + */} + + + + + + + + + + + + + + + +
+ + + ) +} +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 f8644ec0..0632ac88 100644 --- a/web/client/src/sections/fillion/nav-item.js +++ b/web/client/src/sections/fillion/nav-item.js @@ -3,113 +3,118 @@ import { Link } from 'react-router-dom'; import { Menu } from 'antd'; import { ReadOutlined } from '@ant-design/icons'; const SubMenu = Menu.SubMenu; -export function getNavItem(user, dispatch) { - const isshow = user?.userResources?. - some(i => i.resourceId === 'OVERLOADMANAGE' || - i.resourceId === 'ROADMANAGE' || - i.resourceId === 'BRIDGEMANAGE' || - i.resourceId === 'MAINTENANCEMANAGE' || - i.resourceId === 'TRANSPORTATIONMANAGE' || - i.resourceId === 'CONSERVATIONMANAGE' || - i.resourceId === 'PUBLICTRANSPORTMANAGE' || - i.resourceId === 'FILEMANAGE' || - i.resourceId === 'PUBLICITYVIDEO' || - i.resourceId === 'FEEDBACKMANAGE' || - i.resourceId === 'REPORTMANAGE' || - i.resourceId === 'PATROLMANAGE' || - i.resourceId === 'ASSESSMANAGE' || - i.resourceId === 'VIDEOCENTER' || - i.resourceId === 'BUILDINGPROJECT' || - i.resourceId === 'MAINTENANCESPOTCHECK' || - i.resourceId === 'LUZHENG' - ) +export function getNavItem (user, dispatch) { + const isshow = user?.userResources?. + some(i => i.resourceId === 'OVERLOADMANAGE' || + i.resourceId === 'ROADMANAGE' || + i.resourceId === 'BRIDGEMANAGE' || + i.resourceId === 'MAINTENANCEMANAGE' || + i.resourceId === 'TRANSPORTATIONMANAGE' || + i.resourceId === 'CONSERVATIONMANAGE' || + i.resourceId === 'PUBLICTRANSPORTMANAGE' || + i.resourceId === 'FILEMANAGE' || + i.resourceId === 'PUBLICITYVIDEO' || + i.resourceId === 'FEEDBACKMANAGE' || + i.resourceId === 'REPORTMANAGE' || + i.resourceId === 'PATROLMANAGE' || + i.resourceId === 'ASSESSMANAGE' || + i.resourceId === 'VIDEOCENTER' || + i.resourceId === 'BUILDINGPROJECT' || + i.resourceId === 'MAINTENANCESPOTCHECK' || + i.resourceId === 'LUZHENG' || + i.resourceId === 'ADJUSTLOG' + ) - return ( - user?.username == 'SuperAdmin' || isshow ? - } title={'数据管理'}> - {/* {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ? + return ( + user?.username == 'SuperAdmin' || isshow ? + } title={'数据管理'}> + {/* {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ? 治超管理 : ''} */} - {/* + {/* 任务管理 */} - - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'LUZHENG') ? - - 路政管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ? - - 道路管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BRIDGEMANAGE') ? - - 桥梁管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCEMANAGE') ? - - 管养管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'TRANSPORTATIONMANAGE') ? - - 运政管理 - : ''} - {/* + + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'LUZHENG') ? + + 路政管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ? + + 道路管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BRIDGEMANAGE') ? + + 桥梁管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCEMANAGE') ? + + 管养管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'TRANSPORTATIONMANAGE') ? + + 运政管理 + : ''} + {/* 执法管理 */} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'CONSERVATIONMANAGE') ? - - 养护管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PATROLMANAGE') ? - - 巡查管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FEEDBACKMANAGE') ? - - 异常反馈 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'REPORTMANAGE') ? + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'CONSERVATIONMANAGE') ? + + 养护管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PATROLMANAGE') ? + + 巡查管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FEEDBACKMANAGE') ? + + 异常反馈 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'REPORTMANAGE') ? - - 建设上报 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BUILDINGPROJECT') ? - - 在建项目 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICTRANSPORTMANAGE') ? - - 公交管理 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FILEMANAGE') ? - - 档案管理 - : ''} - {/* + + 建设上报 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BUILDINGPROJECT') ? + + 在建项目 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICTRANSPORTMANAGE') ? + + 公交管理 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FILEMANAGE') ? + + 档案管理 + : ''} + {/* 视频管理 */} - {/* + {/* 接口管理 */} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICITYVIDEO') ? - - 宣传视频 - : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICITYVIDEO') ? + + 宣传视频 + : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ASSESSMANAGE') ? - - 考核评分 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'VIDEOCENTER') ? - - 视频中心 - : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCESPOTCHECK') ? - - 养护抽查 - : ''} - : null - ); + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ASSESSMANAGE') ? + + 考核评分 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'VIDEOCENTER') ? + + 视频中心 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCESPOTCHECK') ? + + 养护抽查 + : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ADJUSTLOG') ? + + 调整日志 + : ''} + : null + ); } diff --git a/web/client/src/sections/fillion/routes.js b/web/client/src/sections/fillion/routes.js index 9172cd69..bd4f6d1b 100644 --- a/web/client/src/sections/fillion/routes.js +++ b/web/client/src/sections/fillion/routes.js @@ -14,184 +14,193 @@ import { File } from './containers'; import { Jiekouguanli } from './containers' import { Task, Assess, VideoCenter, } from './containers' import { Building } from './containers' -import { MaintenanceSpotCheck } from './containers' +import { MaintenanceSpotCheckNew, AdjustLog } from './containers' import Luzheng from './containers/luzheng'; export default [{ - type: 'inner', - route: { - path: '/fillion', - key: 'fillion', - breadcrumb: '数据管理', - menuSelectKeys: ['fillion'], - menuOpenKeys: ['fillion'], - childRoutes: [{ - path: '/infor', - key: 'fillioninfor', - menuSelectKeys: ['fillioninfor'], - component: Infor, - breadcrumb: '治超管理', - authCode: 'OVERLOADMANAGE' - }, - { - path: '/luzheng', - key: 'luzheng', - menuSelectKeys: ['luzheng'], - component: Luzheng, - breadcrumb: '路政管理', - authCode: 'OVERLOADMANAGE' - }, - { - path: '/task', - key: 'filliontask', - menuSelectKeys: ['filliontask'], - component: Task, - breadcrumb: '任务管理', - //authCode: 'OVERLOADMANAGE' - }, { - path: '/transportation', - key: 'filliontransportation', - menuSelectKeys: ['filliontransportation'], - component: transportation, - breadcrumb: '道路管理', - authCode: 'ROADMANAGE' + type: 'inner', + route: { + path: '/fillion', + key: 'fillion', + breadcrumb: '数据管理', + menuSelectKeys: ['fillion'], + menuOpenKeys: ['fillion'], + childRoutes: [{ + path: '/infor', + key: 'fillioninfor', + menuSelectKeys: ['fillioninfor'], + component: Infor, + breadcrumb: '治超管理', + authCode: 'OVERLOADMANAGE' + }, + { + path: '/luzheng', + key: 'luzheng', + menuSelectKeys: ['luzheng'], + component: Luzheng, + breadcrumb: '路政管理', + authCode: 'OVERLOADMANAGE' + }, + { + path: '/task', + key: 'filliontask', + menuSelectKeys: ['filliontask'], + component: Task, + breadcrumb: '任务管理', + //authCode: 'OVERLOADMANAGE' + }, { + path: '/transportation', + key: 'filliontransportation', + menuSelectKeys: ['filliontransportation'], + component: transportation, + breadcrumb: '道路管理', + authCode: 'ROADMANAGE' - }, - { - path: '/processsing', - key: 'fillionprocesssing', - menuSelectKeys: ['fillionprocesssing'], - component: Building, - breadcrumb: '在建项目', - authCode: 'BUILDINGPROJECT' + }, + { + path: '/processsing', + key: 'fillionprocesssing', + menuSelectKeys: ['fillionprocesssing'], + component: Building, + breadcrumb: '在建项目', + authCode: 'BUILDINGPROJECT' - } - , { - path: '/bridge', - key: 'fillionbridge', - menuSelectKeys: ['fillionbridge'], - component: BridgeTable, - breadcrumb: '桥梁管理', - authCode: 'BRIDGEMANAGE' + } + , { + path: '/bridge', + key: 'fillionbridge', + menuSelectKeys: ['fillionbridge'], + component: BridgeTable, + breadcrumb: '桥梁管理', + authCode: 'BRIDGEMANAGE' - } - , { - path: '/highways', - key: 'fillionhighways', - menuSelectKeys: ['fillionhighways'], - component: HigHways, - breadcrumb: '管养管理', - authCode: 'MAINTENANCEMANAGE' + } + , { + path: '/highways', + key: 'fillionhighways', + menuSelectKeys: ['fillionhighways'], + component: HigHways, + breadcrumb: '管养管理', + authCode: 'MAINTENANCEMANAGE' - }, { - path: '/operational', - key: 'fillionoperational', - menuSelectKeys: ['fillionoperational'], - component: OperaTional, - breadcrumb: '运政管理', - authCode: 'TRANSPORTATIONMANAGE' + }, { + path: '/operational', + key: 'fillionoperational', + menuSelectKeys: ['fillionoperational'], + component: OperaTional, + breadcrumb: '运政管理', + authCode: 'TRANSPORTATIONMANAGE' - }, { - path: '/enforce', - key: 'fillionenforce', - menuSelectKeys: ['fillionenforce'], - component: Enforce, - breadcrumb: '执法管理', - }, { - path: '/maintenance', - key: 'fillionmaintenance', - menuSelectKeys: ['fillionmaintenance'], - component: Maintenance, - breadcrumb: '养护管理', - authCode: 'CONSERVATIONMANAGE' - }, { - path: '/patrol', - key: 'fillionpatrol', - menuSelectKeys: ['fillionpatrol'], - component: Patrol, - breadcrumb: '巡查管理', - authCode: 'PATROLMANAGE' + }, { + path: '/enforce', + key: 'fillionenforce', + menuSelectKeys: ['fillionenforce'], + component: Enforce, + breadcrumb: '执法管理', + }, { + path: '/maintenance', + key: 'fillionmaintenance', + menuSelectKeys: ['fillionmaintenance'], + component: Maintenance, + breadcrumb: '养护管理', + authCode: 'CONSERVATIONMANAGE' + }, { + path: '/patrol', + key: 'fillionpatrol', + menuSelectKeys: ['fillionpatrol'], + component: Patrol, + breadcrumb: '巡查管理', + authCode: 'PATROLMANAGE' - }, { - path: '/patrol_anomaly', - key: 'fillionpatrolanomaly', - menuSelectKeys: ['fillionpatrolanomaly'], - component: Patrol, - breadcrumb: '异常反馈', - authCode: 'FEEDBACKMANAGE' + }, { + path: '/patrol_anomaly', + key: 'fillionpatrolanomaly', + menuSelectKeys: ['fillionpatrolanomaly'], + component: Patrol, + breadcrumb: '异常反馈', + authCode: 'FEEDBACKMANAGE' - }, { - path: '/patrol_road', - key: 'fillionpatrolroad', - menuSelectKeys: ['fillionpatrolroad'], - component: Patrol, - breadcrumb: '建设上报', - authCode: 'REPORTMANAGE' + }, { + path: '/patrol_road', + key: 'fillionpatrolroad', + menuSelectKeys: ['fillionpatrolroad'], + component: Patrol, + breadcrumb: '建设上报', + authCode: 'REPORTMANAGE' - }, { - path: '/public', - key: 'fillionpublic', - menuSelectKeys: ['fillionpublic'], - component: Public, - breadcrumb: '公交管理', - authCode: 'PUBLICTRANSPORTMANAGE' + }, { + path: '/public', + key: 'fillionpublic', + menuSelectKeys: ['fillionpublic'], + component: Public, + breadcrumb: '公交管理', + authCode: 'PUBLICTRANSPORTMANAGE' - }, - { - path: '/file', - key: 'fileCont', - menuSelectKeys: ['fileCont'], - component: File, - breadcrumb: '档案管理', - authCode: 'FILEMANAGE' + }, + { + path: '/file', + key: 'fileCont', + menuSelectKeys: ['fileCont'], + component: File, + breadcrumb: '档案管理', + authCode: 'FILEMANAGE' - }, - { - path: '/videois', - key: 'fillionvideois', - menuSelectKeys: ['fillionvideois'], - component: Videois, - breadcrumb: '视频管理', - authCode: 'PUBLICITYVIDEO' + }, + { + path: '/videois', + key: 'fillionvideois', + menuSelectKeys: ['fillionvideois'], + component: Videois, + breadcrumb: '视频管理', + authCode: 'PUBLICITYVIDEO' - }, - { - path: '/jiekouguanli', - key: 'jiekouguanli', - menuSelectKeys: ['jiekouguanli'], - component: Jiekouguanli, - breadcrumb: '接口管理', - }, { - path: '/promotional', - key: 'fillionpromotional', - menuSelectKeys: ['fillionpromotional'], - component: PromoTional, - breadcrumb: '视频管理', - authCode: 'PUBLICITYVIDEO' - }, { - path: '/assess', - key: 'fillionassess', - menuSelectKeys: ['fillionassess'], - component: Assess, - breadcrumb: '考核评分', - authCode: 'ASSESSMANAGE' - }, { - path: '/videoCenter', - key: 'fillionvideoCenter', - menuSelectKeys: ['fillionvideoCenter'], - component: VideoCenter, - breadcrumb: '视频中心', - authCode: 'VIDEOCENTER' + }, + { + path: '/jiekouguanli', + key: 'jiekouguanli', + menuSelectKeys: ['jiekouguanli'], + component: Jiekouguanli, + breadcrumb: '接口管理', + }, { + path: '/promotional', + key: 'fillionpromotional', + menuSelectKeys: ['fillionpromotional'], + component: PromoTional, + breadcrumb: '视频管理', + authCode: 'PUBLICITYVIDEO' + }, { + path: '/assess', + key: 'fillionassess', + menuSelectKeys: ['fillionassess'], + component: Assess, + breadcrumb: '考核评分', + authCode: 'ASSESSMANAGE' + }, { + path: '/videoCenter', + key: 'fillionvideoCenter', + menuSelectKeys: ['fillionvideoCenter'], + component: VideoCenter, + breadcrumb: '视频中心', + authCode: 'VIDEOCENTER' - }, - { - path: '/maintenanceSpotCheck', - key: 'maintenanceSpotCheck', - menuSelectKeys: ['maintenanceSpotCheck'], - component: MaintenanceSpotCheck, - breadcrumb: '养护抽查', - authCode: 'MAINTENANCESPOTCHECK' + }, + { + path: '/maintenanceSpotCheck', + key: 'maintenanceSpotCheck', + menuSelectKeys: ['maintenanceSpotCheck'], + component: MaintenanceSpotCheckNew, + breadcrumb: '养护抽查', + authCode: 'MAINTENANCESPOTCHECK' - } - ] - } + }, + { + path: '/adjustLog', + key: 'adjustLog', + menuSelectKeys: ['adjustLog'], + component: AdjustLog, + breadcrumb: '调整日志', + authCode: 'ADJUSTLOG' + + } + ] + } }]; diff --git a/web/client/src/sections/organization/containers/authority.js b/web/client/src/sections/organization/containers/authority.js index 66b8ab89..c745e478 100644 --- a/web/client/src/sections/organization/containers/authority.js +++ b/web/client/src/sections/organization/containers/authority.js @@ -9,282 +9,282 @@ import Resource from '../components/resource'; import user from './user'; const Authority = (props) => { - const CheckboxGroup = Checkbox.Group; - const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = 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', 'MAINTENANCESPOTCHECK' - ] - const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员 - const [depSelectedKeys, setDepSelectedKeys] = useState([]) - const [userSelectedKeys, setUserSelectedKeys] = useState([]) - const [depSelected, setDepSelected] = useState() - const [userSelected, setUserSelected] = useState() - const [resCode, setResCode] = useState(userResource.map(i => i.resourceId)) - const [useName, setUseName] = useState()// 选中名字 - const [userType, setUserType] = useState() - const [depMessagedata, setdepMessagedata] = useState(depMessage) + const CheckboxGroup = Checkbox.Group; + const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = 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', 'MAINTENANCESPOTCHECK', 'ADJUSTLOG' + ] + const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员 + const [depSelectedKeys, setDepSelectedKeys] = useState([]) + const [userSelectedKeys, setUserSelectedKeys] = useState([]) + const [depSelected, setDepSelected] = useState() + const [userSelected, setUserSelected] = useState() + const [resCode, setResCode] = useState(userResource.map(i => i.resourceId)) + const [useName, setUseName] = useState()// 选中名字 + const [userType, setUserType] = useState() + const [depMessagedata, setdepMessagedata] = useState(depMessage) - const rescodeall = resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })) - //console.log(resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })), '这个是总的骂') - const [indeterminate, setIndeterminate] = useState(false); - const [checkAll, setCheckAll] = useState(true); - const [rescheckAll, setrescheckAll] = useState(false) - const [isshow, setisshow] = useState(false); + const rescodeall = resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })) + //console.log(resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })), '这个是总的骂') + const [indeterminate, setIndeterminate] = useState(false); + const [checkAll, setCheckAll] = useState(true); + const [rescheckAll, setrescheckAll] = useState(false) + const [isshow, setisshow] = useState(false); - let plainOptions = depUser.map(i => ({ label: i.name, value: i.id })); - const [checkedList, setCheckedList] = useState(depUser.map(i => i.id)); - const onChange = (list) => { - // console.log(list,'选择的') - setCheckedList(list); - setIndeterminate(!!list.length && list.length < plainOptions.length); - // setResCode(userResource.map(i=>i.resourceId)) - setCheckAll(list.length === plainOptions.length); - dispatch(getUserResource(list)) - // if(list.length === plainOptions.length){ - // setUseName('全部用户') - // } - }; + let plainOptions = depUser.map(i => ({ label: i.name, value: i.id })); + const [checkedList, setCheckedList] = useState(depUser.map(i => i.id)); + const onChange = (list) => { + // console.log(list,'选择的') + setCheckedList(list); + setIndeterminate(!!list.length && list.length < plainOptions.length); + // setResCode(userResource.map(i=>i.resourceId)) + setCheckAll(list.length === plainOptions.length); + dispatch(getUserResource(list)) + // if(list.length === plainOptions.length){ + // setUseName('全部用户') + // } + }; - // console.log(userSelectedKeys,'当前1') - const onresChange = (d) => { - setResCode(d) - setrescheckAll(d.length === r1.length) - } - const onresCheckAllChange = (d) => { - setrescheckAll(d.target.checked) - setResCode(d.target.checked ? r1 : []) + // console.log(userSelectedKeys,'当前1') + const onresChange = (d) => { + setResCode(d) + setrescheckAll(d.length === r1.length) + } + const onresCheckAllChange = (d) => { + setrescheckAll(d.target.checked) + setResCode(d.target.checked ? r1 : []) - } - const onCheckAllChange = (e) => { - setCheckedList(e.target.checked ? plainOptions.map(i => i.value) : []); - setIndeterminate(false); - // if(e.target.checked){ - // setUseName('全部用户') - // } + } + const onCheckAllChange = (e) => { + setCheckedList(e.target.checked ? plainOptions.map(i => i.value) : []); + setIndeterminate(false); + // if(e.target.checked){ + // setUseName('全部用户') + // } - setCheckAll(e.target.checked); - // setResCode(userResource.map(i=>i.resourceId)) - }; - const onshowchange = (e) => { - setisshow(e.target.checked) - } - //console.log('depMessagedata', depMessagedata) + setCheckAll(e.target.checked); + // setResCode(userResource.map(i=>i.resourceId)) + }; + const onshowchange = (e) => { + setisshow(e.target.checked) + } + //console.log('depMessagedata', depMessagedata) - useEffect(() => { - dispatch(getResource()) - if (!(depMessage && depMessage.length)) { - dispatch(getDepMessage()) - } - setResCode(userResource.map(i => i.resourceId)) - setisshow(userResource.some(i => i.isshow === "true")) - setrescheckAll(userResource.map(i => i.resourceId).length === 14) - }, []) - useEffect(() => { - setResCode(userResource.map(i => i.resourceId)) - setisshow(userResource.some(i => i.isshow === "true")) - setrescheckAll(userResource.map(i => i.resourceId).length === 14) - }, [userResource]) - useEffect(async () => { - if (depMessage.length) { - //('depMessage', depMessage) - //超级管理员展示所有部门 - if (user?.username === 'SuperAdmin') { - setdepMessagedata(depMessage) - dispatch(getDepUser(depMessage[0]?.id)) - setDepSelectedKeys([depMessage[0]?.id]) - setDepSelected([depMessage[0]?.name]) - } else { - //不是超级管理员,展示相应部门的数据 - dispatch(getDepUser(user.departmentId)) - const res = await dispatch(getDepById({ deptId: parseInt(user.departmentId) })) - //console.log('resssss', res) - setdepMessagedata(res.payload.data) - // if (authDep.length > 0) { - // dispatch(getDepUser(authDep[0]?.id)) - // setDepSelectedKeys([authDep[0]?.id]) - // setDepSelected([authDep[0]?.name]) - // } - } + useEffect(() => { + dispatch(getResource()) + if (!(depMessage && depMessage.length)) { + dispatch(getDepMessage()) + } + setResCode(userResource.map(i => i.resourceId)) + setisshow(userResource.some(i => i.isshow === "true")) + setrescheckAll(userResource.map(i => i.resourceId).length === 14) + }, []) + useEffect(() => { + setResCode(userResource.map(i => i.resourceId)) + setisshow(userResource.some(i => i.isshow === "true")) + setrescheckAll(userResource.map(i => i.resourceId).length === 14) + }, [userResource]) + useEffect(async () => { + if (depMessage.length) { + //('depMessage', depMessage) + //超级管理员展示所有部门 + if (user?.username === 'SuperAdmin') { + setdepMessagedata(depMessage) + dispatch(getDepUser(depMessage[0]?.id)) + setDepSelectedKeys([depMessage[0]?.id]) + setDepSelected([depMessage[0]?.name]) + } else { + //不是超级管理员,展示相应部门的数据 + dispatch(getDepUser(user.departmentId)) + const res = await dispatch(getDepById({ deptId: parseInt(user.departmentId) })) + //console.log('resssss', res) + setdepMessagedata(res.payload.data) + // if (authDep.length > 0) { + // dispatch(getDepUser(authDep[0]?.id)) + // setDepSelectedKeys([authDep[0]?.id]) + // setDepSelected([authDep[0]?.name]) + // } + } - } + } - }, [depMessage]) - // useEffect(() => { - // if(user.username!=='SuperAdmin'){ - // dispatch(getDepMessage(user.departmentId)) - // } - // }, [depMessage]) - useEffect(() => { - const copy = [...new Set(depUser)] - setDepUserCopy(copy) - if (copy.length) { - setUserSelectedKeys([copy[0].id]) - setUserSelected(copy[0].username) - dispatch(getUserResource(copy[0].id)) - setUseName(copy[0].name) - } - setCheckedList(copy.map(i => i.id)) - }, [depUser]) - // console.log(depUser,'用户信息') - const handleSave = () => { - // console.log( userSelectedKeys[0],'当前选中的id') - // checkedList.map(i=>{ - // dispatch(postUserRes({ userId: i, resCode: resCode,isShow:isshow })).then(res => { - // if (res.success) { - // dispatch(getUserResource(i)) - // } - // }) - // dispatch(postUserReso({ userId: i, resCode: resCode,isShow:isshow })) - // }) + }, [depMessage]) + // useEffect(() => { + // if(user.username!=='SuperAdmin'){ + // dispatch(getDepMessage(user.departmentId)) + // } + // }, [depMessage]) + useEffect(() => { + const copy = [...new Set(depUser)] + setDepUserCopy(copy) + if (copy.length) { + setUserSelectedKeys([copy[0].id]) + setUserSelected(copy[0].username) + dispatch(getUserResource(copy[0].id)) + setUseName(copy[0].name) + } + setCheckedList(copy.map(i => i.id)) + }, [depUser]) + // console.log(depUser,'用户信息') + const handleSave = () => { + // console.log( userSelectedKeys[0],'当前选中的id') + // checkedList.map(i=>{ + // dispatch(postUserRes({ userId: i, resCode: resCode,isShow:isshow })).then(res => { + // if (res.success) { + // dispatch(getUserResource(i)) + // } + // }) + // dispatch(postUserReso({ userId: i, resCode: resCode,isShow:isshow })) + // }) - dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })).then(res => { - if (res.success) { - dispatch(getUserResource(userSelectedKeys[0])) - } - }) - dispatch(postUserReso({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })) - } + dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })).then(res => { + if (res.success) { + dispatch(getUserResource(userSelectedKeys[0])) + } + }) + dispatch(postUserReso({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })) + } - return ( - - - - - { - depMessagedata.length ? - { - setUserType(selectedNodes[0].type) - setCheckedList(depUserCopy.map(i => i.id)) - // setResCode(userResource.map(i=>i.resourceId)) + return ( + + + + + { + depMessagedata.length ? + { + setUserType(selectedNodes[0].type) + setCheckedList(depUserCopy.map(i => i.id)) + // setResCode(userResource.map(i=>i.resourceId)) - if (selected) { - setCheckedList(depUserCopy.map(i => i.id)) - setDepSelectedKeys(selectedKeys) - setDepSelected(selectedNodes[0].name || "") - dispatch(getDepUser(selectedKeys[0])) + if (selected) { + setCheckedList(depUserCopy.map(i => i.id)) + setDepSelectedKeys(selectedKeys) + setDepSelected(selectedNodes[0].name || "") + dispatch(getDepUser(selectedKeys[0])) - // setResCode(userResource.map(i=>i.resourceId)) + // setResCode(userResource.map(i=>i.resourceId)) - } + } - }} - treeData={depMessagedata} - fieldNames={{ - title: 'name', - key: 'id', - children: 'subordinate' - }} - /> : '' - } - - - - - { - depUserCopy?.length ? - { - const name = node.name - setUseName(name) + }} + treeData={depMessagedata} + fieldNames={{ + title: 'name', + key: 'id', + children: 'subordinate' + }} + /> : '' + } + + + + + { + depUserCopy?.length ? + { + const name = node.name + setUseName(name) - if (selected) { - // console.log(selectedKeys,'选中的selectedKeys') - // console.log(selectedNodes[0].username || '','node') - // console.log(selectedKeys[0],'请求的值') - setUserSelectedKeys(selectedKeys) - setUserSelected(selectedNodes[0].username || '') - dispatch(getUserResource(selectedKeys[0])) - } + if (selected) { + // console.log(selectedKeys,'选中的selectedKeys') + // console.log(selectedNodes[0].username || '','node') + // console.log(selectedKeys[0],'请求的值') + setUserSelectedKeys(selectedKeys) + setUserSelected(selectedNodes[0].username || '') + dispatch(getUserResource(selectedKeys[0])) + } - }} - treeData={depUserCopy} - fieldNames={{ - title: 'name', - key: 'id' - }} - /> : + }} + treeData={depUserCopy} + fieldNames={{ + title: 'name', + key: 'id' + }} + /> : - //
- // i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}> - // 全选 - // + //
+ // i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}> + // 全选 + // - // i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}/> - //
: + // i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}/> + //
: - } -
- - - i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}> - 不可编辑 - - {depUserCopy?.length ? - - {/* + + + i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}> + 不可编辑 + + {depUserCopy?.length ? + + {/* i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?4:userType} /> */} -
- i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} - > - 全选 - - i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} - /> -
- -
- - - - : - - - } - - - - ) +
+ i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} + > + 全选 + + i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} + /> +
+ + + + + + : + + + } + + + + ) } -function mapStateToProps(state) { - const { userResource, resource, depMessage, depUser, global, auth } = state; - return { - clientHeight: global.clientHeight, - loading: depMessage.isRequesting || depUser.isRequesting || resource.isRequesting, - userResource: userResource.data || [], - resource: resource.data || [], - depMessage: depMessage.data || [], - depUser: depUser.data || [], - user: auth.user - }; +function mapStateToProps (state) { + const { userResource, resource, depMessage, depUser, global, auth } = state; + return { + clientHeight: global.clientHeight, + loading: depMessage.isRequesting || depUser.isRequesting || resource.isRequesting, + userResource: userResource.data || [], + resource: resource.data || [], + depMessage: depMessage.data || [], + depUser: depUser.data || [], + user: auth.user + }; } export default connect(mapStateToProps)(Authority); \ No newline at end of file