From 8b2ae58008f47e676f8d67ae2b52adb598788c5c Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Tue, 19 Jul 2022 10:08:18 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=20=E9=87=8D=E5=86=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=BE=81=E9=9B=86=E5=88=A0=E9=99=A4=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProblemCollectionDetailList.vue | 68 ++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) 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)