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

报错信息修改

parent bb5bc95e
......@@ -20,6 +20,8 @@ import {
} from '@/constants/excelConfig'
import { useRoute } from 'vue-router'
import { isFunction } from '@/utils/is'
import axios from 'axios'
import { ElMessage } from 'element-plus'
const filePath = ref('')
const props = defineProps(['fileId', 'type'])
......@@ -28,28 +30,36 @@ const loading = ref(false)
const route = useRoute()
/**生成excel */
const generateExcel = (path: string) => {
const generateExcel = async (path: string) => {
// 保存浏览文件的地址
filePath.value = path
LuckyExcel.transformExcelToLuckyByUrl(
'/api/sys/static/' + path,
new Date().getTime() + '.xlsx',
async (exportJson: any) => {
luckysheet.create({
container: 'preview-excel', //luckysheet is the container id
showinfobar: false,
showtoolbar: false,
showsheetbar: false,
showsheetbarConfig,
cellRightClickConfig,
sheetRightClickConfig,
showstatisticBarConfig,
data: exportJson.sheets,
title: exportJson.info.name,
userInfo: exportJson.info.name.creator
})
try {
const res = await axios.get('/api/sys/static/' + path)
LuckyExcel.transformExcelToLuckyByUrl(
'/api/sys/static/' + path,
new Date().getTime() + '.xlsx',
async (exportJson: any) => {
luckysheet.create({
container: 'preview-excel', //luckysheet is the container id
showinfobar: false,
showtoolbar: false,
showsheetbar: false,
showsheetbarConfig,
cellRightClickConfig,
sheetRightClickConfig,
showstatisticBarConfig,
data: exportJson.sheets,
title: exportJson.info.name,
userInfo: exportJson.info.name.creator
})
}
)
} catch (e) {
console.log(e, 'eeee')
if (e?.response) {
ElMessage.error(e.response.data.message)
}
)
}
}
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