diff --git a/src/views/standardsAssociation/problemCollection/ProblemCollectionDetailList.vue b/src/views/standardsAssociation/problemCollection/ProblemCollectionDetailList.vue index 2817f7e..8decd9d 100644 --- a/src/views/standardsAssociation/problemCollection/ProblemCollectionDetailList.vue +++ b/src/views/standardsAssociation/problemCollection/ProblemCollectionDetailList.vue @@ -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)