Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lottery
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
hewenhao
lottery
Commits
da937d70
Commit
da937d70
authored
Oct 09, 2025
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加导出功能
parent
7caf7c4b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
Result.vue
src/components/Result.vue
+21
-0
No files found.
src/components/Result.vue
View file @
da937d70
...
@@ -42,6 +42,11 @@
...
@@ -42,6 +42,11 @@
</div>
</div>
</div>
</div>
</el-scrollbar>
</el-scrollbar>
<template
#
footer
>
<el-button
type=
"primary"
@
click=
"exportData"
>
导出数据
</el-button>
</
template
>
</art-dialog>
</art-dialog>
</template>
</template>
<
script
>
<
script
>
...
@@ -106,6 +111,22 @@ export default {
...
@@ -106,6 +111,22 @@ export default {
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
})
})
},
// 导出为csv 文件
exportData
()
{
const
data
=
[[
'奖项'
,
'中奖人'
]]
this
.
resultList
.
forEach
(
item
=>
{
item
.
value
.
forEach
(
subItem
=>
{
data
.
push
([
item
.
name
,
subItem
.
name
||
subItem
.
index
])
})
})
const
csvContent
=
data
.
map
(
row
=>
row
.
join
(
','
)).
join
(
'
\
n'
)
const
blob
=
new
Blob
([
csvContent
],
{
type
:
'text/csv;charset=utf-8;'
})
const
url
=
URL
.
createObjectURL
(
blob
)
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
url
a
.
download
=
'result.csv'
a
.
click
()
}
}
}
}
}
}
...
...
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