|
|
|
@ -15,7 +15,7 @@ import MuiDataGrid from 'views/form/MuiDataGrid';
|
|
|
|
|
|
|
|
|
|
import xitCmm from 'commons/XitCmm';
|
|
|
|
|
import CmmModal from 'views/form/Modal/CmmModal';
|
|
|
|
|
import SaveParkingSimsaForm from './SaveParkingSimsaForm';
|
|
|
|
|
import SaveParkingTargetForm from './SaveParkingTargetForm';
|
|
|
|
|
import NumberFormat from 'react-number-format';
|
|
|
|
|
import ExcelDownload from 'views/form/ExcelDownload';
|
|
|
|
|
import { findParkingTargets, saveParkingTargets } from 'apis/parking';
|
|
|
|
@ -24,7 +24,7 @@ const ParkingRegister = () => {
|
|
|
|
|
const [rcIrTransfer, setRcIrTransfer] = useState('1');
|
|
|
|
|
const [rcSeq1, setRcSeq1] = useState('2022200801');
|
|
|
|
|
const [rcSeq2, setRcSeq2] = useState('2022200899');
|
|
|
|
|
const [selection, setSelection] = useState([]);
|
|
|
|
|
const [selectionModel, setSelectionModel] = useState([]);
|
|
|
|
|
const [totalCount, setTotalCount] = useState(0);
|
|
|
|
|
const [rowsStatus, setRowsStatus] = useState({
|
|
|
|
|
page: 0,
|
|
|
|
@ -60,6 +60,7 @@ const ParkingRegister = () => {
|
|
|
|
|
|
|
|
|
|
findParkingTargets(params).then((response) => {
|
|
|
|
|
if (response && response.data) {
|
|
|
|
|
setSelectionModel([]);
|
|
|
|
|
setTotalCount(response.count);
|
|
|
|
|
setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data }));
|
|
|
|
|
}
|
|
|
|
@ -67,7 +68,7 @@ const ParkingRegister = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSave = () => {
|
|
|
|
|
if (selection.length === 0) {
|
|
|
|
|
if (selectionModel.length === 0) {
|
|
|
|
|
xitCmm.alertParam(`처리할 데이타가 없습니다`);
|
|
|
|
|
} else {
|
|
|
|
|
setOpen(true);
|
|
|
|
@ -75,19 +76,19 @@ const ParkingRegister = () => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const submitParkingSimsa = (params) => {
|
|
|
|
|
const submitParkingTargets = (params) => {
|
|
|
|
|
const param = {
|
|
|
|
|
...params,
|
|
|
|
|
rcIrTransfer,
|
|
|
|
|
rcSeq1,
|
|
|
|
|
rcSeq2,
|
|
|
|
|
rcCodes: selection.map((d) => rowsStatus.rows[d - 1].rcCode)
|
|
|
|
|
rcCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].rcCode)
|
|
|
|
|
};
|
|
|
|
|
setOpen(false);
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
|
|
saveParkingTargets(param).then(() => {
|
|
|
|
|
setSelection([]);
|
|
|
|
|
setSelectionModel([]);
|
|
|
|
|
search();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
@ -105,7 +106,7 @@ const ParkingRegister = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSelection = (newSelection) => {
|
|
|
|
|
setSelection(newSelection);
|
|
|
|
|
setSelectionModel(newSelection);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@ -166,7 +167,7 @@ const ParkingRegister = () => {
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item>
|
|
|
|
|
<Button
|
|
|
|
|
disabled={selection.length === 0}
|
|
|
|
|
disabled={selectionModel.length === 0}
|
|
|
|
|
variant="contained"
|
|
|
|
|
color="primary"
|
|
|
|
|
size="small"
|
|
|
|
@ -197,9 +198,10 @@ const ParkingRegister = () => {
|
|
|
|
|
totalCount={totalCount}
|
|
|
|
|
setRowsStatus={setRowsStatus}
|
|
|
|
|
handleSelection={handleSelection}
|
|
|
|
|
selectionModel={selectionModel}
|
|
|
|
|
/>
|
|
|
|
|
<CmmModal isBackdrop title="심의등록" open={open} setOpen={setOpen}>
|
|
|
|
|
<SaveParkingSimsaForm isDisabled={selection.length === 0} handleModalSave={submitParkingSimsa} />
|
|
|
|
|
<SaveParkingTargetForm isDisabled={selectionModel.length === 0} handleModalSave={submitParkingTargets} />
|
|
|
|
|
</CmmModal>
|
|
|
|
|
</MainCard>
|
|
|
|
|
);
|