Merge pull request #18 from SDSRV-IDP/fix/fe-bugs

Fix download filename
This commit is contained in:
Đỗ Xuân Tân 2024-02-06 10:16:43 +07:00 committed by GitHub Enterprise
commit b11b08476e
2 changed files with 9 additions and 5 deletions

View File

@ -133,7 +133,7 @@ const columns: TableColumnsType<DataType> = [
key: 'snImeiAAR',
width: '130px',
render: (_, record) => {
const isAbnormal = record.snImeiAAR * 100 < 98;
const isAbnormal = record.snImeiAAR * 100 < 95;
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{(record.snImeiAAR * 100)?.toFixed(2)}

View File

@ -94,8 +94,10 @@ export async function downloadReport(report_id: string) {
let filename = "report.xlsx";
try {
let basename = response.headers['content-disposition'].split('filename=')[1].split('.')[0];
let extension = response.headers['content-disposition'].split('.')[1].split(';')[0];
filename = `${basename}.${extension}`
if (basename[0] == '_') {
basename = basename.substring(1);
}
filename = `${basename}.xlsx`
} catch(err) {
console.log(err);
}
@ -123,8 +125,10 @@ export async function downloadDashboardReport(duration='30d', subsidiary='ALL')
let filename = "report.xlsx";
try {
let basename = response.headers['content-disposition'].split('filename=')[1].split('.')[0];
let extension = response.headers['content-disposition'].split('.')[1].split(';')[0];
filename = `${basename}.${extension}`
if (basename[0] == '_') {
basename = basename.substring(1);
}
filename = `${basename}.xlsx`
} catch(err) {
console.log(err);
}