修改useDownloadBlob实现错误
parent
72be04d42b
commit
967105f3d0
|
|
@ -63,7 +63,7 @@ function HiddenLevelSelectTree(props) {
|
|||
}, []);
|
||||
|
||||
return (
|
||||
<BasicSelectTree treeData={treeData} placeholder="隐患级别" nameKey="dictLabel" idKey="dictValue" {...restProps} />
|
||||
<BasicSelectTree treeData={treeData} placeholder="隐患级别" onlyLastLevel={true} nameKey="dictLabel" idKey="dictValue" {...restProps} />
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ interface UseDownloadBlobOptions {
|
|||
params?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface downloadBlobOptions {
|
||||
url: string;
|
||||
options?: UseDownloadBlobOptions;
|
||||
}
|
||||
|
||||
export type DownloadBlobFunction = (options: downloadBlobOptions) => Promise<any>;
|
||||
export type DownloadBlobFunction = (url: string, options: UseDownloadBlobOptions) => Promise<any>;
|
||||
|
||||
/**
|
||||
* 下载Blob流文件
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export default function useDownloadBlob(returnType = "object") {
|
|||
return reject(new Error("请传入 url"));
|
||||
|
||||
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]) => {
|
||||
finalUrl.searchParams.append(key, value);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue