批量取消处罚

dev
truthhun 11 months ago
parent e4d8131357
commit 7bc1cb40ef

@ -162,7 +162,7 @@ export default {
},
{
page: '/admin/user/punishment',
title: '',
title: '',
icon: 'el-icon-warning-outline',
},
],

@ -33,6 +33,24 @@
</el-select>
</el-form-item>
</template>
<template slot="buttons">
<el-form-item>
<el-tooltip
class="item"
effect="dark"
content="批量取消处罚"
placement="top"
>
<el-button
type="warning"
@click="batchCancelPunishment"
:disabled="selectedRow.length === 0"
icon="el-icon-edit"
></el-button
>
</el-tooltip>
</el-form-item>
</template>
</FormSearch>
</el-card>
<el-card shadow="never" class="mgt-20px">
@ -82,7 +100,11 @@
</template>
<script>
import { listPunishment, getPunishment } from '~/api/punishment'
import {
listPunishment,
getPunishment,
cancelPunishment,
} from '~/api/punishment'
import { genLinkHTML, parseQueryIntArray } from '~/utils/utils'
import TableList from '~/components/TableList.vue'
import FormSearch from '~/components/FormSearch.vue'
@ -116,7 +138,7 @@ export default {
},
head() {
return {
title: `罚管理 - ${this.settings.system.sitename}`,
title: `罚管理 - ${this.settings.system.sitename}`,
}
},
computed: {
@ -162,6 +184,27 @@ export default {
this.users = res.data.user || []
}
},
async batchCancelPunishment() {
let res = await this.$confirm(
`您确定要取消选中的${this.selectedRow.length}条处罚吗?`,
'',
{
confirmButtonText: '',
cancelButtonText: '',
type: 'warning',
}
)
if (res) {
const ids = this.selectedRow.map((item) => item.id)
const res = await cancelPunishment({ id: ids })
if (res.status === 200) {
this.$message.success('')
this.listPunishment()
} else {
this.$message.error(res.data.message)
}
}
},
async listPunishment() {
this.loading = true
const res = await listPunishment(this.search)
@ -268,7 +311,7 @@ export default {
},
{
prop: 'enable',
label: '',
label: '',
width: 80,
type: 'bool',
},

Loading…
Cancel
Save