MCPcopy
hub / github.com/1Panel-dev/MaxKB / exportExcel

Function exportExcel

ui/src/request/index.ts:231–253  ·  view source on GitHub ↗
(
  fileName: string,
  url: string,
  params: any,
  loading?: NProgress | Ref<boolean>,
)

Source from the content-addressed store, hash-verified

229 params: any,
230 loading?: NProgress | Ref<boolean>,
231) => Promise<any> = (
232 fileName: string,
233 url: string,
234 params: any,
235 loading?: NProgress | Ref<boolean>,
236) => {
237 return promise(request({ url: url, method: 'get', params, responseType: 'blob' }), loading).then(
238 (res: any) => {
239 if (res) {
240 const blob = new Blob([res], {
241 type: 'application/vnd.ms-excel',
242 })
243 const link = document.createElement('a')
244 link.href = window.URL.createObjectURL(blob)
245 link.download = fileName
246 link.click()
247 //释放内存
248 window.URL.revokeObjectURL(link.href)
249 }
250 return true
251 },
252 )
253}
254
255function extractFilename(contentDisposition: string) {
256 if (!contentDisposition) return null

Callers 12

exportDocumentFunction · 0.90
exportQATemplateFunction · 0.90
exportTableTemplateFunction · 0.90
exportKnowledgeFunction · 0.90
exportDocumentFunction · 0.90
exportQATemplateFunction · 0.90
exportTableTemplateFunction · 0.90
exportKnowledgeFunction · 0.90
exportDocumentFunction · 0.90
exportQATemplateFunction · 0.90
exportTableTemplateFunction · 0.90
exportKnowledgeFunction · 0.90

Calls 1

promiseFunction · 0.70

Tested by

no test coverage detected