import { styled } from 'styled-components'; import { useState, useEffect } from 'react'; import { TableStyle, TableInfo, ListOption } from '../../styles/Components'; import Button from '../../components/common/button/Button'; import VBPSearchBar from '../../components/IndexManage/VBPSearchBar'; import { VBPIndexExport, VbpIndexView } from '../../apis'; const VBPContent = () => { const token = sessionStorage.getItem('token'); let d = new Date(); const START_DATE = new Date(new Date(d.setDate(d.getDate() - 1)).setHours(0, 0, 0, 0)); const END_DATE = new Date(); const [sendDate, setSendDate] = useState(START_DATE); const [finishDate, setFinishDate] = useState(END_DATE); const [dataList, setDataList] = useState([]); useEffect(() => { fetchData(START_DATE, END_DATE); }, []); // console.log(dataList); const fetchData = async (startDate, endDate) => { const startDateToLocal = startDate.getFullYear() + '-' + (startDate.getMonth() + 1 < 9 ? '0' + (startDate.getMonth() + 1) : startDate.getMonth() + 1) + '-' + (startDate.getDate() < 9 ? '0' + startDate.getDate() : startDate.getDate()); const endDateToLocal = endDate.getFullYear() + '-' + (endDate.getMonth() + 1 < 9 ? '0' + (endDate.getMonth() + 1) : endDate.getMonth() + 1) + '-' + (endDate.getDate() < 9 ? '0' + endDate.getDate() : endDate.getDate()); setDataList(await VbpIndexView(token, startDateToLocal, endDateToLocal)); setSendDate(startDateToLocal); setFinishDate(endDateToLocal); }; // 엑셀 다운로드 const handleXlsxExport = () => { const fileName = 'Caliverse_VBP_Index.xlsx'; VBPIndexExport(token, fileName, sendDate, finishDate); }; return ( <>