Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-baoshen-excel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何远江
topsun-baoshen-excel
Commits
b504e336
Commit
b504e336
authored
Oct 18, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报错信息修改
parent
bb5bc95e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
19 deletions
+29
-19
index.vue
src/components/PreviewExcel/index.vue
+29
-19
No files found.
src/components/PreviewExcel/index.vue
View file @
b504e336
...
...
@@ -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
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment