|
@ -3,11 +3,10 @@ import { connect } from 'react-redux'; |
|
|
import { Button, Popconfirm } from 'antd'; |
|
|
import { Button, Popconfirm } from 'antd'; |
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
import CheckItemsModal from '../components/checkItemsModal'; |
|
|
import CheckItemsModal from '../components/checkItemsModal'; |
|
|
import { createPatrolPlan, delPatrolPlan, updatePatrolPlan } from '../actions/plan'; |
|
|
import { getCheckItems, createCheckItems, updateCheckItems, delCheckItems, createCheckItemsGroup } from '../actions/checkItems'; |
|
|
import { getCheckItems, createCheckItems, updateCheckItems, createCheckItemsGroup } from '../actions/checkItems'; |
|
|
|
|
|
|
|
|
|
|
|
function CheckItems(props) { |
|
|
function CheckItems(props) { |
|
|
const { dispatch, user } = props; |
|
|
const { dispatch } = props; |
|
|
const tableRef = useRef(); |
|
|
const tableRef = useRef(); |
|
|
const [dataSource, setDataSource] = useState([{}]); |
|
|
const [dataSource, setDataSource] = useState([{}]); |
|
|
const [visible, setVisible] = useState(false); |
|
|
const [visible, setVisible] = useState(false); |
|
@ -45,6 +44,14 @@ function CheckItems(props) { |
|
|
setVisible(false); |
|
|
setVisible(false); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function delItems(ids) { |
|
|
|
|
|
dispatch(delCheckItems(ids)).then(res => { |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
tableRef.current.reload(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const columns = [{ |
|
|
const columns = [{ |
|
|
title: '检查项', |
|
|
title: '检查项', |
|
|
dataIndex: 'name', |
|
|
dataIndex: 'name', |
|
@ -75,13 +82,7 @@ function CheckItems(props) { |
|
|
}}>修改</Button> |
|
|
}}>修改</Button> |
|
|
<Popconfirm |
|
|
<Popconfirm |
|
|
title="确认删除?" |
|
|
title="确认删除?" |
|
|
onConfirm={() => { |
|
|
onConfirm={() => { delItems(record.id) }}> |
|
|
dispatch(delPatrolPlan(record.id)).then(res => { |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
tableRef.current.reload(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}}> |
|
|
|
|
|
<Button type="link" danger>删除</Button> |
|
|
<Button type="link" danger>删除</Button> |
|
|
</Popconfirm> |
|
|
</Popconfirm> |
|
|
</> |
|
|
</> |
|
@ -98,7 +99,11 @@ function CheckItems(props) { |
|
|
rowKey='id' |
|
|
rowKey='id' |
|
|
pagination={{ pageSize: 10 }} |
|
|
pagination={{ pageSize: 10 }} |
|
|
request={async (params = {}) => { |
|
|
request={async (params = {}) => { |
|
|
const res = await dispatch(getCheckItems(params)); |
|
|
const res = await dispatch(getCheckItems({ |
|
|
|
|
|
limit: params.pageSize, |
|
|
|
|
|
page: params.current - 1, |
|
|
|
|
|
name: params?.name |
|
|
|
|
|
})); |
|
|
setDataSource(res?.payload.data?.rows); |
|
|
setDataSource(res?.payload.data?.rows); |
|
|
return { ...res }; |
|
|
return { ...res }; |
|
|
}} |
|
|
}} |
|
@ -118,9 +123,10 @@ function CheckItems(props) { |
|
|
<Button |
|
|
<Button |
|
|
key="del" |
|
|
key="del" |
|
|
type='primary' |
|
|
type='primary' |
|
|
|
|
|
disabled={!select?.length} |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
// const values = searchConfig?.form?.getFieldsValue();
|
|
|
const ids = select?.map(s => s.id).join(); |
|
|
// console.log(values);
|
|
|
delItems(ids); |
|
|
}} |
|
|
}} |
|
|
>批量删除</Button>, |
|
|
>批量删除</Button>, |
|
|
], |
|
|
], |
|
|