Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporateCulture-qd
Overview
Overview
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
王立鹏
corporateCulture-qd
Commits
e6d3866d
Commit
e6d3866d
authored
Feb 13, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 20331】 feat: 加入导入excel和导出excel 相关的按钮组件,用于后台
parent
e8385acb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletions
+43
-1
index.vue
src/components/common/ExportExcelBtn/index.vue
+42
-0
index.vue
src/components/common/ImportExcelBtn/index.vue
+1
-1
No files found.
src/components/common/ExportExcelBtn/index.vue
0 → 100644
View file @
e6d3866d
<!-- 导出excel按钮组件 后端直接返回纯数据 前端根据数据处理生成excel -->
<
script
setup
lang=
"tsx"
generic=
"T, K"
>
import
{
exportExcel
,
type
ExportColumn
}
from
'@/utils'
import
type
{
BackendServiceResult
}
from
'@/utils/request/types'
const
{
api
,
searchParams
,
fileName
=
'导出数据'
,
columns
,
}
=
defineProps
<
{
api
:
(
params
:
T
)
=>
Promise
<
BackendServiceResult
<
K
[]
>>
searchParams
:
T
columns
:
ExportColumn
<
K
>
[]
fileName
:
string
}
>
()
const
loading
=
ref
(
false
)
const
handleExport
=
async
()
=>
{
loading
.
value
=
true
try
{
const
{
data
}
=
await
api
(
searchParams
)
loading
.
value
=
false
exportExcel
({
data
,
columns
,
fileName
,
})
}
catch
(
error
)
{
console
.
log
(
error
)
}
finally
{
loading
.
value
=
false
}
}
</
script
>
<
template
>
<el-button
:loading=
"loading"
type=
"primary"
@
click=
"handleExport"
>
<el-icon
v-show=
"!loading"
><IEpDownload
/></el-icon>
导出
</el-button>
</
template
>
src/components/common/
UploadExcel
/index.vue
→
src/components/common/
ImportExcelBtn
/index.vue
View file @
e6d3866d
// 导入excel相关
<!-- 导入excel按钮组件 前端传二进制文件 -->
<
script
setup
lang=
"tsx"
generic=
"T"
>
<
script
setup
lang=
"tsx"
generic=
"T"
>
import
type
{
BackendServiceResult
}
from
'@/utils/request/types'
import
type
{
BackendServiceResult
}
from
'@/utils/request/types'
const
props
=
defineProps
<
{
const
props
=
defineProps
<
{
...
...
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