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,28 +30,36 @@ const loading = ref(false) ...@@ -28,28 +30,36 @@ 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
LuckyExcel.transformExcelToLuckyByUrl( try {
'/api/sys/static/' + path, const res = await axios.get('/api/sys/static/' + path)
new Date().getTime() + '.xlsx', LuckyExcel.transformExcelToLuckyByUrl(
async (exportJson: any) => { '/api/sys/static/' + path,
luckysheet.create({ new Date().getTime() + '.xlsx',
container: 'preview-excel', //luckysheet is the container id async (exportJson: any) => {
showinfobar: false, luckysheet.create({
showtoolbar: false, container: 'preview-excel', //luckysheet is the container id
showsheetbar: false, showinfobar: false,
showsheetbarConfig, showtoolbar: false,
cellRightClickConfig, showsheetbar: false,
sheetRightClickConfig, showsheetbarConfig,
showstatisticBarConfig, cellRightClickConfig,
data: exportJson.sheets, sheetRightClickConfig,
title: exportJson.info.name, showstatisticBarConfig,
userInfo: exportJson.info.name.creator 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 = () => { 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