【update】 重写问题征集删除方法

This commit is contained in:
fengchenchen
2022-07-19 10:08:18 +08:00
parent 5a12223a56
commit 8b2ae58008
@@ -96,6 +96,7 @@ import { JeroListMixin } from '@/mixins/JeroListMixin'
import ProblemCollectionModal from './modules/ProblemCollectionModal'
import { getMeetInfoById } from '../../../api/incomePaymentsApi'
import { compareCurrentTime } from '../../../utils/meetingJudgeUtil'
import { getAction } from '../../../api/manage'
export default {
name: 'ProblemCollectionDetailList',
@@ -175,7 +176,72 @@ export default {
resolve(result)
})
})
}
},
batchDel: function () {
if(!this.url.deleteBatch){
this.$message.error('请设置url.deleteBatch属性!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
return
} else {
var ids = ''
for (var a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ','
}
var that = this
this.$confirm({
title: '确认删除',
content: '是否删除选中数据?',
onOk: function () {
that.loading = true
getAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的全部数据,如果是的话页码减一
if (that.ipagination.current > 1 && (that.ipagination.current === Math.ceil(that.ipagination.total / that.ipagination.pageSize)) &&
that.selectedRowKeys.length === that.dataSource.length
) {
that.ipagination.current -= 1
}
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
}
},
handleDelete: function (id) {
if(!this.url.delete){
this.$message.error('请设置url.delete属性!')
return
}
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除此条数据吗?',
onOk: function() {
getAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
},
},
async created() {
console.log('-----------this.$route-------', this.$route.params)