[200~
This commit is contained in:
parent
d880d2ddc9
commit
843da7c933
@ -8,7 +8,7 @@ import PageTitle from '../../../components/pageTitle/PageTitle'
|
||||
import { IndustryInfoView } from '../../../styles/layouts/industryInfo/IndustryInfoView'
|
||||
import InputUploadPdf from '../../../components/inputUploadPdf/inputUpload';
|
||||
import { api } from '../../../services/api'
|
||||
import PdfThumbnail from 'react-pdf-thumbnail';
|
||||
// import PdfThumbnail from 'react-pdf-thumbnail';
|
||||
|
||||
import FormData from 'form-data';
|
||||
|
||||
@ -58,12 +58,12 @@ export default function industryInfo({userName}: any) {
|
||||
<IndustryInfoView>
|
||||
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
|
||||
PDF Baixado com Sucesso!
|
||||
PDF enviado com Sucesso!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
||||
PDF não baixado!
|
||||
Falha ao enviar PDF!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Head>
|
||||
|
||||
@ -36,8 +36,24 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
|
||||
setUnidade(event.target.value);
|
||||
};
|
||||
|
||||
function stringToBytes(text) {
|
||||
const length = text.length;
|
||||
const result = new Uint8Array(length);
|
||||
for (let i = 0; i < length; i++) {
|
||||
const code = text.charCodeAt(i);
|
||||
const byte = code > 255 ? 32 : code;
|
||||
result[i] = byte;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// const originalString = 'ååå';
|
||||
// const bytes = stringToBytes(originalString);
|
||||
// const blob = new Blob([bytes.buffer], { type: 'text/plain; charset=ISO-8859-1' });
|
||||
|
||||
function downloadCSVFile(csv, filename) {
|
||||
const csv_file = new Blob([csv], {type: "text/csv"});
|
||||
|
||||
const csv_file = new Blob(["\ufeff",csv], {type: "text/csv"});
|
||||
|
||||
const download_link = document.createElement("a");
|
||||
|
||||
@ -63,7 +79,8 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
|
||||
row.push(cols[j].innerText);
|
||||
}
|
||||
|
||||
data.push(row.join(","));
|
||||
|
||||
data.push(row.join(";"));
|
||||
}
|
||||
|
||||
downloadCSVFile(data.join("\n"), filename);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user