|
@@ -19,6 +19,7 @@
|
19
|
19
|
|
20
|
20
|
<el-row style="margin-top: 20px; margin-bottom: 20px;">
|
21
|
21
|
<el-button type="primary" icon="el-icon-circle-plus" @click="dialogAddForm">添加</el-button>
|
|
22
|
+ <el-button type="danger" icon="el-icon-delete" @click="deleteBanner">删除</el-button>
|
22
|
23
|
<!-- <el-button type="primary" icon="el-icon-edit">设置轮播数</el-button> -->
|
23
|
24
|
</el-row>
|
24
|
25
|
|
|
@@ -31,14 +32,14 @@
|
31
|
32
|
highlight-current-row
|
32
|
33
|
style="width: 100%; margin-top: 20px;"
|
33
|
34
|
@selection-change="handleSelectionChange">
|
34
|
|
- <el-table-column label="选择" type="selection" sortable="custom" align="center" width="50">
|
|
35
|
+ <el-table-column label="选择" type="selection" sortable="custom" align="center" >
|
35
|
36
|
</el-table-column>
|
36
|
|
- <el-table-column label="编号" width="150px" align="center">
|
|
37
|
+ <el-table-column label="编号" align="center" min-width="30px">
|
37
|
38
|
<template slot-scope="scope">
|
38
|
39
|
<span>{{ scope.row.id }}</span>
|
39
|
40
|
</template>
|
40
|
41
|
</el-table-column>
|
41
|
|
- <el-table-column label="标题" align="center">
|
|
42
|
+ <el-table-column label="标题" align="center" min-width="250px">
|
42
|
43
|
<template slot-scope="scope">
|
43
|
44
|
<!-- <span class="link-type" @click="handleUpdate(scope.row)">{{ scope.row.title }}</span> -->
|
44
|
45
|
<el-tag>{{ scope.row.title }}</el-tag>
|
|
@@ -79,10 +80,9 @@
|
79
|
80
|
<span>{{ scope.row.updateUserName }}</span>
|
80
|
81
|
</template>
|
81
|
82
|
</el-table-column>
|
82
|
|
- <el-table-column label="操作" class-name="status-col" width="300" align="center">
|
|
83
|
+ <el-table-column label="操作" class-name="status-col" align="center">
|
83
|
84
|
<template slot-scope="scope">
|
84
|
85
|
<el-button type="primary" icon="el-icon-edit" @click="updateBanner(scope.row.id)">修改</el-button>
|
85
|
|
- <el-button type="danger" icon="el-icon-delete" @click="deleteBanner(scope.row.id)">删除</el-button>
|
86
|
86
|
</template>
|
87
|
87
|
</el-table-column>
|
88
|
88
|
</el-table>
|
|
@@ -165,7 +165,8 @@ export default {
|
165
|
165
|
bannerPositionArr: [
|
166
|
166
|
{ id: 1, value: '首页banner' },
|
167
|
167
|
{ id: 2, value: '服务banner' }
|
168
|
|
- ]
|
|
168
|
+ ],
|
|
169
|
+ deleteBannerId: []
|
169
|
170
|
}
|
170
|
171
|
},
|
171
|
172
|
computed: {
|
|
@@ -187,29 +188,35 @@ export default {
|
187
|
188
|
'CreateCommunity',
|
188
|
189
|
'UpdateCommunity'
|
189
|
190
|
]),
|
190
|
|
- deleteBanner(bannerId) {
|
|
191
|
+ deleteBanner() {
|
191
|
192
|
this.$confirm('您确定删除此banner吗?', '提示', {
|
192
|
193
|
confirmButtonText: '确定',
|
193
|
194
|
cancelButtonText: '取消',
|
194
|
195
|
type: 'warning'
|
195
|
196
|
}).then(() => {
|
196
|
|
- this.$store.dispatch('DeleteBanner', bannerId).then((res) => {
|
197
|
|
- console.log('删除操作: ' + res.code)
|
198
|
|
- if (res.code === '0') {
|
199
|
|
- this.$notify({
|
200
|
|
- title: '操作成功!',
|
201
|
|
- message: res.message,
|
202
|
|
- type: 'success'
|
203
|
|
- })
|
204
|
|
- this.getList()
|
205
|
|
- } else {
|
206
|
|
- this.$notify({
|
207
|
|
- title: '操作失败',
|
208
|
|
- message: res.message,
|
209
|
|
- type: 'warning'
|
210
|
|
- })
|
211
|
|
- }
|
212
|
|
- })
|
|
197
|
+ console.log(this.deleteBannerId)
|
|
198
|
+ if (this.deleteBannerId.length === 0) {
|
|
199
|
+ this.$message({
|
|
200
|
+ message: '请选择需要删除的数据!',
|
|
201
|
+ type: 'warning'
|
|
202
|
+ })
|
|
203
|
+ } else {
|
|
204
|
+ this.$store.dispatch('DeleteBanner', this.deleteBannerId).then((res) => {
|
|
205
|
+ if (res.code === '0') {
|
|
206
|
+ this.$message({
|
|
207
|
+ message: res.message,
|
|
208
|
+ type: 'success'
|
|
209
|
+ })
|
|
210
|
+ this.deleteBannerId = []
|
|
211
|
+ this.getList()
|
|
212
|
+ } else {
|
|
213
|
+ this.$message({
|
|
214
|
+ message: res.message,
|
|
215
|
+ type: 'warning'
|
|
216
|
+ })
|
|
217
|
+ }
|
|
218
|
+ })
|
|
219
|
+ }
|
213
|
220
|
}).catch(() => {
|
214
|
221
|
this.$message({
|
215
|
222
|
type: 'info',
|
|
@@ -284,7 +291,11 @@ export default {
|
284
|
291
|
row.status = status
|
285
|
292
|
},
|
286
|
293
|
handleSelectionChange(data) {
|
287
|
|
- console.log('多选框 :', data)
|
|
294
|
+ this.deleteBannerId = []
|
|
295
|
+ const bannerIdArr = this.deleteBannerId
|
|
296
|
+ for (const i in data) {
|
|
297
|
+ bannerIdArr.push(data[i].id)
|
|
298
|
+ }
|
288
|
299
|
},
|
289
|
300
|
handleSearch() {
|
290
|
301
|
this.getList()
|