修改资料库
This commit is contained in:
@@ -19,7 +19,7 @@ import TableHeader from '@/components/table/header/index.vue'
|
||||
import { libtemplateDel } from '@/api/supervision-boot/database/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import { getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
||||
import PopupEdit from './components/form.vue'
|
||||
defineOptions({
|
||||
name: 'database/stencil'
|
||||
@@ -50,7 +50,7 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
window.open(window.location.origin + '/#/previewFile?' + row.name)
|
||||
window.open(window.location.origin + '/#/previewFile?' + row.url)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -101,16 +101,27 @@ const tableStore = new TableStore({
|
||||
const addUser = () => {
|
||||
popupEditRef.value.open('新增模版')
|
||||
}
|
||||
|
||||
// 下载报告
|
||||
const downloadTheReport = (url: string) => {
|
||||
// getFileNameAndFilePath({ filePath: url }).then((res: any) => {
|
||||
// const link = document.createElement('a')
|
||||
// link.href = res.data.url
|
||||
// link.download = res.data.name
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
// document.body.removeChild(link)
|
||||
// })
|
||||
let urls = url
|
||||
let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
|
||||
downloadFile({ filePath: url }).then((res: any) => {
|
||||
let blob = new Blob([res], {
|
||||
type: urls.includes('.pdf')
|
||||
? 'application/pdf'
|
||||
: urls.includes('.docx')
|
||||
? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
: ''
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = name
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
})
|
||||
}
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
Reference in New Issue
Block a user