wenlele
1 year ago
190 changed files with 101 additions and 34365 deletions
@ -1,14 +0,0 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getAllDepUsers(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_AllDEPUSERS', |
|||
url: ApiTable.getAllDepUsers, |
|||
msg: { option: '获取部门下的所有员工' },//子部门算在第一级部门下面
|
|||
reducer: { name: 'allDepUsers' } |
|||
}); |
|||
} |
@ -1,24 +0,0 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function appointTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_APPOINT_TASK', |
|||
url: ApiTable.appointTask, |
|||
msg: { option: '指派任务' }, |
|||
}); |
|||
} |
|||
|
|||
export function pushAppointSMS(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'PUSH_APPOINT_SMS', |
|||
url: ApiTable.pushAppointSMS, |
|||
msg: { option: '发送指派信息' }, |
|||
}); |
|||
} |
@ -1,35 +0,0 @@ |
|||
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: '编辑/新增考核评分信息' }, |
|||
}); |
|||
} |
@ -1,37 +0,0 @@ |
|||
// 'use strict';
|
|||
|
|||
// import { basicAction } from '@peace/utils'
|
|||
// import { ApiTable } from '$utils'
|
|||
|
|||
// export function reportRectify (timeRange) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'get',
|
|||
// dispatch: dispatch,
|
|||
// actionType: 'GET_REPORT_RECTIFY',
|
|||
// url: `${ApiTable.getReportRectify}?startTime=${timeRange ? timeRange[0] : ''}&endTime=${timeRange ? timeRange[1] : ''}`,
|
|||
// msg: {},
|
|||
// reducer: { name: 'reportRectify' }
|
|||
// });
|
|||
// }
|
|||
|
|||
// export function reportRectifyDetail (day, depId) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'get',
|
|||
// dispatch: dispatch,
|
|||
// actionType: 'GET_REPORT_RECTIFY_DETAIL',
|
|||
// url: `${ApiTable.getReportRectifyDetail}?day=${day}&depId=${depId}`,
|
|||
// msg: {},
|
|||
// reducer: { name: 'reportRectifyDetail' }
|
|||
// });
|
|||
// }
|
|||
|
|||
// export function compileReportRectifyDetail (data) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'post',
|
|||
// dispatch: dispatch,
|
|||
// data,
|
|||
// actionType: 'COMPILE_REPORT_RECTIFY_DETAIL',
|
|||
// url: `${ApiTable.compileReportRectifyDetail}`,
|
|||
// msg: { option: '保存信息' },
|
|||
// });
|
|||
// }
|
@ -1,59 +0,0 @@ |
|||
// 'use strict';
|
|||
|
|||
// import { basicAction } from '@peace/utils'
|
|||
// import { ApiTable } from '$utils'
|
|||
|
|||
// export function allAreas (orgId) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'get',
|
|||
// dispatch: dispatch,
|
|||
// actionType: 'GET_ALL_AREAS',
|
|||
// url: `${ApiTable.allAreas}`,
|
|||
// msg: {},
|
|||
// reducer: { name: 'allAreas' }
|
|||
// });
|
|||
// }
|
|||
|
|||
// export function addReportConfig (data) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'post',
|
|||
// dispatch: dispatch,
|
|||
// data: data,
|
|||
// actionType: 'POST_REPORT_CONFIGS',
|
|||
// url: `${ApiTable.addReportConfig}`,
|
|||
// msg: { option: '添加报表配置' },
|
|||
// });
|
|||
// }
|
|||
|
|||
// export function getReportConfig () {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'get',
|
|||
// dispatch: dispatch,
|
|||
// actionType: 'GET_REPORT_CONFIGS',
|
|||
// url: `${ApiTable.getReportConfig}`,
|
|||
// msg: { error: '获取报表配置失败' },
|
|||
// reducer: { name: 'reportConfig' }
|
|||
// });
|
|||
// }
|
|||
|
|||
// export function editReportConfig (data, configId) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'put',
|
|||
// dispatch: dispatch,
|
|||
// data: data,
|
|||
// actionType: 'EDIT_REPORT_CONFIGS',
|
|||
// url: `${ApiTable.editReportConfig.replace('{reportId}', configId)}`,
|
|||
// msg: { option: '编辑报表配置' },
|
|||
// });
|
|||
// }
|
|||
|
|||
// export function delReportConfig (configId) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'del',
|
|||
// dispatch: dispatch,
|
|||
// actionType: 'DEL_REPORT_CONFIGS',
|
|||
// url: `${ApiTable.delReportConfig.replace('{reportId}', configId)}`,
|
|||
// msg: { option: '删除报表配置' },
|
|||
// });
|
|||
// }
|
|||
|
@ -1,42 +0,0 @@ |
|||
'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: '查询随机抽查明细失败' }, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
@ -1,89 +0,0 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
|
|||
export function createFileDir(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'CREATE_FILE_DIR', |
|||
url: ApiTable.createFileDir, |
|||
query, |
|||
msg: { error: '创建文件夹失败' }, |
|||
// reducer: { name: 'uploadFile' }
|
|||
}); |
|||
} |
|||
|
|||
export function delFileDir(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_FILE_DIR', |
|||
url: ApiTable.delFileDir, |
|||
query, |
|||
msg: { error: '删除文件夹失败' }, |
|||
// reducer: { name: 'uploadFile' }
|
|||
}); |
|||
} |
|||
|
|||
export function queryFileDir(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'QUERY_FILE_DIR', |
|||
url: ApiTable.queryFileDIr, |
|||
query, |
|||
msg: { error: '查询文件夹失败' }, |
|||
reducer: { name: 'fileDirs' } |
|||
}); |
|||
} |
|||
|
|||
export function updateFileDir(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'UPDATE_FILE_DIR', |
|||
url: ApiTable.updateFileDir, |
|||
query, |
|||
msg: { error: '更新文件夹名称失败' }, |
|||
// reducer: { name: 'fileDirs' }
|
|||
}); |
|||
} |
|||
|
|||
|
|||
// data : {typeId, userId, userName, startDate, endDate, fileSize, fileName, fileUrl, fileExt}
|
|||
export function uploadFile(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
dispatch: dispatch, |
|||
actionType: 'UPLOAD_FILE', |
|||
url: ApiTable.uploadFile, |
|||
data, |
|||
msg: { error: '上传文件失败' }, |
|||
reducer: { name: 'uploadFile' } |
|||
}); |
|||
} |
|||
|
|||
export function deleteFile(id) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'DELETE_FILE', |
|||
url: ApiTable.deleteFile, |
|||
msg: { error: '删除文件数据失败' }, |
|||
query: { id }, |
|||
reducer: { name: 'fileDel' } |
|||
}); |
|||
} |
|||
|
|||
export function getFileList(query) { // fId, limit, offset, searchTxt
|
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_FILE_LIST', |
|||
url: ApiTable.getFileList, |
|||
query, |
|||
msg: { error: '获取档案数据失败' }, |
|||
reducer: { name: 'fileList' } |
|||
}); |
|||
} |
@ -1,18 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import * as infor from './infor' |
|||
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' |
|||
import * as luzheng from './luzheng' |
|||
export default { |
|||
...infor, |
|||
...patrol, |
|||
...file, |
|||
...assess, |
|||
...allDepUsers, |
|||
...getReportSpotPrepare, |
|||
...luzheng |
|||
} |
@ -1,436 +0,0 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
import { Request } from '@peace/utils' |
|||
|
|||
export function getDepMessage() { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_DEPARTMENT_MESSAGE', |
|||
url: ApiTable.getDepMessage, |
|||
msg: { error: '获取部门信息失败' }, |
|||
reducer: { name: 'depMessage' } |
|||
}); |
|||
} |
|||
// export function getReportStatistic(query) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'get',
|
|||
// dispatch: dispatch,
|
|||
// query: query,
|
|||
// actionType: 'GET_DEPARTMENT_STATIS',
|
|||
// url: ApiTable.getReportStatistic,
|
|||
// msg: { error: '获取填报信息失败' },
|
|||
// reducer: { name: 'reportstatistic' }
|
|||
// });
|
|||
|
|||
// }
|
|||
export function getOperaTional(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_OPERA_TIONAL', |
|||
url: ApiTable.getOperaTional, |
|||
msg: { error: '获取客运信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putOperaTional(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_OPERA_TIONAL', |
|||
url: ApiTable.putOperaTional, |
|||
msg: { option: '编辑车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function getSpecificVehicle(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_SPECIFIC_VEHICLE', |
|||
url: ApiTable.getSpecificVehicle, |
|||
msg: { error: '获取车辆信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putSpecificVehicle(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'put_SPECIFIC_VEHICLE', |
|||
url: ApiTable.putSpecificVehicle, |
|||
msg: { option: '编辑车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function putHouseholds(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'put_HOUSEHOLDS', |
|||
url: ApiTable.putHouseholds, |
|||
msg: { option: '编辑业户信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function getHouseholds(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_HOUSEHOLDS', |
|||
url: ApiTable.getHouseholds, |
|||
msg: { error: '获取业户信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function getRoadway(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_ROADWAY', |
|||
url: ApiTable.getRoadway, |
|||
msg: { error: '获取道路信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putRoadway(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_ROADWAY', |
|||
url: ApiTable.putRoadway, |
|||
msg: { option: query?.roadId?'编辑':'新增' + '道路信息' }, |
|||
}); |
|||
} |
|||
export function getBridge(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_BRIDGE', |
|||
url: ApiTable.getBridge, |
|||
msg: { error: '获取桥梁信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putBridge(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_BRIDGE', |
|||
url: ApiTable.putBridge, |
|||
msg: { option: '编辑桥梁信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function getProject(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_PROJECT', |
|||
url: ApiTable.getProject, |
|||
msg: { error: '获取工程信息失败' }, |
|||
reducer: { name: 'projectList' } |
|||
}); |
|||
} |
|||
export function putProject(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'GET_PROJECT', |
|||
url: ApiTable.putProject, |
|||
msg: { option: '编辑工程信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function getHighways(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_HIGHWAYS', |
|||
url: ApiTable.getHighways, |
|||
msg: { error: '获取设施统计信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putHighways(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'GET_HIGHWAYS', |
|||
url: ApiTable.putHighways, |
|||
msg: { option: '编辑设施统计信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function getCircuit(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_CIRCUIT', |
|||
url: ApiTable.getCircuit, |
|||
msg: { error: '获取线路信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putCircuit(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_CIRCUIT', |
|||
url: ApiTable.putCircuit, |
|||
msg: { option: '编辑线路信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function getVehicle(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_VEHICLE', |
|||
url: ApiTable.getVehicle, |
|||
msg: { error: '获取车辆信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putVehicle(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_VEHICLE', |
|||
url: ApiTable.putVehicle, |
|||
msg: { option: '编辑车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delRoadway(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_ROADWAY', |
|||
url: ApiTable.delRoadway.replace("{roadId}", query?.roadId), |
|||
msg: { option: '删除车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delProject(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_PROJECT', |
|||
url: ApiTable.delProject.replace("{projectId}", query?.projectId), |
|||
msg: { option: '删除工程信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delBridge(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_BRIDGE', |
|||
url: ApiTable.delBridge.replace("{bridgeId}", query?.bridgeId), |
|||
msg: { option: '删除桥梁信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delSpecificVehicle(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_SPECIFICVENICLE', |
|||
url: ApiTable.delSpecificVehicle.replace("{vehicleId}", query?.vehicleId), |
|||
msg: { option: '删除车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delHouseholds(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_HOUSEHOLDS', |
|||
url: ApiTable.delHouseholds.replace("{businessId}", query?.businessId), |
|||
msg: { option: '删除业户信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delCircuit(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_CIRCUIT', |
|||
url: ApiTable.delCircuit.replace("{lineId}", query?.lineId), |
|||
msg: { option: '删除运营线路信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delVehicle(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_VEHICLE', |
|||
url: ApiTable.delVehicle.replace("{carId}", query?.carId), |
|||
msg: { option: '删除车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
|
|||
export function getPurchase(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_PURCHASE', |
|||
url: ApiTable.getPurchase, |
|||
msg: { error: '获取治超信息失败' }, |
|||
|
|||
}); |
|||
} |
|||
export function putPurchase(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_PURCHASE', |
|||
url: ApiTable.putPurchase, |
|||
msg: { option: '编辑治超信息' }, |
|||
|
|||
}); |
|||
} |
|||
export function delPurchase(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_PURCHASE', |
|||
url: ApiTable.delPurchase.replace("{overspeedId}", query?.overspeedId), |
|||
msg: { option: '删除车辆信息' }, |
|||
|
|||
}); |
|||
} |
|||
|
|||
export function getPropagata(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_PROPAGATA', |
|||
url: ApiTable.getpropagata, |
|||
msg: { error: '获取宣传视频信息失败' }, |
|||
// reducer: { name: 'reportstatistic' }
|
|||
}); |
|||
} |
|||
export function putAddPropagata(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_PROPAGATA', |
|||
url: ApiTable.putpropagata, |
|||
msg: { option: '新增宣传视频' }, |
|||
// reducer: { name: 'reportstatistic' }
|
|||
}); |
|||
} |
|||
export function putEditPropagata(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_PROPAGATA', |
|||
url: ApiTable.putpropagata, |
|||
msg: { option: '编辑宣传视频' }, |
|||
// reducer: { name: 'reportstatistic' }
|
|||
}); |
|||
} |
|||
export function delPropagata(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_PROPAGATA', |
|||
url: ApiTable.delpropagata.replace("{publicityId}", query?.publicityId), |
|||
msg: { option: '删除宣传视频信息' }, |
|||
// reducer: { name: 'reportstatistic' }
|
|||
}); |
|||
} |
|||
|
|||
export function getShippingList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_SHIPPING_LIST', |
|||
url: ApiTable.getShippingList, |
|||
msg: { error: '获取货运信息失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function putShippingList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_SHIPPING_LIST', |
|||
url: ApiTable.putShippingList, |
|||
msg: { option: '编辑货运信息' }, |
|||
}); |
|||
} |
|||
//获取管养单位概况
|
|||
export function getCustodyunit() { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_CUSTODY_UNIT', |
|||
url: ApiTable.getCustodyunit, |
|||
msg: { error: '获取管养单位概况失败' }, |
|||
reducer: { name: 'roadMaintenances_management' } |
|||
}); |
|||
} |
|||
export function getCustodyunitOne(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query:query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_CUSTODY_UNIT_ONE', |
|||
url: ApiTable.getCustodyunit, |
|||
msg: { error: '获取管养单位概况失败' }, |
|||
// reducer: { name: 'roadMaintenances_management' }
|
|||
}); |
|||
} |
|||
export function postCustodyunit(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data: query, |
|||
dispatch: dispatch, |
|||
actionType: 'POST_CUSTODY_UNIT', |
|||
url: ApiTable.postCustodyunit, |
|||
msg: { option: '编辑管养单位概况' }, |
|||
// reducer: { name: 'roadMaintenances' }
|
|||
}); |
|||
} |
|||
export function getxiuyangas(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_XIUYANG', |
|||
url: ApiTable.getXiuyang, |
|||
msg: { error: '获取信息失败' }, |
|||
reducer: { name: 'xiuyang' } |
|||
}); |
|||
} |
@ -1,51 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
export function getRoadadministration (query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_LU_ZHENG', |
|||
url: ApiTable.getRoadadministration, |
|||
msg: { option: '获取路政信息' }, |
|||
// reducer: { name: 'chcekList' }
|
|||
}); |
|||
} |
|||
|
|||
|
|||
export function addRoadadministration (params) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch: dispatch, |
|||
actionType: 'ADD_LU_ZHENG', |
|||
url: ApiTable.addRoadadministration, |
|||
msg: { option: '新增路政信息' }, |
|||
}); |
|||
} |
|||
|
|||
|
|||
export function delRoadadministration (id) { |
|||
return dispatch => basicAction({ |
|||
type: 'delete', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_LU_ZHENG', |
|||
url: ApiTable.delRoadadministration.replace(':id', id), |
|||
msg: { option: '删除路政信息' }, |
|||
}) |
|||
} |
|||
export function modifyRoadadministration (id, params) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch: dispatch, |
|||
actionType: 'EDIT_LU_ZHENG', |
|||
url: ApiTable.modifyRoadadministration.replace(':id', id), |
|||
msg: { option: '修改路政信息' }, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
@ -1,73 +0,0 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
|
|||
export function getReportList (query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_REPORT_LIST', |
|||
url: ApiTable.getReportList, |
|||
query, |
|||
msg: { error: '获取巡查数据失败' }, |
|||
reducer: { name: 'reportList' } |
|||
}); |
|||
} |
|||
|
|||
export function getReportDetail (reportId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_REPORT_DETAIL_LIST', |
|||
url: ApiTable.getReportDetail.replace("{reportId}", reportId), |
|||
msg: { error: '获取巡查数据失败' }, |
|||
reducer: { name: 'reportDetail' } |
|||
}); |
|||
} |
|||
|
|||
export function getUserList (query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_USER_LIST', |
|||
url: ApiTable.getUsers, |
|||
query, |
|||
msg: { error: '获取用户数据失败' }, |
|||
reducer: { name: 'userList' } |
|||
}); |
|||
} |
|||
|
|||
export function handleReport (reportId, data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
dispatch: dispatch, |
|||
actionType: 'HANDLE_REPORT', |
|||
url: ApiTable.handleReport.replace("{reportId}", reportId), |
|||
data: data, |
|||
msg: { option: '处理数据' }, |
|||
}); |
|||
} |
|||
|
|||
|
|||
export function getAnspectionNotificationPhone (query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_ANSPECTION_NOTIFICATION_PHONE', |
|||
url: ApiTable.getAnspectionNotificationPhone, |
|||
query, |
|||
msg: { error: '获取短信提醒电话' }, |
|||
reducer: { name: 'anspectionNotificationPhoneList' } |
|||
}); |
|||
} |
|||
|
|||
export function addAnspectionNotificationPhone (data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
dispatch: dispatch, |
|||
actionType: 'POST_ANSPECTION_NOTIFICATION_PHONE', |
|||
url: ApiTable.getAnspectionNotificationPhone, |
|||
data: data, |
|||
msg: { option: '添加短信提醒' }, |
|||
}); |
|||
} |
@ -1,35 +0,0 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_TASK', |
|||
url: ApiTable.getTask, |
|||
msg: { error: '获取任务信息' }, |
|||
reducer: { name: 'task' } |
|||
}); |
|||
} |
|||
|
|||
export function delTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_TASK', |
|||
url: ApiTable.delTask.replace("{taskId}", query?.id), |
|||
msg: { option: '删除任务信息' }, |
|||
}); |
|||
} |
|||
|
|||
export function editTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_TASK', |
|||
url: ApiTable.editTask, |
|||
msg: { option: '编辑或新增任务信息' }, |
|||
}); |
|||
} |
@ -1,112 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Input, Select, DatePicker, InputNumber, Button, Modal } from 'antd'; |
|||
import { unitList } from '../containers/assess' |
|||
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
|||
import moment from 'moment'; |
|||
|
|||
const { Option } = Select; |
|||
|
|||
const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { |
|||
const [form] = Form.useForm(); |
|||
const [loading, setLoading] = useState(false); |
|||
|
|||
return ( |
|||
<Modal |
|||
title="考核评分" |
|||
open={visible} |
|||
visible={visible} |
|||
cancelButtonProps={{ |
|||
disabled: check, |
|||
}} |
|||
onOk={() => { |
|||
if (check) { |
|||
return onCancel() |
|||
} |
|||
setLoading(true) |
|||
form.validateFields().then(values => { |
|||
dispatch(editAssess({ |
|||
...values, |
|||
month: moment(values.month).format('YYYY-MM-DD'), |
|||
assessId: editData ? editData.id : undefined |
|||
})).then(res => { |
|||
if (res.success) { |
|||
onCancel() |
|||
} |
|||
setLoading(false) |
|||
}) |
|||
}) |
|||
}} |
|||
onCancel={() => { |
|||
onCancel() |
|||
}} |
|||
confirmLoading={loading} |
|||
> |
|||
<Form |
|||
form={form} |
|||
initialValues={editData ? { |
|||
...editData, |
|||
month: moment(editData.month), |
|||
} : {}} |
|||
disabled={check} |
|||
labelCol={{ |
|||
span: 6, |
|||
}} |
|||
wrapperCol={{ |
|||
span: 18, |
|||
}} |
|||
> |
|||
<Form.Item name="unit" label="管养责任单位" rules={[{ required: true, message: '请填写' }]}> |
|||
<Select> |
|||
{ |
|||
unitList.map(item => ( |
|||
<Option value={item} key={item} /> |
|||
)) |
|||
} |
|||
</Select> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="month" label="考核月份" rules={[{ required: true, message: '请填写' }]}> |
|||
<DatePicker picker="month" /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="totalPoints" label="考核总分" rules={[{ required: true, message: '请填写' }]}> |
|||
<InputNumber step={0.1} precision={1} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="industryPoints" label="内业得分"> |
|||
<InputNumber step={0.1} precision={1} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="industryOutPoints" label="外业得分"> |
|||
<InputNumber step={0.1} precision={1} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="plusOrSubtract" label="加减分"> |
|||
<InputNumber step={0.1} precision={1} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="industryDeductionReason" label="内业扣分原因"> |
|||
<Input.TextArea rows={4} maxLength={1024} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="industryOutDeductionReason" label="外业扣分原因"> |
|||
<Input.TextArea rows={4} maxLength={1024} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="remark" label="备注"> |
|||
<Input.TextArea rows={4} maxLength={1024} /> |
|||
</Form.Item> |
|||
</Form> |
|||
</Modal> |
|||
); |
|||
}; |
|||
|
|||
function mapStateToProps (state) { |
|||
const { auth, assess } = state |
|||
return { |
|||
user: auth.user, |
|||
assess: assess.data || [] |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(AssessModal); |
File diff suppressed because it is too large
@ -1,379 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import React, { useState, useEffect, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Button, Popconfirm } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import './protable.less' |
|||
import ProjectModal from './project/project'; |
|||
import { getProject, delProject } from "../actions/infor" |
|||
|
|||
import moment from 'moment'; |
|||
// import UserModal from './infor/details';
|
|||
const BuildingTable = (props) => { |
|||
const { dispatch, user, depData, depMessage, depLoading } = props |
|||
const [rowSelected, setRowSelected] = useState([]) |
|||
const [sitename, setSitename] = useState()//名称
|
|||
const [counts, setCounts] = useState()//shuju
|
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalVisibleyilan, setModalVisibleyilan] = useState(false); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [typecard, setTypecard] = useState(); |
|||
const [recortd, setRecortd] = useState() |
|||
const [whichofits, setWhichofits] = useState('在建项目') |
|||
const [delet, setDelet] = useState() |
|||
const [differentiate, setDifferentiate] = useState('road') |
|||
const [grade, setGrade] = useState('project') |
|||
const [departmentInfo, setDepartment] = useState('') |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'BUILDINGPROJECT')?.isshow === "true" ? true : '') |
|||
//console.log('user111', user)
|
|||
const ref = useRef() |
|||
const [activeKey, setActiveKey] = useState('tab1'); |
|||
//打开弹窗
|
|||
const yilanModal = (type, record) => { |
|||
setModalVisibleyilan(true); |
|||
// setModalType(type);
|
|||
if (type == 'edit') { |
|||
setModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
} |
|||
const getData = async () => { |
|||
const res = await dispatch(getProject({ |
|||
entryName: sitename |
|||
})); |
|||
setCounts(res.payload.data) |
|||
} |
|||
const deldatas = async (id) => { // 工程
|
|||
const query = { |
|||
projectId: id |
|||
} |
|||
dispatch(delProject(query)).then((res) => { |
|||
setDelet(res) |
|||
}) |
|||
const res = await dispatch(getProject({ |
|||
entryName: sitename |
|||
})); |
|||
setCounts(res.payload.data) |
|||
} |
|||
|
|||
const columns = { |
|||
tab1: [ |
|||
{ |
|||
title: '项目名称', |
|||
dataIndex: 'placeName', |
|||
fixed: 'left', |
|||
width: 120, |
|||
options: 1, |
|||
backgroundColor: "#ffffff", |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setSitename(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入项目名称进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
}, |
|||
render: (dom, record) => { |
|||
return record.entryName |
|||
}, |
|||
}, |
|||
{ |
|||
title: '项目规模(公里)', |
|||
search: false, |
|||
dataIndex: 'containers', |
|||
|
|||
fixed: 'left', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.projectMileage |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '项目投资(万元)', |
|||
search: false, |
|||
dataIndex: 'time2', |
|||
valueType: 'dateRange', |
|||
// align: 'right',
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.investment |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '业主单位', |
|||
search: false, |
|||
dataIndex: 'time3', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.buildUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '质量监督单位', |
|||
search: false, |
|||
dataIndex: 'time3', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.qutityUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '施工单位', |
|||
search: false, |
|||
dataIndex: 'time6', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.constructionUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '设计单位', |
|||
search: false, |
|||
dataIndex: 'time5', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.designUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '监理单位', |
|||
search: false, |
|||
dataIndex: 'time4', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.constructionControlUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '开工时间', |
|||
search: false, |
|||
dataIndex: 'time7', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.startTime ? moment(record.startTime).format('YYYY-MM-DD') : '' |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '是否完成', |
|||
search: false, |
|||
dataIndex: 'time8', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.done === true ? '已完成' : '未完成' |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '备注', |
|||
search: false, |
|||
dataIndex: 'time9', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.remark |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'creatTime', |
|||
valueType: 'dateTimeRange', |
|||
hideInSearch: true, |
|||
width: 160, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div><Button type="link" |
|||
onClick={() => { |
|||
yilanModal('edit', record) |
|||
setTypecard('compile') |
|||
setRecortd(record) |
|||
}} |
|||
disabled={editAble} |
|||
>编辑</Button><Popconfirm title='是否确认删除' onConfirm={() => { deldatas(record.id) }} disabled={editAble}> |
|||
<Button type="link" disabled={editAble}>删除</Button> |
|||
</Popconfirm></div> |
|||
|
|||
} |
|||
}, |
|||
{ |
|||
key: "direction", |
|||
hideInTable: true, |
|||
dataIndex: "direction", |
|||
order: 6, |
|||
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|||
return ( |
|||
<div> <Button |
|||
type="primary" |
|||
style={{ width: "100px" }} |
|||
onClick={() => { |
|||
yilanModal('edit', record) |
|||
setTypecard('') |
|||
}} |
|||
disabled={editAble} |
|||
> |
|||
新增 |
|||
</Button> |
|||
{/* <Button |
|||
type="primary" |
|||
style={{ width: "100px", marginLeft: 20 }} |
|||
|
|||
> |
|||
导入 |
|||
</Button> */} |
|||
</div> |
|||
|
|||
|
|||
); |
|||
}, |
|||
}, |
|||
] |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
<div className='protable-transpor'> |
|||
<ProTable |
|||
actionRef={ref} |
|||
toolbar={{ |
|||
multipleLine: true, |
|||
menu: { |
|||
activeKey, |
|||
onChange: (key) => setActiveKey(key), |
|||
items: [ |
|||
// {
|
|||
// key: 'tab1',
|
|||
// label: <span onClick={() => {
|
|||
// setWhichofits('在建项目')
|
|||
// setDifferentiate('project')
|
|||
// setGrade('在建项目')
|
|||
|
|||
// }}>在建项目{activeKey === 'tab1'}</span>,
|
|||
// },
|
|||
], |
|||
}, |
|||
}} |
|||
scroll={{ x: 800 }} |
|||
options={false} |
|||
ref={c => { finishedProductTable = c; }} |
|||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|||
rowKey='id' |
|||
onReset={(v) => { |
|||
setSitename('') |
|||
}} |
|||
rowSelection={{ |
|||
selectedRowKeys: rowSelected, |
|||
onChange: (selectedRowKeys) => { |
|||
setRowSelected(selectedRowKeys); |
|||
}, |
|||
}} |
|||
columns={columns[activeKey]} |
|||
dataSource={counts || []} |
|||
request={async (params) => { |
|||
//console.log(whichofits)
|
|||
if (whichofits == '在建项目') { |
|||
const query = { |
|||
entryName: sitename |
|||
} |
|||
setRowSelected([]); |
|||
const res = await dispatch(getProject(query)); |
|||
setCounts(res.payload.data) |
|||
return { |
|||
...res, |
|||
total: res.payload.data ? res.payload.data.count : 0 |
|||
} |
|||
} |
|||
}} |
|||
search={{ |
|||
defaultCollapsed: false, |
|||
optionRender: (searchConfig, formProps, dom) => [ |
|||
...dom.reverse(), |
|||
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, grade, differentiate) }} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'BUILDINGPROJECT')?.isshow === "true" ? true : ''} |
|||
> |
|||
<Button |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'BUILDINGPROJECT')?.isshow === "true" ? true : ''} |
|||
> |
|||
导出 |
|||
</Button> |
|||
</Popconfirm> |
|||
], |
|||
}} |
|||
> |
|||
</ProTable> |
|||
</div> |
|||
|
|||
{modalVisibleyilan ? <ProjectModal |
|||
visible={modalVisibleyilan} |
|||
onVisibleChange={setModalVisibleyilan} |
|||
modalRecord={modalRecord} |
|||
typecard={typecard} |
|||
getData={getData} |
|||
rewkeys={'road'} |
|||
recortd={recortd} |
|||
setRecortd={setRecortd} |
|||
setDelet={setDelet} |
|||
/> : ''} |
|||
</Spin > |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(BuildingTable); |
@ -1,180 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { Modal, Form, Input, Select, DatePicker, AutoComplete, Col, Button, Row } from 'antd'; |
|||
|
|||
import { MinusCircleOutlined, PlusOutlined, PlusCircleOutlined } from '@ant-design/icons'; |
|||
const Search = Input.Search |
|||
const { TextArea } = Input; |
|||
import moment from 'moment'; |
|||
|
|||
const EditGuanlang = (props) => { |
|||
const { visible, onCancel, editData, handleSaveScore, readOnly, companys, searchCompany, applyState } = props; |
|||
const [form] = Form.useForm(); |
|||
const [replyFiles, setReplyFiles] = useState([]); |
|||
const [companyOpts, setCompanyOpts] = useState([]); |
|||
const [stationItem, setStationItem] = useState(null); |
|||
const [deviceList, setDeviceList] = useState([]); |
|||
|
|||
useEffect(() => { |
|||
if (!visible) { |
|||
form.resetFields() |
|||
} |
|||
}, [visible]) |
|||
|
|||
useEffect(() => { |
|||
if (editData) { |
|||
let revertData = Object.assign({}, editData); |
|||
Object.keys(editData).forEach(key => { |
|||
if (key == 'accidentTime') { |
|||
revertData[key] = editData[key] && moment(editData[key]); |
|||
} |
|||
if (key == 'images') { |
|||
// const list = (editData[key] || '').split(',') || []
|
|||
if (editData[key]) { |
|||
|
|||
revertData[key] = JSON.parse(editData[key]); |
|||
} |
|||
} |
|||
}); |
|||
form.setFieldsValue({ ...revertData }); |
|||
} |
|||
}, [editData]) |
|||
|
|||
useEffect(() => { |
|||
if (companys && companys.length) { |
|||
let list = []; |
|||
companys.forEach(item => { |
|||
list.push({ label: item.company, value: item.company }) |
|||
}) |
|||
setCompanyOpts(list); |
|||
} |
|||
}, [companys]) |
|||
|
|||
useEffect(() => { |
|||
if (editData && companys && companys.length) { |
|||
handleSelectCompany(null, { value: editData.companyName }) |
|||
let list = ((editData || {}).accidentStations || []).map(item => item.stationId) |
|||
form.setFieldsValue({ stations: list }) |
|||
} |
|||
}, [companys, editData]) |
|||
|
|||
|
|||
const handleSave = () => { |
|||
const data = form.getFieldsValue(true); |
|||
//console.log(data, 'data')
|
|||
handleSaveScore(); |
|||
} |
|||
|
|||
const onFileUploaded = (fileList) => { |
|||
setReplyFiles(fileList); |
|||
} |
|||
|
|||
const handleSelectCompany = (v, opt) => { |
|||
const { value } = opt; |
|||
const target = companys.filter(c => c.company == value); |
|||
setDeviceList(target[0]?.deviceInfos || []); |
|||
|
|||
} |
|||
const data1 = [ |
|||
{ label: '2021年12月', value: '2021年12月' }, |
|||
{ label: '2021年11月', value: '2021年11月' }, |
|||
{ label: '2021年10月', value: '2021年10月' }, |
|||
{ label: '2021年9月', value: '2021年9月' }, |
|||
{ label: '2021年8月', value: '2021年8月' }, |
|||
{ label: '2021年7月', value: '2021年7月' }, |
|||
{ label: '2021年6月', value: '2021年6月' }, |
|||
{ label: '2021年5月', value: '2021年5月' }, |
|||
{ label: '2021年4月', value: '2021年4月' }, |
|||
{ label: '2021年3月', value: '2021年3月' }, |
|||
{ label: '2021年2月', value: '2021年2月' }, |
|||
{ label: '2021年1月', value: '2021年1月' }] |
|||
|
|||
const data2 = [ |
|||
{ label: '噪声传感器', value: '噪声传感器' }, |
|||
{ label: '导轮式固定测斜仪', value: '导轮式固定测斜仪' }, |
|||
{ label: '闭合式磁通量传感器', value: '闭合式磁通量传感器' }, |
|||
{ label: '扬尘监测系统', value: '扬尘监测系统' }, |
|||
{ label: '空气质量监测系统', value: '空气质量监测系统' }, |
|||
{ label: '车辆动态称重系统', value: '车辆动态称重系统' }, |
|||
{ label: '多通道振动采集仪', value: '多通道振动采集仪' }, |
|||
{ label: '应急照明控制器', value: '应急照明控制器' }, |
|||
{ label: '钢筋计', value: '钢筋计' }, |
|||
{ label: '噪声传感器', value: '噪声传感器' }, |
|||
{ label: '风速风向仪', value: '风速风向仪' }, |
|||
{ label: '静力水准仪', value: '静力水准仪' }, |
|||
{ label: '表面式应变计', value: '表面式应变计' }, |
|||
{ label: '光纤光栅锚索计', value: '光纤光栅锚索计' }, |
|||
{ label: '加速度计', value: '加速度计' }, |
|||
{ label: '闭合式磁通量传感器', value: '闭合式磁通量传感器' }, |
|||
{ label: '开环式磁通量传感器', value: '开环式磁通量传感器' }, |
|||
{ label: '压差式变形测量传感器', value: '压差式变形测量传感器' }, |
|||
{ label: '多通道振动采集仪', value: '多通道振动采集仪' }, |
|||
{ label: '压电式传感器', value: '压电式传感器' }, |
|||
{ label: '钢筋计', value: '钢筋计' }, |
|||
{ label: '盒式固定测斜仪', value: '盒式固定测斜仪' }, |
|||
{ label: '拉线位移传感器', value: '拉线位移传感器' }, |
|||
{ label: '表面式应变计', value: '表面式应变计' }, |
|||
{ label: '芯型土压力计', value: '芯型土压力计' }, |
|||
{ label: '芯型锚索计', value: '芯型锚索计' }, |
|||
{ label: '收敛仪', value: '收敛仪' }, |
|||
{ label: '激光测距仪 ', value: '激光测距仪 ' }, |
|||
{ label: '磁电式传感器', value: '磁电式传感器' }, |
|||
{ label: '压电式传感器', value: '压电式传感器' }, |
|||
{ label: '锚索计', value: '锚索计' }, |
|||
{ label: '静力水准仪 ', value: '静力水准仪 ' }, |
|||
{ label: '移动测斜仪 ', value: '移动测斜仪 ' } |
|||
] |
|||
return ( |
|||
<Modal |
|||
title="数据汇集" |
|||
visible={visible} |
|||
destroyOnClose |
|||
width={600} |
|||
// onOk={handleSave}
|
|||
onCancel={onCancel} |
|||
footer={null} |
|||
> |
|||
<Form form={form} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} onFinish={handleSave}> |
|||
|
|||
|
|||
<Row> |
|||
<Col span={20}> |
|||
<Form.Item |
|||
label={'历史数据'} |
|||
name={'startposition'}> |
|||
<Select options={data1} defaultValue="2021年12月" mode="multiple"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
|
|||
</Row> |
|||
<Row> |
|||
|
|||
<Col span={20}> |
|||
<Form.Item |
|||
label={'传感器设备'} |
|||
name={'endposition'}> |
|||
<Select options={data2} defaultValue="噪声传感器" mode="multiple"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Form.Item wrapperCol={{ span: 12, offset: 6 }}> |
|||
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}> |
|||
<Button htmlType="submit" onClick={() => { |
|||
onCancel() |
|||
}}> |
|||
取消 |
|||
</Button> |
|||
<Button type="primary" onClick={() => { |
|||
onCancel() |
|||
}}> |
|||
确定 |
|||
</Button> |
|||
</Col> |
|||
</Form.Item> |
|||
</Form> |
|||
*汇集历史数据,接入物联网监测数据,实现大数据的接入解算。 |
|||
</Modal > |
|||
) |
|||
} |
|||
|
|||
|
|||
export default EditGuanlang; |
@ -1,211 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { Modal, Form, Input, Select, DatePicker, AutoComplete, Col, Button, Row } from 'antd'; |
|||
|
|||
import { MinusCircleOutlined, PlusOutlined, PlusCircleOutlined } from '@ant-design/icons'; |
|||
const Search = Input.Search |
|||
const { TextArea } = Input; |
|||
import moment from 'moment'; |
|||
|
|||
const EditGuanlang = (props) => { |
|||
const { visible, onCancel, editData, handleSaveScore, readOnly, companys, searchCompany, applyState } = props; |
|||
const [form] = Form.useForm(); |
|||
const [replyFiles, setReplyFiles] = useState([]); |
|||
const [companyOpts, setCompanyOpts] = useState([]); |
|||
const [stationItem, setStationItem] = useState(null); |
|||
const [deviceList, setDeviceList] = useState([]); |
|||
|
|||
useEffect(() => { |
|||
if (!visible) { |
|||
form.resetFields() |
|||
} |
|||
}, [visible]) |
|||
|
|||
useEffect(() => { |
|||
if (editData) { |
|||
let revertData = Object.assign({}, editData); |
|||
Object.keys(editData).forEach(key => { |
|||
if (key == 'accidentTime') { |
|||
revertData[key] = editData[key] && moment(editData[key]); |
|||
} |
|||
if (key == 'images') { |
|||
// const list = (editData[key] || '').split(',') || []
|
|||
if (editData[key]) { |
|||
|
|||
revertData[key] = JSON.parse(editData[key]); |
|||
} |
|||
} |
|||
}); |
|||
form.setFieldsValue({ ...revertData }); |
|||
} |
|||
}, [editData]) |
|||
|
|||
useEffect(() => { |
|||
if (companys && companys.length) { |
|||
let list = []; |
|||
companys.forEach(item => { |
|||
list.push({ label: item.company, value: item.company }) |
|||
}) |
|||
setCompanyOpts(list); |
|||
} |
|||
}, [companys]) |
|||
|
|||
useEffect(() => { |
|||
if (editData && companys && companys.length) { |
|||
handleSelectCompany(null, { value: editData.companyName }) |
|||
let list = ((editData || {}).accidentStations || []).map(item => item.stationId) |
|||
form.setFieldsValue({ stations: list }) |
|||
} |
|||
}, [companys, editData]) |
|||
|
|||
|
|||
const handleSave = () => { |
|||
const data = form.getFieldsValue(true); |
|||
//console.log(data,'data')
|
|||
handleSaveScore(); |
|||
} |
|||
|
|||
const onFileUploaded = (fileList) => { |
|||
setReplyFiles(fileList); |
|||
} |
|||
|
|||
const handleSelectCompany = (v, opt) => { |
|||
const { value } = opt; |
|||
const target = companys.filter(c => c.company == value); |
|||
setDeviceList(target[0]?.deviceInfos || []); |
|||
|
|||
} |
|||
|
|||
return ( |
|||
<Modal |
|||
title="新增摄像头" |
|||
visible={visible} |
|||
destroyOnClose |
|||
width={1000} |
|||
// onOk={handleSave}
|
|||
onCancel={onCancel} |
|||
footer={null} |
|||
> |
|||
<Form form={form} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} onFinish={handleSave}> |
|||
<img src='/assets/images/tiptop.png' style={{ width: '100%' }}></img> |
|||
<Row style={{ marginBottom: '20px' }}> |
|||
<Col span={20}> <a>配置属性</a> </Col> |
|||
<Col span={2}> <Button>视频格式转换</Button> </Col> |
|||
{/* <Col span={2}> <Button>测试</Button> </Col> */} |
|||
|
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
// style={{ width: 'calc(45% - 4px' }}
|
|||
label={'设备名称'} |
|||
rules={[{ required: true, message: '设备名称为必填项' }]} |
|||
name={'guanlangname'}> |
|||
<Input placeholder="请输入设备名称、常用项目或者位置定义" /> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'云台支持'} |
|||
name={'roadnamee'} |
|||
rules={[{ required: true, message: '所在道路名称不能为空' }]} |
|||
> |
|||
<Select options={[{ label: '支持', value: '支持' }, { label: '不支持', value: '不支持' }]} defaultValue="支持"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'高清切换'} |
|||
name={'startposition'}> |
|||
<Select options={[{ label: '支持', value: '支持' }, { label: '不支持', value: '不支持' }]} defaultValue="支持"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'语音支持'} |
|||
name={'endposition'}> |
|||
<Select options={[{ label: '支持', value: '支持' }, { label: '不支持', value: '不支持' }]} defaultValue="支持"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
style={{ width: 'calc(45%-4px' }} |
|||
label={'内存'} |
|||
name={'guanlangmaterial'} |
|||
rules={[{ required: true, message: '管廊材质不能为空' }]}> |
|||
<Select options={[{ label: '8g', value: '8g' }, { label: '16g', value: '16g' }, { label: '32g', value: '32g' } |
|||
, { label: '64g', value: '64g' }, { label: '128g', value: '128g' }, { label: '256g', value: '256g' }, { label: '>256g', value: '>256g' }]} defaultValue="未安装"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'序列设备号'} |
|||
name={'guanlanglayer'} |
|||
rules={[{ required: true, message: '序列设备号不能为空' }]}> |
|||
<Input placeholder="请输入序列设备号" /> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
|
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
style={{ width: 'calc(45%-4px' }} |
|||
label={'安装位置'} |
|||
name={'guanlanglength'} |
|||
rules={[{ required: true, message: '安装位置不能为空' }]}> |
|||
<Input placeholder="请输入高德经纬度坐标" /> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
|
|||
<Form.Item |
|||
label={'通道号'} |
|||
name={'manageunit'} |
|||
rules={[{ required: true, message: '通道号不能为空' }]}> |
|||
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}> |
|||
<Input /> |
|||
|
|||
</Col> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'设备类型'} |
|||
name={'startposition'}> |
|||
<Select options={[{ label: '枪机', value: '枪机' }, { label: '球机', value: '球机' }, { label: '其他', value: '其他' }]} placeholder="请选择摄像头类型"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'设备能力'} |
|||
name={'endposition'}> |
|||
<Select options={[{ label: '普通摄像头', value: '普通摄像头' }, { label: '人流量计数', value: '人流量计数' }, { label: '热成像', value: '热成像' }, { label: 'AI摄像头', value: 'AI摄像头' }, { label: '其他', value: '其他' }]} placeholder="请选择能力"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Form.Item wrapperCol={{ span: 12, offset: 6 }}> |
|||
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}> |
|||
<Button htmlType="submit" onClick={() => { |
|||
onCancel() |
|||
}}> |
|||
取消 |
|||
</Button> |
|||
<Button type="primary" htmlType="submit"> |
|||
确定 |
|||
</Button> |
|||
</Col> |
|||
</Form.Item> |
|||
</Form> |
|||
|
|||
</Modal > |
|||
) |
|||
} |
|||
|
|||
|
|||
export default EditGuanlang; |
File diff suppressed because it is too large
@ -1,169 +0,0 @@ |
|||
'use strict'; |
|||
import React, { useState, useEffect, useCallback, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin } from 'antd'; |
|||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect, ProFormSelect, Form } from '@ant-design/pro-form'; |
|||
import { getDepUser } from '../../../organization/actions/user' |
|||
import { appointTask } from '../../actions/appointTask' |
|||
import { getReportList, } from '../../../fillion/actions/patrol'; |
|||
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(null) |
|||
const [depUsers, setDepUsers] = useState() |
|||
|
|||
|
|||
const handleTreeSelectChange = async (value) => { |
|||
//console.log('recordId', recordId)
|
|||
setDepId(value) |
|||
// 根据选择的部门ID获取对应的用户数据
|
|||
setDepUsers([]) |
|||
const res = await dispatch(getDepUser(value)); |
|||
setDepUsers(res?.payload.data); |
|||
//setSelectKey(selectKey + 1)
|
|||
// 清空第二个输入框的值
|
|||
|
|||
} |
|||
|
|||
// useEffect(() => {
|
|||
// setSelectKey(selectKey + 1)
|
|||
// }, [depUsers])
|
|||
const handleFinish = async (values) => { |
|||
const { name } = values; |
|||
// 在这里使用第二个框的值进行网络请求或其他操作
|
|||
await dispatch(appointTask({ recordId, performerId: name })) |
|||
//form.resetFields(); // 重置表单字段
|
|||
//formRef.current.resetFields();
|
|||
queryData() |
|||
onCancel() |
|||
|
|||
}; |
|||
const dispatchGetDepUser = useCallback(async () => { |
|||
if (depId) { |
|||
const res = await dispatch(getDepUser(depId)); |
|||
setDepUsers(res?.payload.data); |
|||
} |
|||
}, [depId, dispatch]); |
|||
|
|||
useEffect(() => { |
|||
dispatchGetDepUser() |
|||
}, [dispatchGetDepUser]) |
|||
const [depMessagedata, setdepMessagedata] = useState(depMessage) |
|||
return ( |
|||
<Spin spinning={false}> |
|||
<ModalForm |
|||
title='指派' |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={handleFinish} |
|||
modalProps={{ |
|||
destroyOnClose: true, |
|||
}} |
|||
//initialValues={{ departmentId: null, name: null }}
|
|||
> |
|||
<ProForm.Group> |
|||
<ProFormTreeSelect |
|||
name={'departmentId'} |
|||
placeholder="请选择所属部门" |
|||
width="md" |
|||
label="所属部门" |
|||
required |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id', |
|||
children: 'subordinate' |
|||
}} |
|||
onSelect={(selectedKeys, { selected, selectedNodes }) => { |
|||
//console.log('selected', selectedKeys)
|
|||
|
|||
if (selected) { |
|||
setDepSelectedKeys(selectedKeys) |
|||
setDepSelected(selectedNodes[0].name || "") |
|||
dispatch(getDepUser(selectedKeys[0])) |
|||
} |
|||
}} |
|||
fieldProps={{ |
|||
onChange: handleTreeSelectChange, |
|||
fieldNames: { |
|||
label: 'title', |
|||
|
|||
}, |
|||
treeDefaultExpandAll: false, |
|||
}} |
|||
rules={[{ required: true, message: '请选择所属部门' }]} |
|||
request={async () => { |
|||
return depData |
|||
}} |
|||
expandedKeys={["title"]} |
|||
/> |
|||
{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="指派人" |
|||
request={async () => { |
|||
if (depId) { |
|||
const res = await dispatch(getDepUser(depId)); |
|||
const copy = res?.payload.data.filter((user) => { |
|||
if (user.isAdmin) { |
|||
return user |
|||
} |
|||
} |
|||
) |
|||
let processedUsers = copy.map((item) => { |
|||
return { |
|||
label: item.name, |
|||
value: item.id, |
|||
} |
|||
}) |
|||
|
|||
return Promise.resolve(processedUsers) |
|||
|
|||
} |
|||
|
|||
}} |
|||
placeholder="请选择指派人" |
|||
rules={[{ required: true, message: '请选择指派人' }]} |
|||
/> : ''} |
|||
|
|||
|
|||
</ProForm.Group> |
|||
|
|||
</ModalForm> |
|||
</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); |
@ -1,136 +0,0 @@ |
|||
'use strict'; |
|||
import React, { useState, useEffect, useCallback, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, TreeSelect, Modal, Form, Select, Input } from 'antd'; |
|||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect, ProFormSelect } from '@ant-design/pro-form'; |
|||
import { getDepUser } from '../../../organization/actions/user' |
|||
import { appointTask, pushAppointSMS } from '../../actions/appointTask' |
|||
import moment from 'moment' |
|||
import { v4 as uuidv4 } from 'uuid'; |
|||
|
|||
const { TextArea } = Input; |
|||
|
|||
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)) |
|||
let processedUsers = res.payload.data?.map((item) => { |
|||
return { |
|||
label: item.name, |
|||
value: item.id, |
|||
phone: item.phone |
|||
} |
|||
}) |
|||
setDepUsers(processedUsers) |
|||
form.resetFields(['nameId']) |
|||
|
|||
} |
|||
const handleFinish = () => { |
|||
form.validateFields().then(values => { |
|||
dispatch(appointTask({ recordId: recordId, performerId: values.nameId, handleAdvice: values.handleOpinions, handleState: '已指派' })).then((res) => { |
|||
if (res.success) { |
|||
setSelectedUserId(null) |
|||
queryData() |
|||
onCancel() |
|||
setDepUsers([]) |
|||
form.resetFields() |
|||
// const phone = depUsers.find(u => u.value == values.nameId)?.phone;
|
|||
// dispatch(pushAppointSMS({ phone: [phone] }))
|
|||
} |
|||
}) |
|||
}) |
|||
|
|||
} |
|||
|
|||
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.Item label='处理意见:' name='handleOpinions'> |
|||
<TextArea /> |
|||
</Form.Item> |
|||
</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); |
@ -1,94 +0,0 @@ |
|||
import React, { useEffect } from 'react'; |
|||
import PropTypes from 'prop-types'; |
|||
import { delFileDir, queryFileDir, updateFileDir, } from '../../actions/file'; |
|||
import './menu.less' |
|||
import { message, Modal } from 'antd'; |
|||
import { ExclamationCircleOutlined } from '@ant-design/icons' |
|||
|
|||
const { confirm } = Modal; |
|||
|
|||
const FunctionMenu = props => { |
|||
const { dispatch, onDelDir, selectRoad } = props; |
|||
|
|||
useEffect(() => { |
|||
const box = document.getElementById('tree-box'); |
|||
if (box) |
|||
box.oncontextmenu = function (e) { |
|||
//取消默认的浏览器自带右键 很重要!!
|
|||
e.preventDefault(); |
|||
|
|||
//获取我们自定义的右键菜单
|
|||
var menu = document.querySelector("#rihgt-click-menu"); |
|||
|
|||
//根据事件对象中鼠标点击的位置,进行定位
|
|||
menu.style.left = e.clientX + 'px'; |
|||
menu.style.top = e.clientY + 'px'; |
|||
|
|||
//改变自定义菜单的高宽,让它显示出来
|
|||
menu.style.display = 'block'; |
|||
} |
|||
|
|||
//关闭右键菜单,很简单
|
|||
window.onclick = function (e) { |
|||
//用户触发click事件就可以关闭了,因为绑定在window上,按事件冒泡处理,不会影响菜单的功能
|
|||
document.querySelector('#rihgt-click-menu') ? document.querySelector('#rihgt-click-menu').style.display = 'none' : '' |
|||
} |
|||
}, [true]) |
|||
|
|||
const onDeleteDir = () => { |
|||
|
|||
if (selectRoad) { |
|||
const id = selectRoad |
|||
dispatch(delFileDir({ id })).then(res => { |
|||
const { type } = res; |
|||
if (type == 'DEL_FILE_DIR_SUCCESS') { |
|||
dispatch(queryFileDir()); |
|||
message.success('删除成功') |
|||
} else { |
|||
message.error('删除失败') |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
const showDeleteConfirm = () => { |
|||
|
|||
confirm({ |
|||
title: `是否确认删除该道路?`, |
|||
icon: <ExclamationCircleOutlined />, |
|||
// content: 'Some descriptions',
|
|||
okText: '是', |
|||
okType: 'danger', |
|||
cancelText: '否', |
|||
onOk() { |
|||
onDeleteDir(); |
|||
}, |
|||
onCancel() { |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
const refreshFileDir = () => { |
|||
dispatch(queryFileDir()); |
|||
} |
|||
|
|||
return ( |
|||
<div id="rihgt-click-menu"> |
|||
<div class="context_item"> |
|||
<div class="inner_item" onClick={showDeleteConfirm}> |
|||
<i class="glyphicon glyphicon-file"></i> 删除 |
|||
</div> |
|||
</div> |
|||
<div class="context_item"> |
|||
<div class="inner_item" onClick={refreshFileDir}> |
|||
<i class="glyphicon glyphicon-file"></i> 刷新 |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
) |
|||
} |
|||
|
|||
FunctionMenu.propTypes = {} |
|||
|
|||
export default FunctionMenu |
@ -1,43 +0,0 @@ |
|||
#rihgt-click-menu { |
|||
display: none; |
|||
font-size: 1.1em; |
|||
position: fixed; |
|||
width: 200px; |
|||
height: auto; |
|||
padding: 5px 0px; |
|||
border-radius: 5px; |
|||
top: 10; |
|||
left: 10; |
|||
background-color: #fff; |
|||
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24); |
|||
color: #333; |
|||
z-index: 999; |
|||
} |
|||
|
|||
#rihgt-click-menu .context_item { |
|||
height: 32px; |
|||
line-height: 32px; |
|||
cursor: pointer; |
|||
text-overflow: ellipsis; |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
} |
|||
|
|||
#rihgt-click-menu .context_item:hover { |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
#rihgt-click-menu .context_item .inner_item { |
|||
margin: 0px 10px; |
|||
} |
|||
|
|||
#rihgt-click-menu .context_item .inner_item i { |
|||
margin: 0 5px 0 0; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
#rihgt-click-menu .context_hr { |
|||
height: 1px; |
|||
border-top: 1px solid #bbb; |
|||
margin: 3px 10px; |
|||
} |
@ -1,73 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react' |
|||
import PropTypes from 'prop-types'; |
|||
import { Modal, Input, Row, Col } from 'antd'; |
|||
const { Search } = Input; |
|||
const RoadModal = props => { |
|||
const { isVisible, onSubmit, onCancel, roads } = props; |
|||
const [roadName, setRoadName] = useState(''); |
|||
const [isRepeated, setIsRepeated] = useState(true); |
|||
|
|||
let timer = null; |
|||
useEffect(() => { |
|||
if (timer) |
|||
clearTimeout(timer) |
|||
else { |
|||
timer = setTimeout(() => { |
|||
if (roads && roads.some(item => item.roadName == roadName)) { |
|||
setIsRepeated(true) |
|||
} else { |
|||
setIsRepeated(false); |
|||
} |
|||
}, 500); |
|||
} |
|||
|
|||
}, [roadName]); |
|||
|
|||
|
|||
useEffect(() => { |
|||
if (!isVisible) { |
|||
setRoadName('') |
|||
setIsRepeated(false) |
|||
} |
|||
return () => { |
|||
setRoadName('') |
|||
} |
|||
}, [isVisible]) |
|||
|
|||
|
|||
const onInputText = (e) => { |
|||
const value = e.target.value; |
|||
setRoadName(value); |
|||
} |
|||
|
|||
const onConfirm = () => { |
|||
if (!isRepeated) |
|||
if (roadName && roadName.trim() != '') { |
|||
onSubmit(roadName) |
|||
} |
|||
} |
|||
|
|||
|
|||
return ( |
|||
<Modal title="添加道路" visible={isVisible} onOk={onConfirm} onCancel={onCancel} > |
|||
<Row type="flex" style={{ alignContent: 'center' }}> |
|||
<Col span={6}> |
|||
<span style={{ color: 'gray', lineHeight: "32px" }}>请输入道路名称:</span> |
|||
</Col> |
|||
<Col span={18}> |
|||
<Search placeholder='请输入道路名称' onChange={onInputText} value={roadName} /> |
|||
</Col> |
|||
<Row> |
|||
{ |
|||
isRepeated ? <span style={{ color: 'red' }}>道路名称重复</span> |
|||
: '' |
|||
} |
|||
</Row> |
|||
</Row> |
|||
</Modal> |
|||
) |
|||
} |
|||
|
|||
RoadModal.propTypes = {} |
|||
|
|||
export default RoadModal |
@ -1,46 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react' |
|||
import { Modal, Input, Row, Col } from 'antd'; |
|||
import Upload from '../../../../components/Upload'; |
|||
const UploadModal = props => { |
|||
const { isVisible, onSubmit, onCancel, } = props; |
|||
const [files, setFiles] = useState() |
|||
|
|||
|
|||
useEffect(() => { |
|||
if (!isVisible) { |
|||
} |
|||
return () => { |
|||
} |
|||
}, [isVisible]) |
|||
|
|||
|
|||
|
|||
const onConfirm = () => { |
|||
onSubmit(files); |
|||
} |
|||
|
|||
const onFileUploaded = (fileList) => { |
|||
console.log('fileList: ', fileList); |
|||
setFiles(fileList); |
|||
} |
|||
|
|||
return ( |
|||
<Modal title="文件上传" visible={isVisible} onOk={onConfirm} onCancel={onCancel} > |
|||
<Row type="flex" style={{ alignContent: 'center' }}> |
|||
<Upload |
|||
uploadType={'project'} |
|||
maxFilesNum={1} |
|||
maxFileSize={10} |
|||
onChange={onFileUploaded} |
|||
clearFileList={isVisible} |
|||
// value
|
|||
// onStateChange
|
|||
/> |
|||
</Row> |
|||
</Modal> |
|||
) |
|||
} |
|||
|
|||
UploadModal.propTypes = {} |
|||
|
|||
export default UploadModal |
@ -1,466 +0,0 @@ |
|||
import { connect } from 'react-redux'; |
|||
import './protable.less' |
|||
import { Card, Button, Row, DatePicker, Input, Modal, message, Image } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import { getFileList, createFileDir, queryFileDir, uploadFile, deleteFile } from '../actions/file'; |
|||
import { ExclamationCircleOutlined } from '@ant-design/icons'; |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { httpDel } from '@peace/utils' |
|||
import { PinyinHelper } from '@peace/utils'; |
|||
import RoadModal from './file/roadModal'; |
|||
// import Pdfh5 from "pdfh5";
|
|||
// import "pdfh5/css/pdfh5.css";
|
|||
import FunctionMenu from './file/functionMenu'; |
|||
const { confirm } = Modal; |
|||
|
|||
// @ts-ignore
|
|||
import UploadModal from './file/uploadModal'; |
|||
|
|||
// var pdfh5 = null;
|
|||
const DetailList = (props) => { |
|||
const { fileList, loading, dispatch, handelRefresh, onPageChange, user } = props; |
|||
const [imgSrc, setImgSrc] = useState({ imageView: false, imgSrc: '' }) |
|||
const [pdfView, setPdfView] = useState({ showPDF: false, pdfName: '', pdfurl: '' }) |
|||
var tyApiRoot = localStorage.getItem('tyApiRoot') |
|||
|
|||
// useEffect(() => {
|
|||
// if (pdfView.showPDF) {
|
|||
// pdfh5 = new Pdfh5("#pdf-loader", {
|
|||
// pdfurl: pdfView.pdfurl
|
|||
// })
|
|||
// }
|
|||
// }, [pdfView])
|
|||
|
|||
const handleRemove = (record, filePath) => { |
|||
if (record) { |
|||
dispatch(deleteFile(record.id)).then(res => { |
|||
if (res.type == 'DELETE_FILE_SUCCESS') { |
|||
message.success("文件删除成功"); |
|||
handelRefresh() |
|||
} else { |
|||
message.error("文件删除失败") |
|||
} |
|||
}) |
|||
} |
|||
let url = `${tyApiRoot}/attachments`, msg = {}; |
|||
const actionType = "DEL_FILE_RECORD"; |
|||
if (filePath) { |
|||
httpDel(dispatch, { url, actionType, msg, query: { src: filePath } }) |
|||
} |
|||
} |
|||
const overviewPDF = (record, filePath) => { |
|||
setPdfView({ showPDF: true, pdfName: record.fileName, pdfurl: filePath }) |
|||
} |
|||
|
|||
const showDeleteConfirm = (record, filePath) => { |
|||
confirm({ |
|||
title: '是否确认删除该文件?', |
|||
icon: <ExclamationCircleOutlined />, |
|||
// content: 'Some descriptions',
|
|||
okText: '是', |
|||
okType: 'danger', |
|||
cancelText: '否', |
|||
onOk() { |
|||
handleRemove(record, filePath); |
|||
}, |
|||
onCancel() { |
|||
}, |
|||
}); |
|||
} |
|||
//处理预览的逻辑
|
|||
const preview = (url) => { |
|||
let link = encodeURI(url) || '' |
|||
if (link) |
|||
if (url.indexOf("pdf") !== -1 || url.indexOf("csv") !== -1 || url.indexOf("jpg") !== -1 || url.indexOf("png") !== -1) { |
|||
window.open(link) |
|||
} else { |
|||
window.open(`https://view.officeapps.live.com/op/view.aspx?src=${link}`) |
|||
|
|||
} |
|||
} |
|||
const columns = [ |
|||
{ |
|||
title: '资料名称', |
|||
key: 'fileName', |
|||
dataIndex: 'fileName', |
|||
align: 'center', |
|||
}, { |
|||
title: '所属道路', |
|||
key: 'road', |
|||
dataIndex: 'road', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
return fileList?.road?.roadName; |
|||
} |
|||
}, { |
|||
title: '资料类型', |
|||
key: 'fileType', |
|||
dataIndex: 'fileType', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
return fileList?.type?.fileType; |
|||
} |
|||
}, |
|||
{ |
|||
title: '文件类型', |
|||
key: 'fileExt', |
|||
dataIndex: 'fileExt', |
|||
align: 'center' |
|||
}, |
|||
{ |
|||
title: '文件大小', |
|||
width: 100, |
|||
key: 'fileSize', |
|||
dataIndex: 'fileSize', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
let size = 0; |
|||
if (record.fileSize < 1024 * 1024) { |
|||
size = (record.fileSize / 1024).toFixed(2) + 'KB' |
|||
} else { |
|||
size = (record.fileSize / 1024 / 1024).toFixed(2) + 'MB' |
|||
} |
|||
return <span>{size}</span> |
|||
} |
|||
}, { |
|||
title: '创建时间', |
|||
key: 'createDate', |
|||
dataIndex: 'createDate', |
|||
valueType: 'dateTime', |
|||
align: 'center' |
|||
}, { |
|||
title: '操作', |
|||
width: 160, |
|||
key: 'option', |
|||
valueType: 'option', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
const regEx = /\bhttps?:\/\/[^:\/]+/ig; |
|||
const path = record.fileUrl; |
|||
const filename = path.substr(path.lastIndexOf("/") + 1); |
|||
const filePath = path.replace(regEx, ""); |
|||
const filePath_ = `${tyApiRoot}/attachments?src=${filePath}&filename=${filename}`; |
|||
|
|||
return <span> |
|||
{/* {<a style={{ color: '#333398' }} href={fpath}>下载</a>} */} |
|||
{<a style={{ color: '#333398' }} onClick={() => { |
|||
window.open(filePath_); |
|||
}} >下载</a>} |
|||
<span className="ant-divider" /> |
|||
<a style={{ color: '#333398' }} onClick={() => { showDeleteConfirm(record, filePath) }} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : ''} |
|||
>删除</a> |
|||
<span className="ant-divider" /> |
|||
<a style={{ color: '#333398' }} onClick={() => { preview(path) }}>预览</a> |
|||
{/* { |
|||
['.png', '.jpg'].some(item => item == record.fileExt) ? |
|||
[<span className="ant-divider" />, |
|||
<a style={{ color: '#333398' }} onClick={() => { setImgSrc({ imageView: true, imgSrc: path }) }}>预览</a>] |
|||
: '' |
|||
} */} |
|||
{/* { |
|||
['.pdf'].some(item => item == record.fileExt) ? |
|||
[<span className="ant-divider" />, |
|||
<a style={{ color: '#333398' }} onClick={() => overviewPDF(record, path)}>预览</a>] |
|||
: '' |
|||
} */} |
|||
</span> |
|||
}, |
|||
}, |
|||
]; |
|||
return [ |
|||
<ProTable |
|||
columns={columns} |
|||
dataSource={fileList?.list || []} |
|||
loading={loading} |
|||
pagination={{ |
|||
total: fileList?.count || 0, |
|||
pageSize: 10, |
|||
defaultPageSize: 10, |
|||
showSizeChanger: false, |
|||
onChange: (page, pageSize) => { |
|||
onPageChange(page, pageSize) |
|||
} |
|||
}} |
|||
rowKey="key" |
|||
toolBarRender={false} |
|||
search={false} |
|||
/>, |
|||
<Image |
|||
width={200} |
|||
style={{ display: 'none' }} |
|||
src={imgSrc.imgSrc} |
|||
preview={{ |
|||
visible: imgSrc.imageView, |
|||
src: imgSrc.imgSrc, |
|||
onVisibleChange: value => { |
|||
setImgSrc({ imageView: value, imgSrc: '' }); |
|||
}, |
|||
}} |
|||
/>, |
|||
// <Modal
|
|||
// visible={pdfView.showPDF}
|
|||
// footer={null}
|
|||
// title={pdfView.pdfName}
|
|||
// width={860}
|
|||
// onCancel={() => {
|
|||
// pdfh5 = null;
|
|||
// setPdfView({ showPDF: false, pdfName: '', pdfurl: '' });
|
|||
// }}
|
|||
// >
|
|||
// <div id="pdf-loader" style={{ width: 830, height: 600, overflowY: 'hidden' }} />
|
|||
// </Modal>
|
|||
|
|||
]; |
|||
}; |
|||
|
|||
|
|||
|
|||
const RoadNameList = (props) => { |
|||
const [filterRoad, setFilterRoad] = useState([]); |
|||
const [addVisible, setAddVisible] = useState(false); |
|||
const [selectRoad, setSelectRoad] = useState(); |
|||
const { onChange, roads, loading, queryData, dispatch, user } = props |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : '') |
|||
const columns = [ |
|||
{ |
|||
title: '道路名称', |
|||
key: 'roadName', |
|||
dataIndex: 'roadName', |
|||
align: 'center', |
|||
}, |
|||
|
|||
]; |
|||
|
|||
useEffect(() => { |
|||
if (roads && roads instanceof Array && roads.length) { |
|||
setSelectRoad(roads[0].rId) |
|||
onChange(roads[0]); |
|||
} |
|||
}, [roads]) |
|||
|
|||
useEffect(() => { |
|||
if (roads) { |
|||
setFilterRoad(roads) |
|||
} |
|||
}, [roads]) |
|||
|
|||
var timer = null; |
|||
const doRoadNameSearch = (e) => { |
|||
const name = e.target.value; |
|||
if (timer) { |
|||
clearTimeout(timer) |
|||
} else { |
|||
setTimeout(() => { |
|||
let _roads = roads.filter(road => PinyinHelper.isSearchMatched(road.roadName, name)); |
|||
setFilterRoad(_roads); |
|||
}, 500); |
|||
} |
|||
} |
|||
|
|||
const createRoadDir = (roadName) => { |
|||
dispatch(createFileDir({ roadName })).then(res => { |
|||
if (res.type == 'CREATE_FILE_DIR_SUCCESS') { |
|||
setAddVisible(false) |
|||
message.success('新增道路文件夹成功'); |
|||
dispatch(queryFileDir()) |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
const onDelDir = () => { |
|||
|
|||
} |
|||
|
|||
return ( |
|||
<div id="tree-box" className='spilce'> |
|||
<ProTable |
|||
columns={columns} |
|||
dataSource={filterRoad} |
|||
loading={loading} |
|||
rowKey="name" |
|||
rowClassName={(record) => { |
|||
return record.rId == selectRoad ? 'list-row-actived' : ''; |
|||
}} |
|||
toolBarRender={() => [ |
|||
<div> |
|||
<Button onClick={() => setAddVisible(true)} type="primary" style={{ width: '100%', marginBottom: 8 }} |
|||
disabled={editAble} |
|||
>新增</Button> |
|||
<Input placeholder='输入道路名称' onChange={doRoadNameSearch} ></Input> |
|||
</div> |
|||
]} |
|||
options={false} |
|||
pagination={false} |
|||
search={false} |
|||
onRow={(record) => { |
|||
return { |
|||
onClick: () => { |
|||
if (record) { |
|||
let id = record.rId |
|||
if (selectRoad == record.rId) { |
|||
id = null |
|||
} |
|||
setSelectRoad(id); |
|||
onChange(record); |
|||
} |
|||
}, |
|||
}; |
|||
}} |
|||
/> |
|||
<RoadModal |
|||
roads={roads} |
|||
isVisible={addVisible} |
|||
onSubmit={createRoadDir} |
|||
onCancel={() => { setAddVisible(false) }} |
|||
/> |
|||
|
|||
<FunctionMenu |
|||
selectRoad={selectRoad} |
|||
dispatch={dispatch} |
|||
onDelDir={onDelDir} |
|||
/> |
|||
</div> |
|||
|
|||
); |
|||
}; |
|||
|
|||
|
|||
|
|||
const FileTable = (props) => { |
|||
const { roads, fileList, dispatch, fileListLoading, roadsLoading, user } = props; |
|||
const [record, setRecord] = useState(); |
|||
const [activeTabKey1, setActiveTabKey1] = useState('1'); |
|||
const [uploadVisible, setUploadVisible] = useState(false); |
|||
const { RangePicker } = DatePicker; |
|||
|
|||
useEffect(() => { |
|||
if (roads && roads instanceof Array) { |
|||
setRecord(roads[0]); |
|||
} |
|||
}, [roads]) |
|||
|
|||
useEffect(() => { |
|||
if (record) { |
|||
queryData(); |
|||
} |
|||
}, [record]) |
|||
|
|||
const queryData = () => { |
|||
const { rId } = record; |
|||
dispatch(getFileList({ fId: activeTabKey1, limit: 10, offset: 0, roadId: rId })) |
|||
} |
|||
|
|||
const onPageChange = (page, pageSize) => { |
|||
dispatch(getFileList({ fId: activeTabKey1, limit: pageSize, offset: (page - 1) * pageSize, roadId: rId })) |
|||
} |
|||
|
|||
useEffect(() => { |
|||
if (record && activeTabKey1) { |
|||
queryData(); |
|||
} |
|||
|
|||
}, [activeTabKey1, record]) |
|||
|
|||
const handelRefresh = () => { |
|||
queryData() |
|||
} |
|||
|
|||
const tabList = [ |
|||
{ |
|||
key: '1', |
|||
tab: '前期资料', |
|||
}, { |
|||
key: '2', |
|||
tab: '施工资料', |
|||
}, { |
|||
key: '3', |
|||
tab: '竣工资料', |
|||
}, { |
|||
key: '4', |
|||
tab: '维修资料', |
|||
}, { |
|||
key: '5', |
|||
tab: '道路资料', |
|||
}, |
|||
]; |
|||
const onTab1Change = (key) => { |
|||
setActiveTabKey1(key); |
|||
}; |
|||
|
|||
const handleChangeRecord = (newRecord) => { |
|||
let target = null; |
|||
if (!record || newRecord.rId != record.rId) { |
|||
target = newRecord; |
|||
} |
|||
setRecord(target); |
|||
} |
|||
const hanleUpload = (fileList) => { |
|||
let fileUrl, fileExt, fileName, fileSize; |
|||
if (fileList && fileList instanceof Array) { |
|||
const file = fileList[0]; |
|||
fileName = file.name; |
|||
fileExt = fileName.substr(fileName.lastIndexOf('.')); |
|||
fileUrl = file.url; |
|||
fileSize = file.size; |
|||
dispatch(uploadFile({ typeId: activeTabKey1, userId: user.id, fileSize, fileName, fileUrl, fileExt, roadId: record.rId })).then(res => { |
|||
if (res.type == 'UPLOAD_FILE_SUCCESS') { |
|||
message.success('文件新增成功'); |
|||
setUploadVisible(false); |
|||
queryData(); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<div className='card-protable'> |
|||
<Card > |
|||
<RoadNameList |
|||
user={user} |
|||
dispatch={dispatch} |
|||
queryData={queryData} |
|||
onChange={(record) => handleChangeRecord(record)} |
|||
record={record} |
|||
roads={roads} |
|||
loading={roadsLoading} /> |
|||
</Card> |
|||
<Card |
|||
style={{ flex: 1 }} |
|||
tabList={tabList} |
|||
activeTabKey={activeTabKey1} |
|||
onTabChange={(key) => { |
|||
onTab1Change(key); |
|||
}} |
|||
> |
|||
<Row> |
|||
<Button onClick={() => { setUploadVisible(true) }} type="primary" style={{ width: 160, marginBottom: 8, visibility: record ? 'visible' : "hidden" }} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : ''} |
|||
>上传</Button> |
|||
</Row> |
|||
<Card style={{ flex: 1 }}> |
|||
<DetailList user={user} fileList={fileList} record={record} loading={fileListLoading} dispatch={dispatch} handelRefresh={handelRefresh} onPageChange={onPageChange} /> |
|||
</Card> |
|||
</Card> |
|||
<UploadModal |
|||
isVisible={uploadVisible} |
|||
onCancel={() => { setUploadVisible(false) }} |
|||
onSubmit={hanleUpload} |
|||
/> |
|||
</div> |
|||
|
|||
); |
|||
}; |
|||
|
|||
function mapStateToProps(state) { |
|||
const { fileDirs, fileList, auth } = state; |
|||
return { |
|||
roads: fileDirs.data, |
|||
roadsLoading: fileDirs.isRequesting, |
|||
fileList: fileList.data, |
|||
fileListLoading: fileList.isRequesting, |
|||
user: auth.user, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(FileTable); |
@ -1,188 +0,0 @@ |
|||
import React, { Component } from 'react' |
|||
import PropTypes from 'prop-types' |
|||
import { geoJson } from './mock_data'; |
|||
|
|||
export default class Bounds extends Component { |
|||
constructor(props) { |
|||
super(props); |
|||
this.map = props.map; |
|||
this.pl = {}; |
|||
this.textMarker = {}; |
|||
} |
|||
static propTypes = { |
|||
prop: PropTypes |
|||
} |
|||
|
|||
componentDidMount() { |
|||
if (!window.BoundPl) { |
|||
this.drawBounds(); |
|||
} |
|||
} |
|||
|
|||
componentWillUnmount() { |
|||
if (window.local_) |
|||
window.local_.remove(this.pl); |
|||
this.textMarker = null; |
|||
window.BoundPl = null; |
|||
} |
|||
|
|||
drawBounds = () => { |
|||
var map = this.map; |
|||
var loca = window.local_; |
|||
loca.ambLight = { |
|||
intensity: 0.3, |
|||
color: '#fff', |
|||
}; |
|||
loca.dirLight = { |
|||
intensity: 0.6, |
|||
color: '#fff', |
|||
target: [0, 0, 0], |
|||
position: [0, -1, 1], |
|||
}; |
|||
loca.pointLight = { |
|||
color: 'rgb(100,100,100)', |
|||
position: [120.24289, 30.341335, 20000], |
|||
intensity: 3, |
|||
// 距离表示从光源到光照强度为 0 的位置,0 就是光不会消失。
|
|||
distance: 50000, |
|||
}; |
|||
var geo = new Loca.GeoJSONSource({ |
|||
data: geoJson |
|||
}); |
|||
|
|||
var colors = ['#04398c', '#04398c', '#0542a5'].reverse(); |
|||
var height = [500]; |
|||
var pl = new Loca.PolygonLayer({ |
|||
// loca,
|
|||
zIndex: 1, |
|||
opacity: 0.6, |
|||
// cullface: 'none',
|
|||
shininess: 10, |
|||
hasSide: true, |
|||
}); |
|||
|
|||
pl.setSource(geo); |
|||
pl.setStyle({ |
|||
topColor: function (index, feature) { |
|||
var i = index % 3; |
|||
return colors[i]; |
|||
}, |
|||
sideColor: function (index, feature) { |
|||
return '#023890'; |
|||
}, |
|||
borderColor: function () { |
|||
return '#24dcf7' |
|||
}, |
|||
height: function (index, feature) { |
|||
return index == 0 ? height[0] : height[0] + index * 50; |
|||
}, |
|||
altitude: 0, |
|||
}); |
|||
loca.add(pl); |
|||
|
|||
// 创建纯文本标记
|
|||
var text = new AMap.Text({ |
|||
text: '纯文本标记', |
|||
anchor: 'center', // 设置文本标记锚点
|
|||
draggable: true, |
|||
cursor: 'pointer', |
|||
angle: 0, |
|||
visible: false, |
|||
offset: [60, 60], |
|||
extData: 'bounds_text', |
|||
style: { |
|||
'padding': '5px 10px', |
|||
'margin-bottom': '1rem', |
|||
'border-radius': '.25rem', |
|||
'background-color': 'rgba(0,0,0,0.5)', |
|||
// 'width': '12rem',
|
|||
'border-width': 0, |
|||
'box-shadow': '0 2px 6px 0 rgba(255, 255, 255, .3)', |
|||
'text-align': 'center', |
|||
'font-size': '16px', |
|||
'color': '#fff', |
|||
}, |
|||
}); |
|||
// text.setMap(map);
|
|||
if (!this.textMarker) |
|||
map.add(text); |
|||
this.textMarker = text; |
|||
console.log(text) |
|||
// 拾取
|
|||
map.on('mousemove', (e) => { |
|||
var feat = pl.queryFeature(e.pixel.toArray()); |
|||
// if (!text) {
|
|||
map.add(text); |
|||
// text = this.textMarker;
|
|||
// }
|
|||
|
|||
if (feat) { |
|||
text.show(); |
|||
text.setText(feat.properties.NAME); |
|||
text.setPosition(e.lnglat); |
|||
|
|||
pl.setStyle({ |
|||
topColor: (index, feature) => { |
|||
if (feature === feat) { |
|||
return [19, 43, 77, 1]; |
|||
} |
|||
// var v = feature.properties.health * 100;
|
|||
var i = index % 3; |
|||
return colors[i]; |
|||
}, |
|||
sideColor: (index, feature) => { |
|||
if (feature === feat) { |
|||
return '#023890'; |
|||
} |
|||
return '#023890'; |
|||
}, |
|||
borderColor: function () { |
|||
return '#24dcf7' |
|||
}, |
|||
height: function (index, feature) { |
|||
return index == 0 ? height[0] : height[0] + index * 50; |
|||
|
|||
}, |
|||
}); |
|||
} else { |
|||
pl.setStyle({ |
|||
topColor: function (index, feature) { |
|||
var i = index % 3; |
|||
return colors[i]; |
|||
}, |
|||
sideColor: function (index, feature) { |
|||
return '#023890'; |
|||
}, |
|||
borderColor: function () { |
|||
return '#24dcf7' |
|||
}, |
|||
height: function (index, feature) { |
|||
return index == 0 ? height[0] : height[0] + index * 50; |
|||
}, |
|||
altitude: 0, |
|||
}); |
|||
|
|||
text.hide(); |
|||
map.remove(text); |
|||
} |
|||
}); |
|||
|
|||
|
|||
map.setZoom(12.88) |
|||
map.setCenter([115.888149, 28.549851]); |
|||
map.setRotation(-68.7); |
|||
map.setPitch(42); |
|||
|
|||
this.pl = pl; |
|||
window.BoundPl = pl; |
|||
} |
|||
|
|||
render() { |
|||
return ( |
|||
<div> |
|||
</div> |
|||
) |
|||
} |
|||
} |
|||
|
|||
|
File diff suppressed because one or more lines are too long
@ -1,163 +0,0 @@ |
|||
import React from 'react' |
|||
import PropTypes from 'prop-types' |
|||
import { useEffect } from 'react'; |
|||
import { useState } from 'react'; |
|||
import { DatePicker } from 'antd'; |
|||
import Bounds from './bounds'; |
|||
import moment from 'moment'; |
|||
import { getReportList } from '../../actions/patrol' |
|||
const { RangePicker } = DatePicker; |
|||
function PatrolGis(props) { |
|||
const { reportList, userId, dispatch } = props; |
|||
const [mapComplete, setMapComplete] = useState(false); |
|||
const [mapObj, setMapObj] = useState(); |
|||
const [dateRange, setDateRange] = useState([moment().add(-6, 'day'), |
|||
moment()]); |
|||
let markers = []; |
|||
let PATH = []; |
|||
|
|||
useEffect(() => { |
|||
if (AMap) loadMap(); |
|||
return () => { |
|||
if (window.local_) { |
|||
window.local_ = null |
|||
} |
|||
if (mapObj) |
|||
mapObj.clearMap(); |
|||
} |
|||
}, [true]) |
|||
|
|||
useEffect(() => { |
|||
if (mapObj) { |
|||
mapObj.remove(markers); |
|||
mapObj.remove(PATH); |
|||
} |
|||
let query = { userId, reportType: 'patrol' } |
|||
if (userId) { |
|||
if ((dateRange && dateRange instanceof Array)) { |
|||
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') |
|||
} else { |
|||
query.startTime = moment().add(-6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') |
|||
query.endTime = moment().endOf('day').format('YYYY-MM-DD HH:mm:ss') |
|||
} |
|||
dispatch(getReportList(query)); |
|||
} else { |
|||
query.isTop = true; |
|||
dispatch(getReportList(query)); |
|||
} |
|||
}, [userId, dateRange]) |
|||
|
|||
useEffect(() => { |
|||
//console.log('userId', userId)
|
|||
if (reportList && mapObj) { |
|||
mapObj.clearMap(); |
|||
renderMarkers(); |
|||
if (userId) |
|||
renderPath(); |
|||
} |
|||
}, [reportList, mapObj, userId]) |
|||
|
|||
const loadMap = () => { |
|||
const map = new AMap.Map("amapId", { |
|||
resizeEnable: true, |
|||
center: [115.99255, 28.503617],//地图中心点,初始定位加载显示楼块
|
|||
zoom: 8,//地图显示的缩放级别
|
|||
zooms: [8, 18], |
|||
pitch: 0, // 地图俯仰角度,有效范围 0 度- 83 度
|
|||
viewMode: '3D', // 地图模式
|
|||
mapStyle: 'amap://styles/light', |
|||
}); |
|||
|
|||
//主题样式
|
|||
// var styleName = defaultStyleName;
|
|||
// map.setMapStyle(styleName);
|
|||
|
|||
let windowOnload = false; |
|||
map.on('complete', function () { |
|||
console.log("map-complete") |
|||
if (!window.local_) { |
|||
window.local_ = new Loca.Container({ map }); |
|||
setMapObj(map); |
|||
} |
|||
}); |
|||
window.onload = function () { |
|||
console.log("window.onload") |
|||
windowOnload = true; |
|||
} |
|||
}; |
|||
|
|||
const renderMarkers = () => { |
|||
const map = mapObj; |
|||
if (reportList && reportList instanceof Array) { |
|||
reportList.map(item => { |
|||
const { longitude, latitude, user } = item; |
|||
if (!longitude || !latitude) { |
|||
return; |
|||
} |
|||
const imageURL = '/assets/images/worker.png' |
|||
let icon = new AMap.Icon({ |
|||
size: new AMap.Size(24, 24), // 图标尺寸
|
|||
image: imageURL, // Icon的图像
|
|||
rotation: 270, |
|||
// imageOffset: new AMap.Pixel(-14, -14), // 图像相对展示区域的偏移量,适于雪碧图等
|
|||
imageSize: new AMap.Size(24, 24) // 根据所设置的大小拉伸或压缩图片
|
|||
}); |
|||
let marker = new AMap.Marker({ |
|||
position: new AMap.LngLat(longitude, latitude), |
|||
icon: icon, |
|||
offset: new AMap.Pixel(-12, -12), |
|||
// extData: {
|
|||
// name: user.name || '',
|
|||
// }
|
|||
}); |
|||
// marker.setTitle(s.name);
|
|||
markers.push(marker); |
|||
map.add(marker); |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const renderPath = () => { |
|||
const map = mapObj; |
|||
if (reportList && reportList instanceof Array) { |
|||
let list = reportList |
|||
list.sort((a, b) => { |
|||
const timeA = moment(a.time).valueOf(); |
|||
const timeB = moment(b.time).valueOf(); |
|||
return timeA - timeB; |
|||
}) |
|||
let path = [] |
|||
list.map(item => { |
|||
const { longitude, latitude, } = item; |
|||
if (longitude && latitude) |
|||
path.push([item.longitude, item.latitude]) |
|||
}); |
|||
PATH = path; |
|||
var polyline1 = new AMap.Polyline({ |
|||
map: map, |
|||
path: path, // 设置线覆盖物路径
|
|||
showDir: true, |
|||
strokeColor: '#3366bb', // 线颜色
|
|||
strokeWeight: 7 // 线宽
|
|||
}); |
|||
} |
|||
} |
|||
// , display: userId ? 'block' : 'none'
|
|||
return ( |
|||
<div style={{ width: '100%', backgroundColor: '#101824', height: '100%', minHeight: 700, position: 'relative' }}> |
|||
<div id='amapId' style={{ width: '100%', height: '100%', background: "#101824", minHeight: 700 }} /> |
|||
<div style={{ position: 'absolute', top: 8, left: 20, display: userId ? 'block' : 'none' }}> |
|||
<RangePicker |
|||
onChange={(date, dateString) => { setDateRange(dateString) }} |
|||
defaultValue={dateRange} |
|||
/> |
|||
</div> |
|||
{mapObj ? <Bounds map={mapObj} /> : ''} |
|||
</div > |
|||
) |
|||
} |
|||
|
|||
PatrolGis.propTypes = {} |
|||
|
|||
export default PatrolGis |
@ -1,113 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Spin, Table } from 'antd'; |
|||
import { ModalForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'; |
|||
import { putOperaTional, postCustodyunit, getCustodyunitOne,getxiuyangas } from "../../actions/infor" |
|||
|
|||
|
|||
import _ from 'lodash' |
|||
|
|||
const Guanli = (props) => { |
|||
const { visible, onVisibleChange, typecard, rewkeys, recortd, dispatch, setRecortd, setDelet } = props |
|||
const [success, setSuccess] = useState() |
|||
useEffect(() => { |
|||
return () => { |
|||
setRecortd() |
|||
} |
|||
}, [setRecortd]) |
|||
return ( |
|||
<Spin spinning={false}> |
|||
{/* { |
|||
newlysay ? */} |
|||
<ModalForm |
|||
width={'90rem'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={(values) => { |
|||
setDelet(values) |
|||
const query = { ...values, id: recortd?.id, serialNumber: recortd?.id } |
|||
dispatch(postCustodyunit(query)).then((res) => { |
|||
if (res.success === true) { |
|||
let date = { fourceUpdate: false } |
|||
dispatch(getxiuyangas(date)).then((res) => { |
|||
}) |
|||
} |
|||
}) |
|||
return true |
|||
}} |
|||
initialValues={recortd} |
|||
> |
|||
<ProForm.Group> |
|||
<ProFormText |
|||
name='responsibleUnitForManagementAndMaintenance' |
|||
width="md" |
|||
label='管养责任单位' |
|||
placeholder="请输入管养责任单位" |
|||
disabled |
|||
/><ProFormText |
|||
name='maintenanceUnit' |
|||
width="md" |
|||
label='养护单位' |
|||
placeholder="请输入养护单位" |
|||
/><ProFormText |
|||
name='management' |
|||
width="md" |
|||
label='管理人员' |
|||
placeholder="请输入管理人员" |
|||
|
|||
/><ProFormText |
|||
name='worker' |
|||
width="md" |
|||
label='工人' |
|||
placeholder="请输入工人" |
|||
/><ProFormText |
|||
name='publicWelfarePost' |
|||
width="md" |
|||
label='公益岗位' |
|||
placeholder="请输入公益岗位" |
|||
/><ProFormText |
|||
name='countyHighway' |
|||
width="md" |
|||
label='县道' |
|||
placeholder="请输入县道" |
|||
/><ProFormText |
|||
name='townshipRoad' |
|||
width="md" |
|||
label='乡道' |
|||
placeholder="请输入乡道" |
|||
/><ProFormText |
|||
name='villageRoad' |
|||
width="md" |
|||
label='村道' |
|||
placeholder="请输入村道" |
|||
/><ProFormText |
|||
name='bridge' |
|||
width="md" |
|||
label='桥梁' |
|||
placeholder="请输入桥梁" |
|||
/> |
|||
</ProForm.Group> |
|||
|
|||
</ModalForm> |
|||
|
|||
</Spin> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
loading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(Guanli); |
@ -1,112 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Spin, Table } from 'antd'; |
|||
import { ModalForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'; |
|||
import { putOperaTional, putHighways } from "../../actions/infor" |
|||
import _ from 'lodash' |
|||
|
|||
const HightModal = (props) => { |
|||
const { visible, onVisibleChange, typecard, rewkeys, recortd, dispatch, setRecortd, setDelet } = props |
|||
const [success, setSuccess] = useState() |
|||
|
|||
useEffect(() => { |
|||
return () => { |
|||
setRecortd() |
|||
} |
|||
}, [setRecortd]) |
|||
// console.log(recortd)
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
{/* { |
|||
newlysay ? */} |
|||
<ModalForm |
|||
width={'90rem'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={(values) => { |
|||
if (rewkeys === 'passenger') { |
|||
setDelet(values) |
|||
const query = { ...values, id: recortd?.id } |
|||
dispatch(putOperaTional(query)).then((res) => { |
|||
setSuccess(res.success) |
|||
}) |
|||
return true |
|||
|
|||
} |
|||
if (rewkeys === 'highways') { |
|||
setDelet(values) |
|||
|
|||
const query = { ...values, id: recortd?.id } |
|||
dispatch(putHighways(query)).then((res) => { |
|||
setSuccess(res.success) |
|||
}) |
|||
return true |
|||
|
|||
} |
|||
|
|||
}} |
|||
initialValues={recortd} |
|||
> |
|||
{/* {typecard == 'compile' ? */} |
|||
<ProForm.Group |
|||
> |
|||
<ProFormText |
|||
name='name' |
|||
width="md" |
|||
label='类型' |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recortd?.[0]?.value}
|
|||
disabled |
|||
|
|||
/> |
|||
<ProFormText |
|||
name='count' |
|||
width="md" |
|||
label='数量' |
|||
|
|||
placeholder="请输入数量" |
|||
rules={[ |
|||
{ |
|||
required: true, |
|||
message: '请输入整数', |
|||
pattern: RegExp(/^[0-9]\d*$/, 'g'), |
|||
|
|||
}, |
|||
// getValueFromEvent=(event)=>{
|
|||
// return event.target.value.replace(/\D/g,'')
|
|||
// }
|
|||
]} |
|||
|
|||
/> |
|||
|
|||
</ProForm.Group> |
|||
{/* : <ProForm.Group> |
|||
vfdscfd |
|||
</ProForm.Group>} */} |
|||
|
|||
</ModalForm> |
|||
{/* : '' |
|||
} */} |
|||
|
|||
</Spin> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
loading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(HightModal); |
@ -1,421 +0,0 @@ |
|||
|
|||
import React, { useEffect, useState, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Button, Popconfirm } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import './protable.less' |
|||
import { getRoadway, getHighways, getCustodyunit, delProject } from "../actions/infor" |
|||
import HightModal from './highways/highwaysdata'; |
|||
import Guanli from './highways/guanli'; |
|||
|
|||
const TransporTationTable = (props) => { |
|||
const { dispatch, user, depData, depMessage, depLoading } = props |
|||
const [rowSelected, setRowSelected] = useState([]) |
|||
const [sitename, setSitename] = useState()//名称
|
|||
const [counts, setCounts] = useState()//shuju
|
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalVisibleyilan, setModalVisibleyilan] = useState(false); |
|||
const [modalVisibleyilans, setModalVisibleyilans] = useState(false); |
|||
|
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [typecard, setTypecard] = useState(); |
|||
const [activeKey, setActiveKey] = useState('tab1'); |
|||
const [recortd, setRecortd] = useState() |
|||
const [whichofits, setWhichofits] = useState('sheshi') |
|||
const [delet, setDelet] = useState() |
|||
const [differentiate, setDifferentiate] = useState('road') |
|||
const [grade, setGrade] = useState('县') |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'MAINTENANCEMANAGE')[0].isshow === "true" ? true : '') |
|||
const ref = useRef() |
|||
useEffect(() => { ref.current.reload() }, [whichofits, delet]) |
|||
//打开弹窗
|
|||
const hightModal = (type, record) => { |
|||
setModalVisibleyilan(true); |
|||
// setModalType(type);
|
|||
if (type == 'edit') { |
|||
setModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
} |
|||
const yilanModal = (type, record) => { |
|||
setModalVisibleyilans(true); |
|||
// setModalType(type);
|
|||
if (type == 'edit') { |
|||
setModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
} |
|||
const columns = { |
|||
tab1: [ |
|||
{ |
|||
title: '类型', |
|||
dataIndex: 'placeName', |
|||
fixed: 'left', |
|||
width: 120, |
|||
search: false, |
|||
options: 1, |
|||
backgroundColor: "#ffffff", |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setSitename(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入类型进行搜索', |
|||
|
|||
}, |
|||
render: (dom, record) => { |
|||
return record.name |
|||
}, |
|||
}, |
|||
{ |
|||
title: '数量', |
|||
search: false, |
|||
dataIndex: 'containers', |
|||
|
|||
fixed: 'left', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
|
|||
return record.count |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'creatTime', |
|||
valueType: 'dateTimeRange', |
|||
hideInSearch: true, |
|||
width: 160, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div>{record.id !== null ? (<Button type="link" |
|||
onClick={() => { |
|||
hightModal('edit', record) |
|||
setTypecard('compile') |
|||
setRecortd(record) |
|||
}} |
|||
disabled={editAble} |
|||
>编辑</Button>) : null}</div> |
|||
|
|||
} |
|||
}, |
|||
|
|||
], |
|||
tab2: [ |
|||
{ |
|||
title: '管养责单位', |
|||
dataIndex: 'placeName', |
|||
fixed: 'left', |
|||
width: 120, |
|||
options: 1, |
|||
search: false, |
|||
backgroundColor: "#ffffff", |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setSitename(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入项目名称进行搜索', |
|||
|
|||
}, |
|||
render: (dom, record) => { |
|||
return record.responsibleUnitForManagementAndMaintenance |
|||
}, |
|||
}, |
|||
{ |
|||
title: '养护单位', |
|||
search: false, |
|||
dataIndex: 'time1', |
|||
valueType: 'dateRange', |
|||
|
|||
// fixed: 'left',
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.maintenanceUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '管理人员(人)', |
|||
search: false, |
|||
dataIndex: 'time2', |
|||
valueType: 'dateRange', |
|||
// align: 'right',
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.management |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '工人(人)', |
|||
search: false, |
|||
dataIndex: 'time3', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.worker |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '公益岗位(人)', |
|||
search: false, |
|||
dataIndex: 'time4', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.publicWelfarePost |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '县道(km)', |
|||
search: false, |
|||
dataIndex: 'time5', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.countyHighway |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '乡道(km)', |
|||
search: false, |
|||
dataIndex: 'time6', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.townshipRoad |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '村道(km)', |
|||
search: false, |
|||
dataIndex: 'time7', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.villageRoad |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '桥梁(座)', |
|||
search: false, |
|||
dataIndex: 'time8', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.bridge |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'creatTime', |
|||
valueType: 'dateTimeRange', |
|||
hideInSearch: true, |
|||
width: 160, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div><Button type="link" |
|||
onClick={() => { |
|||
yilanModal('edit', record) |
|||
setTypecard('compile') |
|||
setRecortd(record) |
|||
}} |
|||
disabled={editAble} |
|||
>编辑</Button></div> |
|||
|
|||
} |
|||
}, |
|||
|
|||
] |
|||
} |
|||
return ( |
|||
<Spin spinning={false}> |
|||
<div className='protable-transpor'> |
|||
<ProTable |
|||
actionRef={ref} |
|||
toolbar={{ |
|||
multipleLine: true, |
|||
|
|||
menu: { |
|||
type: 'tab', |
|||
activeKey, |
|||
onChange: (key) => setActiveKey(key), |
|||
items: [ |
|||
{ |
|||
key: 'tab1', |
|||
label: <span onClick={() => { |
|||
setWhichofits('sheshi') |
|||
setDifferentiate('bridge') |
|||
}}>设施统计{activeKey === 'tab1'}</span>, |
|||
}, |
|||
{ |
|||
key: 'tab2', |
|||
label: <span onClick={() => { |
|||
setWhichofits('guanli') |
|||
setDifferentiate('project') |
|||
}}>管养统计{activeKey === 'tab2'}</span>, |
|||
}, |
|||
|
|||
], |
|||
}, |
|||
}} |
|||
form={{ |
|||
submitter: false |
|||
}} |
|||
scroll={{ x: 800 }} |
|||
options={false} |
|||
ref={c => { finishedProductTable = c; }} |
|||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|||
//rowKey='id'
|
|||
onReset={(v) => { |
|||
setSitename('') |
|||
}} |
|||
// rowSelection={{
|
|||
// selectedRowKeys: rowSelected,
|
|||
// onChange: (selectedRowKeys) => {
|
|||
// setRowSelected(selectedRowKeys);
|
|||
// },
|
|||
// }}
|
|||
columns={columns[activeKey]} |
|||
dataSource={counts || []} |
|||
request={async (params) => { |
|||
//console.log(whichofits)
|
|||
if (whichofits == 'sheshi') { |
|||
const query = { |
|||
} |
|||
setRowSelected([]); |
|||
const res = await dispatch(getHighways(query)); |
|||
let rslt = res.payload.data?.vehicleRes?.map(item => { |
|||
return { |
|||
...item, |
|||
name: item.name + "(个)" |
|||
} |
|||
}) |
|||
const additionalProperties = Object.entries(res.payload.data?.conserveData[0]).map(([key, value]) => ({ |
|||
id: null, |
|||
name: key, |
|||
count: Number(value), |
|||
type: null |
|||
})) |
|||
additionalProperties.forEach(item => { rslt.push(item) }) |
|||
setCounts(rslt) |
|||
return { |
|||
...res, |
|||
total: res.payload.data ? res.payload.data.count : 0 |
|||
} |
|||
} if (whichofits == 'guanli') { |
|||
const query = { |
|||
|
|||
} |
|||
setRowSelected([]); |
|||
const res = await dispatch(getCustodyunit(query)); |
|||
setCounts(res.payload.data) |
|||
return { |
|||
...res, |
|||
total: res.payload.data ? res.payload.data.count : 0 |
|||
} |
|||
} |
|||
}} |
|||
search={{ |
|||
defaultCollapsed: false, |
|||
optionRender: (searchConfig, formProps, dom) => [ |
|||
...dom.reverse(), |
|||
// <Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected,grade,differentiate) }}>
|
|||
// <Button
|
|||
// >
|
|||
// 导出
|
|||
// </Button>
|
|||
// </Popconfirm>
|
|||
], |
|||
}} |
|||
> |
|||
</ProTable> |
|||
</div> |
|||
{modalVisibleyilan ? <HightModal |
|||
visible={modalVisibleyilan} |
|||
onVisibleChange={setModalVisibleyilan} |
|||
modalRecord={modalRecord} |
|||
typecard={typecard} |
|||
rewkeys={'highways'} |
|||
recortd={recortd} |
|||
setRecortd={setRecortd} |
|||
setDelet={setDelet} |
|||
/> : ''} |
|||
{modalVisibleyilans ? <Guanli |
|||
visible={modalVisibleyilans} |
|||
onVisibleChange={setModalVisibleyilans} |
|||
modalRecord={modalRecord} |
|||
typecard={typecard} |
|||
rewkeys={'guanli'} |
|||
recortd={recortd} |
|||
setRecortd={setRecortd} |
|||
setDelet={setDelet} |
|||
/> : ''} |
|||
</Spin > |
|||
) |
|||
} |
|||
const data = [ |
|||
{ name: "管养责任单位", type: 'responsibleUnitForManagementAndMaintenance' }, |
|||
{ name: "养护单位", type: 'maintenanceUnit' }, |
|||
{ name: "管理人员", type: 'management' }, |
|||
{ name: "工人", type: 'worker' }, |
|||
{ name: "公益岗位", type: 'publicWelfarePost' }, |
|||
{ name: "县道", type: 'countyHighway' }, |
|||
{ name: "乡道", type: 'townshipRoad' }, |
|||
{ name: "村道", type: 'villageRoad' }, |
|||
{ name: "桥梁", type: 'bridge' }, |
|||
] |
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(TransporTationTable); |
@ -1,383 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Spin, Table } from 'antd'; |
|||
import { DrawerForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'; |
|||
import { putRoadway, putSpecificVehicle, putHouseholds,putCircuit,putVehicle,putPurchase } from "../../actions/infor" |
|||
import { putBridge } from "../../actions/infor" |
|||
import _ from 'lodash' |
|||
const UserModal = (props) => { |
|||
const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename,setDelet, dispatch, setRecortd, engineering,whichofits } = props |
|||
const [newlys, setNewlys] = useState() //必填数据
|
|||
const [newlysay, setNewlysay] = useState() //处理hou
|
|||
const [records, setRecords] = useState()//处理
|
|||
const [recordsay, setRecordsay] = useState()//必填数据
|
|||
// const [success, setSuccess] = useState() //状态
|
|||
// const [establishment, setEstablishment] = useState() //业户类型
|
|||
// console.log(recortd)
|
|||
useEffect(() => { |
|||
const array = [] |
|||
if (rewkeys === 'transportation') { |
|||
const xindata = [...data] |
|||
setNewlys(xindata?.splice(0, 2)) |
|||
setNewlysay(xindata) |
|||
} if (rewkeys === 'bridge') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
// console.log(array)
|
|||
} |
|||
if (rewkeys === 'weihuo') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
// console.log(array)
|
|||
} |
|||
if (rewkeys === 'chuzu') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
array?.splice(1, 1) |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
} |
|||
if (rewkeys === 'yehu') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
|
|||
setNewlysay(array) |
|||
// console.log(array)
|
|||
} if (rewkeys === 'xianlu') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
} if (rewkeys === 'cheliang') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
}if (rewkeys === 'zhichao') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
} |
|||
}, []) |
|||
useEffect(() => { |
|||
const arr = [] |
|||
if (rewkeys === 'transportation') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
setRecords(arr) |
|||
} |
|||
if (rewkeys === 'bridge') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
setRecords(arr) |
|||
} |
|||
if (rewkeys === 'weihuo') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
setRecords(arr) |
|||
} |
|||
if (rewkeys === 'chuzu') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
setRecords(arr) |
|||
} if (rewkeys === 'yehu') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
// setEstablishment(arr.splice(-1, 1))
|
|||
setRecords(arr) |
|||
} |
|||
if (rewkeys === 'xianlu') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
// setEstablishment(arr.splice(-1, 1))
|
|||
setRecords(arr) |
|||
} if (rewkeys === 'cheliang') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
// setEstablishment(arr.splice(-1, 1))
|
|||
setRecords(arr) |
|||
} |
|||
}, [recortd]) |
|||
useEffect(() => { |
|||
return () => { |
|||
setRecortd() |
|||
} |
|||
}, [setRecortd]) |
|||
// console.log(recortd)
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
{/* { |
|||
newlysay ? */} |
|||
<DrawerForm |
|||
width={'90rem'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={(values) => { |
|||
if (Object.values(values).length > 0) { |
|||
if (rewkeys === 'transportation') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, level: whichofits, roadId: records?.[0]?.value || '' } |
|||
dispatch(putRoadway(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values, level: whichofits } |
|||
dispatch(putRoadway(query)).then((res) => { |
|||
|
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} |
|||
if (rewkeys === 'bridge') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, roadId: records?.[0]?.value || '' } |
|||
dispatch(putBridge(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values } |
|||
dispatch(putBridge(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} |
|||
if (rewkeys === 'weihuo' || rewkeys === 'chuzu') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, vehicleId: records?.[0]?.value || '', type: rewkeys == 'chuzu' ? '出租车' : '危货' } |
|||
dispatch(putSpecificVehicle(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values, type: rewkeys == 'chuzu' ? '出租车' : '危货' } |
|||
dispatch(putSpecificVehicle(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} |
|||
if (rewkeys === 'yehu') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, businessId: records?.[0]?.value, type: rewkeys == 'chuzu' ? '出租车' : '危货' } |
|||
dispatch(putHouseholds(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values, type: rewkeys === 'chuzu' ? '出租车' : '危货' } |
|||
dispatch(putHouseholds(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} if (rewkeys === 'xianlu') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, lineId: records?.[0]?.value || '' } |
|||
dispatch(putCircuit(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values } |
|||
dispatch(putCircuit(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} |
|||
if (rewkeys === 'cheliang') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, carId: records?.[0]?.value || '' } |
|||
dispatch(putVehicle(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values } |
|||
dispatch(putVehicle(query)).then((res) => { |
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} |
|||
if (rewkeys == 'zhichao') { |
|||
|
|||
if (typecard == 'compile') { |
|||
console.log(typecard) |
|||
|
|||
setDelet(values) |
|||
const query = { ...values, overspeedId: records?.[0]?.value || '' } |
|||
dispatch(putPurchase(query)).then((res) => { |
|||
console.log(res) |
|||
}) |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values } |
|||
dispatch(putPurchase(query)).then((res) => { |
|||
console.log(res) |
|||
|
|||
}) |
|||
return true |
|||
} |
|||
} |
|||
} else { return false } |
|||
|
|||
}} |
|||
initialValues={recortd} |
|||
> |
|||
{typecard == 'compile' ? |
|||
<ProForm.Group |
|||
> |
|||
<ProFormText |
|||
name={newlys?.[0]?.type} |
|||
width="md" |
|||
label={newlys?.[0]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
value={recordsay?.[0]?.value} |
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/><ProFormText |
|||
name={newlys?.[1]?.type} |
|||
width="md" |
|||
label={newlys?.[1]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
value={recordsay?.[1]?.value} |
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/> |
|||
{rewkeys === 'yehu' ? |
|||
<ProFormSelect |
|||
rules={[{ required: true, message: "必填" }]} |
|||
options={[ |
|||
{ |
|||
value: '出租车', |
|||
label: '出租车', |
|||
}, { |
|||
value: '危货', |
|||
label: '危险货运', |
|||
}, |
|||
]} |
|||
name='type' |
|||
label='类型' |
|||
/> : null |
|||
} |
|||
{newlysay?.map((item, index) => { |
|||
return <ProFormText width="md" |
|||
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" |
|||
key={index} |
|||
/> |
|||
})} |
|||
|
|||
</ProForm.Group> |
|||
: <ProForm.Group> |
|||
<ProFormText |
|||
name={newlys?.[0]?.type} |
|||
width="md" |
|||
label={newlys?.[0]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recordssy?.[0]?.value}
|
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/><ProFormText |
|||
name={newlys?.[1]?.type} |
|||
width="md" |
|||
label={newlys?.[1]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recordssy?.[1]?.value}
|
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/> |
|||
{rewkeys === 'yehu' ? |
|||
<ProFormSelect |
|||
rules={[{ required: true, message: "必填" }]} |
|||
options={[ |
|||
{ |
|||
value: '出租车', |
|||
label: '出租车', |
|||
}, { |
|||
value: '危货', |
|||
label: '危险货运', |
|||
}, |
|||
]} |
|||
name='type' |
|||
label='类型' |
|||
/> : null |
|||
} |
|||
{newlysay?.map((item, index) => { |
|||
return <ProFormText width="md" |
|||
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" key={index} |
|||
|
|||
|
|||
/> |
|||
})} |
|||
</ProForm.Group>} |
|||
|
|||
</DrawerForm> |
|||
{/* : '' |
|||
} */} |
|||
|
|||
</Spin> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
loading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(UserModal); |
@ -1,227 +0,0 @@ |
|||
import React, { useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Modal, Form, Button, Input, Switch } from 'antd'; |
|||
import Uploads from "../../../../components/Upload/index" |
|||
import { putAddPropagata } from '../../actions/infor'; |
|||
import { putEditPropagata } from '../../actions/infor'; |
|||
import { getPropagata } from '../../actions/infor'; |
|||
|
|||
|
|||
const VideoUpload = (props) => { |
|||
// const [counts, setCounts] = useState()//shuju
|
|||
const { dispatch, record, counts, setCounts, user } = props |
|||
const [success, setSuccess] = useState() //状态
|
|||
const [form] = Form.useForm(); |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'PUBLICITYVIDEO')[0].isshow === "true" ? true : '') |
|||
//console.log('editAble', props)
|
|||
let edit = editAble |
|||
//弹窗
|
|||
const [isModalVisible, setIsModalVisible] = useState(false); |
|||
const showModal = () => { |
|||
setIsModalVisible(true); |
|||
|
|||
} |
|||
const showModalEdit = () => { |
|||
setIsModalVisible(true); |
|||
}; |
|||
|
|||
//新增
|
|||
const handleOkAdd = () => { |
|||
form.validateFields().then((values) => { |
|||
const videoAddress = values.video.map((item) => { |
|||
return item.storageUrl |
|||
}) |
|||
const videoname = values.videoname |
|||
const enable = values.show |
|||
const data = { name: videoname, video: videoAddress, enable: enable } |
|||
dispatch(putAddPropagata(data)).then(() => { |
|||
dispatch(getPropagata()).then((res) => { |
|||
setCounts(res.payload.data) |
|||
}) |
|||
}) |
|||
form.resetFields() |
|||
setIsModalVisible(false); |
|||
} |
|||
); |
|||
}; |
|||
//编辑
|
|||
const handleOkEdit = (record) => { |
|||
|
|||
form.validateFields().then((values) => { |
|||
const videoname = values.username |
|||
const id = record.id |
|||
const newVideoAddress = values.video.map((item) => { |
|||
return item.storageUrl |
|||
}) |
|||
const data = { publicityId: id, name: videoname, video: newVideoAddress } |
|||
dispatch(putEditPropagata(data)).then(() => { |
|||
dispatch(getPropagata()).then((res) => { |
|||
setCounts(res.payload.data) |
|||
console.log(data); |
|||
}) |
|||
}) |
|||
setIsModalVisible(false); |
|||
} |
|||
); |
|||
}; |
|||
|
|||
const handleCancel = () => { |
|||
setIsModalVisible(false); |
|||
}; |
|||
const handleCancelEdit = () => { |
|||
setIsModalVisible(false); |
|||
form.resetFields() |
|||
}; |
|||
|
|||
const onFinish = (values) => { |
|||
console.log('Success:', values); |
|||
}; |
|||
|
|||
const onFinishFailed = (errorInfo) => { |
|||
console.log('Failed:', errorInfo); |
|||
}; |
|||
|
|||
return ( |
|||
<div > |
|||
{ |
|||
props.type_ys ? <div><Button type='primary' disabled={editAble} >新增</Button> |
|||
<Modal visible={isModalVisible} onOk={handleOkAdd} onCancel={handleCancelEdit} > |
|||
<Form |
|||
form={form} |
|||
name="basic" |
|||
labelCol={{ |
|||
span: 5, |
|||
}} |
|||
wrapperCol={{ |
|||
span: 16, |
|||
}} |
|||
initialValues={{ |
|||
show: true |
|||
}} |
|||
onFinish={onFinish} |
|||
onFinishFailed={onFinishFailed} |
|||
autoComplete="off" |
|||
> |
|||
<Form.Item |
|||
label="视频名称" |
|||
name="videoname" |
|||
rules={[ |
|||
{ |
|||
required: true, |
|||
message: '请输入视频名称!', |
|||
max: 50, |
|||
}, |
|||
]} |
|||
> |
|||
<Input |
|||
placeholder="请输入视频名称" /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item |
|||
label="选择视频" |
|||
name="video" |
|||
rules={[ |
|||
{ |
|||
required: true, |
|||
message: '必须上传视频!', |
|||
}, |
|||
]} |
|||
> |
|||
<Uploads |
|||
maxFilesNum={1} |
|||
fileTypes={['mp4']} |
|||
maxFileSize={200} |
|||
/> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="是否开启展示" |
|||
name="show" |
|||
> |
|||
<Switch checkedChildren="展示" unCheckedChildren="关闭" defaultChecked={true} /> |
|||
</Form.Item> |
|||
</Form> |
|||
</Modal> |
|||
</div> |
|||
: |
|||
<div><Button disabled={editAble} type='link' onClick={showModalEdit} style={{ Position: "absolute", left: "-50px", top: "32px" }}>编辑</Button> |
|||
<Modal visible={isModalVisible} onOk={() => handleOkEdit(record)} onCancel={handleCancel}> |
|||
<Form |
|||
form={form} |
|||
name="basic" |
|||
labelCol={{ |
|||
span: 5, |
|||
}} |
|||
wrapperCol={{ |
|||
span: 16, |
|||
}} |
|||
initialValues={{ |
|||
username: record.name, video: record.video.map((item) => { |
|||
return { url: item } |
|||
}) |
|||
}} |
|||
onFinish={onFinish} |
|||
onFinishFailed={onFinishFailed} |
|||
autoComplete="off" |
|||
|
|||
> |
|||
<Form.Item |
|||
label="视频名称" |
|||
name="username" |
|||
rules={[ |
|||
{ |
|||
required: false, |
|||
message: '没有做出任何修改!', |
|||
max: 50, |
|||
}, |
|||
]} |
|||
> |
|||
<Input |
|||
placeholder="请输入视频名称" |
|||
/> |
|||
|
|||
</Form.Item> |
|||
<Form.Item |
|||
label="选择视频" |
|||
name="video" |
|||
rules={[ |
|||
{ |
|||
required: true, |
|||
message: '必须上传视频!', |
|||
}, |
|||
]} |
|||
> |
|||
<Uploads |
|||
maxFilesNum={1} |
|||
fileTypes={['mp4']} |
|||
maxFileSize={200} |
|||
/> |
|||
</Form.Item> |
|||
</Form> |
|||
</Modal> |
|||
</div> |
|||
} |
|||
</div > |
|||
) |
|||
} |
|||
|
|||
|
|||
|
|||
function mapStateToProps(state) { |
|||
const { depMessage, auth } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
loading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(VideoUpload); |
@ -1,551 +0,0 @@ |
|||
import React, { useEffect, useState, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Button, Popconfirm, Col, Input, Row } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import './protable.less' |
|||
import moment from 'moment'; |
|||
import { getPurchase, delPurchase } from "../actions/infor" |
|||
import UserModal from './infor/details'; |
|||
import Datajuji from './datajuji' |
|||
const InForTable = (props) => { |
|||
const { dispatch, user, depData, depMessage, depLoading } = props |
|||
const [rowSelected, setRowSelected] = useState([]) |
|||
const [counts, setCounts] = useState()//shuju
|
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [typecard, setTypecard] = useState(); |
|||
const [recortd, setRecortd] = useState() |
|||
const [monitor, setMonitor] = useState() |
|||
const [delet, setDelet] = useState() |
|||
const [nameOfInspectionPoint, setNameOfInspectionPoint] = useState()//检测点名称
|
|||
const [licensePlate, setLicensePlate] = useState()//车牌号
|
|||
const [numberOfAxles, setNumberOfAxles] = useState()//车轴数
|
|||
const [overrunRateUpper, setOverrunRateUpper] = useState()//超限率上限
|
|||
const [overrunRateFloor, setOverrunRateFloor] = useState()//超限率下限
|
|||
const [testTime, setTestTime] = useState()//超限率下限
|
|||
const [datajuji, setdatajuji] = useState() //数据聚集弹窗
|
|||
const ref = useRef() |
|||
useEffect(() => { ref.current.reload() }, [monitor, delet]) |
|||
//打开弹窗
|
|||
const openModal = (type, record) => { |
|||
setModalVisible(true); |
|||
// setModalType(type);
|
|||
if (type == 'edit') { |
|||
setModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
} |
|||
const deldata = (id) => { // 治超删除
|
|||
const query = { |
|||
overspeedId: id |
|||
} |
|||
dispatch(delPurchase(query)).then((res) => { |
|||
setDelet(res) |
|||
}) |
|||
} |
|||
const columns = |
|||
[ |
|||
{ |
|||
title: '区/县', |
|||
dataIndex: 'placeName', |
|||
fixed: 'left', |
|||
width: 120, |
|||
options: 1, |
|||
search: false, |
|||
backgroundColor: "#ffffff", |
|||
fieldProps: { |
|||
placeholder: '请输入检测点名称进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
}, |
|||
render: (dom, record) => { |
|||
return record.districtcounty |
|||
}, |
|||
}, |
|||
{ |
|||
title: '检测点名称', |
|||
// search: false,
|
|||
dataIndex: 'containers1', |
|||
|
|||
fixed: 'left', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.nameOfInspectionPoint |
|||
}, |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setNameOfInspectionPoint(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入检测点进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '车牌号码', |
|||
// search: false,
|
|||
dataIndex: 'containers444', |
|||
|
|||
fixed: 'left', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.licensePlate |
|||
}, |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setLicensePlate(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入车牌号进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '车轴数', |
|||
// search: false,
|
|||
dataIndex: 'containers2', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.numberOfAxles |
|||
}, |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setNumberOfAxles(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入车轴数进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '超限率(%)', |
|||
// search: false,
|
|||
dataIndex: 'containers3', |
|||
// valueType: 'dateRange',
|
|||
//
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.overrunRate |
|||
}, |
|||
fieldProps: { |
|||
placeholder: '请输入超限率进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
}, |
|||
renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => { |
|||
return <Input.Group > |
|||
<Row gutter={8}> |
|||
<Col span={8}> |
|||
<Input |
|||
onChange={(value) => { |
|||
setOverrunRateFloor(value.currentTarget.value) |
|||
}} |
|||
placeholder='超限率下限' /> |
|||
</Col> |
|||
<Col span={8}> |
|||
<Input |
|||
onChange={(value) => { |
|||
setOverrunRateUpper(value.currentTarget.value) |
|||
}} |
|||
placeholder='超限率上限' /> |
|||
</Col> |
|||
</Row> |
|||
</Input.Group> |
|||
} |
|||
|
|||
}, { |
|||
title: '超限重量(kg)', |
|||
search: false, |
|||
dataIndex: 'containers4', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.overrunWeight |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '车货总重(kg)', |
|||
search: false, |
|||
dataIndex: 'containers5', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.grossVehicleWeight |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '车货限重(kg)', |
|||
search: false, |
|||
dataIndex: 'containers6', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.vehicleCargoWeightLimit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '检测时间', |
|||
// search: false,
|
|||
width: 140, |
|||
key: 'since', |
|||
dataIndex: 'createdAt', |
|||
valueType: 'date', |
|||
render: (dom, record) => { |
|||
return record.testTime?.slice(0, 10) |
|||
}, |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
// console.log(cs)
|
|||
setTestTime(cs) |
|||
}, |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '经营业户名称', |
|||
search: false, |
|||
dataIndex: 'containers8', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.nameOfBusinessOwner |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '经营业户地址', |
|||
search: false, |
|||
dataIndex: 'containers9', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.businessAddress |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '通知人', |
|||
search: false, |
|||
dataIndex: 'containers10', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.notifier |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '通知方式', |
|||
search: false, |
|||
dataIndex: 'containers11', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.notificationMethod |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '通知结果(打不通、表示不来、不是当事人)', |
|||
search: false, |
|||
dataIndex: 'containers12', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 240, |
|||
|
|||
render: (dom, record) => { |
|||
return record.notificationResults |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '处理时间', |
|||
search: false, |
|||
dataIndex: 'time9', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.processingTime |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '扣分', |
|||
search: false, |
|||
dataIndex: 'containers13', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.deductPoints |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '罚款', |
|||
search: false, |
|||
dataIndex: 'containers14', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.fine |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '备注', |
|||
search: false, |
|||
dataIndex: 'containers14', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 140, |
|||
|
|||
render: (dom, record) => { |
|||
return record.remarks |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'creatTime', |
|||
valueType: 'dateTimeRange', |
|||
hideInSearch: true, |
|||
width: 160, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div><Button type="link" |
|||
onClick={() => { |
|||
openModal('edit', record) |
|||
setTypecard('compile') |
|||
setRecortd(record) |
|||
}} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''} |
|||
>编辑</Button> |
|||
|
|||
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''} |
|||
|
|||
> |
|||
<Button type="link" |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''} |
|||
>删除</Button> |
|||
</Popconfirm></div> |
|||
|
|||
} |
|||
}, |
|||
{ |
|||
key: "direction", |
|||
hideInTable: true, |
|||
dataIndex: "direction", |
|||
order: 6, |
|||
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|||
return ( |
|||
<div> <Button |
|||
type="primary" |
|||
style={{ width: "100px" }} |
|||
onClick={() => { |
|||
openModal('edit', record) |
|||
setTypecard('') |
|||
}} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''} |
|||
> |
|||
新增 |
|||
</Button> |
|||
|
|||
{/* <Button |
|||
type='primary' |
|||
onClick={() => { setdatajuji(true)}} style={{ marginLeft: 15 }} |
|||
> |
|||
数据汇集 |
|||
</Button> */} |
|||
{/* <Button |
|||
type="primary" |
|||
style={{ width: "100px", marginLeft: 20 }} |
|||
|
|||
> |
|||
导入 |
|||
</Button> */} |
|||
</div> |
|||
|
|||
|
|||
); |
|||
}, |
|||
}, |
|||
] |
|||
return ( |
|||
<Spin spinning={false}> |
|||
<div className='protable-transpor'> |
|||
<ProTable |
|||
actionRef={ref} |
|||
scroll={{ x: 800 }} |
|||
options={false} |
|||
ref={c => { finishedProductTable = c; }} |
|||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|||
rowKey='id' |
|||
|
|||
rowSelection={{ |
|||
selectedRowKeys: rowSelected, |
|||
onChange: (selectedRowKeys) => { |
|||
setRowSelected(selectedRowKeys); |
|||
}, |
|||
}} |
|||
columns={columns} |
|||
dataSource={counts || []} |
|||
onReset={(v) => { |
|||
setNameOfInspectionPoint('') |
|||
setLicensePlate('') |
|||
setNumberOfAxles('') |
|||
setOverrunRateUpper('') |
|||
setOverrunRateFloor('') |
|||
setTestTime('') |
|||
}} |
|||
request={async (params) => { |
|||
// console.log(params)
|
|||
const query = { |
|||
limit: params.pageSize, |
|||
page: params.current - 1, |
|||
nameOfInspectionPoint: nameOfInspectionPoint, |
|||
licensePlate: licensePlate, |
|||
numberOfAxles: numberOfAxles, |
|||
overrunRateUpper: overrunRateUpper, |
|||
overrunRateFloor: overrunRateFloor, |
|||
testTime: testTime |
|||
} |
|||
setRowSelected([]); |
|||
const res = await dispatch(getPurchase(query)); |
|||
// console.log(res)
|
|||
setCounts(res.payload.data.rows) |
|||
return { |
|||
...res, |
|||
total: res.payload.data ? res.payload.data.count : 0 |
|||
} |
|||
}} |
|||
search={{ |
|||
defaultCollapsed: false, |
|||
optionRender: (searchConfig, formProps, dom) => [ |
|||
...dom.reverse(), |
|||
<Popconfirm title={rowSelected.length === 0 ? '请勾选内容' : "确认导出?"} |
|||
showCancel={rowSelected.length === 0 ? false : true} |
|||
onConfirm={() => { |
|||
// console.log(rowSelected)
|
|||
rowSelected.length === 0 ? null : props.exports(rowSelected, counts) |
|||
}} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''} |
|||
> |
|||
<Button |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''} |
|||
|
|||
> |
|||
导出 |
|||
</Button> |
|||
</Popconfirm> |
|||
], |
|||
}} |
|||
|
|||
> |
|||
</ProTable></div> |
|||
{modalVisible ? <UserModal |
|||
visible={modalVisible} |
|||
onVisibleChange={setModalVisible} |
|||
modalRecord={modalRecord} |
|||
typecard={typecard} |
|||
rewkeys={'zhichao'} |
|||
data={data} |
|||
recortd={recortd} |
|||
setDelet={setDelet} |
|||
setMonitor={setMonitor} |
|||
// sitename={sitename}
|
|||
setRecortd={setRecortd} |
|||
/> : ''} |
|||
{datajuji ? <Datajuji |
|||
visible={datajuji} |
|||
onCancel={() => { setdatajuji(false) }} |
|||
// handleSaveScore={handleSaveScore}
|
|||
// searchCompany={searchCompany}
|
|||
// companys={companys}
|
|||
// editData={modalRecord}
|
|||
// readOnly={readOnly}
|
|||
// applyState={applyState}
|
|||
></Datajuji> : ''} |
|||
</Spin > |
|||
) |
|||
} |
|||
const data = { |
|||
"districtcounty": "区/县", |
|||
"nameOfInspectionPoint": "检测点名称", |
|||
"licensePlate": "车牌号码", |
|||
"numberOfAxles": "车轴数", |
|||
"overrunRate": "超限率", |
|||
"overrunWeight": "超限重量", |
|||
"grossVehicleWeight": "车货总重", |
|||
"vehicleCargoWeightLimit": "车货限重", |
|||
"testTime": "检测时间", |
|||
"nameOfBusinessOwner": "经营业户名称", |
|||
"businessAddress": "经营业户地址", |
|||
"notifier": "通知人", |
|||
"notificationMethod": "通知方式", |
|||
"notificationResults": "通知结果", |
|||
"processingTime": "处理时间", |
|||
"deductPoints": "扣分", |
|||
"fine": "罚款", |
|||
"remarks": "备注" |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(InForTable); |
@ -1,139 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Input, Select, DatePicker, InputNumber, Button, Modal } from 'antd'; |
|||
import { unitList } from '../containers/assess' |
|||
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
|||
import moment from 'moment'; |
|||
import { getRoadadministration, addRoadadministration, delRoadadministration, modifyRoadadministration } from '../actions/luzheng'; |
|||
// import Uploads from "../../../../components/Upload/index"
|
|||
// import Uploads from '../../../components/Upload/index'
|
|||
import Uploads from './uploads' |
|||
const { Option } = Select; |
|||
|
|||
const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => { |
|||
const [form] = Form.useForm(); |
|||
// console.log(editData,'editData')
|
|||
return ( |
|||
<Modal |
|||
title="路政信息" |
|||
open={visible} |
|||
visible={visible} |
|||
cancelButtonProps={{ |
|||
disabled: check, |
|||
}} |
|||
footer={!check ? [ |
|||
<Button key="submit" type="primary" onClick={() => { |
|||
if (check) { |
|||
return onCancel() |
|||
} |
|||
form.validateFields().then(values => { |
|||
if (editData) { |
|||
dispatch(modifyRoadadministration(editData?.id, { |
|||
...values |
|||
})).then(res => { |
|||
if (res.success) { |
|||
onCancel() |
|||
} |
|||
}) |
|||
} else { |
|||
dispatch(addRoadadministration({ |
|||
...values, |
|||
})).then(res => { |
|||
if (res.success) { |
|||
onCancel() |
|||
} |
|||
}) |
|||
} |
|||
|
|||
}) |
|||
}}> |
|||
确定 |
|||
</Button>, |
|||
<Button onClick={onCancel}> |
|||
取消 |
|||
</Button> |
|||
] : null} |
|||
onOk={() => { |
|||
if (check) { |
|||
return onCancel() |
|||
} |
|||
form.validateFields().then(values => { |
|||
if (editData) { |
|||
dispatch(modifyRoadadministration(editData?.id, { |
|||
...values |
|||
})).then(res => { |
|||
if (res.success) { |
|||
onCancel() |
|||
} |
|||
}) |
|||
} else { |
|||
dispatch(addRoadadministration({ |
|||
...values, |
|||
})).then(res => { |
|||
if (res.success) { |
|||
onCancel() |
|||
} |
|||
}) |
|||
} |
|||
|
|||
}) |
|||
}} |
|||
onCancel={() => { |
|||
onCancel() |
|||
}} |
|||
> |
|||
<Form |
|||
form={form} |
|||
initialValues={editData ? { |
|||
...editData, |
|||
enforcementdate: moment(editData.enforcementdate) |
|||
} : {}} |
|||
disabled={check} |
|||
labelCol={{ |
|||
span: 6, |
|||
}} |
|||
wrapperCol={{ |
|||
span: 18, |
|||
}} |
|||
> |
|||
<Form.Item name="enforcementdate" label="执法日期" rules={[{ required: true, message: '请填写' }]}> |
|||
{/* <Select> |
|||
{ |
|||
unitList.map(item => ( |
|||
<Option value={item} key={item} /> |
|||
)) |
|||
} |
|||
</Select> */} |
|||
<DatePicker /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="roadname" label="执法道路" rules={[{ required: true, message: '请填写' }, { max: 100, message: '不可超过一百个字符' }]}> |
|||
<Input /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="enforcementreslt" label="执法成果" rules={[{ required: true, message: '请填写' }, { max: 100, message: '不可超过一百个字符' }]}> |
|||
<Input /> |
|||
</Form.Item> |
|||
<Form.Item name="picfile" label="执法图片"> |
|||
<Uploads |
|||
maxFilesNum={3} |
|||
fileTypes={['png', 'jpg', 'jpeg']} |
|||
maxFileSize={200} |
|||
fileList={editData?.picfile} |
|||
listType={'picture-card'} |
|||
isedit={editData ? true : false} |
|||
/> |
|||
</Form.Item> |
|||
</Form> |
|||
</Modal> |
|||
); |
|||
}; |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth, assess } = state |
|||
return { |
|||
user: auth.user, |
|||
assess: assess.data || [] |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(LuzhengModel); |
@ -1,799 +0,0 @@ |
|||
import { connect } from 'react-redux'; |
|||
import './protable.less' |
|||
import { Card, Button, DatePicker, Input, Modal, Spin, Image, message, Popover, Tree, Descriptions } from 'antd'; |
|||
import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import { getReportList, getReportDetail } from '../actions/patrol'; |
|||
import React, { useEffect, useState, useMemo } from 'react'; |
|||
import { httpDel } from '@peace/utils' |
|||
import { PinyinHelper } from '@peace/utils'; |
|||
// @ts-ignore
|
|||
import styles from './protable.less'; |
|||
import moment from 'moment'; |
|||
import { getAllDepUsers } from '../actions/allDepUsers' |
|||
import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../../organization/actions/user' |
|||
import { reportTypeText } from './patrolTable' |
|||
import './maintenanceTable.less' |
|||
|
|||
const DetailForm = (props) => { |
|||
const { visible, data, handleClose, loading } = props; |
|||
const [qndmn] = useState(localStorage.getItem('qndmn')); |
|||
const keyList = [ |
|||
{ key: '道路类型', name: 'reportType' }, |
|||
{ key: '其他', name: 'projectType' }, |
|||
{ key: '路线代码', name: 'codeRoad' }, |
|||
{ 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: '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 <div className='maintenanceNew'> |
|||
<Descriptions title="基础信息" bordered style={{ marginBottom: 20 }}> |
|||
<Descriptions.Item label="道路类型">{data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''}</Descriptions.Item> |
|||
<Descriptions.item label="其他">{reportTypeText(data['projectType']) || ''}</Descriptions.item> |
|||
<Descriptions.item label="路线代码">{data['codeRoad'] || ''}</Descriptions.item> |
|||
<Descriptions.item label="路线名称">{data['road'] || ''}</Descriptions.item> |
|||
<Descriptions.item label="养护路段" span={2}>{data['roadSectionStart'] && data['roadSectionEnd'] ? data['roadSectionStart'] + '-' + data['roadSectionEnd'] : ''}</Descriptions.item> |
|||
<Descriptions.Item label="具体位置" span={3} >{data['address'] || ''}</Descriptions.Item> |
|||
</Descriptions> |
|||
<Descriptions title="道路信息" bordered style={{ marginBottom: 20 }}> |
|||
{roadInfo.map(item => ( |
|||
<Descriptions.Item label={item.key}> |
|||
{data[item.name] || ''} |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护作业内容" bordered style={{ marginBottom: 20 }}> |
|||
{mantenanceInfo.map(item => ( |
|||
<Descriptions.Item label={item.key}> |
|||
{data[item.name] || ''} |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护图片" bordered style={{ marginBottom: 20 }} column={3}> |
|||
{mantenancePic.map(item => ( |
|||
<Descriptions.Item label={item.key} className="custom-item" span={3}> |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data[item.name]?.map(imgSrc => { |
|||
return <div style={{ width: '50px', margin: 6, display: 'flex' }}> |
|||
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} /> |
|||
</div> |
|||
}) || '暂无图片'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护视频" bordered style={{ marginBottom: 20 }} column={3}> |
|||
<Descriptions.Item label={'养护视频'} className="custom-item" > |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data['videoUrl']?.map(videoSrc => { |
|||
return <div style={{ width: '44%', margin: 6, display: 'flex' }}> |
|||
<video src={qndmn + '/' + videoSrc} width={'100%'} style={{ marginBottom: 4 }} controls /> |
|||
</div> |
|||
}) || '暂无视频'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
</Descriptions> |
|||
</div> |
|||
|
|||
|
|||
// 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: '60%' }}
|
|||
// value={
|
|||
// obj.name == 'id' ?
|
|||
// moment(data.time).format("YYYYMMDD") * 10000 + data.id
|
|||
// :
|
|||
// obj.name === 'projectType' ?
|
|||
// reportTypeText(data[obj.name])
|
|||
// : obj.name === 'reportType' ? data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道'
|
|||
// : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : '' :
|
|||
// 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: '60%', 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 }} controls />
|
|||
// </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 <div className='maintenanceNew'> |
|||
<Descriptions title="养护信息" bordered style={{ marginBottom: 20 }} column={3}> |
|||
<Descriptions.Item label="道路类型">{data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''}</Descriptions.Item> |
|||
<Descriptions.item label="养护路段" >{data['roadSectionStart'] && data['roadSectionEnd'] ? (data['roadSectionStart'] + '-' + data['roadSectionEnd']) : ''}</Descriptions.item> |
|||
<Descriptions.item label="路线代码">{data['codeRoad'] || ''}</Descriptions.item> |
|||
{/* <Descriptions.item label="路线名称">{data['code'] || ''}</Descriptions.item> */} |
|||
<Descriptions.Item label="具体位置" span={3} >{data['address'] || ''}</Descriptions.Item> |
|||
<Descriptions.Item label="养护内容" span={3} >{data['content'] || ''}</Descriptions.Item> |
|||
</Descriptions> |
|||
<Descriptions title="养护图片" bordered style={{ marginBottom: 20 }} > |
|||
{mantenancePic.map(item => ( |
|||
<Descriptions.Item label={item.key} className="custom-item" span={3}> |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data[item.name]?.map(imgSrc => { |
|||
return <div style={{ width: '50px', margin: 6, display: 'flex' }}> |
|||
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} /> |
|||
</div> |
|||
}) || '暂无图片'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护视频" bordered style={{ marginBottom: 20 }} > |
|||
<Descriptions.Item label={'养护视频'} className="custom-item" > |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data['videoUrl']?.map(videoSrc => { |
|||
return <div style={{ width: '44%', margin: 6, display: 'flex' }}> |
|||
<video src={qndmn + '/' + videoSrc} width={'100%'} style={{ marginBottom: 4 }} controls /> |
|||
</div> |
|||
}) || '暂无视频'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
</Descriptions> |
|||
</div> |
|||
} |
|||
|
|||
} else { |
|||
return '暂无数据' |
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<Modal |
|||
width={'60%'} |
|||
// style={{ width: 800 }}
|
|||
visible={visible} |
|||
footer={null} |
|||
onCancel={handleClose} |
|||
title={'养护管理详情'} |
|||
> |
|||
<Spin spinning={loading}> |
|||
{renderContent(data)} |
|||
</Spin> |
|||
</Modal > |
|||
) |
|||
} |
|||
|
|||
const DetailList = (props) => { |
|||
const { reportList, loading, dispatch, handleOpen, handelRefresh, user } = props; |
|||
const [visible, setVisible] = useState(false) |
|||
const [selectRecord, setSelectRecord] = useState() |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'CONSERVATIONMANAGE')[0].isshow === "true" ? true : '') |
|||
const checkDetail = (record) => { |
|||
dispatch(getReportDetail(record.id)) |
|||
} |
|||
|
|||
const handleRemove = (record) => { |
|||
let url = 'report/{reportId}'; |
|||
const actionType = "DEL_REPORT_RECORD"; |
|||
const msg = {} |
|||
if (record) { |
|||
url = url.replace('{reportId}', record.id) |
|||
httpDel(dispatch, { url, actionType, msg }).then(res => { |
|||
if (res.success) { |
|||
message.success("记录删除成功") |
|||
handelRefresh(); |
|||
} else { |
|||
message.error("记录删除失败") |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
let basicDate = null; |
|||
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: 'projectType', |
|||
dataIndex: 'projectType', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
return (record.codeRoad && record.codeRoad.length > 0) |
|||
? record.codeRoad[0] === 'X' |
|||
? '县道' |
|||
: record.codeRoad[0] === 'Y' |
|||
? '乡道' |
|||
: '村道' |
|||
: '' |
|||
} |
|||
}, { |
|||
title: '所属道路', |
|||
key: 'road', |
|||
dataIndex: 'road', |
|||
align: 'center' |
|||
}, { |
|||
title: '所在路段', |
|||
key: 'address', |
|||
dataIndex: 'address', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
return `${record.roadSectionStart || ''}-${record.roadSectionEnd || ''}` |
|||
} |
|||
}, |
|||
{ |
|||
title: '具体位置', |
|||
key: 'address', |
|||
dataIndex: 'address', |
|||
align: 'center' |
|||
}, |
|||
{ |
|||
title: '上报人', |
|||
width: 100, |
|||
key: 'userName', |
|||
dataIndex: 'userName', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
return record?.user?.name |
|||
} |
|||
}, { |
|||
title: '上报时间', |
|||
key: 'time', |
|||
dataIndex: 'time', |
|||
valueType: 'dateTime', |
|||
align: 'center' |
|||
}, { |
|||
title: '操作', |
|||
width: 200, |
|||
key: 'option', |
|||
valueType: 'option', |
|||
align: 'center', |
|||
render: (text, record) => { |
|||
return [ |
|||
<Button |
|||
onClick={() => { checkDetail(record); handleOpen(); }} |
|||
style={{ marginRight: 10 }}>查看</Button>, |
|||
<Popover |
|||
content={[ |
|||
<div style={{ width: '100%', height: 30 }}> |
|||
<Button onClick={() => setVisible(false)} style={{ float: "right" }} >否</Button> |
|||
<Button type="primary" onClick={() => handleRemove(record)} style={{ marginRight: 8, float: "right" }} >是</Button> |
|||
</div> |
|||
]} |
|||
visible={selectRecord == record.id && visible} |
|||
trigger="click" |
|||
onClick={() => user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'CONSERVATIONMANAGE')[0].isshow === "true" ? '' : setSelectRecord(record.id)} |
|||
title="是否删除该记录?" |
|||
onVisibleChange={(newVisible) => setVisible(newVisible)} |
|||
> |
|||
<Button disabled={editAble}>删除</Button> |
|||
</Popover> |
|||
] |
|||
} |
|||
}, |
|||
]; |
|||
return ( |
|||
<ProTable |
|||
columns={columns} |
|||
dataSource={reportList} |
|||
loading={loading} |
|||
pagination={{ |
|||
pageSize: 10, |
|||
defaultPageSize: 10, |
|||
showSizeChanger: false, |
|||
}} |
|||
rowKey="key" |
|||
toolBarRender={false} |
|||
search={false} |
|||
/> |
|||
); |
|||
}; |
|||
|
|||
|
|||
|
|||
const PatrolNameList = (props) => { |
|||
const { Search } = Input; |
|||
const [users, setUsers] = useState([]); |
|||
const { onChange, record, userList, loading, depMessage, depUser, clientHeight, dispatch, user } = props; |
|||
const [selectRoad, setSelectRoad] = useState(); |
|||
const [selectedTree, setSelectedTree] = useState(); |
|||
const [depSelectedKeys, setDepSelectedKeys] = useState([]) |
|||
const [depAllUser, setDepAllUser] = useState([]) |
|||
//const [depMessagedata, setdepMessagedata] = useState()//侧边栏的展示数据
|
|||
const [expandedKeys, setExpandedKeys] = useState([]); |
|||
const [searchValue, setSearchValue] = useState(''); |
|||
const [autoExpandParent, setAutoExpandParent] = useState(true); |
|||
const [defaultData, setDefaultData] = useState([]); |
|||
const [dataList, setDataList] = useState([]); |
|||
//console.log('record', record)
|
|||
useEffect(() => { |
|||
let departments = [] |
|||
const generateData = (data, _preKey, _tns) => { |
|||
const preKey = _preKey || '0'; |
|||
const tns = _tns || []; |
|||
const children = []; |
|||
|
|||
data.forEach(department => { |
|||
const key = `${preKey}-${department.depId}`; |
|||
const node = { |
|||
title: department.depName.toString(), |
|||
key, |
|||
children: [], |
|||
}; |
|||
|
|||
if (department.users.length > 0) { // 仅当部门有用户时添加子节点
|
|||
department.users.forEach(user => { |
|||
node.children.push({ |
|||
title: user.name.toString(), |
|||
key: `${key}-${user.id}`, |
|||
isLeaf: true, // 用户节点为叶子节点
|
|||
}); |
|||
}); |
|||
} |
|||
|
|||
if (department.children && department.children.length > 0) { |
|||
const childKeys = generateData(department.children, key, node.children); |
|||
children.push(...childKeys); |
|||
} |
|||
|
|||
tns.push(node); |
|||
if (node.children.length > 0 && department.expanded) { // 仅当部门展开时添加子节点
|
|||
children.push(key); |
|||
} |
|||
}); |
|||
return children; |
|||
}; |
|||
if (user?.username === 'SuperAdmin') { |
|||
departments = [...new Set(depAllUser)] |
|||
} else { |
|||
let depAllUserCopy = [] |
|||
depAllUser.map((item) => { |
|||
if (item.depId === user?.departmentId) { |
|||
depAllUserCopy.push(item) |
|||
} |
|||
}) |
|||
departments = [...new Set(depAllUserCopy)] |
|||
} |
|||
|
|||
const processedData = []; |
|||
const expandedKeys = generateData(departments, null, processedData); |
|||
setDefaultData(processedData); |
|||
setDataList(processedData.map(item => ({ key: item.key, title: item.title.toString(), children: item.children }))); |
|||
setExpandedKeys(expandedKeys); |
|||
}, [depAllUser]) |
|||
|
|||
useEffect(() => { |
|||
dispatch(getAllDepUsers()).then((res) => { |
|||
if (res.success) setDepAllUser(res?.payload?.data) |
|||
}) |
|||
|
|||
|
|||
}, []) |
|||
const getParentKey = (key, tree) => { |
|||
let parentKey; |
|||
for (let i = 0; i < tree.length; i++) { |
|||
const node = tree[i]; |
|||
if (node.children) { |
|||
if (node.children.some((item) => item.key === key)) { |
|||
parentKey = node.key; |
|||
} else { |
|||
parentKey = getParentKey(key, node.children); |
|||
} |
|||
} |
|||
if (parentKey) { |
|||
break; |
|||
} |
|||
} |
|||
return parentKey; |
|||
}; |
|||
|
|||
const handleSearch = (value) => { |
|||
const filteredKeys = []; |
|||
const expandedKeys = []; |
|||
|
|||
const loopTreeData = (data) => { |
|||
data.forEach((item) => { |
|||
if (item.title.indexOf(value) > -1) { |
|||
filteredKeys.push(item.key); |
|||
let parentKey = getParentKey(item.key, defaultData); |
|||
while (parentKey) { |
|||
if (!expandedKeys.includes(parentKey)) { |
|||
expandedKeys.push(parentKey); |
|||
} |
|||
parentKey = getParentKey(parentKey, defaultData); |
|||
} |
|||
} |
|||
if (item.children) { |
|||
loopTreeData(item.children); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
loopTreeData(defaultData); |
|||
setSearchValue(value); |
|||
setExpandedKeys(expandedKeys); |
|||
}; |
|||
|
|||
const handleExpand = (expandedKeys) => { |
|||
setExpandedKeys(expandedKeys); |
|||
}; |
|||
|
|||
const renderTreeNodes = (data) => { |
|||
return data.map((item) => { |
|||
const { key, title, children } = item; |
|||
const isLeaf = !children || children.length === 0; |
|||
|
|||
return ( |
|||
<Tree.TreeNode |
|||
key={key} |
|||
title={title} |
|||
icon={isLeaf ? null : ( |
|||
expandedKeys.includes(key) ? <CaretDownOutlined /> : <CaretRightOutlined /> |
|||
)} |
|||
isLeaf={isLeaf} |
|||
> |
|||
{children && children.length > 0 && renderTreeNodes(children)} |
|||
</Tree.TreeNode> |
|||
); |
|||
}); |
|||
}; |
|||
|
|||
const treeData = useMemo(() => { |
|||
const loop = (data) => |
|||
data.map((item) => { |
|||
const { title, key, children } = item; |
|||
const strTitle = title.toString(); |
|||
const index = strTitle.indexOf(searchValue); |
|||
const beforeStr = strTitle.substring(0, index); |
|||
const afterStr = strTitle.slice(index + searchValue.length); |
|||
const titleNode = index > -1 ? ( |
|||
<span> |
|||
{beforeStr} |
|||
<span style={{ color: '#f50' }}>{searchValue}</span> |
|||
{afterStr} |
|||
</span> |
|||
) : ( |
|||
<span>{strTitle}</span> |
|||
); |
|||
|
|||
if (children && children.length > 0) { |
|||
return { |
|||
title: titleNode, |
|||
key, |
|||
children: loop(children), |
|||
}; |
|||
} |
|||
|
|||
return { |
|||
title: titleNode, |
|||
key, |
|||
}; |
|||
}); |
|||
|
|||
return loop(defaultData); |
|||
}, [searchValue, defaultData]); |
|||
useEffect(() => { |
|||
if (userList && userList instanceof Array && userList.length) { |
|||
setSelectRoad(userList[0].id) |
|||
// onChange(userList[0]);
|
|||
} |
|||
}, [userList]) |
|||
|
|||
useEffect(() => { |
|||
if (userList && userList instanceof Array) { |
|||
let users = userList.filter(user => user.remark != 'sp'); |
|||
setUsers(users); |
|||
} |
|||
}, [userList]) |
|||
const handleSelect = (selectedKeys, { selected, selectedNodes, node }) => { |
|||
if (selected) { |
|||
if (selectedKeys[0].split("-").length - 1 >= 2) { |
|||
let id = selectedKeys[0].split('-')[selectedKeys[0].split('-').length - 1] |
|||
//console.log('id', id)
|
|||
onChange(id); |
|||
} |
|||
|
|||
} |
|||
//('selectedKeys', selectedKeys, selected, selectedNodes, node)
|
|||
|
|||
}; |
|||
|
|||
if (loading) { |
|||
return <div>Loading...</div> |
|||
} |
|||
|
|||
return ( |
|||
<div className='spilce' style={{ height: '600px', width: '100%', overflow: 'auto' }} > |
|||
<Search |
|||
placeholder="请输入上报人员" |
|||
value={searchValue} |
|||
onChange={(e) => handleSearch(e.target.value)} |
|||
/> |
|||
<Tree |
|||
expandedKeys={expandedKeys} |
|||
onExpand={handleExpand} |
|||
autoExpandParent={autoExpandParent} |
|||
onSelect={handleSelect} |
|||
> |
|||
{renderTreeNodes(treeData)} |
|||
</Tree> |
|||
</div> |
|||
|
|||
); |
|||
}; |
|||
|
|||
|
|||
|
|||
const MaintenanceTable = (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() |
|||
}, []) |
|||
|
|||
useEffect(() => { |
|||
// if (userList && userList instanceof Array) {
|
|||
// let users = userList.filter(user => user.remark != 'sp');
|
|||
// setRecord(users[0]);
|
|||
// }
|
|||
}, [userList]) |
|||
|
|||
useEffect(() => { |
|||
// if (record) {
|
|||
queryData() |
|||
// }
|
|||
}, [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 = userL && userL.length ? userL + '' : undefined |
|||
} else { |
|||
userId = record |
|||
} |
|||
|
|||
//: user?.username === 'SuperAdmin' && record === 1 ? record?.id : record ? record : user?.id
|
|||
let query = { |
|||
userId, |
|||
reportType: 'conserve', |
|||
asc: true |
|||
} |
|||
if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { |
|||
query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') |
|||
query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') |
|||
} |
|||
dispatch(getReportList(query)) |
|||
} |
|||
} |
|||
|
|||
const handleClose = () => { |
|||
setDetailVisible(false) |
|||
} |
|||
const handleOpen = () => { |
|||
setDetailVisible(true) |
|||
} |
|||
|
|||
const handelRefresh = () => { |
|||
let query = { |
|||
userId: record.id, |
|||
reportType: 'conserve', |
|||
asc: true |
|||
} |
|||
dispatch(getReportList(query)); |
|||
} |
|||
|
|||
const handleExport = () => { |
|||
if (reportList && reportList instanceof Array && reportList.length) { |
|||
let ids = reportList.map(item => item.id); |
|||
exports(ids); |
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<div className='card-protable'> |
|||
<Card > |
|||
<PatrolNameList |
|||
depMessage={depMessage} depUser={depUser} clientHeight={clientHeight} dispatch={dispatch} user={user} |
|||
onChange={(record) => setRecord(record)} record={record} userList={userList} loading={userLoading} handelRefresh={handelRefresh} /> |
|||
</Card> |
|||
<Card style={{ flex: 1 }} > |
|||
<div style={{ marginBottom: 20 }}> |
|||
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} /> |
|||
<Button style={{ marginLeft: 20 }}>查询</Button> |
|||
<Button style={{ marginLeft: 20 }} onClick={handleExport}>导出</Button> |
|||
</div> |
|||
<Card style={{ flex: 1 }}> |
|||
<DetailList |
|||
user={user} |
|||
reportList={reportList} record={record} loading={reportListLoading} dispatch={dispatch} handleOpen={handleOpen} |
|||
handelRefresh={handelRefresh} |
|||
/> |
|||
</Card> |
|||
<DetailForm |
|||
visible={detailVisible} |
|||
handleClose={handleClose} |
|||
data={reportDetail} |
|||
loading={reportDetailLoading} /> |
|||
</Card> |
|||
</div> |
|||
|
|||
); |
|||
}; |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage, userList, reportList, reportDetail, depUser, global, allDepUsers } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
clientHeight: global.clientHeight, |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
userList: userList.data || [], |
|||
userLoading: userList.isRequesting, |
|||
reportList: reportList.data, |
|||
reportListLoading: reportList.isRequesting, |
|||
reportDetail: reportDetail.data, |
|||
reportDetailLoading: reportDetail.isRequesting, |
|||
depUser: depUser.data || [], |
|||
allDepUsers: allDepUsers.data || [] |
|||
|
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(MaintenanceTable) |
@ -1,19 +0,0 @@ |
|||
.maintenanceNew { |
|||
.ant-descriptions-item-label { |
|||
width: 19%; |
|||
} |
|||
|
|||
.ant-descriptions-item-content { |
|||
width: 40px; |
|||
} |
|||
} |
|||
|
|||
.maintenanceOld { |
|||
.ant-descriptions-item-label { |
|||
width: 20%; |
|||
} |
|||
|
|||
.ant-descriptions-item-content { |
|||
width: 40px; |
|||
} |
|||
} |
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,235 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Spin, Table } from 'antd'; |
|||
import { DrawerForm, ProForm, ProFormText, ProFormSelect, ProFormDatePicker, ProFormTextArea } from '@ant-design/pro-form'; |
|||
import { putProject } from "../../actions/infor" |
|||
import _ from 'lodash' |
|||
|
|||
const data = { |
|||
"entryName": "项目名称", |
|||
"projectMileage": "项目规模(公里)", |
|||
"investment": " 项目投资(万元)", |
|||
"buildUnit": "业主单位", |
|||
"qutityUnit": "质量监督单位", |
|||
"constructionUnit": "施工单位", |
|||
"designUnit": "设计单位", |
|||
"constructionControlUnit": "监理单位", |
|||
//"startTime": "开工时间",
|
|||
//"remark": "备注",
|
|||
"roadCodeStart": "起点路段编码", |
|||
} |
|||
const ProjectModal = (props) => { |
|||
const { visible, onVisibleChange, typecard, rewkeys, recortd, dispatch, setRecortd, setDelet, getData } = props |
|||
//console.log('typecard', newlysay)
|
|||
const [newlys, setNewlys] = useState() //必填数据
|
|||
|
|||
const [newlysay, setNewlysay] = useState() //处理hou
|
|||
const [records, setRecords] = useState()//处理
|
|||
const [recordsay, setRecordsay] = useState()//必填数据
|
|||
const [success, setSuccess] = useState() //状态
|
|||
useEffect(() => { |
|||
const array = [] |
|||
if (rewkeys === 'road') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
// console.log()
|
|||
|
|||
} |
|||
if (rewkeys === 'bridge') { |
|||
_.forIn(data, function (value, key) { |
|||
array.push({ name: value, type: key }) |
|||
}); |
|||
setNewlys(array?.splice(0, 2)) |
|||
setNewlysay(array) |
|||
// console.log()
|
|||
|
|||
} |
|||
}, []) |
|||
useEffect(() => { |
|||
const arr = [] |
|||
if (rewkeys === 'road') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
|
|||
setRecords(arr) |
|||
} |
|||
if (rewkeys === 'bridge') { |
|||
_.forIn(recortd, function (value, key) { |
|||
arr.push({ value: value, type: key }) |
|||
}); |
|||
setRecordsay(arr.splice(1, 2)) |
|||
setRecords(arr) |
|||
} |
|||
}, [recortd]) |
|||
useEffect(() => { |
|||
return () => { |
|||
setRecortd() |
|||
} |
|||
}, []) |
|||
// console.log(recortd)
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
{/* { |
|||
newlysay ? */} |
|||
<DrawerForm |
|||
width={'90rem'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={(values) => { |
|||
// console.log(values)
|
|||
if (rewkeys === 'road') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, type: rewkeys, projectId: records?.[0]?.value || '', done: values.done === 'true' ? true : false } |
|||
dispatch(putProject(query)).then((res) => { |
|||
}) |
|||
getData() |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values, type: rewkeys, done: values.done === 'true' ? true : false } |
|||
dispatch(putProject(query)).then((res) => { |
|||
}) |
|||
getData() |
|||
return true |
|||
} |
|||
} |
|||
if (rewkeys === 'bridge') { |
|||
if (typecard == 'compile') { |
|||
setDelet(values) |
|||
const query = { ...values, type: rewkeys, projectId: records?.[0]?.value || '', done: values.done === 'true' ? true : false } |
|||
dispatch(putProject(query)).then((res) => { |
|||
|
|||
}) |
|||
getData() |
|||
return true |
|||
} else { |
|||
setDelet(values) |
|||
const query = { ...values, type: rewkeys, done: values.done === 'true' ? true : false } |
|||
dispatch(putProject(query)).then((res) => { |
|||
|
|||
}) |
|||
getData() |
|||
return true |
|||
} |
|||
} |
|||
}} |
|||
initialValues={{ ...recortd, done: typecard == 'compile' ? recortd?.done ? 'true' : 'false' : '' }} |
|||
> |
|||
{typecard == 'compile' ? |
|||
<ProForm.Group |
|||
> |
|||
<ProFormText |
|||
name={newlys?.[0]?.type} |
|||
width="md" |
|||
label={newlys?.[0]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recordsay?.[0]?.value}
|
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/><ProFormText |
|||
name={newlys?.[1]?.type} |
|||
width="md" |
|||
label={newlys?.[1]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recordsay?.[1]?.value}
|
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/> |
|||
<ProFormSelect |
|||
options={[ |
|||
{ |
|||
value: 'true', |
|||
label: '是', |
|||
}, { |
|||
value: 'false', |
|||
label: '否', |
|||
}, |
|||
]} |
|||
name='done' |
|||
label='是否已完成' |
|||
rules={[{ required: true, message: "必填" }]} |
|||
/> |
|||
{newlysay?.map((item, index) => { |
|||
return <ProFormText width="md" |
|||
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" |
|||
key={index} |
|||
/> |
|||
})} |
|||
|
|||
</ProForm.Group> |
|||
: <ProForm.Group> |
|||
<ProFormText |
|||
name={newlys?.[0]?.type} |
|||
width="md" |
|||
label={newlys?.[0]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recordssy?.[0]?.value}
|
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/><ProFormText |
|||
name={newlys?.[1]?.type} |
|||
width="md" |
|||
label={newlys?.[1]?.name} |
|||
|
|||
placeholder="请输入名称" |
|||
// value={recordssy?.[1]?.value}
|
|||
// rules={[{ required: true, message: "必填" }]}
|
|||
/> |
|||
<ProFormSelect |
|||
request={async () => [ |
|||
{ |
|||
value: 'true', |
|||
label: '是', |
|||
}, { |
|||
value: 'false', |
|||
label: '否', |
|||
}, |
|||
]} |
|||
|
|||
name='done' |
|||
label='是否已完成' |
|||
rules={[{ required: true, message: "必填" }]} |
|||
/> |
|||
{newlysay?.map((item, index) => { |
|||
return <ProFormText width="md" |
|||
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" key={index} |
|||
|
|||
|
|||
/> |
|||
})} |
|||
|
|||
|
|||
</ProForm.Group>} |
|||
<ProFormDatePicker width="md" name='startTime' label='开工时间' ></ProFormDatePicker> |
|||
<ProFormTextArea width="md" name='remark' label='备注' ></ProFormTextArea> |
|||
</DrawerForm> |
|||
{/* : '' |
|||
} */} |
|||
|
|||
</Spin> |
|||
) |
|||
} |
|||
function mapStateToProps (state) { |
|||
const { depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
loading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(ProjectModal); |
@ -1,177 +0,0 @@ |
|||
import React, { useEffect, useState, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Button, Popconfirm, Switch } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import './protable.less' |
|||
import VideoUpload from './infor/videoUpload'; |
|||
import { getPropagata } from '../actions/infor'; |
|||
import { putEditPropagata } from '../actions/infor'; |
|||
import { delPropagata } from '../actions/infor'; |
|||
|
|||
const promotionalTable = (props) => { |
|||
const { dispatch, user } = props |
|||
const [rowSelected, setRowSelected] = useState([]) |
|||
const [counts, setCounts] = useState()//shuju
|
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'PUBLICITYVIDEO')[0].isshow === "true" ? true : '') |
|||
|
|||
const onClickEnable = (record) => { |
|||
const id = record.id |
|||
const name = record.name |
|||
const video = record.video |
|||
|
|||
const enable = true ? record.enable == false : true |
|||
const data = ({ publicityId: id, name: name, video: video, enable: enable }) |
|||
dispatch(putEditPropagata(data)).then((res) => { |
|||
dispatch(getPropagata()).then((res) => { |
|||
setCounts(res.payload.data) |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
|
|||
|
|||
const columns = |
|||
[ |
|||
{ |
|||
title: '序号', |
|||
search: false, |
|||
dataIndex: 'containers', |
|||
fixed: 'left', |
|||
width: 120, |
|||
render: (dom, record, key) => { |
|||
return key + 1 |
|||
} |
|||
}, |
|||
{ |
|||
title: '视频名称', |
|||
dataIndex: 'videoName', |
|||
fixed: 'left', |
|||
search: false, |
|||
width: 120, |
|||
options: 1, |
|||
render: (dom, record) => { |
|||
return record.name |
|||
} |
|||
}, |
|||
{ |
|||
title: '是否展示', |
|||
dataIndex: 'shuffling', |
|||
valueType: 'shufflingRange', |
|||
search: false, |
|||
width: 120, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div > |
|||
<Switch checkedChildren="展示" unCheckedChildren="关闭" onClick={() => onClickEnable(record)} defaultChecked={true ? record.enable == true : false} disabled={editAble} /> |
|||
</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'creatTime', |
|||
valueType: 'dateTimeRange', |
|||
hideInSearch: true, |
|||
width: 120, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div style={{ position: 'relative', marginTop: '-30px' }}> |
|||
<VideoUpload record={record} counts={counts} setCounts={setCounts} user={user} /> |
|||
<Popconfirm |
|||
disabled={editAble} |
|||
title="是否确定删除?" |
|||
arrowPointAtCenter={true} |
|||
showArrow={true} |
|||
position="topRight" |
|||
onConfirm={ |
|||
() => { |
|||
const query = { |
|||
publicityId: record.id |
|||
} |
|||
dispatch(delPropagata(query)).then(() => { |
|||
dispatch(getPropagata()).then((res) => { |
|||
setCounts(res.payload.data) |
|||
}) |
|||
}) |
|||
} |
|||
} |
|||
|
|||
> |
|||
<Button type="link" float="right" disabled={editAble} |
|||
>删除</Button> |
|||
</Popconfirm> |
|||
</div> |
|||
|
|||
} |
|||
}, |
|||
{ |
|||
key: "direction", |
|||
hideInTable: true, |
|||
dataIndex: "direction", |
|||
order: 6, |
|||
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|||
return ( |
|||
<div> |
|||
<VideoUpload type_ys={1} counts={counts} setCounts={setCounts} /> |
|||
</div> |
|||
); |
|||
}, |
|||
}, |
|||
] |
|||
|
|||
//获取数据
|
|||
useEffect(() => { |
|||
const vedio = dispatch(getPropagata()).then((res) => { |
|||
setCounts(res.payload.data) |
|||
}) |
|||
}, []) |
|||
|
|||
|
|||
return ( |
|||
|
|||
<Spin spinning={false}> |
|||
<div className='protable-transpor'> |
|||
<ProTable |
|||
scroll={{ x: 800 }} |
|||
options={false} |
|||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|||
rowKey='id' |
|||
form={{ |
|||
submitter: false, |
|||
}} |
|||
columns={columns} |
|||
dataSource={counts || []} |
|||
request={async (params) => { |
|||
const query = { |
|||
limit: params.pageSize, |
|||
offset: ((params.current ? params.current : 1) - 1) * params.pageSize |
|||
} |
|||
setRowSelected([]); |
|||
}} |
|||
> |
|||
</ProTable></div> |
|||
</Spin > |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
|
|||
const { auth, depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(promotionalTable); |
@ -1,31 +0,0 @@ |
|||
.protable-transpor { |
|||
.ant-table-cell-fix-left { |
|||
background-color: #ffffff !important; |
|||
} |
|||
|
|||
.ant-table-cell-fix-right { |
|||
background-color: #ffffff !important; |
|||
} |
|||
|
|||
} |
|||
|
|||
.list-row-actived { |
|||
background-color: #e2f6ff; |
|||
font-weight: 600; |
|||
color: #1E80FF |
|||
} |
|||
|
|||
|
|||
.ant-divider { |
|||
width: 0px; |
|||
height: 8px; |
|||
border-left: 1px solid gray; |
|||
margin: 0px 8px; |
|||
opacity: 0.8; |
|||
} |
|||
|
|||
.card-protable { |
|||
display: flex; |
|||
flex-direction: row; |
|||
width: 100%; |
|||
} |
File diff suppressed because it is too large
@ -1,152 +0,0 @@ |
|||
import React, { useState, useEffect, useRef } from 'react'; |
|||
import { Modal, Form, Input, Select, Button } from 'antd'; |
|||
import { connect } from 'react-redux'; |
|||
import { getRoadway } from '../../actions/infor' |
|||
import { getUserList } from '../../actions/patrol'; |
|||
import { editTask } from '../../actions/task'; |
|||
|
|||
const AddModal = (props) => { |
|||
const { dispatch, recordRow, visible, onClose, user, lookVal } = props |
|||
const { TextArea } = Input |
|||
const [form] = Form.useForm() |
|||
const [inputVal, setIputVal] = useState(undefined) |
|||
const [selectVal, setSelectVal] = useState('') |
|||
const [roadRes, setRoadRes] = useState([])//路线列表
|
|||
const [userList, setUserList] = useState([])//用户列表
|
|||
useEffect(async () => { |
|||
const res = await dispatch(getUserList()) |
|||
setUserList(res?.payload.data) |
|||
}, [true]) |
|||
|
|||
const onChange = () => { |
|||
form.resetFields(['code'])//清空具体某个表单的值
|
|||
} |
|||
useEffect(() => { |
|||
form.setFieldsValue(recordRow ? { 'name': recordRow?.road.id, 'code': recordRow?.road.id, 'danger': recordRow?.dangerDescription, 'user': recordRow?.user.id } : {}) |
|||
}, [recordRow]) |
|||
useEffect(async () => { |
|||
const res = await dispatch(getRoadway({})) |
|||
setRoadRes(res?.payload.data) |
|||
}, []) |
|||
//新增和修改
|
|||
const handleSaveUpdate = () => { |
|||
form.validateFields().then((values) => { |
|||
//console.log('values', recordRow)
|
|||
//console.log('values', values)
|
|||
const val = { |
|||
dangerDescription: values.danger, |
|||
userId: values.user, |
|||
routeId: values.name, |
|||
id: recordRow?.id |
|||
} |
|||
dispatch(editTask(val)).then(res => { |
|||
if (res.success) { |
|||
onClose() |
|||
form.resetFields() |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
return ( |
|||
<Modal visible={visible} |
|||
title={lookVal ? '查看' : recordRow ? '编辑任务' : '新增数据'} |
|||
onCancel={() => { |
|||
onClose() |
|||
form.resetFields()//清空所有个表单的值
|
|||
setSelectVal('')//置空路线代码的选择
|
|||
}} |
|||
onOk={ |
|||
handleSaveUpdate |
|||
} |
|||
footer={ |
|||
lookVal ? null : [ |
|||
<Button onClick={() => { onClose(); form.resetFields(); setSelectVal('') }}>取消</Button>, |
|||
<Button type='primary' onClick={handleSaveUpdate}>确认</Button> |
|||
] |
|||
} |
|||
> |
|||
<Form form={form}> |
|||
<Form.Item |
|||
label="路线名称" |
|||
name="name" |
|||
//initialValues={recordRow?.road.routeName}
|
|||
rules={[{ required: true, message: '路线名称' }]} > |
|||
<Select |
|||
disabled={lookVal ? true : false} |
|||
allowClear='true' |
|||
showSearch |
|||
placeholder="请输入关键词" |
|||
onChange={(value) => { |
|||
onChange() |
|||
setSelectVal(value) |
|||
}} |
|||
filterOption={(input, option) => |
|||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) |
|||
} |
|||
options={roadRes?.map((item) => ({ |
|||
label: item.routeName, |
|||
value: item.id |
|||
}) |
|||
)} |
|||
/> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="路线代码" |
|||
name="code" |
|||
rules={[{ required: true, message: '路线代码' }]}> |
|||
<Select |
|||
disabled={lookVal ? true : false} |
|||
placeholder="请输入关键词" |
|||
value={selectVal} |
|||
> |
|||
<Select.Option key={selectVal}>{selectVal}</Select.Option> |
|||
</Select> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="隐患说明" |
|||
name="danger" |
|||
rules={[{ required: true, message: '隐患说明' }]}> |
|||
<TextArea disabled={lookVal ? true : false} /> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="责任人" |
|||
name="user" |
|||
rules={[{ required: true, message: '责任人' }]}> |
|||
<Select |
|||
disabled={lookVal ? true : false} |
|||
allowClear='true' |
|||
showSearch |
|||
placeholder="请输入负责人" |
|||
options={userList?.map((item) => ({ |
|||
label: item.name, |
|||
value: item.id |
|||
}) |
|||
)} |
|||
/> |
|||
</Form.Item> |
|||
{lookVal ? <Form.Item |
|||
label="下发时间" |
|||
name="issuanceTime" |
|||
> |
|||
<Input disabled={lookVal ? true : false} /> |
|||
</Form.Item> : ''} |
|||
{lookVal ? <Form.Item |
|||
label="图片说明" |
|||
name="picture" |
|||
> |
|||
<Input disabled={lookVal ? true : false} /> |
|||
</Form.Item> : ''} |
|||
</Form> |
|||
</Modal > |
|||
|
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(AddModal) |
File diff suppressed because it is too large
@ -1,327 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import React, { Component } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Upload, message, Modal, Card, Button } from 'antd'; |
|||
import moment from 'moment'; |
|||
import { PlusOutlined, UploadOutlined, CloseOutlined } from '@ant-design/icons'; |
|||
|
|||
class Uploads extends Component { |
|||
constructor(props) { |
|||
super(props); |
|||
this.ApiRoot = localStorage.getItem('tyApiRoot') |
|||
this.state = { |
|||
fileUploading: false, |
|||
fileList: [], |
|||
curPreviewPic: '', |
|||
delPicIng: false, |
|||
removeFilesList: [] |
|||
}; |
|||
} |
|||
dealName = (uploaded) => { |
|||
|
|||
let realName = uploaded.split('/')[2] |
|||
let x1 = realName.split('.') |
|||
let x2 = x1[0].split('_') |
|||
let showName = `${x2[0]}.${x1[1]}` |
|||
return showName |
|||
} |
|||
|
|||
setFileList = (value) => { |
|||
let defaultFileList = []; |
|||
defaultFileList = value.map((u, index) => { |
|||
// let fileUrl = `${this.ApiRoot}/${u.url}`;
|
|||
let fileUrl = `${u.url}`; |
|||
return { |
|||
uid: -index - 1, |
|||
name: this.dealName(u.url), |
|||
status: 'done', |
|||
storageUrl: u.url, |
|||
url: fileUrl |
|||
}; |
|||
}); |
|||
// onChange(defaultFileList)
|
|||
this.setState({ |
|||
fileList: defaultFileList |
|||
}); |
|||
}; |
|||
|
|||
componentDidMount () { |
|||
const { value } = this.props; |
|||
if (value) { |
|||
this.setFileList(value); |
|||
} |
|||
} |
|||
|
|||
componentWillReceiveProps (np) { |
|||
const { dispatch, value: thisEditData, onChange } = this.props; |
|||
const { value: nextEditData, clearFileList } = np; |
|||
console.log(nextEditData,'哈哈哈哈') |
|||
|
|||
const setFileList = () => { |
|||
let defaultFileList = []; |
|||
defaultFileList = nextEditData.map((u, index) => { |
|||
// let fileUrl = `${this.ApiRoot}/${u.storageUrl}`;
|
|||
let fileUrl = `${u.url}`; |
|||
return { |
|||
uid: -index - 1, |
|||
name: this.dealName(u.storageUrl), |
|||
status: 'done', |
|||
storageUrl: u.storageUrl, |
|||
url: fileUrl, |
|||
size: u.size || -1 |
|||
}; |
|||
}); |
|||
this.setState({ |
|||
fileList: defaultFileList |
|||
}); |
|||
}; |
|||
if (nextEditData && nextEditData.length) { |
|||
if (!thisEditData || !this.state.fileList.length) { |
|||
setFileList(); |
|||
} else if (nextEditData.length != thisEditData.length) { |
|||
setFileList(); |
|||
} else { |
|||
let repeat = true; |
|||
for (let i = 0; i < thisEditData.length; i++) { |
|||
if (thisEditData[i] != nextEditData[i]) { |
|||
repeat = false; |
|||
break; |
|||
} |
|||
} |
|||
if (!repeat) { |
|||
setFileList(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
if (clearFileList) { |
|||
this.setState({ |
|||
fileList: [] |
|||
}); |
|||
} |
|||
|
|||
|
|||
// else{
|
|||
// this.setState({
|
|||
// fileList:[],
|
|||
// })
|
|||
// }
|
|||
} |
|||
|
|||
render () { |
|||
const UploadPath = { |
|||
project: ['txt', 'dwg', 'doc', 'docx', 'xls', 'xlsx', 'pdf', 'png', 'jpg', 'rar', 'zip'], |
|||
report: ['doc', 'docx', 'xls', 'xlsx', 'pdf'], |
|||
data: ['txt', 'xls', 'xlsx'], |
|||
image: ['png', 'jpg', 'svg', 'jpeg'], |
|||
three: ['js'], |
|||
video: ['mp4'] |
|||
}; |
|||
/** |
|||
* uploadType 【string】 主要区别文件上传路径 以及类型 以 web/routes/attachment/index.js 中 UploadPath 的 key 值为准;默认 project; |
|||
* disabled 【boolean】 上传是否可用 |
|||
* maxFilesNum 【number】 最大上传数量 |
|||
* fileTypes 【array[string]】 可允许上传的文件类型; |
|||
* maxFileSize 【number】 单个文件最大大小 M |
|||
* listType 【antd】 upload 组件的属性 |
|||
* onChange 【function】 文件数量变化时候回调 返回文件 |
|||
* value 【array[obj]】 编辑数据 [{url:'xxx', [size:999]}] |
|||
* onStateChange 【function】 文件状态改变回调函数 上传中 return { uploading:true/false } |
|||
*/ |
|||
const { |
|||
uploadType, |
|||
disabled, |
|||
maxFilesNum, |
|||
fileTypes, |
|||
maxFileSize, |
|||
listType, |
|||
onChange, |
|||
value, |
|||
showUploadList, |
|||
onStateChange |
|||
} = this.props; |
|||
const { fileList, curPreviewPic, delPicIng, removeFilesList } = this.state; |
|||
const that = this; |
|||
let uploadType_ = uploadType || 'project'; |
|||
let maxFilesNum_ = maxFilesNum || 1; |
|||
let defaultFileTypes = fileTypes || UploadPath[uploadType_]; |
|||
const uploadProps = { |
|||
name: 'checkFile_', |
|||
multiple: false, |
|||
showUploadList: showUploadList || true, |
|||
action: `${this.ApiRoot}/attachments/${uploadType_}`, |
|||
listType: listType || 'text', |
|||
disabled: disabled, |
|||
beforeUpload: (file) => { |
|||
if (fileList.length >= maxFilesNum_) { |
|||
message.warning(`最多选择${maxFilesNum_}个文件上传`); |
|||
return false; |
|||
} |
|||
if (file.name.length > 60) { |
|||
message.warning(`文件名过长(大于60字符),请修改后上传`); |
|||
return false; |
|||
} |
|||
const extNames = file.name.split('.'); |
|||
var reg = /^[\.\s\u4e00-\u9fa5a-zA-Z0-9_-]{0,}$/; |
|||
if (!reg.exec(file.name)) { |
|||
message.warning(`文件名包含除字母、汉字、数字、中划线、下划线之外的字符,请修改后上传`); |
|||
return false; |
|||
} |
|||
let isDAE = false; |
|||
if (extNames.length > 0) { |
|||
let fileType = extNames[extNames.length - 1].toLowerCase(); |
|||
isDAE = defaultFileTypes.some((f) => f == fileType); |
|||
} |
|||
if (!isDAE) { |
|||
message.error(`只能上传 ${defaultFileTypes.join()} 格式的文件!`); |
|||
return false; |
|||
} |
|||
const isLt = file.size / 1024 / 1024 < (maxFileSize || 3); |
|||
if (!isLt) { |
|||
message.error(`文件必须小于${maxFileSize || 3}MB!`); |
|||
return false; |
|||
} |
|||
this.setState({ |
|||
fileUploading: true |
|||
}); |
|||
if (onStateChange) { |
|||
onStateChange({ uploading: true }); |
|||
} |
|||
}, |
|||
onChange (info) { |
|||
const status = info.file.status; |
|||
if (status === 'uploading') { |
|||
that.setState({ |
|||
fileList: info.fileList |
|||
}); |
|||
} |
|||
if (status === 'done') { |
|||
let { uploaded, url } = info.file.response; |
|||
let size = info.file.size; |
|||
let nextFileList = fileList; |
|||
nextFileList[nextFileList.length - 1] = { |
|||
uid: -moment().unix(), |
|||
name: that.dealName(uploaded), |
|||
status: 'done', |
|||
storageUrl: uploaded, |
|||
url: url, |
|||
size: size |
|||
}; |
|||
onChange(nextFileList); |
|||
that.setState({ |
|||
fileUploading: false, |
|||
fileList: nextFileList |
|||
}); |
|||
if (onStateChange) { |
|||
onStateChange({ uploading: false }); |
|||
} |
|||
} else if (status === 'error') { |
|||
that.setState({ |
|||
fileUploading: false |
|||
}); |
|||
message.error(`${info.file.name} 上传失败,请重试`); |
|||
if (onStateChange) { |
|||
onStateChange({ uploading: false }); |
|||
} |
|||
} |
|||
}, |
|||
onRemove (file) { |
|||
let nextFileList = []; |
|||
fileList.map((f, i) => { |
|||
if (f.uid != file.uid) { |
|||
nextFileList.push(f); |
|||
} |
|||
}); |
|||
let nextRemoveFiles = removeFilesList.concat([file.storageUrl]); |
|||
if (curPreviewPic == file.url) { |
|||
that.setState({ |
|||
curPreviewPic: '' |
|||
}); |
|||
} |
|||
onChange(nextFileList); |
|||
that.setState({ |
|||
fileList: nextFileList, |
|||
removeFilesList: nextRemoveFiles |
|||
}); |
|||
}, |
|||
onPreview (file) { |
|||
let filePostfix = file.url.split('.').pop(); |
|||
filePostfix = filePostfix.toLowerCase(); |
|||
if (UploadPath.image.some((img) => img == filePostfix)) { |
|||
that.setState({ |
|||
curPreviewPic: file.url |
|||
}); |
|||
} else { |
|||
message.warn('仅支持图片预览'); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
let fileList_ = fileList |
|||
// .map(f => {
|
|||
// if (f.storageUrl) {
|
|||
// let realName = f.storageUrl.split('/').pop()
|
|||
// if (f.name != realName) {
|
|||
// f.name = realName
|
|||
// }
|
|||
// }
|
|||
// return f
|
|||
// })
|
|||
|
|||
return ( |
|||
<div> |
|||
<Spin spinning={delPicIng}> |
|||
<Upload {...uploadProps} fileList={fileList_}> |
|||
{ |
|||
disabled ? ( |
|||
'' |
|||
) : |
|||
listType == 'picture-card' ? |
|||
( |
|||
fileList.length >= maxFilesNum_ ? null : ( |
|||
<div style={{}}> |
|||
<PlusOutlined /> |
|||
<div>上传图片</div> |
|||
</div> |
|||
) |
|||
) : ( |
|||
<Button disabled={fileList.length >= maxFilesNum_} icon={<UploadOutlined />}> 文件上传 </Button> |
|||
) |
|||
} |
|||
</Upload> |
|||
{ |
|||
curPreviewPic ? ( |
|||
<Card |
|||
bodyStyle={{ |
|||
padding: 8 |
|||
}} |
|||
> |
|||
<div style={{ marginBottom: 8 }} > |
|||
<span>文件预览</span> |
|||
<span |
|||
style={{ float: 'right' }} |
|||
onClick={() => { this.setState({ curPreviewPic: '' }); }} |
|||
> |
|||
<CloseOutlined style={{ fontSize: 20 }} /> |
|||
</span> |
|||
</div> |
|||
<img style={{ width: '100%' }} src={curPreviewPic}></img> |
|||
</Card> |
|||
) : '' |
|||
} |
|||
</Spin> |
|||
</div> |
|||
); |
|||
} |
|||
} |
|||
|
|||
function mapStateToProps (state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user |
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(Uploads); |
@ -1,215 +0,0 @@ |
|||
|
|||
import { connect } from 'react-redux'; |
|||
import './protable.less' |
|||
import { Card, Button, Popconfirm, Badge,Col, Row } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
// import { Badge, Button } from 'antd';
|
|||
import React, { useEffect, useState } from 'react'; |
|||
// @ts-ignore
|
|||
import styles from './protable.less'; |
|||
const DetailList = (props) => { |
|||
const { ip } = props; |
|||
const [tableListDataSource, setTableListDataSource] = useState([]); |
|||
|
|||
const columns= [ |
|||
{ |
|||
title: '视频', |
|||
key: 'createdAt', |
|||
dataIndex: 'createdAt', |
|||
valueType: 'dateTime', |
|||
render: (dom, record) => { |
|||
return <Row> |
|||
<Col span={8}></Col> |
|||
<Col span={8}>col-8</Col> |
|||
<Col span={8}>col-8</Col> |
|||
</Row> |
|||
}, |
|||
}, |
|||
]; |
|||
useEffect(() => { |
|||
const source = []; |
|||
for (let i = 0; i < 15; i += 1) { |
|||
source.push({ |
|||
createdAt: Date.now() - Math.floor(Math.random() * 10000), |
|||
code: `const getData = async params => {
|
|||
const data = await getData(params); |
|||
return { list: data.data, ...data }; |
|||
};`,
|
|||
key: i, |
|||
}); |
|||
} |
|||
setTableListDataSource(source); |
|||
}, [ip]); |
|||
return ( |
|||
<ProTable |
|||
columns={columns} |
|||
dataSource={tableListDataSource} |
|||
pagination={{ |
|||
pageSize: 3, |
|||
showSizeChanger: false, |
|||
}} |
|||
rowKey="key" |
|||
toolBarRender={false} |
|||
search={false} |
|||
/> |
|||
); |
|||
}; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
const ipListDataSource= []; |
|||
|
|||
for (let i = 0; i < 10; i += 1) { |
|||
ipListDataSource.push({ |
|||
ip: `106.14.98.1${i}4`, |
|||
cpu: 10, |
|||
mem: 20, |
|||
status: [Math.floor(Math.random() * 10) % 4], |
|||
disk: 30, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
const IPList = (props) => { |
|||
const { onChange, ip } = props; |
|||
|
|||
const columns= [ |
|||
{ |
|||
title: '路段名称', |
|||
key: 'ip', |
|||
dataIndex: 'ip', |
|||
render: (_, item) => { |
|||
console.log(item.ip) |
|||
return <Badge status={item.status} text={item.ip} />; |
|||
}, |
|||
}, |
|||
|
|||
]; |
|||
return ( |
|||
<div className='spilce'> |
|||
<ProTable |
|||
columns={columns} |
|||
request={(params, sorter, filter) => { |
|||
// 表单搜索项会从 params 传入,传递给后端接口。
|
|||
console.log(params, sorter, filter); |
|||
return Promise.resolve({ |
|||
data: ipListDataSource, |
|||
success: true, |
|||
}); |
|||
}} |
|||
rowKey="ip" |
|||
rowClassName={(record) => { |
|||
return record.ip === ip ? styles['split-row-select-active'] : ''; |
|||
}} |
|||
toolbar={{ |
|||
search: { |
|||
onSearch: (value) => { |
|||
alert(value); |
|||
}, |
|||
}, |
|||
}} |
|||
options={false} |
|||
pagination={false} |
|||
search={false} |
|||
onRow={(record) => { |
|||
return { |
|||
onClick: () => { |
|||
if (record.ip) { |
|||
onChange(record.ip); |
|||
} |
|||
}, |
|||
}; |
|||
}} |
|||
/></div> |
|||
|
|||
); |
|||
}; |
|||
|
|||
|
|||
|
|||
const videoTable = () => { |
|||
const [ip, setIp] = useState('0.0.0.0'); |
|||
const tabList = [ |
|||
{ |
|||
key: 'tab1', |
|||
tab: '公交', |
|||
}, |
|||
{ |
|||
key: 'tab2', |
|||
tab: '路段', |
|||
}, |
|||
]; |
|||
const contentList= { |
|||
tab1: [<div className='card-protable'> |
|||
<Card > |
|||
<IPList onChange={(cIp) => setIp(cIp)} ip={ip} /> |
|||
</Card> |
|||
<Card style={{flex:1}}> |
|||
<DetailList ip={ip} /> |
|||
</Card> |
|||
</div>], |
|||
tab2: [<div className='card-protable'> |
|||
<Card > |
|||
<IPList onChange={(cIp) => setIp(cIp)} ip={ip} /> |
|||
</Card> |
|||
<Card style={{flex:1}}> |
|||
|
|||
<DetailList ip={ip} /> |
|||
</Card> |
|||
</div>] |
|||
}; |
|||
const [activeTabKey1, setActiveTabKey1] = useState('tab1'); |
|||
const [activeTabKey2, setActiveTabKey2] = useState('app'); |
|||
const onTab1Change = (key) => { |
|||
setActiveTabKey1(key); |
|||
}; |
|||
|
|||
const onTab2Change = (key) => { |
|||
setActiveTabKey2(key); |
|||
}; |
|||
return ( |
|||
<> |
|||
<Card |
|||
style={{ |
|||
width: '100%', |
|||
}} |
|||
tabList={tabList} |
|||
activeTabKey={activeTabKey1} |
|||
onTabChange={(key) => { |
|||
onTab1Change(key); |
|||
}} |
|||
> |
|||
{contentList[activeTabKey1]} |
|||
</Card> |
|||
|
|||
</> |
|||
|
|||
); |
|||
}; |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(videoTable); |
@ -1,169 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import AssessModal from '../components/assessModal'; |
|||
import { Form, Space, DatePicker, Button, Select, Popconfirm } from 'antd' |
|||
import moment from 'moment'; |
|||
|
|||
export const unitList = [ |
|||
'县道', |
|||
'蒋巷镇', |
|||
'三江镇', |
|||
'塔城乡', |
|||
'泾口乡', |
|||
'八一乡', |
|||
'冈上镇', |
|||
'南新乡', |
|||
'富山乡', |
|||
'莲塘镇', |
|||
'金湖管理处', |
|||
'武阳镇', |
|||
'向塘镇', |
|||
'幽兰镇', |
|||
'广福镇', |
|||
'塘南镇', |
|||
'银三角管委会', |
|||
'黄马乡', |
|||
] |
|||
function Assess(props) { |
|||
const { dispatch, assess, user } = props; |
|||
const [assessModalVisible, setAssessModalVisible] = useState(false); |
|||
const [editData, setEditData] = useState(null); |
|||
const [query, setQuery] = useState({ page: 1, pageSize: 10 }) |
|||
const [loading, setLoading] = useState(false); |
|||
const [isCheck, setIsCheck] = useState(false) |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '') |
|||
useEffect(() => { |
|||
return () => { }; |
|||
}, []); |
|||
|
|||
useEffect(() => { |
|||
getData() |
|||
}, [query]) |
|||
|
|||
const getData = () => { |
|||
setLoading(true) |
|||
dispatch(getAssess(query)).then(res => { |
|||
setLoading(false) |
|||
}) |
|||
} |
|||
|
|||
return ( |
|||
<div> |
|||
<div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}> |
|||
<Form layout="inline" onFinish={(v) => { |
|||
setQuery({ ...query, unit: v.unit, month: v.month ? moment(v.month).format() : undefined }) |
|||
}}> |
|||
<Form.Item name="unit" label="责任单位" > |
|||
<Select style={{ width: 200 }} placeholder="全部" allowClear> |
|||
{ |
|||
unitList.map(item => ( |
|||
<Option value={item} key={item} /> |
|||
)) |
|||
} |
|||
</Select> |
|||
</Form.Item> |
|||
|
|||
<Form.Item name="month" label="考核月份"> |
|||
<DatePicker picker="month" style={{ width: 200 }} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item> |
|||
<Button type="primary" htmlType="submit">搜索</Button> |
|||
</Form.Item> |
|||
</Form> |
|||
|
|||
<Button type="primary" disabled={editAble} |
|||
onClick={() => { |
|||
setAssessModalVisible(true) |
|||
}}>新增</Button> |
|||
</div> |
|||
<ProTable |
|||
columns={[{ |
|||
title: '责任单位', |
|||
dataIndex: 'unit', |
|||
key: 'unit', |
|||
}, |
|||
{ |
|||
title: '考核月份', |
|||
dataIndex: 'month', |
|||
key: 'month', |
|||
render: (text, record) => ( |
|||
text ? moment(record.month).format('YYYY-MM') : '' |
|||
) |
|||
}, |
|||
{ |
|||
title: '考核得分', |
|||
dataIndex: 'totalPoints', |
|||
key: 'totalPoints', |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
key: 'action', |
|||
render: (text, record) => ( |
|||
<span> |
|||
<Button type="link" onClick={() => { |
|||
setAssessModalVisible(true) |
|||
setEditData(record) |
|||
setIsCheck(true) |
|||
}}>详情</Button> |
|||
<Button type="link" onClick={() => { |
|||
setAssessModalVisible(true) |
|||
setEditData(record) |
|||
disabled = { editAble } |
|||
}}>编辑</Button> |
|||
<Popconfirm |
|||
title="确定删除此条数据吗?" |
|||
onConfirm={() => { |
|||
setLoading(true) |
|||
dispatch(delAssess({ id: record.id })).then(res => { |
|||
setLoading(false) |
|||
if (res.success) { |
|||
getData() |
|||
} |
|||
}) |
|||
}} |
|||
> |
|||
<Button type="link" danger disabled={editAble}>删除</Button> |
|||
</Popconfirm> |
|||
</span> |
|||
), |
|||
},]} |
|||
dataSource={assess.rows || []} |
|||
loading={loading} |
|||
pagination={{ |
|||
total: assess?.count || 0, |
|||
pageSize: 10, |
|||
defaultPageSize: 10, |
|||
showSizeChanger: false, |
|||
onChange: (page, pageSize) => { |
|||
setQuery({ |
|||
...query, |
|||
page, limit: pageSize |
|||
}) |
|||
} |
|||
}} |
|||
rowKey="key" |
|||
toolBarRender={false} |
|||
search={false} |
|||
/> |
|||
{ |
|||
assessModalVisible ? <AssessModal check={isCheck} visible={assessModalVisible} editData={editData} onCancel={() => { |
|||
getData() |
|||
setIsCheck(false) |
|||
setEditData(null) |
|||
setAssessModalVisible(false) |
|||
}} /> : '' |
|||
} |
|||
</div> |
|||
); |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, assess } = state |
|||
return { |
|||
user: auth.user, |
|||
assess: assess.data || [], |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Assess); |
@ -1,38 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import BridgeTable from '../components/bridgeTable'; |
|||
const superagent = require('superagent'); |
|||
const bridge = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
const exports = (ids, differentiate) => { |
|||
let idas = ids.toString() |
|||
if (differentiate == 'bridge') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
}if(differentiate=='project'){ |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
} |
|||
|
|||
|
|||
} |
|||
return ( |
|||
<> <BridgeTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(bridge); |
@ -1,38 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import BuildingTable from '../components/buildingTable'; |
|||
const superagent = require('superagent'); |
|||
const building = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
const exports = (ids, differentiate) => { |
|||
//console.log('sssss1', ids, differentiate)
|
|||
let idas = ids.toString() |
|||
if (differentiate == 'bridge') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
} if (differentiate == 'project') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
} |
|||
|
|||
|
|||
} |
|||
return ( |
|||
<> <BuildingTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(building); |
@ -1,42 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import EnforceTable from '../components/enforceTable'; |
|||
const superagent = require('superagent'); |
|||
const enforce = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
//批量导出
|
|||
const exports = (ids, counts) => { |
|||
// console.log(user);
|
|||
let reportIds = []; |
|||
if (ids.length) |
|||
reportIds = ids |
|||
else |
|||
reportIds = (counts || {}).ids || []; |
|||
superagent.post('/_report/http') |
|||
.send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { |
|||
const resTextIs = res.text.split('/').pop() |
|||
window.open( |
|||
'/_api/' + |
|||
`attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) |
|||
}) |
|||
} |
|||
return ( |
|||
<> <EnforceTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(enforce); |
@ -1,40 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { queryFileDir } from '../actions/file'; |
|||
import FileTable from '../components/fileTable'; |
|||
const superagent = require('superagent'); |
|||
const patrol = (props) => { |
|||
const { dispatch, user } = props |
|||
|
|||
useEffect(() => { |
|||
dispatch(queryFileDir()) |
|||
}, [true]) |
|||
//批量导出
|
|||
const exports = (ids, counts) => { |
|||
let reportIds = []; |
|||
if (ids.length) |
|||
reportIds = ids |
|||
else |
|||
reportIds = (counts || {}).ids || []; |
|||
superagent.post('/_report/http') |
|||
.send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { |
|||
const resTextIs = res.text.split('/').pop() |
|||
window.open( |
|||
'/_api/' + |
|||
`attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) |
|||
}) |
|||
} |
|||
|
|||
return ( |
|||
<> <FileTable exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(patrol); |
@ -1,33 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import HighwaysTable from '../components/highwaysTable'; |
|||
const superagent = require('superagent'); |
|||
const highways = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
const exports = (ids, counts) => { |
|||
//console.log(counts);
|
|||
let idas = ids.toString() |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${'overspeed'}&token=${user.token}`) |
|||
|
|||
} |
|||
return ( |
|||
<> <HighwaysTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(highways); |
@ -1,26 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import Infor from './infor'; |
|||
import transportation from './transportation'; |
|||
import BridgeTable from './bridge'; |
|||
import HigHways from './highways'; |
|||
import OperaTional from './operational'; |
|||
import Enforce from './enforce'; |
|||
import Public from './public'; |
|||
import Videois from './videois'; |
|||
import PromoTional from './promotional'; |
|||
import Maintenance from './maintenance'; |
|||
import Patrol from './patrol'; |
|||
import File from './file'; |
|||
import Jiekouguanli from './jiekouguanli'; |
|||
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, MaintenanceSpotCheck |
|||
}; |
@ -1,46 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import InForTable from '../components/inforTable'; |
|||
const superagent = require('superagent'); |
|||
const infor = (props) => { |
|||
const { dispatch, user} = props |
|||
const [data, setData] = useState() |
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
// //打开弹窗
|
|||
// const openModal = (type, record) => {
|
|||
// setModalVisible(true);
|
|||
// // setModalType(type);
|
|||
// if (type == 'edit') {
|
|||
// setModalRecord(record);
|
|||
// } else {
|
|||
// setModalRecord(null);
|
|||
// }
|
|||
// }
|
|||
//批量导出
|
|||
const exports = (ids,counts) => { |
|||
console.log(counts); |
|||
let idas=ids.toString() |
|||
window.open( |
|||
'/_api/'+`data/export/?ids=${idas||''}&exp=${'overspeed'}&token=${user.token}`) |
|||
|
|||
} |
|||
return ( |
|||
<> <InForTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const {auth}=state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(infor); |
@ -1,9 +0,0 @@ |
|||
import React from 'react' |
|||
|
|||
export default function Jiekouguanli() { |
|||
return ( |
|||
<div> |
|||
<img src='/assets/images/jiekou.png' style={{width:'100%'}}></img> |
|||
</div> |
|||
) |
|||
} |
@ -1,211 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
|||
import { getRoadadministration, addRoadadministration, delRoadadministration, modifyRoadadministration } from '../actions/luzheng'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import AssessModal from '../components/luzhengmodel'; |
|||
import { Form, Space, DatePicker, Button, Select, Popconfirm, Image, Tooltip } from 'antd' |
|||
import moment from 'moment'; |
|||
import { values } from 'lodash'; |
|||
|
|||
export const unitList = [ |
|||
'县道', |
|||
'蒋巷镇', |
|||
'三江镇', |
|||
'塔城乡', |
|||
'泾口乡', |
|||
'八一乡', |
|||
'冈上镇', |
|||
'南新乡', |
|||
'富山乡', |
|||
'莲塘镇', |
|||
'金湖管理处', |
|||
'武阳镇', |
|||
'向塘镇', |
|||
'幽兰镇', |
|||
'广福镇', |
|||
'塘南镇', |
|||
'银三角管委会', |
|||
'黄马乡', |
|||
] |
|||
function Assess(props) { |
|||
const { dispatch, assess, user } = props; |
|||
const [assessModalVisible, setAssessModalVisible] = useState(false); |
|||
const [editData, setEditData] = useState(null); |
|||
const [query, setQuery] = useState({ page: 1, pageSize: 10 }) |
|||
const [loading, setLoading] = useState(false); |
|||
const [isCheck, setIsCheck] = useState(false) |
|||
const [datasource, setdatasource] = useState([]) |
|||
const [dateRange, setDateRange] = useState(['1970-1-1', '2099-12-31']); |
|||
const { RangePicker } = DatePicker |
|||
const [total, settotal] = useState(0) |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '') |
|||
useEffect(() => { |
|||
|
|||
return () => { }; |
|||
}, []); |
|||
|
|||
useEffect(() => { |
|||
getData() |
|||
}, [query]) |
|||
|
|||
const getData = () => { |
|||
setLoading(true) |
|||
console.log(query, 'query') |
|||
dispatch(getRoadadministration({ ...query })).then(res => { |
|||
if (res?.success) { |
|||
setdatasource(res?.payload?.data?.rows) |
|||
settotal(res?.payload?.data?.count) |
|||
setLoading(false) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
return ( |
|||
<div> |
|||
<div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}> |
|||
<Form layout="inline" onFinish={(v) => { |
|||
|
|||
setQuery({ |
|||
...query, page: 1, unit: v.unit, startTime: v?.time && moment(v?.time[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), |
|||
endTime: v?.time && moment(v?.time[1]).add(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss') |
|||
}) |
|||
}}> |
|||
|
|||
|
|||
<Form.Item name="time" label="执行日期"> |
|||
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item> |
|||
<Button type="primary" htmlType="submit">搜索</Button> |
|||
</Form.Item> |
|||
</Form> |
|||
|
|||
<Button type="primary" disabled={editAble} |
|||
onClick={() => { |
|||
setAssessModalVisible(true) |
|||
}}>新增</Button> |
|||
</div> |
|||
<ProTable |
|||
columns={[{ |
|||
title: '执法日期', |
|||
dataIndex: 'enforcementdate', |
|||
key: 'enforcementdate', |
|||
render: (t, r) => { |
|||
return r?.enforcementdate ? moment(r?.enforcementdate).format('YYYY-MM-DD') : '--' |
|||
} |
|||
}, |
|||
{ |
|||
title: '执法道路', |
|||
dataIndex: 'roadname', |
|||
key: 'roadname', |
|||
render: (t, r) => { |
|||
return <Tooltip title={r?.roadname}> |
|||
<span className='shenglve'>{r?.roadname && r?.roadname?.length > 20 ? r?.roadname?.substr(0, 20) + '...' : r?.roadname}</span> |
|||
</Tooltip> |
|||
} |
|||
}, |
|||
{ |
|||
title: '执法成果', |
|||
dataIndex: 'enforcementreslt', |
|||
key: 'enforcementreslt', |
|||
render: (t, r) => { |
|||
return <Tooltip title={r?.enforcementreslt}> |
|||
<span className='shenglve'>{r?.enforcementreslt && r?.enforcementreslt?.length > 20 ? r?.enforcementreslt?.substr(0, 20) + '...' : r?.enforcementreslt}</span> |
|||
</Tooltip> |
|||
} |
|||
}, |
|||
{ |
|||
title: '执法图片', |
|||
dataIndex: 'picfile', |
|||
key: 'picfile', |
|||
render: (t, r) => { |
|||
if (r?.picfile && r?.picfile?.length !== 0) { |
|||
return r?.picfile?.map(i => { |
|||
return <span style={{ marginRight: 10 }}> |
|||
<Image src={i?.url} width={80} /> |
|||
</span> |
|||
}) |
|||
} else { |
|||
return '--' |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
key: 'action', |
|||
render: (text, record) => ( |
|||
<span> |
|||
<Button type="link" onClick={() => { |
|||
setAssessModalVisible(true) |
|||
setEditData(record) |
|||
setIsCheck(true) |
|||
}}>详情</Button> |
|||
<Button type="link" onClick={() => { |
|||
setAssessModalVisible(true) |
|||
setEditData(record) |
|||
|
|||
}} disabled={editAble}>编辑</Button> |
|||
<Popconfirm |
|||
title="确定删除此条数据吗?" |
|||
onConfirm={() => { |
|||
setLoading(true) |
|||
dispatch(delRoadadministration(record.id)).then(res => { |
|||
setLoading(false) |
|||
if (res.success) { |
|||
setQuery({ ...query, page: 1, pageSize: 10, limit: 10 }) |
|||
// getData(page)
|
|||
} |
|||
}) |
|||
}} |
|||
> |
|||
<Button type="link" danger disabled={editAble}>删除</Button> |
|||
</Popconfirm> |
|||
</span> |
|||
), |
|||
},]} |
|||
dataSource={datasource || []} |
|||
loading={loading} |
|||
pagination={{ |
|||
total: total || 0, |
|||
pageSize: 10, |
|||
defaultPageSize: 10, |
|||
showSizeChanger: false, |
|||
onChange: (page, pageSize) => { |
|||
console.log(page, 'page') |
|||
setQuery({ |
|||
...query, |
|||
page, limit: pageSize |
|||
}) |
|||
} |
|||
}} |
|||
rowKey="key" |
|||
toolBarRender={false} |
|||
search={false} |
|||
/> |
|||
{ |
|||
assessModalVisible ? <AssessModal check={isCheck} visible={assessModalVisible} editData={editData} onCancel={() => { |
|||
getData() |
|||
setIsCheck(false) |
|||
setEditData(null) |
|||
setAssessModalVisible(false) |
|||
}} /> : '' |
|||
} |
|||
</div> |
|||
); |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, assess } = state |
|||
return { |
|||
user: auth.user, |
|||
assess: assess.data || [], |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Assess); |
@ -1,41 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import MaintenanceTable from '../components/maintenanceTable'; |
|||
import { getUserList } from '../actions/patrol'; |
|||
const superagent = require('superagent'); |
|||
|
|||
const Maintenance = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
|
|||
useEffect(() => { |
|||
dispatch(getUserList()) |
|||
}, [true]) |
|||
|
|||
//批量导出
|
|||
const exports = (ids, counts) => { |
|||
// console.log(user);
|
|||
let reportIds = ids.toString(); |
|||
window.open( |
|||
'/_api/' + |
|||
`data/export?exp=maintenance&ids=${reportIds}&token=${user.token}`) |
|||
} |
|||
return ( |
|||
<> <MaintenanceTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Maintenance); |
@ -1,668 +0,0 @@ |
|||
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 <div className='maintenanceNew'> |
|||
<Descriptions title="基础信息" bordered style={{ marginBottom: 20 }}> |
|||
<Descriptions.Item label="道路类型">{data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''}</Descriptions.Item> |
|||
<Descriptions.item label="其他">{reportTypeText(data['projectType']) || ''}</Descriptions.item> |
|||
<Descriptions.item label="路线代码">{data['codeRoad'] || ''}</Descriptions.item> |
|||
<Descriptions.item label="路线名称">{data['code'] || ''}</Descriptions.item> |
|||
<Descriptions.item label="养护路段" span={2}>{data['roadSectionStart'] + '-' + data['roadSectionEnd'] || ''}</Descriptions.item> |
|||
<Descriptions.Item label="具体位置" span={3} >{data['address'] || ''}</Descriptions.Item> |
|||
</Descriptions> |
|||
<Descriptions title="道路信息" bordered style={{ marginBottom: 20 }}> |
|||
{roadInfo.map(item => ( |
|||
<Descriptions.Item label={item.key}> |
|||
{data[item.name] || ''} |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="道路信息" bordered style={{ marginBottom: 20 }}> |
|||
{mantenanceInfo.map(item => ( |
|||
<Descriptions.Item label={item.key}> |
|||
{data[item.name] || ''} |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护图片" bordered style={{ marginBottom: 20 }} > |
|||
{mantenancePic.map(item => ( |
|||
<Descriptions.Item label={item.key} span={3} > |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data[item.name]?.map(imgSrc => { |
|||
return <div style={{ width: '50px', margin: 6, display: 'flex' }}> |
|||
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} /> |
|||
</div> |
|||
}) || '暂无图片'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护视频" bordered style={{ marginBottom: 20 }} > |
|||
<Descriptions.Item label={'养护视频'} span={3}> |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data['videoUrl']?.map(videoSrc => { |
|||
return <div style={{ width: '44%', margin: 6, display: 'flex' }}> |
|||
<video src={qndmn + '/' + videoSrc} width={'100%'} style={{ marginBottom: 4 }} controls /> |
|||
</div> |
|||
}) || '暂无视频'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
</Descriptions> |
|||
</div> |
|||
// if (data) {
|
|||
// if (moment(data.time).isAfter(moment('2023-08-03 00:00:00'))) {
|
|||
// 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: '60%' }}
|
|||
// value={
|
|||
// obj.name == 'id' ?
|
|||
// moment(data.time).format("YYYYMMDD") * 10000 + data.id
|
|||
// :
|
|||
// obj.name == 'projectType' ?
|
|||
// reportTypeText(data[obj.name])
|
|||
// : obj.name == 'reportType' && data['codeRoad'] ? data['codeRoad'][0] === 'X' ? '县道'
|
|||
// : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' :
|
|||
// 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: '60%', 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 width={'100%'} style={{ marginBottom: 4 }} >
|
|||
// <source src={qndmn + '/' + videoUrl} type="video/mp4" controls />
|
|||
// </video>
|
|||
// </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 <div className='maintenanceNew'> |
|||
<Descriptions title="养护信息" bordered style={{ marginBottom: 20 }} column={3}> |
|||
<Descriptions.Item label="道路类型">{data['codeRoad'] && data['codeRoad'].length ? data['codeRoad'][0] === 'X' ? '县道' : data['codeRoad'][0] === 'Y' ? '乡道' : '村道' : ''}</Descriptions.Item> |
|||
<Descriptions.item label="养护路段" >{data['roadSectionStart'] && data['roadSectionEnd'] ? (data['roadSectionStart'] + '-' + data['roadSectionEnd']) : ''}</Descriptions.item> |
|||
<Descriptions.item label="路线代码">{data['codeRoad'] || ''}</Descriptions.item> |
|||
{/* <Descriptions.item label="路线名称">{data['code'] || ''}</Descriptions.item> */} |
|||
<Descriptions.Item label="具体位置" span={3} >{data['address'] || ''}</Descriptions.Item> |
|||
<Descriptions.Item label="养护内容" span={3} >{data['content'] || ''}</Descriptions.Item> |
|||
</Descriptions> |
|||
<Descriptions title="养护图片" bordered style={{ marginBottom: 20 }} > |
|||
{mantenancePic.map(item => ( |
|||
<Descriptions.Item label={item.key} className="custom-item" span={3}> |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data[item.name]?.map(imgSrc => { |
|||
return <div style={{ width: '50px', margin: 6, display: 'flex' }}> |
|||
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} /> |
|||
</div> |
|||
}) || '暂无图片'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
))} |
|||
</Descriptions> |
|||
<Descriptions title="养护视频" bordered style={{ marginBottom: 20 }} > |
|||
<Descriptions.Item label={'养护视频'} className="custom-item" > |
|||
<div style={{ width: '70%', display: 'flex', position: 'relative', flexWrap: 'wrap' }}> |
|||
{data['videoUrl']?.map(videoSrc => { |
|||
return <div style={{ width: '44%', margin: 6, display: 'flex' }}> |
|||
<video src={qndmn + '/' + videoSrc} width={'100%'} style={{ marginBottom: 4 }} controls /> |
|||
</div> |
|||
}) || '暂无视频'} |
|||
</div> |
|||
</Descriptions.Item> |
|||
</Descriptions> |
|||
</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 |
|||
width={'60%'} |
|||
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(['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 ( |
|||
<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} |
|||
expandable={{ |
|||
//expandedRowKeys, // 控制哪些行展开,这里需要通过 state 管理
|
|||
defaultExpandedRowKeys: ['0'], |
|||
// onExpand: handleExpand,
|
|||
expandedRowRender: (record) => ( |
|||
< Table |
|||
pagination={false} |
|||
dataSource={record?.reportDetail} |
|||
columns={ |
|||
[ |
|||
{ title: '所属道路', dataIndex: 'road' }, |
|||
{ |
|||
title: '所在路段', |
|||
key: 'address', |
|||
dataIndex: 'address', |
|||
align: 'center', |
|||
render: (_, r) => { |
|||
return `${r?.roadSectionStart || ''}-${r?.roadSectionEnd || ''}` |
|||
} |
|||
}, |
|||
{ title: '具体位置', dataIndex: 'address' }, |
|||
{ |
|||
title: '上报人', |
|||
width: 100, |
|||
key: 'userName', |
|||
dataIndex: 'userName', |
|||
align: 'center', |
|||
render: (text, r) => { |
|||
return r?.user?.name || '' |
|||
} |
|||
}, |
|||
{ |
|||
title: '上报时间', |
|||
key: 'time', |
|||
dataIndex: 'time', |
|||
valueType: 'dateTime', |
|||
align: 'center', |
|||
render: (_, r) => { |
|||
return moment(r?.time).format('YYYY-MM-DD HH:mm:ss') |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
key: 'caozuo', |
|||
align: 'center', |
|||
render: (_, r) => { |
|||
return <Button |
|||
onClick={() => { checkDetail(r); handleOpen() }} |
|||
style={{ marginRight: 10 }}>查看</Button> |
|||
} |
|||
} |
|||
// { title: '', dataIndex: 'subColumn1' },
|
|||
// { title: '', dataIndex: 'subColumn2' },
|
|||
// ... 其他子表格列配置
|
|||
]} |
|||
/> |
|||
), |
|||
}} |
|||
pagination={{ |
|||
pageSize: 10, |
|||
defaultPageSize: 10, |
|||
showSizeChanger: false, |
|||
}} |
|||
rowKey={(record) => { return record.id }} |
|||
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" > |
|||
|
|||
<Button style={{ marginLeft: '200%' }} type='primary' onClick={extractHandler}>开始抽取</Button> |
|||
</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); |
@ -1,38 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import OperaTionalTable from '../components/operationalTable'; |
|||
const superagent = require('superagent'); |
|||
const operational = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
const exports = (ids,differentiate,genre) => { |
|||
let idas=ids.toString() |
|||
if(differentiate=='vehicle'){ |
|||
window.open( |
|||
'/_api/'+`data/export/?ids=${idas||''}&exp=${differentiate}&municipalType=${genre}&token=${user.token}`) |
|||
}if(differentiate=='business'){ |
|||
window.open( |
|||
'/_api/'+`data/export/?ids=${idas||''}&exp=${differentiate}&token=${user.token}`) |
|||
} |
|||
|
|||
|
|||
} |
|||
return ( |
|||
<> <OperaTionalTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(operational); |
@ -1,39 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import { getUserList } from '../actions/patrol'; |
|||
import PatrolTable from '../components/patrolTable'; |
|||
|
|||
const patrol = (props) => { |
|||
const { dispatch, user, location: { pathname } } = props |
|||
|
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
setData(props) |
|||
}, []); |
|||
|
|||
useEffect(() => { |
|||
dispatch(getUserList()) |
|||
}, [true]) |
|||
//批量导出
|
|||
const exports = (ids, reportType) => { |
|||
let reportIds = ids.toString(); |
|||
window.open( |
|||
'/_api/' + |
|||
`data/export?exp=patrol&ids=${reportIds}&token=${user.token}&patrolType=${reportType}`) |
|||
} |
|||
return ( |
|||
<> |
|||
<PatrolTable data={data} exports={exports} pathname={pathname} user={user} /> |
|||
</> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(patrol); |
@ -1,35 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import EnforceTable from '../components/enforceTable'; |
|||
import PromoTionalTable from '../components/promotionalTable'; |
|||
const superagent = require('superagent'); |
|||
const promotional = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
//批量导出
|
|||
const exports = (ids,counts) => { |
|||
console.log(counts); |
|||
let idas=ids.toString() |
|||
window.open( |
|||
'/_api/'+`data/export/?ids=${idas||''}&exp=${'overspeed'}&token=${user.token}`) |
|||
|
|||
} |
|||
return ( |
|||
<> <PromoTionalTable data={data} exports={exports}/> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(promotional); |
@ -1,38 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import PublicTable from '../components/publicTable'; |
|||
const superagent = require('superagent'); |
|||
const Public = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
//批量导出
|
|||
const exports = (ids, rewkeys) => { |
|||
let idas = ids.toString() |
|||
if (rewkeys === 'xianlu') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${'busLine'}&token=${user.token}`) |
|||
} |
|||
if (rewkeys === 'cheliang') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${'busCar'}&token=${user.token}`) |
|||
} |
|||
} |
|||
return ( |
|||
<> <PublicTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Public); |
@ -1,186 +0,0 @@ |
|||
'use strict'; |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Button, Table, Spin, Select, Divider, Popconfirm } from 'antd'; |
|||
import moment from 'moment'; |
|||
import { debounce } from 'lodash' |
|||
import AddModal from '../components/task/addTaskModal'; |
|||
import { getRoadway } from '../actions/infor' |
|||
import { getTask } from '../actions/task' |
|||
import { delTask } from '../actions/task' |
|||
|
|||
const Task = (props) => { |
|||
const { dispatch } = props |
|||
const [addModalVis, setAddModalVis] = useState(false) |
|||
const [roadRes, setRoadRes] = useState([])//路线列表
|
|||
const [selectVal, setSelectVal] = useState('all')//选择框得值
|
|||
const [inputVal, setIputVal] = useState(undefined) |
|||
const [taskRes, setTaskRes] = useState([]) |
|||
const [recordRow, setRecordRow] = useState(null) |
|||
const [lookVal, setLookval] = useState('') |
|||
useEffect(async () => { |
|||
const res = await dispatch(getRoadway({})) |
|||
setRoadRes(res.payload.data) |
|||
}, []) |
|||
|
|||
const getData = async (querySelect = { id: inputVal, isdanger: selectVal === 'all' ? undefined : selectVal === 'y' ? true : false }) => { |
|||
const task = await dispatch(getTask(querySelect)) |
|||
setTaskRes(task.payload?.data) |
|||
} |
|||
useEffect(async () => { |
|||
getData() |
|||
}, []) |
|||
//搜索道路名称
|
|||
const searchRoadName = async (value) => { |
|||
const task = await dispatch(getTask({ id: value, isdanger: selectVal === 'all' ? undefined : selectVal === 'y' ? true : false })) |
|||
setTaskRes(task.payload?.data) |
|||
setIputVal(value) |
|||
} |
|||
//选择安全是否消除
|
|||
const changeSelect = async (value) => { |
|||
//console.log('value', value)
|
|||
const task1 = await dispatch(getTask({ id: inputVal, isdanger: value === 'all' ? undefined : value === 'y' ? true : false })) |
|||
setTaskRes(task1.payload?.data) |
|||
setSelectVal(value) |
|||
} |
|||
//刪除task
|
|||
const delTaskHandler = async (record) => { |
|||
const res = await dispatch(delTask({ id: record.id })) |
|||
if (res.success) { |
|||
getData() |
|||
} |
|||
} |
|||
//查看
|
|||
const look = (record) => { |
|||
setAddModalVis(true) |
|||
setLookval(record) |
|||
setRecordRow(record); |
|||
|
|||
} |
|||
//配置表格列
|
|||
const columns = [{ |
|||
title: '路线名称', |
|||
render: (_, record) => { |
|||
return <div>{record.road.routeName}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '路线代码', |
|||
render: (_, record) => { |
|||
return <div>{record.road.routeCode}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '隐患说明', |
|||
dataIndex: 'dangerDescription', |
|||
//with: 20,
|
|||
// textWrap: 'word-break',
|
|||
// ellipsis: true
|
|||
}, |
|||
{ |
|||
title: '下发时间', |
|||
render: (_, record) => { |
|||
return <div>{record.issuanceTime ? moment(record?.issuanceTime).format('YYYY-MM-DD HH:mm:ss') : ''}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '责任人', |
|||
//with: 20,
|
|||
render: (_, record) => { |
|||
return <div>{record.user.name}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '是否消除隐患', |
|||
render: (_, record) => { |
|||
return <div>{record.isdanger === null ? '' : record.isdanger === 'true' ? '是' : '否'}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '上报时间', |
|||
render: (_, record) => { |
|||
return <div>{record.reportTime ? moment(record.reportTime).format('YYYY-MM-DD HH:mm:ss') : ''}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
render: (dom, record) => { |
|||
return <div> |
|||
{record.reportTime ? '' : <Button type='link' onClick={() => { |
|||
setRecordRow(record); |
|||
setAddModalVis(true) |
|||
}}>编辑</Button>} |
|||
<Popconfirm title='确定要删除吗?' onConfirm={() => { delTaskHandler(record) }}><Button type='link'>刪除</Button></Popconfirm> |
|||
<Button type='link' onClick={() => { look(record) }}>查看</Button> |
|||
</div> |
|||
|
|||
} |
|||
}, |
|||
] |
|||
|
|||
//配置分页
|
|||
const paginationOpt = { |
|||
defaultCurrent: 1, |
|||
defaultPageSize: 5, |
|||
total: taskRes?.count, |
|||
showSizeChanger: true, |
|||
showQuickJumper: true, |
|||
pageSizeOptions: ["5", "10", "15"], |
|||
showTotal: function () { |
|||
return `共有${taskRes?.count}条` |
|||
} |
|||
} |
|||
|
|||
|
|||
return (<div className='taskMenu'> |
|||
<div style={{ display: 'flex', flexWrap: ' nowrap', justifyContent: 'space-between' }}> |
|||
<div style={{ marginLeft: 20 }}> |
|||
路线名称: <Select |
|||
allowClear='true' |
|||
showSearch |
|||
placeholder="请输入关键词" |
|||
//optionFilterProp="children"
|
|||
onChange={(value) => { searchRoadName(value) }} |
|||
//onSearch={(value) => { console.log('11111', value) }}
|
|||
filterOption={(input, option) => |
|||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) |
|||
} |
|||
options={roadRes?.map((item) => ({ |
|||
label: item.routeName, |
|||
value: item.id |
|||
}) |
|||
)} |
|||
/> |
|||
</div> |
|||
<div> |
|||
是否存在安全隐患: <Select placeholder='请输入关键词' |
|||
options={[{ value: 'all', label: '全部' }, { value: 'y', label: '是' }, { value: 'n', label: '否' }]} |
|||
|
|||
onChange={(value) => { changeSelect(value) }}> |
|||
</Select> |
|||
</div> |
|||
<div > |
|||
<Button type='primary' onClick={() => { setRecordRow(null); setAddModalVis(true) }}>新增</Button> |
|||
</div> |
|||
</div> |
|||
<Divider style={{ marginTop: 10 }} /> |
|||
<Table columns={columns} dataSource={taskRes?.rows} size="small" pagination={paginationOpt}> |
|||
</Table> |
|||
<AddModal visible={addModalVis} onClose={() => { setAddModalVis(false); getData(); setRecordRow(null); setLookval(null) }} recordRow={recordRow} |
|||
lookVal={lookVal} |
|||
></AddModal> |
|||
|
|||
</div >) |
|||
|
|||
|
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
//const { task } = state;
|
|||
return { |
|||
|
|||
//isRequesting: task.isRequesting,
|
|||
} |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(Task); |
@ -1,40 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import TransporTationTable from '../components/transportationTable'; |
|||
const superagent = require('superagent'); |
|||
const transportation = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
//批量导出
|
|||
const exports = (ids, grade, differentiate) => { |
|||
//console.log(differentiate);
|
|||
let idas = ids.toString() |
|||
if (differentiate == 'road') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&roadLevel=${grade || ''}&token=${user.token}`) |
|||
} if (differentiate == 'project') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
} |
|||
|
|||
|
|||
} |
|||
return ( |
|||
<> <TransporTationTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(transportation); |
@ -1,30 +0,0 @@ |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import AssessModal from '../components/assessModal'; |
|||
import { Form, Space, DatePicker, Button, Select, Popconfirm } from 'antd' |
|||
import moment from 'moment'; |
|||
|
|||
function VideoCenter (props) { |
|||
const { dispatch, vcmpWebUrl, vcmpMirrorId } = props; |
|||
|
|||
useEffect(() => { |
|||
return () => { }; |
|||
}, []); |
|||
|
|||
return ( |
|||
<div> |
|||
<iframe allowFullScreen src={`${vcmpWebUrl}/callService?mid=${vcmpMirrorId}`} style={{ height: 'calc(100vh - 142px)', width: '100%', display: 'block' }} frameBorder={0}></iframe> |
|||
</div> |
|||
); |
|||
} |
|||
function mapStateToProps (state) { |
|||
const { auth, global } = state |
|||
return { |
|||
user: auth.user, |
|||
vcmpWebUrl: global.vcmpWebUrl, |
|||
vcmpMirrorId: global.vcmpMirrorId, |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(VideoCenter); |
@ -1,243 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Input, Table, Button, Select, message, Popconfirm } from 'antd'; |
|||
// import { getAccidentInfo, createAccidentInfo, deleteAccidentInfo, editAccidentInfo, getAllCompany } from '../actions/device';
|
|||
|
|||
// import EditAccidentModal from '../components/editAccidentModal';
|
|||
import EditGuanlang from '../components/editGuanlang'; |
|||
import '../style.less'; |
|||
import { Func } from '$utils'; |
|||
|
|||
import moment from 'moment'; |
|||
var recordId = null; |
|||
const Guanlang = (props) => { |
|||
const { dispatch, user, totalPage, companys, creditScore } = props |
|||
const [data, setData] = useState([]) |
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [companyName, setCompanyName] = useState(null) |
|||
const [creditCode, setCreditCode] = useState(null) |
|||
const [pageSize, setPageSize] = useState(10); |
|||
const [currentPage, setCurrentPage] = useState(1); |
|||
const [applyStatus, setApplyStatus] = useState(null); |
|||
const [applyState, setApplyState] = useState('check'); // check 查看;create 新增; apply 初审; approve 复审
|
|||
const [editModal, setEditModal] = useState(false); |
|||
const [readOnly, setReadOnly] = useState(false); |
|||
|
|||
const accidentInfo= [] |
|||
// const initial = (params, search = false) => {
|
|||
// dispatch(getAccidentInfo(params)).then(() => { if (search) setCurrentPage(1) })
|
|||
// }
|
|||
|
|||
useEffect(() => { |
|||
const params = { limit: pageSize, offset: currentPage } |
|||
// initial(params)
|
|||
}, [true]) |
|||
|
|||
|
|||
const openModal = (record, state) => { |
|||
if (state == 'check') { |
|||
setReadOnly(true) |
|||
} else { |
|||
setReadOnly(false) |
|||
} |
|||
searchCompany(record.companyName) |
|||
setApplyState(state); |
|||
setModalVisible(true); |
|||
setModalRecord(record); |
|||
} |
|||
const search = () => { |
|||
const params = { company: companyName, applyStatus, limit: pageSize, offset: 1 } |
|||
// initial(params, true)
|
|||
} |
|||
const clearSearch = () => { |
|||
setCompanyName(null) |
|||
setCreditCode(null) |
|||
const params = { limit: pageSize, offset: currentPage } |
|||
// initial(params)
|
|||
} |
|||
const columns = [ |
|||
{ |
|||
title: '序号', |
|||
dataIndex: 'companyName', |
|||
key: 'companyName', |
|||
|
|||
}, |
|||
{ |
|||
title: '设备名称', |
|||
dataIndex: 'accidentTime', |
|||
key: 'accidentTime', |
|||
|
|||
render: (text) => { |
|||
return moment(text).format('YYYY-MM-DD') |
|||
} |
|||
}, |
|||
{ |
|||
title: '设备状态', |
|||
dataIndex: 'stationName', |
|||
key: 'stationName', |
|||
|
|||
render: (v, t) => { |
|||
let list = t.accidentStations.map(item => item.stationName); |
|||
return list.join(','); |
|||
} |
|||
}, |
|||
{ |
|||
title: '接入类型', |
|||
dataIndex: 'stationName', |
|||
key: 'stationName', |
|||
|
|||
render: (v, t) => { |
|||
let list = t.accidentStations.map(item => item.stationName); |
|||
return list.join(','); |
|||
} |
|||
}, |
|||
{ |
|||
title: '设备厂家', |
|||
dataIndex: 'stationName', |
|||
key: 'stationName', |
|||
|
|||
render: (v, t) => { |
|||
let list = t.accidentStations.map(item => item.stationName); |
|||
return list.join(','); |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
render: (record) => { |
|||
return ( |
|||
<span> |
|||
<a onClick={() => openModal(record, 'check')}>查看 </a> |
|||
<a onClick={() => openModal(record, 'edit')}>编辑 </a> |
|||
<Popconfirm |
|||
title="确认删除" |
|||
onConfirm={() => { |
|||
// console.log(record)
|
|||
// dispatch(deleteAccidentInfo(record.id)).then((res) => {
|
|||
// if (res.success) {
|
|||
// message.success('删除记录成功');
|
|||
// search();
|
|||
// }
|
|||
// }
|
|||
// )
|
|||
} |
|||
} |
|||
> |
|||
<a>删除 </a> |
|||
</Popconfirm> |
|||
</span> |
|||
) |
|||
} |
|||
} |
|||
]; |
|||
|
|||
const handleSaveScore = (data) => { |
|||
console.log('执行了') |
|||
setModalVisible(false); |
|||
// if (applyState == 'create')
|
|||
// dispatch(createAccidentInfo(data)).then(res => {
|
|||
// if (res.success) {
|
|||
// message.success('事故资讯添加成功');
|
|||
// setModalVisible(false);
|
|||
// search();
|
|||
// }
|
|||
// })
|
|||
// else if (applyState == 'edit') {
|
|||
// dispatch(editAccidentInfo(data)).then(res => {
|
|||
// if (res.success) {
|
|||
// message.success('事故资讯编辑成功');
|
|||
// setModalVisible(false);
|
|||
// search();
|
|||
// }
|
|||
// })
|
|||
// }
|
|||
} |
|||
var timer = null; |
|||
const searchCompany = (companyName) => { |
|||
if (timer) { |
|||
clearTimeout(timer) |
|||
} else { |
|||
timer = setTimeout(() => { |
|||
// dispatch(getAllCompany({ companyName }));
|
|||
}, 400); |
|||
} |
|||
} |
|||
|
|||
const spanStyle = { diplay: 'inline-block', marginLeft: 10 } |
|||
const inputStyle = { width: 200 } |
|||
return ( |
|||
<div style={{ margin: 5 }}> |
|||
<div style={{ marginBottom: 10 }}> |
|||
<span style={spanStyle}> |
|||
设备搜索: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<span style={{...spanStyle,marginLeft: 40}}> |
|||
接入类型: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<span style={{...spanStyle,marginLeft: 40}}> |
|||
厂家筛选: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<span style={{...spanStyle,marginLeft: 40}}> |
|||
查询状态: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<Button type='primary' onClick={() => search()} style={{ marginLeft: 15 }}>查询</Button> |
|||
<Button onClick={() => { setModalVisible(true); setApplyState('create'); setReadOnly(false); setModalRecord(null) }} style={{ marginLeft: 15 }}>新增</Button> |
|||
</div> |
|||
|
|||
<div> |
|||
<Table |
|||
rowKey='id' |
|||
columns={columns} |
|||
dataSource={accidentInfo} |
|||
pagination={{ |
|||
total: totalPage, |
|||
showSizeChanger: true, |
|||
showQuickJumper: true, |
|||
current: currentPage, |
|||
showTotal: (total) => { |
|||
return <span style={{ fontSize: 15 }}>{`共${Math.ceil(total / pageSize)}页,${total}项`}</span> |
|||
}, |
|||
onShowSizeChange: (currentPage, pageSize) => { |
|||
setCurrentPage(currentPage); |
|||
setPageSize(pageSize); |
|||
const params = { company: companyName, creditCode, limit: pageSize, offset: currentPage } |
|||
// initial(params)
|
|||
}, |
|||
onChange: (page, pageSize) => { |
|||
setCurrentPage(page); |
|||
setPageSize(pageSize); |
|||
const params = { company: companyName, creditCode, limit: pageSize, offset: page } |
|||
// initial(params)
|
|||
} |
|||
}} |
|||
/> |
|||
|
|||
{modalVisible ? <EditGuanlang |
|||
visible={modalVisible} |
|||
onCancel={() => { setModalVisible(false) }} |
|||
handleSaveScore={handleSaveScore} |
|||
// searchCompany={searchCompany}
|
|||
companys={companys} |
|||
editData={modalRecord} |
|||
readOnly={readOnly} |
|||
applyState={applyState} |
|||
></EditGuanlang> : ''} |
|||
</div> |
|||
</div> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, accidentInfo, allCompany } = state |
|||
return { |
|||
// user: auth?.user,
|
|||
// accidentInfo: accidentInfo?.data && accidentInfo?.data.rows || [],
|
|||
// totalPage: accidentInfo.data && accidentInfo.data.count,
|
|||
// companys: allCompany.data && allCompany.data.rows || []
|
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Guanlang); |
|||
|
@ -1,13 +0,0 @@ |
|||
'use strict'; |
|||
import reducers from './reducers'; |
|||
import routes from './routes'; |
|||
import actions from './actions'; |
|||
import { getNavItem } from './nav-item'; |
|||
export default { |
|||
key: 'fillion', |
|||
name: '填报管理', |
|||
reducers: reducers, |
|||
routes: routes, |
|||
actions: actions, |
|||
getNavItem: getNavItem |
|||
}; |
@ -1,115 +0,0 @@ |
|||
import React from 'react'; |
|||
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' |
|||
) |
|||
|
|||
return ( |
|||
user?.username == 'SuperAdmin' || isshow ? |
|||
<SubMenu key="fillion" icon={<ReadOutlined />} title={'数据管理'}> |
|||
{/* {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ? |
|||
<Menu.Item key="fillioninfor"> |
|||
<Link to="/fillion/infor">治超管理</Link> |
|||
</Menu.Item> : ''} */} |
|||
{/* <Menu.Item key="filliontask"> |
|||
<Link to="/fillion/task">任务管理</Link> |
|||
</Menu.Item> */} |
|||
|
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'LUZHENG') ? |
|||
<Menu.Item key="luzheng"> |
|||
<Link to="/fillion/luzheng">路政管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ? |
|||
<Menu.Item key="filliontransportation"> |
|||
<Link to="/fillion/transportation">道路管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BRIDGEMANAGE') ? |
|||
<Menu.Item key="fillionbridge"> |
|||
<Link to="/fillion/bridge">桥梁管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCEMANAGE') ? |
|||
<Menu.Item key="fillionhighways"> |
|||
<Link to="/fillion/highways">管养管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'TRANSPORTATIONMANAGE') ? |
|||
<Menu.Item key="fillionoperational"> |
|||
<Link to="/fillion/operational">运政管理</Link> |
|||
</Menu.Item> : ''} |
|||
{/* <Menu.Item key="fillionenforce"> |
|||
<Link to="/fillion/enforce">执法管理</Link> |
|||
</Menu.Item> */} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'CONSERVATIONMANAGE') ? |
|||
<Menu.Item key="fillionmaintenance"> |
|||
<Link to="/fillion/maintenance">养护管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PATROLMANAGE') ? |
|||
<Menu.Item key="fillionpatrol"> |
|||
<Link to="/fillion/patrol">巡查管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FEEDBACKMANAGE') ? |
|||
<Menu.Item key="fillionpatrolanomaly"> |
|||
<Link to="/fillion/patrol_anomaly">异常反馈</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'REPORTMANAGE') ? |
|||
|
|||
<Menu.Item key="fillionpatrolroad"> |
|||
<Link to="/fillion/patrol_road">建设上报</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BUILDINGPROJECT') ? |
|||
<Menu.Item key="fillionbuilding"> |
|||
<Link to="/fillion/processsing">在建项目</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICTRANSPORTMANAGE') ? |
|||
<Menu.Item key="fillionpublic"> |
|||
<Link to="/fillion/public">公交管理</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FILEMANAGE') ? |
|||
<Menu.Item key="fileCont"> |
|||
<Link to="/fillion/file">档案管理</Link> |
|||
</Menu.Item> : ''} |
|||
{/* <Menu.Item key="fillionvideois"> |
|||
<Link to="/fillion/videois">视频管理</Link> |
|||
</Menu.Item> */} |
|||
{/* <Menu.Item key="jiekouguanli"> |
|||
<Link to="/fillion/jiekouguanli">接口管理</Link> |
|||
</Menu.Item> */} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICITYVIDEO') ? |
|||
<Menu.Item key="fillionpromotional"> |
|||
<Link to="/fillion/promotional">宣传视频</Link> |
|||
</Menu.Item> : ''} |
|||
|
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ASSESSMANAGE') ? |
|||
<Menu.Item key="fillionassess"> |
|||
<Link to="/fillion/assess">考核评分</Link> |
|||
</Menu.Item> : ''} |
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'VIDEOCENTER') ? |
|||
<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 |
|||
); |
|||
} |
@ -1,5 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
export default { |
|||
|
|||
} |
@ -1,197 +0,0 @@ |
|||
'use strict'; |
|||
import { Infor } from './containers'; |
|||
import { transportation } from './containers'; |
|||
import { BridgeTable } from './containers'; |
|||
import { HigHways } from './containers'; |
|||
import { OperaTional } from './containers'; |
|||
import { Enforce } from './containers'; |
|||
import { Public } from './containers'; |
|||
import { Videois } from './containers'; |
|||
import { PromoTional } from './containers'; |
|||
import { Maintenance } from './containers' |
|||
import { Patrol } from './containers' |
|||
import { File } from './containers'; |
|||
import { Jiekouguanli } from './containers' |
|||
import { Task, Assess, VideoCenter, } from './containers' |
|||
import { Building } from './containers' |
|||
import { MaintenanceSpotCheck } 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' |
|||
|
|||
}, |
|||
{ |
|||
path: '/processsing', |
|||
key: 'fillionprocesssing', |
|||
menuSelectKeys: ['fillionprocesssing'], |
|||
component: Building, |
|||
breadcrumb: '在建项目', |
|||
authCode: 'BUILDINGPROJECT' |
|||
|
|||
} |
|||
, { |
|||
path: '/bridge', |
|||
key: 'fillionbridge', |
|||
menuSelectKeys: ['fillionbridge'], |
|||
component: BridgeTable, |
|||
breadcrumb: '桥梁管理', |
|||
authCode: 'BRIDGEMANAGE' |
|||
|
|||
} |
|||
, { |
|||
path: '/highways', |
|||
key: 'fillionhighways', |
|||
menuSelectKeys: ['fillionhighways'], |
|||
component: HigHways, |
|||
breadcrumb: '管养管理', |
|||
authCode: 'MAINTENANCEMANAGE' |
|||
|
|||
}, { |
|||
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: '/patrol_anomaly', |
|||
key: 'fillionpatrolanomaly', |
|||
menuSelectKeys: ['fillionpatrolanomaly'], |
|||
component: Patrol, |
|||
breadcrumb: '异常反馈', |
|||
authCode: 'FEEDBACKMANAGE' |
|||
|
|||
}, { |
|||
path: '/patrol_road', |
|||
key: 'fillionpatrolroad', |
|||
menuSelectKeys: ['fillionpatrolroad'], |
|||
component: Patrol, |
|||
breadcrumb: '建设上报', |
|||
authCode: 'REPORTMANAGE' |
|||
|
|||
}, { |
|||
path: '/public', |
|||
key: 'fillionpublic', |
|||
menuSelectKeys: ['fillionpublic'], |
|||
component: Public, |
|||
breadcrumb: '公交管理', |
|||
authCode: 'PUBLICTRANSPORTMANAGE' |
|||
|
|||
}, |
|||
{ |
|||
path: '/file', |
|||
key: 'fileCont', |
|||
menuSelectKeys: ['fileCont'], |
|||
component: File, |
|||
breadcrumb: '档案管理', |
|||
authCode: 'FILEMANAGE' |
|||
|
|||
}, |
|||
{ |
|||
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: '/maintenanceSpotCheck', |
|||
key: 'maintenanceSpotCheck', |
|||
menuSelectKeys: ['maintenanceSpotCheck'], |
|||
component: MaintenanceSpotCheck, |
|||
breadcrumb: '养护抽查', |
|||
authCode: 'MAINTENANCESPOTCHECK' |
|||
|
|||
} |
|||
] |
|||
} |
|||
}]; |
@ -1,3 +0,0 @@ |
|||
#example:hover { |
|||
font-size: larger; |
|||
} |
@ -1,63 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getAuthority(orgId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_MEMBERS', |
|||
url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`, |
|||
msg: { error: '获取用户列表失败' }, |
|||
reducer: { name: 'members' } |
|||
}); |
|||
} |
|||
export function getResource(userId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_RESOURCE', |
|||
url: `${ApiTable.getResource}`, |
|||
msg: { error: '获取权限失败' }, |
|||
reducer: { name: 'resource' } |
|||
}); |
|||
} |
|||
export function getUserResource(userId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_USER_RESOURCE', |
|||
url: `${ApiTable.getUserResource}?userId=${userId}`, |
|||
msg: { error: '获取用户权限失败' }, |
|||
reducer: { name: 'userResource' } |
|||
}); |
|||
} |
|||
export function postUserRes(body) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
dispatch: dispatch, |
|||
actionType: 'UPDATE_USER_RESOURCE', |
|||
url: `${ApiTable.postUserRes}`, |
|||
data: body, |
|||
msg: { success: '更新用户权限' } |
|||
}); |
|||
} |
|||
|
|||
export function postUserReso(body) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
dispatch: dispatch, |
|||
actionType: 'UPDATE_USER_RESOURCE', |
|||
url: `${ApiTable.postUserReso}`, |
|||
data: body, |
|||
msg: { success: '更新用户权限' } |
|||
}); |
|||
} |
|||
export default { |
|||
getAuthority, |
|||
getResource, |
|||
getUserResource, |
|||
postUserRes, |
|||
postUserReso |
|||
} |
@ -1,11 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import * as authority from './authority' |
|||
import { getDepMessage, getDepUser, createUser } from './user' |
|||
|
|||
export default { |
|||
...authority, |
|||
getDepMessage, |
|||
getDepUser, |
|||
createUser, |
|||
} |
@ -1,123 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getDepMessage() { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_DEPARTMENT_MESSAGE', |
|||
url: ApiTable.getDepMessage, |
|||
msg: { error: '获取部门信息失败' }, |
|||
reducer: { name: 'depMessage' } |
|||
}); |
|||
} |
|||
|
|||
export function getDepById(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query, |
|||
actionType: 'GET_DEP_BY_ID', |
|||
url: ApiTable.getDepById, |
|||
msg: { error: '根据id获取部门失败失败' }, |
|||
reducer: { name: 'depByIdInfo' } |
|||
}); |
|||
} |
|||
|
|||
export function getDepUser(depId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_DEPARTMENT_USER', |
|||
url: ApiTable.getDepUser.replace('{depId}', depId), |
|||
msg: { error: '获取部门下用户信息失败' }, |
|||
reducer: { name: 'depUser' } |
|||
}); |
|||
} |
|||
|
|||
export function createUser(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'CREATE_DEPARTMENT_USER', |
|||
url: ApiTable.createUser, |
|||
msg: { option: '新建用户' }, |
|||
}); |
|||
} |
|||
|
|||
export function updateUser(userId, data) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'UPDATE_DEPARTMENT_USER', |
|||
url: ApiTable.updateUser.replace('{userId}', userId), |
|||
msg: { option: '修改用户' }, |
|||
}); |
|||
} |
|||
|
|||
export function delUser(userIds) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_DEPARTMENT_USER', |
|||
url: ApiTable.delUser.replace('{userIds}', userIds), |
|||
msg: { option: '删除用户' }, |
|||
}); |
|||
} |
|||
|
|||
export function resetPwd(userId, data) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'CREATE_DEPARTMENT_USER', |
|||
url: ApiTable.resetPwd.replace('{userId}', userId), |
|||
msg: { option: '重置用户密码' }, |
|||
}); |
|||
} |
|||
|
|||
export function createDep(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'CREATE_DEPARTMENT', |
|||
url: ApiTable.createDepMessage, |
|||
msg: { option: '新建部门' }, |
|||
}); |
|||
} |
|||
|
|||
export function delDep(depId) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_DEPARTMENT', |
|||
url: ApiTable.delDepMessage.replace('{depId}', depId), |
|||
msg: { option: '删除部门' }, |
|||
}); |
|||
} |
|||
|
|||
export function updateDep(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'UPDATE_DEPARTMENT', |
|||
url: ApiTable.createDepMessage, |
|||
msg: { option: '修改部门' }, |
|||
}); |
|||
} |
|||
export default { |
|||
getDepMessage, |
|||
getDepUser, |
|||
createUser, |
|||
updateUser, |
|||
delUser, |
|||
resetPwd, |
|||
createDep, |
|||
delDep |
|||
} |
@ -1,140 +0,0 @@ |
|||
import React, { useRef, useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Card, Modal, TreeSelect } from 'antd'; |
|||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|||
|
|||
const DepModal = (props) => { |
|||
const { visible, onVisibleChange, onConfirm, depModalType, depData, data } = props |
|||
console.log('data', data) |
|||
const formRef = useRef(); |
|||
const roadCode = [ |
|||
{ title: "莲塘镇", value: "360121100000" }, |
|||
{ title: "向塘镇", value: "360121101000" }, |
|||
{ title: "三江镇", value: "360121102000" }, |
|||
{ title: "塘南镇", value: "360121103000" }, |
|||
{ title: "幽兰镇", value: "360121104000" }, |
|||
{ title: "蒋巷镇", value: "360121105000" }, |
|||
{ title: "武阳镇", value: "360121106000" }, |
|||
{ title: "冈上镇", value: "360121107000" }, |
|||
{ title: "广福镇", value: "360121108000" }, |
|||
//{ title: "昌东镇", value: "360121191000" },
|
|||
//{ title: "麻丘镇", value: "360121192000" },
|
|||
{ title: "泾口乡", value: "360121200000" }, |
|||
{ title: "南新乡", value: "360121201000" }, |
|||
{ title: "塔城乡", value: "360121202000" }, |
|||
{ title: "黄马乡", value: "360121203000" }, |
|||
{ title: "富山乡", value: "360121204000" }, |
|||
//{ title: "东新乡", value: "360121205000" },
|
|||
{ title: "八一乡", value: "360121206000" }, |
|||
//{ title: "小蓝经济开发区", value: "360121403000" },
|
|||
{ title: "银三角管理委员会", value: "360121471000" }, |
|||
// { title: "五星垦殖场", value: "360121501000" },
|
|||
// { title: "良种繁殖场", value: "360121572000" },
|
|||
] |
|||
useEffect(() => { |
|||
//console.log('depData', depData)
|
|||
}, []) |
|||
|
|||
const onFinish = (values) => { |
|||
if (onConfirm) { |
|||
if (depModalType === 'edit') { |
|||
let value = { |
|||
name: values.name, |
|||
depId: data.id, |
|||
dependence: values.dependence, |
|||
areaCode: values.areaCode |
|||
} |
|||
onConfirm(value) |
|||
} else { |
|||
onConfirm(values); |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
<ModalForm |
|||
title={depModalType === 'edit' ? '编辑部门' : '新增部门'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={onFinish} |
|||
formRef={formRef} |
|||
destroyOnClose |
|||
initialValues={depModalType === 'edit' ? data : null} |
|||
> |
|||
<ProFormText |
|||
name={['name']} |
|||
width="md" |
|||
label="部门名称" |
|||
required |
|||
maxLength={10} |
|||
placeholder="请输入部门名称" |
|||
fieldProps={{ |
|||
autocomplete: 'new-password' |
|||
}} |
|||
rules={[ |
|||
{ required: true, message: '请输入部门名称' }, { max: 10, message: '请输入10个字以内的名称' } |
|||
]} |
|||
/> |
|||
<ProFormTreeSelect |
|||
name={['dependence']} |
|||
width="md" |
|||
label="上级部门" |
|||
autocomplete='off' |
|||
placeholder="选择上级部门" |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id', |
|||
children: 'subordinate' |
|||
}} |
|||
request={async () => { |
|||
return depData |
|||
}} |
|||
/> |
|||
<ProFormTreeSelect |
|||
name={['areaCode']} |
|||
width="md" |
|||
label="所属区域" |
|||
autocomplete='off' |
|||
placeholder="选择所属区域" |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id', |
|||
//children: 'subordinate'
|
|||
}} |
|||
request={async () => { |
|||
return roadCode |
|||
}} |
|||
/> |
|||
</ModalForm> |
|||
</Spin> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { depMessage } = state; |
|||
|
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// key: d.id,
|
|||
children: d.subordinate.map(s => { |
|||
return { |
|||
title: s.name, |
|||
value: s.id, |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
loading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(DepModal); |
@ -1,74 +0,0 @@ |
|||
import React, { useRef, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Card, Modal, TreeSelect } from 'antd'; |
|||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|||
|
|||
const ResetPwd = (props) => { |
|||
const { visible, onVisibleChange, onConfirm } = props; |
|||
const formRef = useRef(); |
|||
|
|||
const onFinish = (values) => { |
|||
if (onConfirm) { |
|||
onConfirm(values); |
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
<ModalForm |
|||
title={'重置密码'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={onFinish} |
|||
formRef={formRef} |
|||
destroyOnClose |
|||
> |
|||
<ProFormText.Password |
|||
name={['password']} |
|||
width="md" |
|||
label="新密码" |
|||
required |
|||
placeholder="请输入密码" |
|||
fieldProps={{ |
|||
autocomplete: 'new-password' |
|||
}} |
|||
rules={[ |
|||
{ required: true, message: '请填写密码' }, |
|||
{ min: 6, message: '请填写至少6位密码' }, |
|||
]} |
|||
/> |
|||
<ProFormText.Password |
|||
name={['checkPassword']} |
|||
width="md" |
|||
label="确认密码" |
|||
required |
|||
autocomplete='off' |
|||
placeholder="请输入密码" |
|||
rules={[ |
|||
{ required: true, message: '请再次填写密码' }, |
|||
{ min: 6, message: '请填写至少6位密码' }, |
|||
{ |
|||
validator: (rule, value, callback) => { |
|||
const pwd = formRef.current.getFieldValue('password'); |
|||
if (!value) { |
|||
callback(); |
|||
} |
|||
if (pwd == value) { |
|||
callback(); |
|||
} else { |
|||
callback('两次输入的密码不一致'); |
|||
} |
|||
} |
|||
} |
|||
]} |
|||
/> |
|||
</ModalForm> |
|||
</Spin> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
return {}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(ResetPwd); |
@ -1,119 +0,0 @@ |
|||
import React, { useEffect } from 'react'; |
|||
import { Checkbox, Table } from 'antd'; |
|||
import { useState } from 'react'; |
|||
|
|||
const CheckboxGroup = Checkbox.Group; |
|||
|
|||
const Resource = props => { |
|||
const { roleData, userRole, userSelected, setResCode, userType } = props; |
|||
const [indeterminate, setIndeterminate] = useState({}); |
|||
const [roleCheck, setRoleCheck] = useState({});//一级权限码
|
|||
const [parentRoleCheck, setParentRoleCheck] = useState({}); //二级权限码
|
|||
useEffect(() => { |
|||
const check = {} |
|||
const parentCheck = {} |
|||
const initInd = {} |
|||
roleData && roleData.map && roleData.map(r => { |
|||
let currentInd = false; |
|||
let sum = 0; |
|||
if (r.resources) { |
|||
check[r.code] = [] |
|||
r.resources.map(child => { |
|||
if (userRole.find(code => code.resourceId == child.code)) { |
|||
currentInd = true; |
|||
sum++; |
|||
check[r.code].push(child.code); |
|||
} |
|||
}) |
|||
} |
|||
parentCheck[r.code] = r.resources.length === sum |
|||
initInd[r.code] = parentCheck[r.code] ? false : currentInd |
|||
}); |
|||
setParentRoleCheck(parentCheck) |
|||
setRoleCheck(check); |
|||
setIndeterminate(initInd); |
|||
}, [userRole]); |
|||
|
|||
const setResData = (role) => { |
|||
let codes = []; |
|||
// Object.keys(partRole).map(r => {
|
|||
// if (partRole[r]) codes.push(r)
|
|||
// })
|
|||
Object.keys(role).map(r => { |
|||
if (role[r].length) { |
|||
codes.push(r); |
|||
} |
|||
codes = codes.concat(role[r]) |
|||
}) |
|||
setResCode(codes) |
|||
} |
|||
return ( |
|||
<Table |
|||
bordered |
|||
pagination={false} |
|||
dataSource={roleData} |
|||
columns={[{ |
|||
title: '功能', |
|||
key: 'name', |
|||
dataIndex: 'name', |
|||
render: (text, record) => { |
|||
const parentCode = record.code |
|||
return <Checkbox |
|||
|
|||
indeterminate={indeterminate[parentCode]} |
|||
onChange={(e) => { |
|||
const currentParCheck = JSON.parse(JSON.stringify(parentRoleCheck)); |
|||
currentParCheck[parentCode] = e.target.checked; |
|||
const currentCode = JSON.parse(JSON.stringify(roleCheck)); |
|||
currentCode[parentCode] = e.target.checked ? roleData.find(r => r.code == parentCode).resources.map(r => r.code) : [] |
|||
const currentInd = JSON.parse(JSON.stringify(indeterminate)); |
|||
currentInd[parentCode] = false; |
|||
|
|||
setParentRoleCheck(currentParCheck); |
|||
setRoleCheck(currentCode); |
|||
setIndeterminate(currentInd); |
|||
setResData(currentCode) |
|||
}} |
|||
checked={parentRoleCheck[parentCode] || false} |
|||
disabled={userSelected === "SuperAdmin" || userType === 4} |
|||
options={''} |
|||
> |
|||
{text} |
|||
</Checkbox> |
|||
} |
|||
}, { |
|||
title: '列表', |
|||
key: 'resources', |
|||
dataIndex: 'resources', |
|||
render: (text, record) => { |
|||
let data = []; |
|||
console.log() |
|||
text.map(s => { s.name !== "整治汇总编辑" ? data.push({ label: s.name, value: s.code }) : '' }) |
|||
let parentCode = record.code; |
|||
|
|||
return <CheckboxGroup |
|||
disabled={userSelected === "SuperAdmin" || userType === 4} |
|||
options={data} |
|||
value={roleCheck[parentCode] || []} |
|||
onChange={value => { |
|||
const checkArr = JSON.parse(JSON.stringify(roleCheck)); |
|||
const parentCheck = JSON.parse(JSON.stringify(parentRoleCheck)); |
|||
const ind = JSON.parse(JSON.stringify(indeterminate)); |
|||
const currentCode = roleData.find(r => r.code == parentCode) || {} |
|||
|
|||
checkArr[parentCode] = value; |
|||
ind[parentCode] = !!value.length && value.length < currentCode.resources.length |
|||
parentCheck[parentCode] = value.length === currentCode.resources.length |
|||
|
|||
setRoleCheck(checkArr); |
|||
setIndeterminate(ind); |
|||
setParentRoleCheck(parentCheck); |
|||
setResData(checkArr) |
|||
}} |
|||
/> |
|||
} |
|||
}]} |
|||
></Table > |
|||
) |
|||
} |
|||
export default Resource |
@ -1,206 +0,0 @@ |
|||
import React from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin } from 'antd'; |
|||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|||
|
|||
|
|||
|
|||
const UserModal = (props) => { |
|||
const { visible, modalType, depData, onVisibleChange, onConfirm, editData, depMessagedata } = props |
|||
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 depDatas = pakData(depMessagedata || []) |
|||
const onFinish = (values) => { |
|||
if (onConfirm) { |
|||
onConfirm(values); |
|||
} |
|||
} |
|||
|
|||
|
|||
const checkName = (rule, value, callback) => { |
|||
if (value && value.replace(/[^\u4E00-\u9FA5]/g).includes('undefined')) { |
|||
callback(new Error('请输入中文!')); |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
<ModalForm |
|||
title={modalType == 'edit' ? '编辑用户' : '新建用户'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={onFinish} |
|||
|
|||
destroyOnClose |
|||
initialValues={ |
|||
modalType == 'edit' ? |
|||
{ |
|||
contract: editData |
|||
} : |
|||
{ |
|||
contract: { |
|||
enable: true |
|||
} |
|||
} |
|||
} |
|||
> |
|||
<ProForm.Group> |
|||
<ProFormText |
|||
name={['contract', 'name']} |
|||
width="md" |
|||
label="姓名" |
|||
required |
|||
placeholder="请输入姓名" |
|||
rules={[{ required: true, message: '请输入姓名' }, |
|||
{ max: 5, message: '请输入5个字以内的名称' }, |
|||
{ validator: checkName } |
|||
]} |
|||
/> |
|||
< ProFormText |
|||
name={['contract', 'phone']} |
|||
width="md" |
|||
label="手机号(用户名)" |
|||
required |
|||
fieldProps={{ |
|||
maxLength: 11, |
|||
}} |
|||
getValueFromEvent={(event) => { |
|||
return event.target.value.replace(/\D/g, '') |
|||
}} |
|||
placeholder="请输入手机号(用户名)" |
|||
rules={[ |
|||
{ required: true, valueType: Number, max: 11 }, { pattern: /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/, message: "请输入正确的手机号" } |
|||
]} |
|||
/> |
|||
|
|||
</ProForm.Group> |
|||
<ProForm.Group> |
|||
<ProFormTreeSelect |
|||
name={['contract', 'departmentId']} |
|||
placeholder="请选择所属部门" |
|||
width="md" |
|||
label="所属部门" |
|||
required |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id', |
|||
children: 'subordinate' |
|||
}} |
|||
onSelect={(selectedKeys, { selected, selectedNodes }) => { |
|||
if (selected) { |
|||
setDepSelectedKeys(selectedKeys) |
|||
setDepSelected(selectedNodes[0].name || "") |
|||
dispatch(getDepUser(selectedKeys[0])) |
|||
} |
|||
}} |
|||
fieldProps={{ |
|||
fieldNames: { |
|||
label: 'title', |
|||
}, |
|||
treeDefaultExpandAll: false, |
|||
}} |
|||
rules={[{ required: true, message: '请选择所属部门' }]} |
|||
request={async () => { |
|||
return depDatas |
|||
}} |
|||
expandedKeys={["title"]} |
|||
/> |
|||
{modalType == 'edit' ? null : <ProFormText.Password |
|||
name={['contract', 'password']} |
|||
width="md" |
|||
label="密码" |
|||
required |
|||
placeholder="请输入密码" |
|||
fieldProps={{ |
|||
autocomplete: 'new-password' |
|||
}} |
|||
rules={[ |
|||
{ required: true, message: '请填写密码' }, |
|||
{ min: 6, message: '请填写至少6位密码' }, |
|||
]} |
|||
/>} |
|||
{/* <ProFormText |
|||
name={['contract', 'username']} |
|||
width="md" |
|||
label="职位" |
|||
fieldProps={{ |
|||
maxLength: 30, |
|||
}} |
|||
getValueFromEvent={(event) => { |
|||
return event.target.value |
|||
}} |
|||
placeholder="请输入职位" |
|||
// rules={[
|
|||
// { required: true }
|
|||
// ]}
|
|||
/> */} |
|||
</ProForm.Group> |
|||
<ProForm.Group> |
|||
|
|||
<ProFormText |
|||
name={['contract', 'email']} |
|||
width="md" |
|||
label="邮箱" |
|||
// required
|
|||
placeholder="请输入邮箱" |
|||
rules={[ |
|||
// { required: true, message: '请输入邮箱' },
|
|||
{ type: 'email', message: '请输入正确格式的邮箱' }, |
|||
]} |
|||
/> |
|||
<ProFormSwitch |
|||
name={['contract', 'enable']} |
|||
width="md" |
|||
label="是否启用" |
|||
placeholder="请选择" |
|||
// defaultChecked
|
|||
valuePropName="checked" |
|||
/> |
|||
<ProFormSwitch |
|||
name={['contract', 'isAdmin']} |
|||
width="md" |
|||
label="是否管理员" |
|||
placeholder="请选择" |
|||
// defaultChecked
|
|||
valuePropName="checked" |
|||
/> |
|||
</ProForm.Group> |
|||
</ModalForm> |
|||
</Spin> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { depMessage } = 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, |
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(UserModal); |
@ -1,290 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Row, Col, Card, Button, Tree, Empty, Checkbox } from 'antd'; |
|||
import { getDepMessage, getDepUser } from '../actions/user'; |
|||
import { getResource, getUserResource, postUserRes, postUserReso } from '../actions/authority'; |
|||
import { getDepById } from '../actions/user'; |
|||
|
|||
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 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('全部用户')
|
|||
// }
|
|||
}; |
|||
|
|||
// 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('全部用户')
|
|||
// }
|
|||
|
|||
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])
|
|||
// }
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
}, [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 })) |
|||
} |
|||
|
|||
return ( |
|||
<Spin spinning={loading}> |
|||
<Row gutter={16}> |
|||
<Col span={4} style={{ height: '100%' }}> |
|||
<Card title="部门" bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|||
{ |
|||
depMessagedata.length ? |
|||
<Tree |
|||
height={clientHeight - 100} |
|||
defaultExpandedKeys={[depMessagedata[0].id]} |
|||
selectedKeys={depSelectedKeys} |
|||
onSelect={(selectedKeys, { selected, selectedNodes, node }) => { |
|||
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])) |
|||
|
|||
// setResCode(userResource.map(i=>i.resourceId))
|
|||
|
|||
} |
|||
|
|||
}} |
|||
treeData={depMessagedata} |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id', |
|||
children: 'subordinate' |
|||
}} |
|||
/> : '' |
|||
} |
|||
</Card> |
|||
</Col> |
|||
<Col span={4} style={{ height: '100%', }}> |
|||
<Card title={` 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|||
{ |
|||
depUserCopy?.length ? |
|||
<Tree |
|||
height={clientHeight - 100} |
|||
defaultSelectedKeys={[depUserCopy[0]?.id]} |
|||
selectedKeys={userSelectedKeys} |
|||
onSelect={(selectedKeys, { selected, selectedNodes, node, event }) => { |
|||
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])) |
|||
} |
|||
|
|||
}} |
|||
treeData={depUserCopy} |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id' |
|||
}} |
|||
/> : <Empty /> |
|||
|
|||
// <div>
|
|||
// <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}>
|
|||
// 全选
|
|||
// </Checkbox>
|
|||
|
|||
// <CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}/>
|
|||
// </div> : <Empty />
|
|||
|
|||
} |
|||
</Card> |
|||
</Col> |
|||
<Col span={16} style={{ height: '100%', }}> |
|||
<Checkbox onChange={onshowchange} checked={isshow} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}> |
|||
不可编辑 |
|||
</Checkbox> |
|||
{depUserCopy?.length ? |
|||
<Card title={` 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|||
{/* <Resource |
|||
userSelected={userSelected} |
|||
roleData={resource} |
|||
userRole={userResource} |
|||
setResCode={setResCode} |
|||
userType={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?4:userType} |
|||
/> */} |
|||
<div> |
|||
<Checkbox |
|||
onChange={onresCheckAllChange} |
|||
checked={rescheckAll} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} |
|||
> |
|||
全选 |
|||
</Checkbox> |
|||
<CheckboxGroup |
|||
options={rescodeall} |
|||
value={resCode} |
|||
onChange={onresChange} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} |
|||
/> |
|||
</div> |
|||
<Row type="flex" justify="center" style={{ marginBottom: 16, marginTop: 16, textAlign: 'center' }}> |
|||
<Col span="24"> |
|||
<Button |
|||
disabled={userSelected === "SuperAdmin" || userType === 4} |
|||
onClick={handleSave} |
|||
style={{ width: '60%' }} |
|||
type='primary'>保存修改</Button> |
|||
</Col></Row> |
|||
</Card> |
|||
: <Card title={`[]功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|||
<Empty /> |
|||
</Card> |
|||
} |
|||
</Col> |
|||
</Row> |
|||
</Spin > |
|||
) |
|||
} |
|||
|
|||
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); |
@ -1,7 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
import UserManage from './user'; |
|||
|
|||
|
|||
export { UserManage}; |
@ -1,460 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { DeleteOutlined, EllipsisOutlined, FormOutlined } from '@ant-design/icons'; |
|||
import { Spin, Space, Button, Popconfirm, Row, Col, Tree, Table, Card, Switch, Tooltip, Breadcrumb } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import { getDepById } from '../actions/user'; |
|||
import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../actions/user' |
|||
import { postUserRes } from '../actions/authority' |
|||
import UserModal from '../components/userModal'; |
|||
import ResetPwd from '../components/resetPwd'; |
|||
import DepModal from '../components/depModal'; |
|||
|
|||
const TreeNode = Tree.TreeNode; |
|||
|
|||
const UserManage = (props) => { |
|||
const { dispatch, loading, depMessage, depUser, clientHeight, user, actions } = props |
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalType, setModalType] = useState(); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [pwdModalVisible, setPwdModalVisible] = useState(false); |
|||
const [depSelectedKeys, setDepSelectedKeys] = useState([]) |
|||
const [rowSelected, setRowSelected] = useState([]) |
|||
const [depModalVisible, setDepModalVisible] = useState(false); |
|||
const [depModalType, setDepModalType] = useState(); |
|||
const [depModalRecord, setDepModalRecord] = useState(); |
|||
const [selectedTree, setSelectedTree] = useState(); |
|||
const [depCrumbs, setDepCrumbs] = useState([]); |
|||
const [depUserCopy, setDepUserCopy] = useState([]) |
|||
const [uid, setuid] = useState() |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'USERMANAGE')?.isshow === "true" ? true : '')//控制操作(新增删除等操作,对应权限的'不可编辑')是否可操作
|
|||
const [depMessagedata, setdepMessagedata] = useState(depMessage) |
|||
//('depMessagedata', depMessagedata)
|
|||
useEffect(async () => { |
|||
if (depMessage.length) { |
|||
//console.log('depMessage', depMessage)
|
|||
//超级管理员展示所有部门
|
|||
if (user?.username === 'SuperAdmin') { |
|||
setdepMessagedata(depMessage) |
|||
setDepSelectedKeys([depMessage[0].id]) |
|||
dispatch(getDepUser(depMessage[0].id)) |
|||
} else { |
|||
//不是超级管理员,展示相应部门的数据
|
|||
dispatch(getDepUser(user.departmentId)) |
|||
const res = await dispatch(getDepById({ deptId: parseInt(user.departmentId) })) |
|||
//('resssss', res)
|
|||
setdepMessagedata(res.payload.data) |
|||
// setDepSelectedKeys([res.payload.data[0].id])
|
|||
// dispatch(getDepUser(res.payload.data[0].id))
|
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
}, [depMessage]) |
|||
useEffect(() => { |
|||
let code = ['USERMANAGE', 'AUTHORIMANAGE'] |
|||
//console.log('你來u盧克嗎', depUser, uid)
|
|||
// console.log(depUser.filter(i=>i.phone===uid)[0]?.id,'当前的用户user')
|
|||
if (depUser?.filter(i => i.phone === uid)[0]?.id) { |
|||
//console.log('你來u盧克嗎', depUser, uid)
|
|||
|
|||
dispatch(postUserRes({ userId: depUser.filter(i => i.phone === uid)[0]?.id, resCode: code, isShow: false })) |
|||
} |
|||
}, [uid]) |
|||
useEffect(() => { |
|||
dispatch(getDepMessage()) |
|||
}, []) |
|||
useEffect(() => { |
|||
//console.log('depuser', depUser, user)
|
|||
// const copy = depUser.filter((item) => {
|
|||
// //console.log('item1', item)
|
|||
// return item.id !== user.id//把自己筛选出去
|
|||
// })
|
|||
// //console.log('copy', copy)
|
|||
const copy = [...new Set(depUser)] |
|||
setDepUserCopy(copy) |
|||
}, [depUser]) |
|||
useEffect(() => { |
|||
if (depMessage.length) { |
|||
|
|||
|
|||
} |
|||
}, [depMessage]) |
|||
|
|||
useEffect(() => { |
|||
const list = handleCrumbs(depSelectedKeys) |
|||
setDepCrumbs(list) |
|||
|
|||
}, [depSelectedKeys]) |
|||
//删除自己退出登录
|
|||
const conFirmHandler = (record) => { |
|||
delUsers([record.id]) |
|||
if (user?.id === record.id) { |
|||
dispatch(actions.auth.logout(user)); |
|||
history.push(`/network`); |
|||
} |
|||
} |
|||
const columns = |
|||
[ |
|||
{ |
|||
title: '姓名', |
|||
dataIndex: 'name', |
|||
}, |
|||
{ |
|||
title: '手机号(用户名)', |
|||
dataIndex: 'phone', |
|||
}, |
|||
{ |
|||
title: '邮箱', |
|||
dataIndex: 'email', |
|||
}, { |
|||
title: '启用状态', |
|||
dataIndex: 'enable', |
|||
render: (_, r) => { |
|||
return <Switch checkedChildren="启用" unCheckedChildren="禁用" disabled defaultChecked={r.enable} /> |
|||
} |
|||
}, |
|||
{ |
|||
title: '是否管理员', |
|||
dataIndex: 'isadmin', |
|||
render: (_, r) => { |
|||
return <div>{r.isAdmin ? '是' : '否'}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'action', |
|||
render: (dom, record) => { |
|||
// return record.username == 'SuperAdmin' ? '' : [
|
|||
// <Button type="link" onClick={() => { openModal('edit', record) }}>编辑</Button>,
|
|||
// <Popconfirm
|
|||
// title="确认删除?"
|
|||
// onConfirm={() => {
|
|||
// delUsers([record.id])
|
|||
// }}
|
|||
// >
|
|||
// <Button type="link">删除</Button>
|
|||
// </Popconfirm>,
|
|||
// <Button
|
|||
// type="link"
|
|||
// onClick={() => {
|
|||
// setModalRecord(record);
|
|||
// setPwdModalVisible(true);
|
|||
// }}
|
|||
// >重置密码</Button>
|
|||
// ]
|
|||
return [ |
|||
<Button type="link" onClick={() => { openModal('edit', record) }} disabled={editAble}>编辑</Button>, |
|||
<Popconfirm |
|||
title="确认删除?" |
|||
onConfirm={() => { conFirmHandler(record) }} |
|||
disabled={editAble} |
|||
> |
|||
<Button type="link" disabled={editAble}>删除</Button> |
|||
</Popconfirm>, |
|||
<Button |
|||
type="link" |
|||
onClick={() => { |
|||
setModalRecord(record); |
|||
setPwdModalVisible(true); |
|||
}} |
|||
disabled={editAble} |
|||
>重置密码</Button> |
|||
] |
|||
}, |
|||
}, |
|||
]; |
|||
|
|||
//弹窗确认
|
|||
const onConfirm = (values) => { |
|||
//('values.contract', values.contract)
|
|||
if (modalType == 'edit') { |
|||
dispatch(updateUser(modalRecord.id, values.contract)).then(res => { |
|||
if (res.success) { |
|||
setModalVisible(false); |
|||
dispatch(getDepUser(depSelectedKeys[0])); |
|||
} |
|||
}); |
|||
} else { |
|||
dispatch(createUser(values.contract)).then(res => { |
|||
if (res.success) { |
|||
setModalVisible(false); |
|||
dispatch(getDepMessage()) |
|||
setuid(values.contract.phone) |
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
} |
|||
|
|||
//打开弹窗
|
|||
const openModal = (type, record) => { |
|||
setModalVisible(true); |
|||
setModalType(type); |
|||
if (type == 'edit') { |
|||
setModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
} |
|||
|
|||
//打开部门弹窗
|
|||
const openDepModal = (type, record) => { |
|||
setDepModalVisible(true) |
|||
setDepModalType(type) |
|||
if (type == 'edit') { |
|||
setDepModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
|
|||
} |
|||
|
|||
//删除用户
|
|||
const delUsers = (ids, type) => { |
|||
dispatch(delUser(ids)).then(res => { |
|||
dispatch(getDepUser(depSelectedKeys[0])); |
|||
if (type == 'batch') { |
|||
setRowSelected([]); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
//重置密码
|
|||
const onPwdConfirm = (values) => { |
|||
dispatch(resetPwd(modalRecord.id, { password: values.password })).then(res => { |
|||
if (res.success) { |
|||
setPwdModalVisible(false); |
|||
dispatch(getDepUser(depSelectedKeys[0])); |
|||
} |
|||
}); |
|||
} |
|||
//部门新增及编辑
|
|||
const onDepConfirm = (data) => { |
|||
//console.log('depModalType:', depModalType);
|
|||
//console.log('data:', data);
|
|||
if (depModalType == 'edit') { |
|||
|
|||
dispatch(updateDep(data)).then(res => { |
|||
if (res.success) { |
|||
setDepModalVisible(false); |
|||
dispatch(getDepMessage()); |
|||
} |
|||
}); |
|||
} else { |
|||
dispatch(createDep(data)).then(res => { |
|||
if (res.success) { |
|||
setDepModalVisible(false); |
|||
dispatch(getDepMessage()); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
} |
|||
// 删除部门
|
|||
const delDepartment = (id) => { |
|||
dispatch(delDep(id)).then(res => { |
|||
if (res.success) { |
|||
dispatch(getDepMessage()) |
|||
} |
|||
}); |
|||
} |
|||
const renderTree = (item, id) => { |
|||
return <div style={{ display: 'flex', width: '6vw', justifyContent: 'space-between' }}> |
|||
<Tooltip title={item.name}> |
|||
<div style={{ width: '70%', textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}>{item.name}</div> |
|||
</Tooltip> |
|||
<div style={{ width: '30%' }} > |
|||
{ |
|||
selectedTree == id ? <> |
|||
{user?.username === 'SuperAdmin' ? <FormOutlined onClick={() => { |
|||
setDepModalRecord(item) |
|||
setDepModalVisible(true) |
|||
setDepModalType('edit') |
|||
}} /> : null} |
|||
{user?.username === 'SuperAdmin' ? <Popconfirm title='是否确认删除?' onConfirm={() => { delDepartment(id) }} > |
|||
<DeleteOutlined style={{ marginLeft: 5 }} /> |
|||
</Popconfirm> : ''} |
|||
</> : null |
|||
} |
|||
</div> |
|||
|
|||
</div> |
|||
} |
|||
|
|||
const handleCrumbs = (id) => { |
|||
let crumbsList = [] |
|||
|
|||
depMessage?.forEach(d => { |
|||
if (id == d.id) { |
|||
crumbsList.push(d.name) |
|||
} |
|||
d.subordinate?.forEach(s => { |
|||
if (id == s.id) { |
|||
crumbsList.push(d.name) |
|||
crumbsList.push(s.name) |
|||
} |
|||
s.subordinate?.forEach(a => { |
|||
if (id == a.id) { |
|||
crumbsList.push(d.name) |
|||
crumbsList.push(s.name) |
|||
crumbsList.push(a.name) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
return crumbsList |
|||
} |
|||
|
|||
|
|||
return (<div > |
|||
<Spin spinning={loading} /* style={{ height: "calc(100vh - 70px)" }} */> |
|||
<Row gutter={16} /* style={{ overflow: "scroll" }} */> |
|||
<Col flex="260px" style={{ height: '100%' }}> |
|||
|
|||
<Card bordered={false} bodyStyle={{ padding: 8, paddingTop: 24, }}> |
|||
{user?.username === 'SuperAdmin' ? <Button |
|||
type="primary" |
|||
key="primary" |
|||
style={{ marginLeft: 10 }} |
|||
onClick={() => openDepModal('create')} |
|||
> |
|||
新建部门</Button> : null} |
|||
|
|||
|
|||
{ |
|||
depMessage.length ? |
|||
<Tree |
|||
height={clientHeight - 95} |
|||
defaultExpandedKeys={[depMessagedata[0]?.id]} |
|||
selectedKeys={depSelectedKeys} |
|||
onSelect={(selectedKeys, e) => { |
|||
// console.log('selectedKeys:',selectedKeys);
|
|||
|
|||
if (e.selected) { |
|||
handleCrumbs(selectedKeys) |
|||
setSelectedTree(selectedKeys) |
|||
setDepSelectedKeys(selectedKeys) |
|||
dispatch(getDepUser(selectedKeys[0])) |
|||
} |
|||
}} |
|||
style={{ paddingTop: 20 }} |
|||
> |
|||
{ |
|||
depMessagedata?.map((s, index) => { |
|||
return <TreeNode title={renderTree(s, s.id)} key={s.id} > |
|||
{ |
|||
s.subordinate.map(k => { |
|||
return <TreeNode title={renderTree(k, k.id)} key={k.id} onMouseOver={() => { setIShowIcon(k.id) }} onMouseOut={() => { setIShowIcon(null) }}> |
|||
{ |
|||
k.subordinate.map(i => { |
|||
return <TreeNode title={renderTree(i, i.id)} key={i.id} onMouseOver={() => { setIShowIcon(i.id) }} onMouseOut={() => { setIShowIcon(null) }}> |
|||
</TreeNode> |
|||
}) |
|||
} |
|||
</TreeNode> |
|||
}) |
|||
} |
|||
</TreeNode> |
|||
}) |
|||
} |
|||
</Tree> : '' |
|||
} |
|||
</Card> |
|||
</Col> |
|||
|
|||
<Col /* flex="auto" */ style={{ width: "calc(100% - 260px)", height: '100%', display: "black" }}> |
|||
<Card bordered={false} height={clientHeight} bodyStyle={{ padding: 8, paddingTop: 24, overflow: "hidden", width: "100%" }}> |
|||
<Breadcrumb separator=">" style={{ marginLeft: 24 }}> |
|||
{ |
|||
depCrumbs?.map((c, index) => { return (<Breadcrumb.Item key={index}>{c}</Breadcrumb.Item>) }) |
|||
} |
|||
</Breadcrumb> |
|||
<ProTable |
|||
columns={columns} |
|||
dataSource={depUserCopy} |
|||
style={{ width: "100% ", height: clientHeight - 95, overflow: "auto" }} |
|||
rowSelection={{ |
|||
selectedRowKeys: rowSelected, |
|||
onChange: (selectedRowKeys) => { |
|||
setRowSelected(selectedRowKeys); |
|||
|
|||
}, |
|||
getCheckboxProps: (record) => { |
|||
return { |
|||
disabled: record.username === 'SuperAdmin', |
|||
} |
|||
}, |
|||
}} |
|||
options={false} |
|||
search={false} |
|||
rowKey="id" |
|||
toolBarRender={() => [ |
|||
<span> |
|||
<Button |
|||
type="primary" |
|||
key="primary" |
|||
style={{ marginRight: 10 }} |
|||
onClick={() => openModal('create')} |
|||
disabled={editAble} |
|||
>新建用户</Button> |
|||
{/* <Button style={{ marginRight: 10 }} onClick={() => { dispatch(getDepUser(depSelectedKeys[0])); }}>刷新</Button> */} |
|||
<Popconfirm title="确认删除?" onConfirm={() => { delUsers(rowSelected, 'batch') }} disabled={editAble}> |
|||
<Button disabled={editAble}>批量删除</Button> |
|||
</Popconfirm> |
|||
</span> |
|||
]} |
|||
/> |
|||
</Card> |
|||
|
|||
{ |
|||
depMessage.length && modalVisible ? |
|||
<UserModal |
|||
depMessagedata={depMessagedata} |
|||
dispatch={dispatch} |
|||
visible={modalVisible} |
|||
onVisibleChange={setModalVisible} |
|||
modalType={modalType} |
|||
onConfirm={onConfirm} |
|||
editData={modalRecord} |
|||
/> |
|||
: '' |
|||
} |
|||
{pwdModalVisible ? <ResetPwd visible={pwdModalVisible} |
|||
onVisibleChange={setPwdModalVisible} |
|||
onConfirm={onPwdConfirm} /> : ''} |
|||
|
|||
{depModalVisible ? <DepModal visible={depModalVisible} |
|||
onVisibleChange={setDepModalVisible} |
|||
depModalType={depModalType} |
|||
data={depModalRecord} |
|||
onConfirm={onDepConfirm} /> : ''} |
|||
|
|||
|
|||
|
|||
</Col> |
|||
</Row> |
|||
</Spin> |
|||
</div> |
|||
|
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { depMessage, depUser, global, auth } = state; |
|||
// console.log(state);
|
|||
return { |
|||
clientHeight: global.clientHeight, |
|||
loading: depMessage.isRequesting, |
|||
depMessage: depMessage.data || [], |
|||
depUser: depUser.data || [], |
|||
user: auth.user, |
|||
actions: global.actions |
|||
|
|||
|
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(UserManage); |
@ -1,15 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import reducers from './reducers'; |
|||
import routes from './routes'; |
|||
import actions from './actions'; |
|||
import { getNavItem } from './nav-item'; |
|||
|
|||
export default { |
|||
key: 'organization', |
|||
name: '', |
|||
reducers: reducers, |
|||
routes: routes, |
|||
actions: actions, |
|||
getNavItem: getNavItem |
|||
}; |
@ -1,39 +0,0 @@ |
|||
import React from 'react'; |
|||
import { Link } from 'react-router-dom'; |
|||
import { Menu } from 'antd'; |
|||
import { SettingOutlined } from '@ant-design/icons'; |
|||
import { Func } from '$utils'; |
|||
import { push } from 'react-router-redux'; |
|||
|
|||
|
|||
const SubMenu = Menu.SubMenu; |
|||
|
|||
export function getNavItem(user, dispatch) { |
|||
// if (!Func.isAuthorized("ORG_MANAGE")) {
|
|||
// return null
|
|||
// }
|
|||
// // console.log(!Func.isAuthorized("ORG_MANAGE"));
|
|||
// if (user.type != 1 && user.type != 2 && user.type != 3) {
|
|||
// dispatch(push('/fillion/infor'));
|
|||
// return null
|
|||
// }
|
|||
const isshow = user?.userResources?.some(i => i.resourceId === 'USERMANAGE' || i.resourceId === 'AUTHORIMANAGE') |
|||
return ( |
|||
user?.username == 'SuperAdmin' || isshow ? |
|||
<SubMenu key="organization" icon={<SettingOutlined />} title={'授权管理'}> |
|||
|
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'USERMANAGE') ? < Menu.Item key="userManage"> |
|||
<Link to="/organization/user">用户管理</Link> |
|||
</Menu.Item> : '' |
|||
} |
|||
|
|||
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'AUTHORIMANAGE') ? <Menu.Item key="userAuthority"> |
|||
<Link to="/organization/authority"> 权限管理</Link> |
|||
</Menu.Item> : ''} |
|||
|
|||
|
|||
|
|||
|
|||
</SubMenu > : null |
|||
) |
|||
} |
@ -1,5 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
export default { |
|||
|
|||
}; |
@ -1,32 +0,0 @@ |
|||
'use strict'; |
|||
import { UserManage, AdminiSter } from './containers'; |
|||
import Authority from './containers/authority'; |
|||
export default [{ |
|||
type: 'inner', |
|||
route: { |
|||
path: '/organization', |
|||
key: 'organization', |
|||
breadcrumb: '授权管理', |
|||
menuSelectKeys: ['userManage'], |
|||
menuOpenKeys: ['organization'], |
|||
childRoutes: [{ |
|||
path: '/user', |
|||
key: 'userManage', |
|||
menuSelectKeys: ['userManage'], |
|||
component: UserManage, |
|||
breadcrumb: '用户管理', |
|||
authCode: 'USERMANAGE' |
|||
|
|||
}, |
|||
{ |
|||
path: '/authority', |
|||
key: 'userAuthority', |
|||
menuSelectKeys: ['userAuthority'], |
|||
component: Authority, |
|||
breadcrumb: '权限管理', |
|||
authCode: 'AUTHORIMANAGE' |
|||
} |
|||
|
|||
] |
|||
} |
|||
}]; |
@ -1,204 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction, clearData } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getMembers (orgId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_MEMBERS', |
|||
url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`, |
|||
msg: { error: '获取用户列表失败' }, |
|||
reducer: { name: 'members' } |
|||
}); |
|||
} |
|||
|
|||
|
|||
//获取大屏道路统计信息
|
|||
export function getdaolutongji () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_DAOLUTONGJI', |
|||
url: ApiTable.getBgroadstatistics, |
|||
msg: { error: '获取道路统计信息失败' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
|
|||
//获取治超监测点处理数据信息
|
|||
export function getjiandmanage () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_JIANDMANAGE', |
|||
url: ApiTable.getzhichaomanager, |
|||
msg: { error: '获取治超监测点处理数据信息失败' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
|
|||
|
|||
//获取治超详情列
|
|||
export function getjiandetail () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_JIANDETAIL', |
|||
url: ApiTable.getzhichaodetail, |
|||
msg: { error: '获取治超监测点处理数据信息失败' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
// <<<<<<< HEAD
|
|||
// 获取运政数据统计
|
|||
export function getyunzheng () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_YUNZHENG', |
|||
url: ApiTable.getYunZheng, |
|||
msg: { error: '获取运政统计数据信息' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
// 获取道路养护数据统计及列表
|
|||
export function getRoadmaintain () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_ROADMAINTAIN', |
|||
url: ApiTable.getroadmaintain, |
|||
msg: { error: '获取道路养护数据信息' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
// 获取治超详情列
|
|||
export function getZhichaolist () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_ZHICHAOLIST', |
|||
url: ApiTable.getzhichaoList, |
|||
msg: { error: '获取治超详情列表数据' }, |
|||
// reducer: { name: 'members' }
|
|||
// =======
|
|||
}); |
|||
} |
|||
|
|||
//获取宣传数据
|
|||
export function getxuanchuan () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_XUANCHUAN', |
|||
url: ApiTable.getpropagata, |
|||
msg: { error: '获取宣传信息失败' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
|
|||
//获取公交车辆层级信息
|
|||
export function getBusTierList () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_BUSTIER', |
|||
url: ApiTable.getBusTier, |
|||
msg: { error: '获取公交车辆层级信息失败' }, |
|||
reducer: { name: 'busTier' } |
|||
// >>>>>>> 385f017aeac33adc39a31e75faf6254a1a881d16
|
|||
}); |
|||
} |
|||
//获取道路拥堵指数
|
|||
export function getGodshuju () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_GODSHUJU', |
|||
url: ApiTable.getgodshuju, |
|||
msg: { error: '获取道路拥堵指数失败' }, |
|||
// reducer: { name: 'busTier' }
|
|||
// >>>>>>> 385f017aeac33adc39a31e75faf6254a1a881d16
|
|||
}); |
|||
} |
|||
|
|||
//获取路政列表
|
|||
export function getHighwayList () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_HIGHWAYS', |
|||
url: ApiTable.getHighways, |
|||
msg: { error: '获取路政列表失败' }, |
|||
reducer: { name: 'highways' } |
|||
}); |
|||
} |
|||
//获取道路养护统计及列表
|
|||
export function getRoadMaintenanceList () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_ROAD_MAINTENANCES', |
|||
url: ApiTable.getRoadMaintenance, |
|||
msg: { error: '获取道路养护列表失败' }, |
|||
reducer: { name: 'roadMaintenances' } |
|||
}); |
|||
} |
|||
//获取管养单位概况
|
|||
export function getCustodyunit () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_CUSTODY_UNIT', |
|||
url: ApiTable.getCustodyunit, |
|||
msg: { error: '获取管养单位概况失败' }, |
|||
// reducer: { name: 'roadMaintenances' }
|
|||
}); |
|||
} |
|||
|
|||
export function getNearestAssessData (query = {}) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_NEAREST_ASSESS_DATA', |
|||
url: ApiTable.nearestAssessData, |
|||
msg: { error: '获取各乡镇考核得分情况失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getVideoCenterList () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_VIDEO_CENTER_LIST', |
|||
url: ApiTable.videoCenterList, |
|||
msg: { error: '获取视频中心列表失败' }, |
|||
reducer: { name: 'videoCenterList' } |
|||
}); |
|||
} |
|||
|
|||
export function getBusRunTime () { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_BUS_REALTIME_LIST', |
|||
url: ApiTable.busRealtimeList, |
|||
msg: { error: '获取公交实时信息失败' }, |
|||
reducer: { name: 'busRunTime', params: { noClear: true } } |
|||
}); |
|||
} |
|||
|
|||
export const getBuslineActionType = 'GET_BUS_LINE' |
|||
export function getBusline (busLicence) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: getBuslineActionType, |
|||
url: ApiTable.busLine + `?busLicence=${busLicence}`, |
|||
msg: { error: '获取公交路线信息失败' }, |
|||
reducer: { name: 'busLine', params: { noClear: true } } |
|||
}); |
|||
} |
@ -1,7 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import * as example from './example' |
|||
|
|||
export default { |
|||
...example |
|||
} |
@ -1,79 +0,0 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Card } from 'antd'; |
|||
import Build from './footer/build' |
|||
import '../style.less'; |
|||
import Header from './heand'; |
|||
import Footer from './footer'; |
|||
import ProTable, { TableDropdown } from '@ant-design/pro-table'; |
|||
import Gis from './footer/gis/gis'; |
|||
import OlMap from './public/olMap' |
|||
import { getReportList } from '../../fillion/actions/patrol' |
|||
|
|||
const MAPID = 'screenGis' |
|||
|
|||
const Example = (props) => { |
|||
const { dispatch, actions, user, loading } = props |
|||
const [tabKey, setTabKey] = useState('leadership') |
|||
const [patrolList, setPatrolList] = useState([]); |
|||
const [roadProjectList, setRoadProjectList] = useState([]); |
|||
|
|||
const tabChange = (tab) => { |
|||
setTabKey(tab) |
|||
// dispatch({ type: 'TAB-CHANGE', data: tab })
|
|||
console.log(tab); |
|||
if (tab === 'conserve') { |
|||
dispatch(getReportList({ |
|||
reportType: 'conserve', |
|||
isTop: true |
|||
})).then(res => { |
|||
console.log(res); |
|||
if (res.success) { |
|||
setPatrolList(res.payload.data || []) |
|||
} |
|||
}) |
|||
} |
|||
if (tab === 'build') { |
|||
dispatch(getReportList({ |
|||
reportType: 'road', |
|||
isTop: true |
|||
})).then(res => { |
|||
if (res.success) { |
|||
setRoadProjectList(res.payload.data || []) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<Spin tip="biubiubiu~" spinning={loading}> |
|||
<div style={{ |
|||
backgroundColor: "#031839", width: "100vw", height: "100vh", /* transform: `scale(${Math.min( |
|||
document.body.clientWidth / 1920, |
|||
document.body.clientHeight / 1080 |
|||
)})`, */
|
|||
}}> |
|||
<div style={{ width: "100%", height: "10%" }}> |
|||
<Header tabChange={tabChange} tabKey={tabKey} dispatch={dispatch} user={user} /> |
|||
</div> |
|||
<div style={{ position: 'absolute', width: "100%", height: "90%" }}> |
|||
{/* <Gis tabKey={tabKey} /> */} |
|||
<OlMap patrolList={patrolList} roadProjectList={roadProjectList} tab={tabKey} /> |
|||
<Footer tabKey={tabKey} dispatch={dispatch} /> |
|||
</div> |
|||
</div> |
|||
</Spin> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps (state) { |
|||
const { auth, global, members } = state; |
|||
return { |
|||
loading: members.isRequesting, |
|||
user: auth.user, |
|||
actions: global.actions, |
|||
members: members.data |
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(Example); |
@ -1,139 +0,0 @@ |
|||
|
|||
import React, { Component } from 'react'; |
|||
import { Row, Col } from 'antd'; |
|||
|
|||
export default class AutoRollComponent extends Component { |
|||
|
|||
constructor(props) { |
|||
super(props); |
|||
this.scrollElem = null; |
|||
this.stopscroll = false; |
|||
this.preTop = 0; |
|||
this.cloneEle = null; |
|||
this.currentTop = 0; |
|||
this.marqueesHeight = 0; |
|||
this.interval = null; |
|||
this.state = { |
|||
enabledScroll: false |
|||
} |
|||
} |
|||
|
|||
get enabledScroll() { |
|||
let scrollElem = document.getElementById(this.props.divId); |
|||
let fatherElem = scrollElem?.parentNode || null; |
|||
if (scrollElem && fatherElem) { |
|||
return scrollElem.scrollHeight > fatherElem.scrollHeight |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
|
|||
marque = (height) => { |
|||
try { |
|||
this.scrollElem = document.getElementById(this.props.divId); |
|||
this.marqueesHeight = height; |
|||
if (this.scrollElem) { |
|||
this.scrollElem.style.height = this.marqueesHeight; |
|||
this.scrollElem.style.overflow = 'hidden'; |
|||
} |
|||
this.repeat(); |
|||
} catch (e) { console.log(e) } |
|||
} |
|||
|
|||
|
|||
repeat = () => { |
|||
this.scrollElem.scrollTop = 0; |
|||
let offset = 1.5 |
|||
|
|||
this.interval = setInterval(() => { |
|||
if (this.stopscroll) return; |
|||
this.currentTop = this.currentTop + offset; |
|||
this.preTop = this.scrollElem.scrollTop; |
|||
this.scrollElem.scrollTop = this.scrollElem.scrollTop + offset; |
|||
// console.log(`this.scrollElem.scrollTop:${this.scrollElem.scrollTop} === this.preTop:${this.preTop}`);
|
|||
if (this.preTop === this.scrollElem.scrollTop) { |
|||
this.scrollElem.scrollTop = this.marqueesHeight; |
|||
this.scrollElem.scrollTop = this.scrollElem.scrollTop + offset; |
|||
} |
|||
}, 40); |
|||
} |
|||
|
|||
|
|||
componentWillUnmount() { |
|||
clearInterval(this.interval); |
|||
} |
|||
|
|||
componentWillReceiveProps(nextProps) { |
|||
requestAnimationFrame(() => { |
|||
if (this.enabledScroll) { |
|||
if (!this.state.enabledScroll) { |
|||
this.setState({ enabledScroll: true }, () => { |
|||
this.marque(10) |
|||
}) |
|||
} |
|||
|
|||
} |
|||
}) |
|||
} |
|||
|
|||
componentDidMount() { |
|||
if (this.enabledScroll) { |
|||
this.setState({ enabledScroll: true }, () => { |
|||
this.marque(10) |
|||
}) |
|||
} |
|||
} |
|||
|
|||
onMouseOver = () => { |
|||
this.stopscroll = true; |
|||
} |
|||
|
|||
onMouseOut = () => { |
|||
this.stopscroll = false; |
|||
} |
|||
|
|||
|
|||
render() { |
|||
|
|||
const { changeStyleCol, heads, spans, data, divId, divHeight, content, containerStyle = {} } = this.props; |
|||
|
|||
return ( |
|||
<div style={{ ...containerStyle, textAlign: 'left' }}> |
|||
{ |
|||
heads ? |
|||
<Row style={{ lineHeight: '40px', height: 40 }}> |
|||
{heads.map((c, index) => { |
|||
return <Col span={spans[index]} key={index}>{c}</Col> |
|||
}) |
|||
} |
|||
</Row> : '' |
|||
} |
|||
|
|||
<div id={divId} style={{ overflow: 'hidden', height: divHeight }} onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut}> |
|||
<div> |
|||
{content ? content : ''} |
|||
{this.state.enabledScroll && content ? content : ''} |
|||
{ |
|||
data ? |
|||
data.map((q, idx) => { |
|||
return ( |
|||
<div key={idx}> |
|||
<Row gutter={16} style={{ borderBottom: '0px solid grey' }}> |
|||
{heads.map((c, index) => { |
|||
return <Col span={spans[index]} key={index} style={{ paddingTop: 8, textAlign: 'left', wordBreak: 'break-word', color: `${c === changeStyleCol ? q.changeColor : ''}` }}> |
|||
{index == 1 ? q.data[index] == -1 ? "-" : q.data[index] : index == 2 ? q.data[1] == -1 ? '-' : q.data[index] : q.data[index]}</Col> |
|||
}) |
|||
} |
|||
</Row> |
|||
</div> |
|||
) |
|||
}) : '' |
|||
} |
|||
<div style={{ margin: 16 }}></div> |
|||
</div> |
|||
</div> |
|||
</div > |
|||
) |
|||
} |
|||
} |
@ -1,296 +0,0 @@ |
|||
|
|||
import './style.less' |
|||
import React, { useEffect, useRef } from 'react'; |
|||
// import ReactEcharts from 'echarts-for-react';
|
|||
import * as echarts from 'echarts'; |
|||
function Leftbottom(props) { |
|||
const { width, height, data, total, text } = props |
|||
const chartRef = useRef(null); |
|||
let colorList = [ |
|||
"rgba(7,185,254,1)", |
|||
"rgba(28,96,254,1)", |
|||
"rgba(4,251,240,1)", |
|||
] |
|||
let underColorList = [ |
|||
"rgba(7,185,254,0.5)", |
|||
"rgba(28,96,254,0.5)", |
|||
"rgba(4,251,240,0.5)", |
|||
] |
|||
const safetyData = [ |
|||
{ name: '县道', value: 72 }, |
|||
{ name: '乡道', value: 17 }, |
|||
{ name: '村道', value: 4 }, |
|||
] |
|||
//写死数据
|
|||
const dataNo = [ |
|||
{ name: '县', value: 207.8 }, |
|||
{ name: '乡', value: 680.5 }, |
|||
{ name: '村', value: 1800.7 }, |
|||
] |
|||
const chartTitle = '道路总公里'; |
|||
const title = '基础设施安全监测版块'; |
|||
let name = [], emptyName = [] |
|||
// console.log(data,'传入的值')
|
|||
// console.log(emptyName,'第二个')
|
|||
// const name = data?.map(d)
|
|||
data?.forEach(d => { |
|||
name.push(d.name) |
|||
emptyName.push({ |
|||
name: '', |
|||
value: d.value |
|||
}) |
|||
}) |
|||
|
|||
// let safetyOption = {
|
|||
// tooltip: {
|
|||
// show: true,
|
|||
// trigger: 'item',
|
|||
// position: 'right',
|
|||
// backgroundColor: 'rgba(0,0,0,0.7)',
|
|||
// textStyle: {
|
|||
// color: '#fff',
|
|||
// },
|
|||
// formatter: (values) => `${values.seriesName}<br /> ${values.marker} ${values.name} <b>${values.value}</b>个(${values.percent}%)`,
|
|||
// },
|
|||
// // title: {
|
|||
// // text:titleNum,//主标题文本
|
|||
// // left:'10%',
|
|||
// // top:'35%',
|
|||
// // subtext:chartTitle,//副标题文本
|
|||
// // textStyle:{
|
|||
// // fontFamily : "YouSheBiaoTiHei",
|
|||
// // fontSize: 20,
|
|||
// // color:'#FFFFFF',
|
|||
// // marginLeft:'20%',
|
|||
// // align:'center'
|
|||
// // },
|
|||
// // subtextStyle:{
|
|||
// // fontFamily : "PingFangSC-Medium PingFang SC",
|
|||
// // fontSize: 12,
|
|||
// // fontWeight:500,
|
|||
// // color:'#E9F7FF',
|
|||
|
|||
// // }
|
|||
// // },
|
|||
// legend: [
|
|||
|
|||
// {
|
|||
// orient: 'vertical',
|
|||
// textStyle: {
|
|||
// color: '#DDEFFF',
|
|||
// fontFamily: 'SourceHanSansCN-Regular',
|
|||
// fontSize: 12,
|
|||
// },
|
|||
// right: 0,
|
|||
// top: 'center',
|
|||
// align: 'left',
|
|||
// itemWidth: 10,
|
|||
// itemHeight: 10,
|
|||
// data: rightLegend || ['地灾', '隧道', '尾矿库', '水库大坝', '智慧消防'],
|
|||
// formatter: (name) => {
|
|||
// for (let i = 0; i < safetyOption.series[0].data.length; i += 1) {
|
|||
// if (name === safetyOption.series[0].data[i].name) {
|
|||
// return `${name} \t ${safetyOption.series[0].data[i].value}`;
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
// },
|
|||
// ],
|
|||
// series: [
|
|||
// {
|
|||
// name: '道路统计',
|
|||
// type: 'pie',
|
|||
// radius: ['50%', '63%'],
|
|||
// center: ["30%", "50%"],
|
|||
// // emphasis: { // 设置高亮时显示标签
|
|||
// // label: {
|
|||
// // show: true
|
|||
// // },
|
|||
// // // scale: true, // 设置高亮时放大图形
|
|||
// // // scaleSize: 20
|
|||
// // },
|
|||
// label: {
|
|||
// show: false,
|
|||
// },
|
|||
// // selectedMode: 'single',
|
|||
// data: safetyData,
|
|||
// itemStyle: {
|
|||
// normal: {
|
|||
// color: (color) => {
|
|||
// const colorList = legendColor || [
|
|||
// '#98D8CA',
|
|||
// '#9494FF',
|
|||
// '#2A43FF',
|
|||
// '#FFD39F',
|
|||
// '#9D5F8B',
|
|||
// '#ADDE81',
|
|||
// '#F8EBA2',
|
|||
// '#5F8EFD',
|
|||
// '#2BB4D3',
|
|||
// '#1488C8',
|
|||
// ];
|
|||
// return colorList[color.dataIndex];
|
|||
// },
|
|||
// },
|
|||
// },
|
|||
// },
|
|||
// ],
|
|||
// };
|
|||
const option = { |
|||
tooltip: { |
|||
show: true, |
|||
trigger: 'item', |
|||
position: 'right', |
|||
backgroundColor: 'rgba(0,0,0,0.7)', |
|||
textStyle: { |
|||
color: '#fff', |
|||
}, |
|||
formatter: (values) => `${values.seriesName}<br /> ${values.marker} ${values.name}<b>${values.value}</b>公里`, |
|||
}, |
|||
// title: {
|
|||
// text:total,//主标题文本
|
|||
// left:'20%',
|
|||
// // top:'35%',
|
|||
// subtext:chartTitle,//副标题文本
|
|||
// textStyle:{
|
|||
// fontFamily : "YouSheBiaoTiHei",
|
|||
// fontSize: 20,
|
|||
// color:'#FFFFFF',
|
|||
// marginLeft:'20%',
|
|||
// align:'center'
|
|||
// },
|
|||
// subtextStyle:{
|
|||
// fontFamily : "PingFangSC-Medium PingFang SC",
|
|||
// fontSize: 12,
|
|||
// fontWeight:500,
|
|||
// color:'#E9F7FF',
|
|||
// align:'center'
|
|||
|
|||
// }
|
|||
// },
|
|||
legend: { |
|||
orient: "vertical", |
|||
itemWidth: 10, |
|||
itemHeight: 10, |
|||
// right: '30%',
|
|||
right: '10%', |
|||
top: 'center', |
|||
align: 'left', |
|||
data: name, |
|||
formatter: (name) => { |
|||
for (let i = 0; i < option.series[1].data.length; i += 1) { |
|||
if (name === option.series[1].data[i].name) { |
|||
let arr = [`{a|${name}}`, `{b|${option.series[1].data[i].value}}`] |
|||
return arr.join('\t'); |
|||
} |
|||
} |
|||
}, |
|||
textStyle: { |
|||
rich: { |
|||
a: { |
|||
color: '#E9F7FF', |
|||
fontSize: 14, |
|||
padding: [0, 10] |
|||
}, |
|||
b: { |
|||
fontSize: 16, |
|||
fontFamily: 'YouSheBiaoTiHei', |
|||
color: '#fff', |
|||
padding: [0, 0, 0, 12] |
|||
}, |
|||
} |
|||
} |
|||
}, |
|||
grid: { |
|||
left: '10%' |
|||
}, |
|||
|
|||
series: [ |
|||
{ |
|||
name: "底层背景", |
|||
type: "pie", |
|||
hoverAnimation: false, |
|||
legendHoverLink: false, |
|||
radius: ["50%", "62%"], |
|||
center: ['25%', '50%'], |
|||
color: underColorList, |
|||
label: { |
|||
show: false |
|||
}, |
|||
labelLine: { |
|||
show: false |
|||
}, |
|||
tooltip: { |
|||
show: false, |
|||
}, |
|||
|
|||
data: emptyName, |
|||
}, |
|||
{ |
|||
name: "道路统计", |
|||
type: "pie", |
|||
radius: ["57%", "70%"], |
|||
center: ['25%', '50%'], |
|||
color: colorList, |
|||
label: { |
|||
show: false |
|||
}, |
|||
data: dataNo, |
|||
// data: data,
|
|||
}, |
|||
], |
|||
}; |
|||
let currentIndex = -1; // 当前高亮图形在饼图数据中的下标
|
|||
useEffect(() => { |
|||
let myChart = echarts.init(chartRef.current); |
|||
// const highlightPie = () =>{ // 取消所有高亮并高亮当前图形
|
|||
// for(var idx in safetyOption.series[0].data)
|
|||
// // 遍历饼图数据,取消所有图形的高亮效果
|
|||
// myChart.dispatchAction({
|
|||
// type: 'downplay',
|
|||
// seriesIndex: 0,
|
|||
// dataIndex: idx
|
|||
// });
|
|||
// // 高亮当前图形
|
|||
// myChart.dispatchAction({
|
|||
// type: 'highlight',
|
|||
// seriesIndex: 0,
|
|||
// dataIndex: currentIndex
|
|||
// });
|
|||
// // myChart.dispatchAction({
|
|||
// // type: 'showTip',
|
|||
// // seriesIndex: 0,
|
|||
// // dataIndex: currentIndex,
|
|||
// // });
|
|||
// }
|
|||
// const selectPie=() =>{ // 高亮效果切换到下一个图形
|
|||
// var dataLen = safetyOption.series[0].data.length;
|
|||
// currentIndex = (currentIndex + 1) % dataLen;
|
|||
// highlightPie();
|
|||
// }
|
|||
// let changePieInterval = setInterval(selectPie, 1000);
|
|||
|
|||
myChart.onChartReady = (instance) => { |
|||
chartRef.current.safetyChart = instance; |
|||
} |
|||
myChart.setOption(option); |
|||
return () => { |
|||
// clearInterval(changePieInterval)
|
|||
} |
|||
}, [data]); |
|||
|
|||
return ( |
|||
<div className='build-left-bottom'> |
|||
<span style={{ position: "absolute", width: "10%", color: "#FFF", backgroundColor: 'rgba(216, 240, 255, 0.1)', right: "5%", textAlign: "center", top: 0 }}>公里</span> |
|||
<div className='build-left-bottom-title'> |
|||
<h2>2689.00</h2> |
|||
{/* <h2>{total}</h2> */} |
|||
<span>道路总公里</span> |
|||
</div> |
|||
<img src='/assets/images/quanju/chart-circle.png'></img> |
|||
<div ref={chartRef} style={{ width: width || "70%", height: height || "90%" }} id="ech"></div> |
|||
</div> |
|||
); |
|||
} |
|||
|
|||
export default Leftbottom |
@ -1,7 +0,0 @@ |
|||
import React from 'react' |
|||
import './style.less' |
|||
export default function Leftcenter() { |
|||
return ( |
|||
<div className='build-left-center'>Leftcenter</div> |
|||
) |
|||
} |
@ -1,7 +0,0 @@ |
|||
import React from 'react' |
|||
import './style.less' |
|||
export default function Lefttop() { |
|||
return ( |
|||
<div className='build-left-top'>Lefttop</div> |
|||
) |
|||
} |
@ -1,244 +0,0 @@ |
|||
|
|||
import './style.less' |
|||
import { Col, Progress, Row } from 'antd'; |
|||
import React, { useEffect, useRef, useState } from 'react'; |
|||
// import ReactEcharts from 'echarts-for-react';
|
|||
import * as echarts from 'echarts'; |
|||
function Rightbottom(props) { |
|||
const { width, height, total, data, text } = props |
|||
const chartRef = useRef(null); |
|||
const [shuzu, setShuzu] = useState() |
|||
let colorList = [ |
|||
// "rgba(7,185,254,1)",
|
|||
"rgba(28,96,254,1)", |
|||
"rgba(4,251,240,1)", |
|||
// "rgba(255,194,20,1)",
|
|||
// 'rgba(255,255,255,1)'
|
|||
] |
|||
let underColorList = [ |
|||
// "rgba(7,185,254,0.5)",
|
|||
"rgba(28,96,254,0.5)", |
|||
"rgba(4,251,240,0.5)", |
|||
// "rgba(255,194,20,0.5)",
|
|||
// 'rgba(255,255,255,0.5)',
|
|||
] |
|||
let name = [], emptyName = [] |
|||
// const name = data?.map(d)
|
|||
|
|||
// const safetyData = [
|
|||
// {name: '一级公路', value: 42},
|
|||
// {name: '二级公路', value: 17},
|
|||
// {name: '三级公路', value: 17},
|
|||
// {name: '四级公路', value: 30},
|
|||
// {name: '等外公路', value: 30},
|
|||
|
|||
// ]
|
|||
|
|||
const rightLegend = ['一级公路', '二级公路', '三级公路', '四级公路', '等外公路'] |
|||
// let data=[
|
|||
// {name: "四级公路", value: 2969},
|
|||
// {name: "等外公路", value: 171},
|
|||
// {name: "三级公路", value: 103},
|
|||
// {name: "二级公路", value: 15},
|
|||
// ]
|
|||
// console.log(data.map(i=>i.name),'jjj')
|
|||
console.log(data); |
|||
let dataq = rightLegend.map((item, index) => { |
|||
console.log(item, index); |
|||
if (data.map(i => i.name).includes(item)) { |
|||
console.log(item); |
|||
console.log(1); |
|||
return { name: item, value: data.filter(i1 => i1.name === item)[0].value } |
|||
} else { |
|||
console.log(2); |
|||
return { name: item, value: 0 } |
|||
} |
|||
}) |
|||
console.log(dataq, '数据') |
|||
dataq?.sort((a, b) => b.value - a.value) |
|||
dataq?.forEach(d => { |
|||
name.push(d.name) |
|||
emptyName.push({ |
|||
name: '', |
|||
value: d.value |
|||
}) |
|||
}) |
|||
let siji = dataq.map((item, index) => { |
|||
if (item.name == "四级公路" || item.name == "等外公路") { |
|||
return item.value |
|||
} |
|||
|
|||
}) |
|||
let sanji = dataq.map((item, index) => { |
|||
if (item.name == "三级公路" || item.name == "二级公路" || item.name == "一级公路") { |
|||
return item.value |
|||
} |
|||
}) |
|||
let dataAll = [{ name: '四级', value: siji[0] + siji[1] }, { name: '三级及以上', value: sanji[2] + sanji[3] + sanji[4] }] |
|||
console.log(dataAll); |
|||
const chartTitle = '道路总公里'; |
|||
const title = '基础设施安全监测版块'; |
|||
// const number = 2738;
|
|||
// const leftLegend = ['地灾', '桥梁', '基坑', '边坡', '水库大坝']
|
|||
|
|||
const legendColor = undefined; |
|||
|
|||
var titleNum = 15 |
|||
const option = { |
|||
tooltip: { |
|||
show: true, |
|||
trigger: 'item', |
|||
position: 'right', |
|||
backgroundColor: 'rgba(0,0,0,0.7)', |
|||
textStyle: { |
|||
color: '#fff', |
|||
}, |
|||
formatter: (values) => `${values.seriesName}<br /> ${values.marker} ${values.name}<b>${values.value}</b>段`, |
|||
}, |
|||
// legend: {
|
|||
// orient: "vertical",
|
|||
// itemWidth: 10,
|
|||
// itemHeight: 10,
|
|||
// // right: '30%',
|
|||
// left: '50%',
|
|||
// top: 'center',
|
|||
// align: 'left',
|
|||
// data: name,
|
|||
// formatter: (name) => {
|
|||
// for (let i = 0; i < option.series[1].data.length; i += 1) {
|
|||
// if (name === option.series[1].data[i].name) {
|
|||
// let arr = [`{a|${name}}`, `{b|${option.series[1].data[i].value}}`]
|
|||
// return arr.join('\t');
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
// textStyle: {
|
|||
// rich: {
|
|||
// a: {
|
|||
// color: '#E9F7FF',
|
|||
// fontSize: 14,
|
|||
// padding:[0,10]
|
|||
// },
|
|||
// b: {
|
|||
// fontSize: 16,
|
|||
// fontFamily: 'YouSheBiaoTiHei',
|
|||
// color: '#fff',
|
|||
// padding:[0,0,0,15]
|
|||
// },
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
grid: { |
|||
left: '10%' |
|||
}, |
|||
|
|||
series: [ |
|||
{ |
|||
name: "底层背景", |
|||
type: "pie", |
|||
hoverAnimation: false, |
|||
legendHoverLink: false, |
|||
radius: ["50%", "62%"], |
|||
center: ['25%', '50%'], |
|||
color: underColorList, |
|||
label: { |
|||
show: false |
|||
}, |
|||
labelLine: { |
|||
show: false |
|||
}, |
|||
tooltip: { |
|||
show: false, |
|||
}, |
|||
|
|||
data: emptyName, |
|||
}, |
|||
{ |
|||
name: "公路等级统计", |
|||
type: "pie", |
|||
radius: ["57%", "70%"], |
|||
center: ['25%', '50%'], |
|||
color: colorList, |
|||
label: { |
|||
show: false |
|||
}, |
|||
data: dataAll, |
|||
}, |
|||
], |
|||
}; |
|||
let currentIndex = -1; // 当前高亮图形在饼图数据中的下标
|
|||
useEffect(() => { |
|||
let myChart = echarts.init(chartRef.current); |
|||
// const highlightPie = () =>{ // 取消所有高亮并高亮当前图形
|
|||
// for(var idx in safetyOption.series[0].data)
|
|||
// // 遍历饼图数据,取消所有图形的高亮效果
|
|||
// myChart.dispatchAction({
|
|||
// type: 'downplay',
|
|||
// seriesIndex: 0,
|
|||
// dataIndex: idx
|
|||
// });
|
|||
// // 高亮当前图形
|
|||
// myChart.dispatchAction({
|
|||
// type: 'highlight',
|
|||
// seriesIndex: 0,
|
|||
// dataIndex: currentIndex
|
|||
// });
|
|||
// // myChart.dispatchAction({
|
|||
// // type: 'showTip',
|
|||
// // seriesIndex: 0,
|
|||
// // dataIndex: currentIndex,
|
|||
// // });
|
|||
// }
|
|||
// const selectPie=() =>{ // 高亮效果切换到下一个图形
|
|||
// var dataLen = safetyOption.series[0].data.length;
|
|||
// currentIndex = (currentIndex + 1) % dataLen;
|
|||
// highlightPie();
|
|||
// }
|
|||
// let changePieInterval = setInterval(selectPie, 1000);
|
|||
|
|||
// myChart.onChartReady = (instance) => {
|
|||
// chartRef.current.safetyChart = instance;
|
|||
// }
|
|||
myChart.setOption(option); |
|||
return () => { |
|||
// clearInterval(changePieInterval)
|
|||
} |
|||
}, [data]); |
|||
|
|||
return ( |
|||
<div className='build-right-bottom'> |
|||
<div className='build-right-bottom-item1'> |
|||
<div> |
|||
|
|||
<span /> |
|||
<span className='sanji'><i style={{ color: 'rgba(28,96,254,1)' }}>►</i> 三级及以上</span> |
|||
</div> |
|||
<div>{sanji[2] + sanji[3] + sanji[4]}</div> |
|||
</div> |
|||
{/* <span style={{position:"absolute",width:"10%",color:"#FFF",backgroundColor:'rgba(216, 240, 255, 0.1)',right:"5%",textAlign:"center",top:0}}>段</span> */} |
|||
<div className='build-right-bottom-title'> |
|||
{/* <h2>{total || 0}</h2> */} |
|||
<h2>2689.00</h2> |
|||
<span>道路总公里</span> |
|||
</div> |
|||
{/* <div className='img1'> |
|||
<img src='/assets/images/quanju/all.png' /> |
|||
</div> */} |
|||
<div className='img'> |
|||
<img src='/assets/images/quanju/chart-circle.png' /> |
|||
</div> |
|||
<div /* ref={chartRef} */ style={{ width: width || "70%", height: height || "90%" }} /* id="ech" */> |
|||
<div ref={chartRef} style={{ width: "65%", height: "90%" }} id="ech"></div> |
|||
<div className='build-right-bottom-item2'> |
|||
<div> |
|||
|
|||
<span /> |
|||
<span className='siji'><i style={{ color: "rgba(4,251,240,1)" }}>►</i> 四级</span> |
|||
</div> |
|||
<div>{siji[0] + siji[1]}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
); |
|||
} |
|||
export default Rightbottom |
@ -1,92 +0,0 @@ |
|||
import React from 'react' |
|||
import './style.less' |
|||
import AutoRollComponent from './AutoRollComponent' |
|||
export default function Rightcenter({data,sundata}) { |
|||
// const data =[ {name: '莲塘镇', total: 12739},
|
|||
// {name: '向塘镇', total: 2445},
|
|||
// {name: '蒋巷镇', total: 2035},
|
|||
// {name: '幽兰镇', total: 1999},
|
|||
// {name: '塘南镇', total: 1915},
|
|||
// {name: '武阳镇', total: 1842},
|
|||
// {name: '冈上镇', total: 1446},
|
|||
// {name: '广福镇', total: 1063},
|
|||
// {name: '三江镇', total: 851},
|
|||
// {name: '泾口乡', total: 657},
|
|||
// {name: '南新镇', total: 640},
|
|||
// {name: '八一乡', total: 569},
|
|||
// {name: '黄马乡', total: 541},
|
|||
// {name: '塔城乡', total: 534},
|
|||
// {name: '富山乡', total: 515},
|
|||
// {name: '东新乡', total: 513},
|
|||
// {name: '银三角', total: 513},
|
|||
// {name: '八月湖街道', total: 513},]
|
|||
// const province = undefined
|
|||
const FIRST = "linear-gradient(360deg, rgba(43, 180, 211, 0.1) 0%, rgba(43, 180, 211, 0.4) 100%)" |
|||
const SECOND = "linear-gradient(360deg, rgba(255, 209, 86, 0.1) 0%, rgba(255, 209, 86, 0.4) 100%)" |
|||
const THIRD = "linear-gradient(360deg, rgba(148, 148, 255, 0.1) 0%, rgba(148, 148, 255, 0.4) 100%)" |
|||
const OTHER = "linear-gradient(360deg, rgba(28, 96, 253, 0) 0%, rgba(28, 96, 253, 0.2) 100%)" |
|||
let TOTALS = data?.map(({ name, total }, index) => { |
|||
let max = Math.max(...data.map(item=>item.total)) |
|||
return { |
|||
name, |
|||
value: total, |
|||
percent: (total * 100 / max).toFixed(2) + "%" |
|||
} |
|||
}) |
|||
let new_TOTALS = TOTALS && TOTALS.length > 10 ? TOTALS.slice(0, 10) : TOTALS |
|||
function Cell(props) { |
|||
const { name, rank, value, percent, style = {},cebg } = props |
|||
let bg = RNAKS[rank] || OTHER |
|||
return <div style={{ |
|||
width: "100%", height: 34, display: "flex", justifyContent: 'center', |
|||
alignItems: "center", marginTop: 7, marginBottom: 7, |
|||
padding: "0 2%", |
|||
...style |
|||
}}> |
|||
<div style={{ |
|||
height: 20, color: "white",whiteSpace:'nowrap', |
|||
fontSize: 10, fontWeight: "bold", display: 'flex', |
|||
alignItems: "center", justifyContent: "center" |
|||
}} > |
|||
{name} |
|||
</div> |
|||
<div style={{ width: "92%", marginLeft: 10 }}> |
|||
{/* <div style={{ width: "100%", height: 18, fontSize: 12, fontWeight: 400, color: "white" }}>{name}</div> */} |
|||
|
|||
<div style={{ display: 'flex', justifyContent: "space-between", alignItems: "center", height: 13 }}> |
|||
<div style={{display:'flex', width:"85%"}}> |
|||
<div style={{ |
|||
position:'relative', |
|||
width: percent, height: 5, |
|||
background: cebg || "linear-gradient(270deg, #1C60FE 0%, rgba(28, 96, 254, 0) 100%)" |
|||
}} >{cebg?<span style={{position:'absolute',right:'0',top:'0',backgroundColor:"#FFF",height:"5px",width:"5px",borderRadius:"2.5px"}}/>:""}</div> |
|||
|
|||
<div style={{width:`calc(100% - ${percent})`,background:'rgba(255,255,255,0.0800)'}}/> |
|||
</div> |
|||
<div style={{ marginLeft: 10, fontSize: 12,color:"#FFFFFF" }}>{value}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
const renderContent = () => { |
|||
|
|||
return new_TOTALS?.map(({ name, value, percent }, index) => { |
|||
return <Cell key={index} rank={index} name={name} value={value} percent={percent} cebg={index===0?'linear-gradient(63deg, rgba(16, 39, 75, 1) 0%, rgba(7, 185, 254, 1) 100%)':undefined}/> |
|||
}) |
|||
|
|||
} |
|||
const RNAKS = [FIRST, SECOND, THIRD] |
|||
|
|||
return ( |
|||
<div className='build-right-center'> |
|||
<div className='build-right-center-top'> |
|||
<img src="/assets/images/quanju/gonglugongcheng.png"></img> |
|||
<div>在建公路工程数量/个</div> |
|||
<h2>{sundata}</h2> |
|||
</div> |
|||
<AutoRollComponent content={renderContent()} |
|||
containerStyle={{ position: "relative", height: "65%", }} |
|||
divHeight={"100%"} divId={"chart-overview-deviceList"} /> |
|||
</div> |
|||
) |
|||
} |
@ -1,7 +0,0 @@ |
|||
import React from 'react' |
|||
import './style.less' |
|||
export default function Righttop() { |
|||
return ( |
|||
<div className='build-right-top'>Righttop</div> |
|||
) |
|||
} |
@ -1,354 +0,0 @@ |
|||
import React, { useEffect, useState, useRef } from 'react' |
|||
import { connect } from 'react-redux'; |
|||
// import LeftTop from './Lefttop'
|
|||
// import LeftCenter from './Leftcenter'
|
|||
import LeftBottom from './Leftbottom' |
|||
// import RightTop from './Righttop'
|
|||
import Rightcenter from './Rightcenter' |
|||
// import Rightbottom from './Rightbottom'
|
|||
import NoData from '../../public/noData'; |
|||
import Module from '../../public/module' |
|||
import RightBottom from './Rightbottom' |
|||
import AutoRollComponent from './AutoRollComponent' |
|||
import './style.less' |
|||
import { getdaolutongji, getxuanchuan } from '../../../actions/example' |
|||
import { Carousel } from 'antd'; |
|||
import { getProject } from '../../../../fillion/actions/infor' |
|||
|
|||
// import { number } from 'echarts';
|
|||
const Build = (props) => { |
|||
const { dispatch, projectList } = props |
|||
let data1 = [ |
|||
{ name: "县", value: 207 }, |
|||
{ name: "乡", value: 729 }, |
|||
{ name: "村", value: 1938 } |
|||
] |
|||
// const safetyData = [
|
|||
// {name: '一级公路', value: 42},
|
|||
// {name: '二级公路', value: 17},
|
|||
// {name: '三级公路', value: 17},
|
|||
// {name: '四级公路', value: 30},
|
|||
// ]
|
|||
const [buildingnumber, setbuildingnumber] = useState(0) |
|||
const [data, setdata] = useState([]) |
|||
const [xuandata, setxuandata] = useState(null) |
|||
const lunbo = useRef(null) |
|||
const lunbovideo = useRef(null) |
|||
const [lunboindex, setlunboindex] = useState(0) |
|||
|
|||
//
|
|||
const lunboMsg = useRef({ index: 0 }) |
|||
|
|||
//获取道路管理数据
|
|||
const requestbuildingnumber = async () => { |
|||
const res = await dispatch(getdaolutongji()); |
|||
let alltype = Object.keys(res.payload.data?.roadType || {}).map((item) => ({ name: item, value: Number(keepThreeNum(res.payload.data.roadType[item])) })) |
|||
setdata(alltype.filter(item => item.name === '县' || item.name === "乡" || item.name === '村')) |
|||
setbuildingnumber(res.payload.data) |
|||
} |
|||
|
|||
//获取宣传栏数据
|
|||
const requestxuanchuanlan = async () => { |
|||
const res = await dispatch(getxuanchuan()); |
|||
// setdata(alltype.filter(item=>item.name!=='null'))
|
|||
setxuandata(res.payload.data || []) |
|||
} |
|||
|
|||
let t1 = Object.values(buildingnumber?.townRoad || {}) |
|||
|
|||
let totalgongli = t1.length !== 0 ? t1.reduce((x, y) => x + y.mileage, 0) : 0 //乡镇道路占比总公里数
|
|||
// let totalcount = t1.length !==0 ? t1.reduce((x,y)=>x+y.roadCount,0):0 //乡镇道路占比公路总条数
|
|||
let totalcount = buildingnumber?.buildedRoad || 0 |
|||
|
|||
// let sungongli = alltype.reduce((x,y)=>x+y.value,0)
|
|||
|
|||
const keepThreeNum = (value) => { |
|||
let resValue = 0 |
|||
//小数点的位置
|
|||
let index = value && value.toString().indexOf('.') + 1 |
|||
//小数的位数
|
|||
let num = value && Math.abs(Number(value)).toString().length - index |
|||
if (index && num > 3) { |
|||
resValue = value && Number(value).toFixed(3) |
|||
} else { |
|||
resValue = value |
|||
} |
|||
return resValue |
|||
} |
|||
let datas = Object.keys(buildingnumber?.townRoad || {}).map((item) => ({ name: item, number: buildingnumber.townRoad[item].roadCount, gongli: Number(keepThreeNum(buildingnumber.townRoad[item].mileage)) })) |
|||
|
|||
let list = datas.sort((a, b) => { |
|||
return b.number - a.number |
|||
}) |
|||
list = list.filter(item => item.name !== "其他") |
|||
|
|||
//道路等级数据
|
|||
let alldengji = Object.keys(buildingnumber?.roadLevel || {}).map((item) => ({ name: item, value: Number(keepThreeNum(buildingnumber.roadLevel[item])) })) |
|||
|
|||
let onlineproject = Object.keys(buildingnumber?.townProject || {}).map((item) => ({ name: item, total: buildingnumber.townProject[item] })) |
|||
onlineproject = onlineproject.sort((a, b) => { |
|||
return b.total - a.total |
|||
}) |
|||
let sunonlineproject = onlineproject?.reduce((x, y) => x + y.total, 0) |
|||
let buildingCount = buildingnumber?.buildingCount |
|||
//let projectAll=
|
|||
let safetyData = alldengji?.filter(item => item.name === '一级公路' || item.name === '二级公路' || item.name === '三级公路' || item.name === '四级公路' || item.name === '等外公路') |
|||
let sundata = data?.reduce((x, y) => x + y.value, 0) |
|||
let sunsafetyData = safetyData?.reduce((x, y) => x + y.value, 0) |
|||
|
|||
useEffect(() => { |
|||
requestbuildingnumber(); |
|||
requestxuanchuanlan() |
|||
dispatch(getProject()) |
|||
}, []) |
|||
|
|||
useEffect(() => { |
|||
lunbo.current.goTo(lunboindex) |
|||
}, [lunboindex]) |
|||
|
|||
const rendercontent = () => { |
|||
return (<div className='build-left-center-content'> |
|||
{list.map(({ name, number, gongli }, index) => <div className='build-left-center-item' key={index}> |
|||
<span>{name}</span> |
|||
<span>{number}</span> |
|||
<span>{gongli}</span> |
|||
</div>)} |
|||
</div>) |
|||
} |
|||
// const xuandata1 = [
|
|||
// {
|
|||
// "id": 26,
|
|||
// "name": "111",
|
|||
// "video":null,
|
|||
// "enable": true
|
|||
// }
|
|||
// ]
|
|||
|
|||
let videos = [] |
|||
if (xuandata && xuandata.length) { |
|||
for (let x of xuandata) { |
|||
if (x.enable) { |
|||
if (x.video && x.video.length) { |
|||
for (let v of x.video) { |
|||
videos.push(v) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
return ( |
|||
<> |
|||
<div className='bgbuild-left'> |
|||
<Module title={"在建公路工程"} style={{ |
|||
width: "100%", |
|||
height: " 33%" |
|||
}} customize={true}> |
|||
<div style={{ height: "100%", position: "relative" }} > |
|||
{/* <span style={{ position: "absolute", width: "10%", color: "#FFF", backgroundColor: 'rgba(216, 240, 255, 0.1)', right: "5%", textAlign: "center" }}>条</span> */} |
|||
{buildingnumber && buildingnumber.buildedRoad !== 0 && totalgongli !== 0 ? <div className='build-left-top'> |
|||
{/* <div className='build-left-top-item'> |
|||
<div> |
|||
<i>►</i> |
|||
<span /> |
|||
<span>在建公路数量</span> |
|||
</div> |
|||
<div>{buildingnumber?.buildingRoad || 0}</div> |
|||
</div> */} |
|||
<img src='/assets/images/quanju/yuanhuan.webp' className='build-left-top-center' /> |
|||
<div className='build-left-top-item'> |
|||
<div>{buildingCount || 0}</div> |
|||
<div> |
|||
{/* <i>►</i> */} |
|||
{/* <span /> */} |
|||
<span>在建数量</span> |
|||
</div> |
|||
</div> |
|||
</div> : <NoData />} |
|||
</div> |
|||
</Module> |
|||
{/* <Module title={"各乡镇现有道路统计"} style={{ |
|||
width: "100%", |
|||
height: " 33%", marginTop: '3%' |
|||
}} customize={true}> |
|||
{ |
|||
totalcount && totalcount !== 0 ? |
|||
<div className='build-left-center'> |
|||
<div className='build-left-center-top'> |
|||
<div> |
|||
<img src='/assets/images/quanju/gonglugongli.png'></img> |
|||
<div> |
|||
<span>公路公里数/公里</span> |
|||
<span>{keepThreeNum(totalgongli)}</span> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<img src='/assets/images/quanju/gongluzong.png'></img> |
|||
<div> |
|||
<span>公路总数/条</span> |
|||
<span>{totalcount || 0}</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div className='build-left-center-titile'> |
|||
<span>乡镇名称</span> |
|||
<span>公路数量/条</span> |
|||
<span>公里</span> |
|||
</div> |
|||
<AutoRollComponent content={rendercontent()} containerStyle={{ position: "relative", height: "50%", }} |
|||
divHeight={"100%"} divId={"chart"} /> |
|||
</div> |
|||
: <NoData /> |
|||
} |
|||
</Module> */} |
|||
<Module title={"在建项目列表"} style={{ |
|||
width: "100%", |
|||
height: " 33%", marginTop: '3%' |
|||
}} customize={true}> |
|||
{ |
|||
totalcount && totalcount !== 0 ? |
|||
<div className='build-left-center' style={{ padding: 12 }}> |
|||
<div className='build-left-center'> |
|||
<div className='build-left-center-titile'> |
|||
<span>项目名称</span> |
|||
<span>项目规模(公里)</span> |
|||
<span>项目投资(万元)</span> |
|||
</div> |
|||
<AutoRollComponent content={ |
|||
<div className='build-left-center-content'> |
|||
{ |
|||
projectList.map((p, index) => { |
|||
return ( |
|||
<div className='build-left-center-item' key={index}> |
|||
<span className='ellipsis' title={p.entryName}>{p.entryName}</span> |
|||
<span>{p.projectMileage}</span> |
|||
<span>{p.investment}</span> |
|||
</div> |
|||
) |
|||
}) |
|||
} |
|||
</div> |
|||
} |
|||
containerStyle={{ position: "relative", height: "85%", }} |
|||
divHeight={"100%"} divId={"chart"} |
|||
/> |
|||
</div> |
|||
</div> |
|||
: <NoData /> |
|||
} |
|||
</Module> |
|||
<Module title={"道路统计"} style={{ |
|||
width: "100%", |
|||
height: " 30%", marginTop: '3%' |
|||
}} customize={true}> |
|||
{data && sundata !== 0 ? <LeftBottom |
|||
data={data} |
|||
width='100%' |
|||
height='100%' |
|||
text='道路总公里' |
|||
//total={keepThreeNum(sundata)}
|
|||
total={keepThreeNum(sundata)} |
|||
// colorList={colorList}
|
|||
// underColorList={underColorList}
|
|||
/> : <NoData />} |
|||
</Module> |
|||
|
|||
</div> |
|||
<div className='bgbuild-right'> |
|||
<Module title={"宣传栏"} style={{ |
|||
width: "100%", |
|||
height: " 33%" |
|||
}} customize={true}> |
|||
<div className='build-right-top'> |
|||
|
|||
{/* <img src='/assets/images/quanju/xuanchuanlan.jpg'></img> */} |
|||
<Carousel dots={false} ref={lunbo} key={lunboindex}> |
|||
{/* { |
|||
videos.map((v, i) => { |
|||
return i == lunboMsg.current.index ? |
|||
<video src={`${localStorage.getItem("qndmn")}/${v}`} key={Math.random()} autoPlay={i == lunboMsg.current.index} onEnded={() => { |
|||
if (i == videos.length - 1) { |
|||
setlunboindex(0) |
|||
lunboMsg.current.index = 0 |
|||
lunbo.current.goTo(1) |
|||
} else { |
|||
setlunboindex(i + 1) |
|||
lunboMsg.current.index = i + 1 |
|||
lunbo.current.next() |
|||
} |
|||
}}></video> |
|||
: <p>123</p> |
|||
}) |
|||
} */} |
|||
|
|||
{ |
|||
xuandata && xuandata !== null && xuandata.length !== 0 ? xuandata.filter(i => i.enable).map((item, index1) => { |
|||
|
|||
if (item.video && item.video !== null && item.video.length !== 0) { |
|||
return item.video.map((i, index) => { |
|||
if (index1 === lunboindex) { |
|||
return <video src={`${localStorage.getItem("qndmn")}/${i}`} autoPlay={true} ref={lunbovideo} onEnded={() => { |
|||
if (index1 < xuandata.filter(i => i.enable).length - 1) { |
|||
setlunboindex(lunboindex + 1) |
|||
} else { |
|||
setlunboindex(0) |
|||
} |
|||
|
|||
}}></video> |
|||
} else { |
|||
return <video src={`${localStorage.getItem("qndmn")}/${i}`} autoPlay={false} ></video> |
|||
} |
|||
}) |
|||
} |
|||
// return <video src={`${localStorage.getItem("qndmn")}/${item.video!==null&&item.video.length!==0?item.video[0]:""}`} autoPlay="autoplay" loop></video>
|
|||
|
|||
}) |
|||
: <video src='#'></video> |
|||
} |
|||
{/* <video src={xuandata&&xuandata!==null&&xuandata.length!==0?`${localStorage.getItem("qndmn")}/${xuandata[0].video!==null&&xuandata[0].video?xuandata[0].video[0]:""}`:"#"} autoPlay="autoplay" loop></video> */} |
|||
</Carousel> |
|||
<h2>全面建设好农村公路,切实发挥先行官作用</h2> |
|||
</div> |
|||
</Module> |
|||
<Module title={"各乡镇在建工程统计"} style={{ |
|||
width: "100%", |
|||
height: " 33%", marginTop: '3%' |
|||
}} customize={true}> |
|||
{sunonlineproject !== 0 ? <Rightcenter data={onlineproject} sundata={buildingCount} /> : <NoData />} |
|||
</Module> |
|||
<Module title={"各路段技术等级统计"} style={{ |
|||
width: "100%", |
|||
height: " 30%", marginTop: '3%' |
|||
}} customize={true}> |
|||
{safetyData && sunsafetyData !== 0 ? <RightBottom width='100%' |
|||
height='100%' |
|||
text='道路总公里' |
|||
total={keepThreeNum(sundata)} |
|||
data={keepThreeNum(safetyData)} /> : <NoData />} |
|||
</Module> |
|||
</div> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps (state) { |
|||
const { auth, depMessage, projectList } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
projectList: projectList.data || [] |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(Build); |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue