diff --git a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js index 4969fc5..c0582d2 100644 --- a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js +++ b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Button, Card, Col, Row, CustomInput } from 'reactstrap'; import { GridDatabase } from '../../../crud/grid/GridDatatable'; import { Link } from 'react-router-dom'; +import { selectableRowsComponent } from '../../../crud/grid/selectableRowsComponent'; const FlightPlanAprvGrid = ({ data, @@ -10,8 +11,6 @@ const FlightPlanAprvGrid = ({ handleClickAprv, joinList, selectGroup, - selPlanSnoList, - setSelPlanSnoList, handleChangeCheckbox }) => { const [aprvAuth, setAprvAuth] = useState(''); @@ -48,24 +47,13 @@ const FlightPlanAprvGrid = ({ { id: 'planSno', name: '번호', - cell: (row, i) => ( - <> - {/* handleChangeCheckbox(e, row)} - /> */} -
{i + 1}
- - ) + cell: (row, i) =>
{i + 1}
}, { id: 'fltPurpose', name: '비행목적', minWidth: '150px', - cell: row =>
{row.fltPurpose}
+ cell: (row, i) =>
{row.fltPurpose}
}, { id: 'fltMethod', @@ -142,6 +130,7 @@ const FlightPlanAprvGrid = ({ count={!!data ? data.length : 0} // pagination={props.pagination} selectableRows + selectableRowsComponent={selectableRowsComponent} onSelectedRowsChange={handleChangeSelected} /> {/* 검색된 데이터가 없습니다. */} diff --git a/src/components/crud/grid/GridDatatable.js b/src/components/crud/grid/GridDatatable.js index 07aef16..e3e364a 100644 --- a/src/components/crud/grid/GridDatatable.js +++ b/src/components/crud/grid/GridDatatable.js @@ -7,38 +7,42 @@ import { File, ChevronDown } from 'react-feather'; +import { selectableRowsComponent } from './selectableRowsComponent'; export const GridDatabase = props => { return props[`${props.handlerPageChange ? 'total' : 'count'}`] <= 0 ? (
표시할 데이터가 없습니다.
) : ( <> - } - className='react-dataTable pal-dateTable' - // defaultSortField='invoiceId' - // paginationDefaultPage={currentPage} - // paginationComponent={CustomPagination} - data={props.data} - paginationServer={ - props.pagination && props.handlerPageChange ? true : false - } - onSelectedRowsChange={ - props.onSelectedRowsChange ? props.onSelectedRowsChange : null - } - selectableRows={props.selectableRows} - onChangePage={props.pagination ? props.handlerPageChange : null} - paginationComponentOptions={{ - noRowsPerPage: props.handlerPageChange ? true : false - }} - /> +
+ } + className='react-dataTable pal-dateTable' + // defaultSortField='invoiceId' + // paginationDefaultPage={currentPage} + // paginationComponent={CustomPagination} + data={props.data} + paginationServer={ + props.pagination && props.handlerPageChange ? true : false + } + onChangePage={props.pagination ? props.handlerPageChange : null} + paginationComponentOptions={{ + noRowsPerPage: props.handlerPageChange ? true : false + }} + selectableRows={props.selectableRows} + selectableRowsComponent={props.selectableRowsComponent} + onSelectedRowsChange={ + props.onSelectedRowsChange ? props.onSelectedRowsChange : null + } + /> +
); }; diff --git a/src/components/crud/grid/selectableRowsComponent.js b/src/components/crud/grid/selectableRowsComponent.js new file mode 100644 index 0000000..8a761b9 --- /dev/null +++ b/src/components/crud/grid/selectableRowsComponent.js @@ -0,0 +1,17 @@ +import { CustomInput, Input } from 'reactstrap'; +import React from 'react'; + +export const selectableRowsComponent = React.forwardRef( + ({ onClick, ...rest }, ref) => { + return ( + <> + + + ); + } +); diff --git a/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js index 89203ef..56f285d 100644 --- a/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js +++ b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js @@ -173,29 +173,30 @@ const FlightPlanAprvContainer = () => { })); }; const handleChangeSelected = ({ selectedRows }) => { - setSelPlanSnoList(selectedRows.map(item => item.planSno)); + console.log(selectedRows); + setSelPlanSnoList(selectedRows?.map(item => item.planSno)); }; - const handleChangeCheckbox = (e, row) => { - const { checked } = e.target; + // const handleChangeCheckbox = (e, row) => { + // const { checked } = e.target; - const dupli = selPlanSnoList?.find(prev => { - if (prev.planSno === row.planSno) { - return true; - } - }); - if (checked) { - if (!dupli) { - setSelPlanSnoList([...selPlanSnoList, row.planSno]); - } - } else { - const list = selPlanSnoList.filter(prev => { - if (prev !== row.planSno) { - return prev; - } - }); - setSelPlanSnoList(list); - } - }; + // const dupli = selPlanSnoList?.find(prev => { + // if (prev.planSno === row.planSno) { + // return true; + // } + // }); + // if (checked) { + // if (!dupli) { + // setSelPlanSnoList([...selPlanSnoList, row.planSno]); + // } + // } else { + // const list = selPlanSnoList.filter(prev => { + // if (prev !== row.planSno) { + // return prev; + // } + // }); + // setSelPlanSnoList(list); + // } + // }; const handleClickAprv = type => e => { // notAprov, aprv @@ -265,7 +266,7 @@ const FlightPlanAprvContainer = () => { handleChangeSelected={handleChangeSelected} selPlanSnoList={selPlanSnoList} setSelPlanSnoList={setSelPlanSnoList} - handleChangeCheckbox={handleChangeCheckbox} + // handleChangeCheckbox={handleChangeCheckbox} /> ) : ( diff --git a/src/containers/basis/group/BasisGroupContainer.js b/src/containers/basis/group/BasisGroupContainer.js index 717b9d9..bf84015 100644 --- a/src/containers/basis/group/BasisGroupContainer.js +++ b/src/containers/basis/group/BasisGroupContainer.js @@ -12,7 +12,7 @@ export const BasisGroupContainer = props => { const { myList, myListCount, mainList, mainListCount } = useSelector( state => state.groupState ); - console.log(mainList); + const { user } = useSelector(state => state.authState); const dispatch = useDispatch(); diff --git a/src/containers/basis/group/BasisGroupUsersContainer.js b/src/containers/basis/group/BasisGroupUsersContainer.js index ca002a6..ff151a2 100644 --- a/src/containers/basis/group/BasisGroupUsersContainer.js +++ b/src/containers/basis/group/BasisGroupUsersContainer.js @@ -191,12 +191,14 @@ export const BasisGroupUsersContainer = props => { }, []); const handlerSearch = () => { - dispatch( - Actions.USER_LIST.request({ - searchParams: params, - cstmrSno: user?.cstmrSno - }) - ); + if (params.cstmrSno && user?.cstmrSno) { + dispatch( + Actions.USER_LIST.request({ + searchParams: params, + cstmrSno: user?.cstmrSno + }) + ); + } }; const handlerAdminConfirm = cstmrGroupSno => { diff --git a/src/modules/basis/group/reducers/basisGroupReducer.ts b/src/modules/basis/group/reducers/basisGroupReducer.ts index 56edbde..8dfdbcb 100644 --- a/src/modules/basis/group/reducers/basisGroupReducer.ts +++ b/src/modules/basis/group/reducers/basisGroupReducer.ts @@ -33,7 +33,6 @@ export const groupReducer = createReducer( .handleAction(Actions.GROUP_MAIN_LIST.success, (state, action) => produce(state, draft => { const { data, count } = action.payload; - console.log(data); // const agreeList = data.filter(res => { // if (res.aprvlYn === 'Y') { // return res;