Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
0da9d5c5
Unverified
Commit
0da9d5c5
authored
Mar 31, 2023
by
BloomingFlowers
Committed by
GitHub
Mar 31, 2023
Browse files
批量删除 (#534)
parent
9f81d58c
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-admin/src/views/goods/list.vue
View file @
0da9d5c5
...
@@ -9,11 +9,11 @@
...
@@ -9,11 +9,11 @@
<el-button
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleFilter"
>
查找
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleFilter"
>
查找
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleCreate"
>
添加
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleCreate"
>
添加
</el-button>
<el-button
:loading=
"downloadLoading"
class=
"filter-item"
type=
"primary"
icon=
"el-icon-download"
@
click=
"handleDownload"
>
导出
</el-button>
<el-button
:loading=
"downloadLoading"
class=
"filter-item"
type=
"primary"
icon=
"el-icon-download"
@
click=
"handleDownload"
>
导出
</el-button>
<el-button
class=
"filter-item"
type=
"danger"
icon=
"el-icon-delete"
:disabled=
"batchDeleteArr.length === 0"
@
click=
"handleDeleteRows"
>
批量删除
</el-button>
</div>
</div>
<!-- 查询结果 -->
<!-- 查询结果 -->
<el-table
v-loading=
"listLoading"
:data=
"list"
element-loading-text=
"正在查询中。。。"
border
fit
highlight-current-row
>
<el-table
v-loading=
"listLoading"
:data=
"list"
element-loading-text=
"正在查询中。。。"
border
fit
highlight-current-row
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"expand"
>
<el-table-column
type=
"expand"
>
<template
slot-scope=
"props"
>
<template
slot-scope=
"props"
>
<el-form
label-position=
"left"
class=
"table-expand"
>
<el-form
label-position=
"left"
class=
"table-expand"
>
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
</el-form>
</el-form>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
align=
"center"
label=
"商品ID"
prop=
"id"
/>
<el-table-column
align=
"center"
label=
"商品ID"
prop=
"id"
/>
<el-table-column
align=
"center"
min-width=
"100"
label=
"名称"
prop=
"name"
/>
<el-table-column
align=
"center"
min-width=
"100"
label=
"名称"
prop=
"name"
/>
...
@@ -140,6 +140,7 @@ export default {
...
@@ -140,6 +140,7 @@ export default {
components
:
{
BackToTop
,
Pagination
},
components
:
{
BackToTop
,
Pagination
},
data
()
{
data
()
{
return
{
return
{
batchDeleteArr
:
[],
thumbnail
,
thumbnail
,
toPreview
,
toPreview
,
list
:
[],
list
:
[],
...
@@ -209,6 +210,27 @@ export default {
...
@@ -209,6 +210,27 @@ export default {
})
})
}).
catch
(()
=>
{})
}).
catch
(()
=>
{})
},
},
handleSelectionChange
(
val
)
{
console
.
log
(
val
)
this
.
batchDeleteArr
=
val
},
handleDeleteRows
()
{
this
.
batchDeleteArr
.
forEach
(
row
=>
this
.
handleDeleteEachRow
(
row
))
this
.
getList
()
},
handleDeleteEachRow
(
row
)
{
deleteGoods
(
row
).
then
(
response
=>
{
this
.
$notify
.
success
({
title
:
'
成功
'
,
message
:
'
删除成功
'
})
}).
catch
(
response
=>
{
this
.
$notify
.
error
({
title
:
'
失败
'
,
message
:
response
.
data
.
errmsg
})
})
},
handleDownload
()
{
handleDownload
()
{
this
.
downloadLoading
=
true
this
.
downloadLoading
=
true
import
(
'
@/vendor/Export2Excel
'
).
then
(
excel
=>
{
import
(
'
@/vendor/Export2Excel
'
).
then
(
excel
=>
{
...
...
Write
Preview
Supports
Markdown
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