|
|
@ -7,7 +7,7 @@ import { createPatrolPlan, delPatrolPlan, updatePatrolPlan, getPatrolPlan } from |
|
|
|
import { getPatrolTemplate } from '../actions/template'; |
|
|
|
import moment from 'moment'; |
|
|
|
|
|
|
|
function PatrolPlan (props) { |
|
|
|
function PatrolPlan(props) { |
|
|
|
const { dispatch, user } = props; |
|
|
|
const tableRef = useRef(); |
|
|
|
const [dataSource, setDataSource] = useState([{}]); |
|
|
@ -39,8 +39,8 @@ function PatrolPlan (props) { |
|
|
|
|
|
|
|
const columns = [{ |
|
|
|
title: '结构物名称', |
|
|
|
dataIndex: 'struName', |
|
|
|
key: 'struName', |
|
|
|
dataIndex: 'projectName', |
|
|
|
key: 'projectName', |
|
|
|
ellipsis: true, |
|
|
|
render: (_, record) => { |
|
|
|
return <div>{record?.project?.name}</div> |
|
|
@ -55,36 +55,41 @@ function PatrolPlan (props) { |
|
|
|
dataIndex: 'startTime', |
|
|
|
key: 'startTime', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
render: (_, record) => moment(record.startTime).format('YYYY-MM-DD') |
|
|
|
}, { |
|
|
|
title: '结束时间', |
|
|
|
dataIndex: 'endTime', |
|
|
|
key: 'endTime', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
render: (_, record) => moment(record.endTime).format('YYYY-MM-DD') |
|
|
|
|
|
|
|
}, { |
|
|
|
title: '巡检频次', |
|
|
|
dataIndex: 'frequency', |
|
|
|
key: 'frequency', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
}, { |
|
|
|
title: '巡检点位', |
|
|
|
dataIndex: 'patrolPoints', |
|
|
|
key: 'patrolPoints', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
render: (_, record) => <div>{record?.points?.length ? record?.points?.map(p => p.name).join() : '-'}</div> |
|
|
|
}, { |
|
|
|
title: '巡检人', |
|
|
|
dataIndex: 'patrolPerson', |
|
|
|
key: 'patrolPerson', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
render: (_, record) => <div>{record?.users?.map(u => u.name).join()}</div> |
|
|
|
}, { |
|
|
|
title: '巡检次数统计', |
|
|
|
dataIndex: 'patrolCount', |
|
|
|
key: 'patrolCount', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
}, { |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'action', |
|
|
@ -127,23 +132,27 @@ function PatrolPlan (props) { |
|
|
|
dataSource={dataSource || []} |
|
|
|
rowKey='id' |
|
|
|
pagination={{ pageSize: 10 }} |
|
|
|
search={false} |
|
|
|
search={{ |
|
|
|
defaultCollapsed: false, |
|
|
|
labelWidth: 'auto', |
|
|
|
optionRender: (searchConfig, formProps, dom) => [ |
|
|
|
...dom.reverse(), |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
setType('create') |
|
|
|
setVisible(true) |
|
|
|
}} |
|
|
|
>新增巡检计划</Button>, |
|
|
|
], |
|
|
|
}} |
|
|
|
request={async (params = {}) => { |
|
|
|
const res = await dispatch(getPatrolPlan(params)); |
|
|
|
setDataSource(res?.payload.data?.rows); |
|
|
|
return { ...res }; |
|
|
|
}} |
|
|
|
onReset={() => { }} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
setType('create') |
|
|
|
setVisible(true) |
|
|
|
}} |
|
|
|
>新增巡检计划</Button> |
|
|
|
]} |
|
|
|
/> |
|
|
|
{ |
|
|
|
visible ? |
|
|
@ -162,7 +171,7 @@ function PatrolPlan (props) { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToProps(state) { |
|
|
|
const { auth } = state |
|
|
|
return { |
|
|
|
user: auth.user |
|
|
|