|
@ -3,14 +3,14 @@ |
|
|
|
|
|
|
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import { connect } from 'react-redux'; |
|
|
import { connect } from 'react-redux'; |
|
|
import { Form, Input, Select, Button, Table, Modal, DatePicker } from 'antd'; |
|
|
import { Form, Input, Select, Button, Table, Modal, DatePicker, Checkbox, Row, Col } from 'antd'; |
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
|
|
|
|
|
|
const PatrolRecord = (props) => { |
|
|
const PatrolRecord = (props) => { |
|
|
const { dispatch, actions, } = props |
|
|
const { dispatch, actions, } = props |
|
|
const { patrolManage } = actions |
|
|
const { patrolManage } = actions |
|
|
const [tableList, settableList] = useState([]) |
|
|
const [tableList, settableList] = useState([]) |
|
|
const [addModel, setAddModel] = useState(false) |
|
|
const [showDetailModal, setShowDetail] = useState(false) |
|
|
const [modelData, setModelData] = useState({}) |
|
|
const [modelData, setModelData] = useState({}) |
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }) |
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }) |
|
|
const [limits, setLimits] = useState() |
|
|
const [limits, setLimits] = useState() |
|
@ -22,9 +22,11 @@ const PatrolRecord = (props) => { |
|
|
}, []) |
|
|
}, []) |
|
|
|
|
|
|
|
|
const record = (params) => { |
|
|
const record = (params) => { |
|
|
dispatch(patrolManage.records(`patrolRecord/all/${params.time[0]}/${params.time[1]}/${params.state}/1`)).then(res => { |
|
|
dispatch(patrolManage.records(`patrolRecord/all/${params.time[0]}/${params.time[1]}/${params.state}/null`)).then(res => { |
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
settableList(res.payload.data?.map(v => ({ ...v, key: v.id }))) |
|
|
settableList(params.name != null ? res.payload.data?.filter(v => |
|
|
|
|
|
(v.points.user.name.indexOf(params.name) != -1 || v.points.project.name.indexOf(params.name) != -1)) |
|
|
|
|
|
.map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) |
|
|
setLimits(res.payload.data?.length) |
|
|
setLimits(res.payload.data?.length) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
@ -35,35 +37,35 @@ const PatrolRecord = (props) => { |
|
|
dataIndex: 'name', |
|
|
dataIndex: 'name', |
|
|
key: 'name', |
|
|
key: 'name', |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return !record.points?.project? '':<div style={{ width: 100 }}>{record.points.project.name}</div> |
|
|
return !record.points?.project ? '' : <div style={{ width: 100 }}>{record.points.project.name}</div> |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '巡检人', |
|
|
title: '巡检人', |
|
|
dataIndex: 'type', |
|
|
dataIndex: 'type', |
|
|
key: 'type', |
|
|
key: 'type', |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return !record.points?.user? '':<div style={{ width: 100 }}>{record.points.user.name}</div> |
|
|
return !record.points?.user ? '' : <div style={{ width: 100 }}>{record.points.user.name}</div> |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '巡检点位', |
|
|
title: '巡检点位', |
|
|
dataIndex: 'type', |
|
|
dataIndex: 'type', |
|
|
key: 'type', |
|
|
key: 'type', |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return !record.points?.user? '':<div style={{ width: 100 }}>{record.points.itemData.name}</div> |
|
|
return !record.points?.user ? '' : <div style={{ width: 100 }}>{record.points.itemData.name}</div> |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '巡检单位', |
|
|
title: '巡检单位', |
|
|
dataIndex: 'type', |
|
|
dataIndex: 'type', |
|
|
key: 'type', |
|
|
key: 'type', |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return !record.points?.user? '':<div style={{ width: 100 }}>{record.points.user.department.name}</div> |
|
|
return !record.points?.user ? '' : <div style={{ width: 100 }}>{record.points.user.department.name}</div> |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '巡检频次', |
|
|
title: '巡检频次', |
|
|
dataIndex: 'describe', |
|
|
dataIndex: 'describe', |
|
|
key: 'describe', |
|
|
key: 'describe', |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return !record.points? '':<div style={{ width: 100 }}>{record.points.frequency}</div> |
|
|
return !record.points ? '' : <div style={{ width: 100 }}>{record.points.frequency}</div> |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '上次巡检日期', |
|
|
title: '上次巡检日期', |
|
@ -79,7 +81,7 @@ const PatrolRecord = (props) => { |
|
|
title: '巡检结果', |
|
|
title: '巡检结果', |
|
|
dataIndex: 'describe', |
|
|
dataIndex: 'describe', |
|
|
key: 'describe', |
|
|
key: 'describe', |
|
|
render: (text, record, index) => !record.alarm? '正常':'异常' |
|
|
render: (text, record, index) => !record.alarm ? '正常' : '异常' |
|
|
}, { |
|
|
}, { |
|
|
title: '操作', |
|
|
title: '操作', |
|
|
dataIndex: 'operation', |
|
|
dataIndex: 'operation', |
|
@ -88,7 +90,7 @@ const PatrolRecord = (props) => { |
|
|
return ( |
|
|
return ( |
|
|
<div style={{ width: 190 }}> |
|
|
<div style={{ width: 190 }}> |
|
|
<Button type="link" onClick={() => { |
|
|
<Button type="link" onClick={() => { |
|
|
setAddModel(true) |
|
|
setShowDetail(true) |
|
|
setModelData(record) |
|
|
setModelData(record) |
|
|
}}> |
|
|
}}> |
|
|
查看详情</Button> |
|
|
查看详情</Button> |
|
@ -122,7 +124,7 @@ const PatrolRecord = (props) => { |
|
|
style={{ marginRight: 16, }} |
|
|
style={{ marginRight: 16, }} |
|
|
initialValue={[moment(search.time[0], format), moment(search.time[1], format)]} |
|
|
initialValue={[moment(search.time[0], format), moment(search.time[1], format)]} |
|
|
> |
|
|
> |
|
|
<DatePicker.RangePicker style={{ marginRight: 16, }}/> |
|
|
<DatePicker.RangePicker showTime style={{ marginRight: 16, }} /> |
|
|
</Form.Item> |
|
|
</Form.Item> |
|
|
<Form.Item |
|
|
<Form.Item |
|
|
name="state" |
|
|
name="state" |
|
@ -160,6 +162,29 @@ const PatrolRecord = (props) => { |
|
|
} |
|
|
} |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
|
|
|
|
<Modal |
|
|
|
|
|
title='巡检记录详情' |
|
|
|
|
|
open={showDetailModal} |
|
|
|
|
|
onCancel={() => setShowDetail(false)} |
|
|
|
|
|
footer={[<Button onClick={() => setShowDetail(false)}>关闭</Button>]} |
|
|
|
|
|
> |
|
|
|
|
|
<Row align='middle' justify='center' style={{ marginBottom: 10 }}> |
|
|
|
|
|
当前点位:{modelData?.points?.itemData?.name} |
|
|
|
|
|
</Row> |
|
|
|
|
|
<Row align='middle' justify='center' style={{ marginBottom: 10 }}> |
|
|
|
|
|
当前位置:{modelData?.points?.itemData?.name} |
|
|
|
|
|
</Row> |
|
|
|
|
|
<Row align='middle' justify='center'> |
|
|
|
|
|
<Checkbox.Group |
|
|
|
|
|
options={[ |
|
|
|
|
|
{ label: '正常', value: 'Apple', disabled: false }, |
|
|
|
|
|
{ label: '异常', value: 'Orange', disabled: false }, |
|
|
|
|
|
]} |
|
|
|
|
|
disabled |
|
|
|
|
|
defaultValue={['Apple']} |
|
|
|
|
|
/> |
|
|
|
|
|
</Row> |
|
|
|
|
|
</Modal> |
|
|
</> |
|
|
</> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|