Browse Source

비행계획승인 - 체크박스 작업

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
e7271ce927
  1. 9
      src/components/basis/flight/aprv/FlightPlanAprvGrid.js
  2. 10
      src/components/crud/grid/GridDatatable.js
  3. 17
      src/components/crud/grid/selectableRowsComponent.js
  4. 1
      src/containers/basis/flight/aprv/FlightPlanAprvContainer.js
  5. 4
      src/containers/basis/flight/plan/FlightPlanDetailContainer.js

9
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 { Button, Card, Col, Row, CustomInput } from 'reactstrap';
import { GridDatabase } from '../../../crud/grid/GridDatatable'; import { GridDatabase } from '../../../crud/grid/GridDatatable';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { selectableRowsComponent } from '../../../crud/grid/selectableRowsComponent';
const FlightPlanAprvGrid = ({ const FlightPlanAprvGrid = ({
data, data,
@ -50,13 +51,13 @@ const FlightPlanAprvGrid = ({
name: '번호', name: '번호',
cell: (row, i) => ( cell: (row, i) => (
<> <>
{/* <CustomInput <CustomInput
type='checkbox' type='checkbox'
id={`check${i + 1}`} id={`check${i + 1}`}
name={`check${i + 1}`} name={`check${i + 1}`}
// checked={checkState} // checked={checkState}
onChange={e => handleChangeCheckbox(e, row)} onChange={e => handleChangeCheckbox(e, row)}
/> */} />
<div>{i + 1}</div> <div>{i + 1}</div>
</> </>
) )
@ -141,8 +142,10 @@ const FlightPlanAprvGrid = ({
columns={columns} columns={columns}
count={!!data ? data.length : 0} count={!!data ? data.length : 0}
// pagination={props.pagination} // pagination={props.pagination}
selectableRows selectableRows //체크박스 할거다
selectableRowsComponent={selectableRowsComponent}
onSelectedRowsChange={handleChangeSelected} onSelectedRowsChange={handleChangeSelected}
// onSelectedRowsChange={handleChangeCheckbox}
/> />
{/* 검색된 데이터가 없습니다. */} {/* 검색된 데이터가 없습니다. */}
</div> </div>

10
src/components/crud/grid/GridDatatable.js

@ -7,6 +7,7 @@ import {
File, File,
ChevronDown ChevronDown
} from 'react-feather'; } from 'react-feather';
import { selectableRowsComponent } from './selectableRowsComponent';
export const GridDatabase = props => { export const GridDatabase = props => {
return props[`${props.handlerPageChange ? 'total' : 'count'}`] <= 0 ? ( return props[`${props.handlerPageChange ? 'total' : 'count'}`] <= 0 ? (
@ -30,14 +31,15 @@ export const GridDatabase = props => {
paginationServer={ paginationServer={
props.pagination && props.handlerPageChange ? true : false props.pagination && props.handlerPageChange ? true : false
} }
onSelectedRowsChange={
props.onSelectedRowsChange ? props.onSelectedRowsChange : null
}
selectableRows={props.selectableRows}
onChangePage={props.pagination ? props.handlerPageChange : null} onChangePage={props.pagination ? props.handlerPageChange : null}
paginationComponentOptions={{ paginationComponentOptions={{
noRowsPerPage: props.handlerPageChange ? true : false noRowsPerPage: props.handlerPageChange ? true : false
}} }}
selectableRows={props.selectableRows}
selectableRowsComponent={props.selectableRowsComponent}
onSelectedRowsChange={
props.onSelectedRowsChange ? props.onSelectedRowsChange : null
}
/> />
</> </>
); );

17
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) => {
console.log(rest);
return (
<CustomInput
id='check'
type='checkbox'
// forwardref={ref}
onClick={onClick}
{...rest}
/>
);
}
);

1
src/containers/basis/flight/aprv/FlightPlanAprvContainer.js

@ -173,6 +173,7 @@ const FlightPlanAprvContainer = () => {
})); }));
}; };
const handleChangeSelected = ({ selectedRows }) => { const handleChangeSelected = ({ selectedRows }) => {
console.log(selectedRows);
setSelPlanSnoList(selectedRows.map(item => item.planSno)); setSelPlanSnoList(selectedRows.map(item => item.planSno));
}; };
const handleChangeCheckbox = (e, row) => { const handleChangeCheckbox = (e, row) => {

4
src/containers/basis/flight/plan/FlightPlanDetailContainer.js

@ -45,9 +45,9 @@ const FlightPlanDetailContainer = () => {
let cTime = new Date(); let cTime = new Date();
let pTime = new Date(date); let pTime = new Date(date);
if (cTime > pTime) { if (cTime > pTime) {
setIsDone(true); // setIsDone(true);
} else { } else {
setIsDone(false); // setIsDone(false);
} }
} }
}, [date]); }, [date]);

Loading…
Cancel
Save