Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d877bfd2
authored
May 23, 2023
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 完善善品导出
parent
c296c9e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
src/api/mall/product/spu.ts
+3
-3
src/views/mall/product/spu/index.vue
+30
-2
No files found.
src/api/mall/product/spu.ts
View file @
d877bfd2
...
@@ -84,7 +84,7 @@ export const deleteSpu = (id: number) => {
...
@@ -84,7 +84,7 @@ export const deleteSpu = (id: number) => {
return
request
.
delete
({
url
:
`/product/spu/delete?id=
${
id
}
`
})
return
request
.
delete
({
url
:
`/product/spu/delete?id=
${
id
}
`
})
}
}
// 导出商品 Spu
// 导出商品 Spu
Excel
export
const
export
User
=
(
params
)
=>
{
export
const
export
Spu
=
async
(
params
)
=>
{
return
request
.
download
({
url
:
'/product/spu/export'
,
params
})
return
await
request
.
download
({
url
:
'/product/spu/export'
,
params
})
}
}
src/views/mall/product/spu/index.vue
View file @
d877bfd2
...
@@ -50,11 +50,21 @@
...
@@ -50,11 +50,21 @@
<Icon
class=
"mr-5px"
icon=
"ep:refresh"
/>
<Icon
class=
"mr-5px"
icon=
"ep:refresh"
/>
重置
重置
</el-button>
</el-button>
<el-button
v-hasPermi=
"['product:
brand
:create']"
plain
type=
"primary"
@
click=
"openForm"
>
<el-button
v-hasPermi=
"['product:
spu
:create']"
plain
type=
"primary"
@
click=
"openForm"
>
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
新增
</el-button>
</el-button>
<!-- TODO @puhui999:增加一个【导出】操作 -->
<!-- TODO @puhui999:增加一个【导出】操作 -->
<el-button
v-hasPermi=
"['product:spu:export']"
:loading=
"exportLoading"
plain
type=
"success"
@
click=
"handleExport"
>
<Icon
class=
"mr-5px"
icon=
"ep:download"
/>
导出
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</ContentWrap>
</ContentWrap>
...
@@ -196,15 +206,17 @@ import { createImageViewer } from '@/components/ImageViewer'
...
@@ -196,15 +206,17 @@ import { createImageViewer } from '@/components/ImageViewer'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
defaultProps
,
handleTree
}
from
'@/utils/tree'
import
{
defaultProps
,
handleTree
}
from
'@/utils/tree'
import
{
ProductSpuStatusEnum
}
from
'@/utils/constants'
import
{
ProductSpuStatusEnum
}
from
'@/utils/constants'
import
{
formatToFraction
}
from
'@/utils'
import
download
from
'@/utils/download'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
{
formatToFraction
}
from
'@/utils'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
const
{
currentRoute
,
push
}
=
useRouter
()
// 路由跳转
const
{
currentRoute
,
push
}
=
useRouter
()
// 路由跳转
const
loading
=
ref
(
false
)
// 列表的加载中
const
loading
=
ref
(
false
)
// 列表的加载中
const
exportLoading
=
ref
(
false
)
// 导出的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
<
any
[]
>
([])
// 列表的数据
const
list
=
ref
<
any
[]
>
([])
// 列表的数据
// tabs 数据
// tabs 数据
...
@@ -373,6 +385,22 @@ const openForm = (id?: number) => {
...
@@ -373,6 +385,22 @@ const openForm = (id?: number) => {
const
openDetail
=
()
=>
{
const
openDetail
=
()
=>
{
message
.
alert
(
'查看详情未完善!!!'
)
message
.
alert
(
'查看详情未完善!!!'
)
}
}
/** 导出按钮操作 */
const
handleExport
=
async
()
=>
{
try
{
// 导出的二次确认
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
ProductSpuApi
.
exportSpu
(
queryParams
)
download
.
excel
(
data
,
'商品spu.xls'
)
}
catch
{
}
finally
{
exportLoading
.
value
=
false
}
}
// 监听路由变化更新列表 TODO @puhui999:这个是必须加的么?fix: 因为编辑表单是以路由的方式打开,保存表单后列表不会刷新
// 监听路由变化更新列表 TODO @puhui999:这个是必须加的么?fix: 因为编辑表单是以路由的方式打开,保存表单后列表不会刷新
watch
(
watch
(
()
=>
currentRoute
.
value
,
()
=>
currentRoute
.
value
,
...
...
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