Commit b504e336 authored by 何远江's avatar 何远江

报错信息修改

parent bb5bc95e
...@@ -20,6 +20,8 @@ import { ...@@ -20,6 +20,8 @@ import {
} from '@/constants/excelConfig' } from '@/constants/excelConfig'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { isFunction } from '@/utils/is' import { isFunction } from '@/utils/is'
import axios from 'axios'
import { ElMessage } from 'element-plus'
const filePath = ref('') const filePath = ref('')
const props = defineProps(['fileId', 'type']) const props = defineProps(['fileId', 'type'])
...@@ -28,9 +30,11 @@ const loading = ref(false) ...@@ -28,9 +30,11 @@ const loading = ref(false)
const route = useRoute() const route = useRoute()
/**生成excel */ /**生成excel */
const generateExcel = (path: string) => { const generateExcel = async (path: string) => {
// 保存浏览文件的地址 // 保存浏览文件的地址
filePath.value = path filePath.value = path
try {
const res = await axios.get('/api/sys/static/' + path)
LuckyExcel.transformExcelToLuckyByUrl( LuckyExcel.transformExcelToLuckyByUrl(
'/api/sys/static/' + path, '/api/sys/static/' + path,
new Date().getTime() + '.xlsx', new Date().getTime() + '.xlsx',
...@@ -50,6 +54,12 @@ const generateExcel = (path: string) => { ...@@ -50,6 +54,12 @@ const generateExcel = (path: string) => {
}) })
} }
) )
} catch (e) {
console.log(e, 'eeee')
if (e?.response) {
ElMessage.error(e.response.data.message)
}
}
} }
const downloadFile = () => { const downloadFile = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment