diff --git a/web/client/src/sections/patrolManage/actions/index.js b/web/client/src/sections/patrolManage/actions/index.js index aaaafe9..c465b0f 100644 --- a/web/client/src/sections/patrolManage/actions/index.js +++ b/web/client/src/sections/patrolManage/actions/index.js @@ -1,7 +1,9 @@ 'use strict'; import * as plan from './plan' +import * as record from './record' export default { ...plan, + ...record, } \ No newline at end of file diff --git a/web/client/src/sections/patrolManage/actions/record.js b/web/client/src/sections/patrolManage/actions/record.js new file mode 100644 index 0000000..a6ae77e --- /dev/null +++ b/web/client/src/sections/patrolManage/actions/record.js @@ -0,0 +1,17 @@ +'use strict'; + +import { basicAction } from '@peace/utils' + +export const GET_PATROL_RECORD_LIST = 'GET_PATROL_RECORD_LIST'; +export const GET_PATROL_RECORD_LIST_SUCCESS = 'GET_PATROL_RECORD_LIST_SUCCESS'; +export const GET_PATROL_RECORD_LIST_ERROR = 'GET_PATROL_RECORD_LIST_ERROR'; +export function records(url) { + return (dispatch) => basicAction({ + type: 'get', + dispatch, + actionType: GET_PATROL_RECORD_LIST, + url: url, + msg: { error: '获取巡检记录失败', }, + reducer: { name: 'record' } + }); +} \ No newline at end of file diff --git a/web/client/src/sections/patrolManage/containers/index.js b/web/client/src/sections/patrolManage/containers/index.js index 4121322..d83768a 100644 --- a/web/client/src/sections/patrolManage/containers/index.js +++ b/web/client/src/sections/patrolManage/containers/index.js @@ -1,5 +1,6 @@ 'use strict'; import PatrolPlan from './patrolPlan'; +import PatrolReocrd from './patrolRecord'; -export { PatrolPlan }; \ No newline at end of file +export { PatrolPlan, PatrolReocrd }; \ No newline at end of file diff --git a/web/client/src/sections/patrolManage/containers/patrolRecord.js b/web/client/src/sections/patrolManage/containers/patrolRecord.js new file mode 100644 index 0000000..e10829e --- /dev/null +++ b/web/client/src/sections/patrolManage/containers/patrolRecord.js @@ -0,0 +1,175 @@ + +'use strict' + +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import { Form, Input, Select, Button, Table, Modal, DatePicker } from 'antd'; +import moment from "moment"; + +const PatrolRecord = (props) => { + const { dispatch, actions, } = props + const { patrolManage } = actions + const [tableList, settableList] = useState([]) + const [addModel, setAddModel] = useState(false) + const [modelData, setModelData] = useState({}) + const [query, setQuery] = useState({ limit: 10, page: 0 }) + const [limits, setLimits] = useState() + const format = 'YYYY-MM-DD' + const [search, setSearch] = useState({ name: null, time: [moment().add(-7, 'd').format(format), moment().format(format)], state: 'null' }) + + useEffect(() => { + record(search) + }, []) + + const record = (params) => { + dispatch(patrolManage.records(`patrolRecord/all/${params.time[0]}/${params.time[1]}/${params.state}/1`)).then(res => { + if (res.success) { + settableList(res.payload.data?.map(v => ({ ...v, key: v.id }))) + setLimits(res.payload.data?.length) + } + }) + } + + const columns = [{ + title: '结构物名称', + dataIndex: 'name', + key: 'name', + render: (text, record, index) => { + return !record.points?.project? '':
{record.points.project.name}
+ } + }, { + title: '巡检人', + dataIndex: 'type', + key: 'type', + render: (text, record, index) => { + return !record.points?.user? '':
{record.points.user.name}
+ } + }, { + title: '巡检点位', + dataIndex: 'type', + key: 'type', + render: (text, record, index) => { + return !record.points?.user? '':
{record.points.itemData.name}
+ } + }, { + title: '巡检单位', + dataIndex: 'type', + key: 'type', + render: (text, record, index) => { + return !record.points?.user? '':
{record.points.user.department.name}
+ } + }, { + title: '巡检频次', + dataIndex: 'describe', + key: 'describe', + render: (text, record, index) => { + return !record.points? '':
{record.points.frequency}
+ } + }, { + title: '上次巡检日期', + dataIndex: 'describe', + key: 'describe', + render: (text, record, index) => moment(record.lastInspectionTime).format('YYYY-MM-DD HH:mm') || '--' + }, { + title: '本次巡检日期', + dataIndex: 'describe', + key: 'describe', + render: (text, record, index) => moment(record.inspectionTime).format('YYYY-MM-DD HH:mm') || '--' + }, { + title: '巡检结果', + dataIndex: 'describe', + key: 'describe', + render: (text, record, index) => !record.alarm? '正常':'异常' + }, { + title: '操作', + dataIndex: 'operation', + key: 'operation', + render: (text, record, index) => { + return ( +
+ +
+ ) + } + } + ] + + return ( + <> +
+
{ + record({ + name: r.name, + time: [moment(r.time[0]).format(format), moment(r.time[1]).format(format)], + state: r.state + }) + }} + > + + + + + + + +