瀏覽代碼

gen financail status report

tags/Baseline_30082024_FRONTEND_UAT
MSI\2Fi 1 年之前
父節點
當前提交
2c54e80b9f
共有 1 個文件被更改,包括 14 次插入6 次删除
  1. +14
    -6
      src/components/Report/FinancialStatusReportGen/FinancialStatusReportGen.tsx

+ 14
- 6
src/components/Report/FinancialStatusReportGen/FinancialStatusReportGen.tsx 查看文件

@@ -40,12 +40,20 @@ const GenFinancialStatusReport: React.FC<Props> = ({ projects, projectCombo }) =
<SearchBox
criteria={searchCriteria}
onSearch={async (query) => {
const projectIndex = projectCombo.findIndex((project) => `${project.code} - ${project.name}` === query.code)
console.log(projectCombo[projectIndex].id)
const response = await fetchProjectsFinancialStatusReport({ projectId: projects[projectIndex].id })
if (response) {
downloadFile(new Uint8Array(response.blobValue), response.filename!!)
}
if (query.code.length > 0 && query.code.toLocaleLowerCase() !== "all") {
const projectIndex = projectCombo.findIndex((project) => `${project.code} - ${project.name}` === query.code)
console.log(projectCombo[projectIndex].id)
const response = await fetchProjectsFinancialStatusReport({ projectId: projects[projectIndex].id })
if (response) {
downloadFile(new Uint8Array(response.blobValue), response.filename!!)
}
}else{
console.log(query.code)
const response = await fetchProjectsFinancialStatusReport({ projectId: -1 })
if (response) {
downloadFile(new Uint8Array(response.blobValue), response.filename!!)
}
}
}}
/>
{/* <DownloadReportButton /> */}


Loading…
取消
儲存