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