修改useDownloadBlob实现错误
parent
72be04d42b
commit
967105f3d0
|
|
@ -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} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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流文件
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue