修改useDownloadBlob实现错误

master
LiuJiaNan 2025-11-11 17:08:43 +08:00
parent 72be04d42b
commit 967105f3d0
3 changed files with 3 additions and 8 deletions

View File

@ -63,7 +63,7 @@ function HiddenLevelSelectTree(props) {
}, []); }, []);
return ( return (
<BasicSelectTree treeData={treeData} placeholder="隐患级别" nameKey="dictLabel" idKey="dictValue" {...restProps} /> <BasicSelectTree treeData={treeData} placeholder="隐患级别" onlyLastLevel={true} nameKey="dictLabel" idKey="dictValue" {...restProps} />
); );
} }

View File

@ -7,12 +7,7 @@ interface UseDownloadBlobOptions {
params?: Record<string, any>; params?: Record<string, any>;
} }
export interface downloadBlobOptions { export type DownloadBlobFunction = (url: string, options: UseDownloadBlobOptions) => Promise<any>;
url: string;
options?: UseDownloadBlobOptions;
}
export type DownloadBlobFunction = (options: downloadBlobOptions) => Promise<any>;
/** /**
* Blob * Blob

View File

@ -18,7 +18,7 @@ export default function useDownloadBlob(returnType = "object") {
return reject(new Error("请传入 url")); return reject(new Error("请传入 url"));
const { name = "", type = "", params = {} } = options; const { name = "", type = "", params = {} } = options;
const finalUrl = (process.env.app.API_HOST || window.__JJB_ENVIRONMENT__.API_HOST) + url; const finalUrl = new URL((process.env.app.API_HOST || window.__JJB_ENVIRONMENT__.API_HOST) + url);
Object.entries(params).forEach(([key, value]) => { Object.entries(params).forEach(([key, value]) => {
finalUrl.searchParams.append(key, value); finalUrl.searchParams.append(key, value);
}); });