// excel Download
const excelFileDownload = async () => {
// eslint-disable-next-line max-len
const fileUrl = 'aaa.xlsx';
const res = await axios({
method: 'get',
url: fileUrl,
responseType: 'blob',
});
const newUrl = window.URL.createObjectURL(res.data);
const a = document.createElement('a');
a.href = newUrl;
a.download = 'aaa.xlsx';
a.click();
a.remove();
window.URL.revokeObjectURL(newUrl);
};
// excel Upload
const inputFileUpload = ref();
const fileUpload = () => {
const input = inputFileUpload.value as HTMLInputElement;
input.click();
};
const readFile = async () => {
const input = inputFileUpload.value as HTMLInputElement;
if (input && input.files) {
const targetFile = input.files[0];
const formData = new FormData();
formData.append('file', targetFile);
const res = await custom_api({
params: formData,
});
if (res.isOK) {
// 데이터 처리
}
}
};