|
|
@ -6,7 +6,7 @@ import PlanTemplateModal from '../components/planTemplateModal'; |
|
|
|
import { createPatrolTemplate, delPatrolTemplate, updatePatrolTemplate, getPatrolTemplate } from '../actions/template'; |
|
|
|
import { getCheckItemsGroup } from '../actions/checkItems'; |
|
|
|
|
|
|
|
function PatrolTemplate (props) { |
|
|
|
function PatrolTemplate(props) { |
|
|
|
const { dispatch, user } = props; |
|
|
|
const tableRef = useRef(); |
|
|
|
const [dataSource, setDataSource] = useState([{}]); |
|
|
@ -27,12 +27,14 @@ function PatrolTemplate (props) { |
|
|
|
title: '模板描述', |
|
|
|
dataIndex: 'describe', |
|
|
|
key: 'describe', |
|
|
|
ellipsis: true |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
}, { |
|
|
|
title: '操作人', |
|
|
|
dataIndex: 'user.name', |
|
|
|
key: 'user.name', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
render: (t, r, i) => { |
|
|
|
return r.user ? r.user.name : '-' |
|
|
|
} |
|
|
@ -41,6 +43,7 @@ function PatrolTemplate (props) { |
|
|
|
dataIndex: 'checkItems', |
|
|
|
key: 'checkItems', |
|
|
|
ellipsis: true, |
|
|
|
search: false, |
|
|
|
render: (_, r) => { |
|
|
|
return r?.checkItems ? r?.checkItems.map(c => <Tag>{c.name}</Tag>) : '-' |
|
|
|
} |
|
|
@ -81,23 +84,26 @@ function PatrolTemplate (props) { |
|
|
|
dataSource={dataSource || []} |
|
|
|
rowKey='id' |
|
|
|
pagination={{ pageSize: 10 }} |
|
|
|
search={false} |
|
|
|
search={{ |
|
|
|
defaultCollapsed: false, |
|
|
|
optionRender: (searchConfig, formProps, dom) => [ |
|
|
|
...dom.reverse(), |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
setType('create') |
|
|
|
setVisible(true) |
|
|
|
}} |
|
|
|
>新增巡检模板</Button>, |
|
|
|
], |
|
|
|
}} |
|
|
|
request={async (params = {}) => { |
|
|
|
const res = await dispatch(getPatrolTemplate(params)); |
|
|
|
setDataSource(res?.payload.data?.rows); |
|
|
|
return { ...res }; |
|
|
|
}} |
|
|
|
onReset={() => { }} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
setType('create') |
|
|
|
setVisible(true) |
|
|
|
}} |
|
|
|
>新增巡检模板</Button> |
|
|
|
]} |
|
|
|
/> |
|
|
|
{ |
|
|
|
visible ? |
|
|
@ -116,7 +122,7 @@ function PatrolTemplate (props) { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToProps(state) { |
|
|
|
const { auth } = state |
|
|
|
return { |
|
|
|
user: auth.user |
|
|
|