From 7b4fb448c3599da0bfe743d602570f45f0b4967e Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Wed, 6 Dec 2023 10:40:31 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9bug79086?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/modules/SearchHistoryModal.vue | 62 +++++++++++-------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/src/views/dashboard/search/modules/SearchHistoryModal.vue b/src/views/dashboard/search/modules/SearchHistoryModal.vue index 935c6b2b..cdae02b7 100644 --- a/src/views/dashboard/search/modules/SearchHistoryModal.vue +++ b/src/views/dashboard/search/modules/SearchHistoryModal.vue @@ -151,36 +151,48 @@ export default { }, // 删除 handleDelete (id) { - deleteSearchHistoryById({ id: id }).then(res => { - if (res.success) { - this.$message.success(res.message) - // 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一 - // if (this.page.pageNo > 1 && ((this.page.pageNo - 1) * this.page.pageSize) + 1 === this.page.total) { - // this.page.pageNo -= 1 - // } - this.model = {} - this.dataList = [] - this.initData(1) - this.indeterminate = !!this.checkedArr.length && this.checkedArr.length < this.dataList.length - this.checkAll = this.checkedArr.length === this.dataList.length - } else { - this.$message.warning(res.message) + this.$confirm({ + title: this.$t('confirmDeletion'), + content: this.$t('areYouSure'), + onOk: () => { + deleteSearchHistoryById({ id: id }).then(res => { + if (res.success) { + this.$message.success(res.message) + // 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一 + // if (this.page.pageNo > 1 && ((this.page.pageNo - 1) * this.page.pageSize) + 1 === this.page.total) { + // this.page.pageNo -= 1 + // } + this.model = {} + this.dataList = [] + this.initData(1) + this.indeterminate = !!this.checkedArr.length && this.checkedArr.length < this.dataList.length + this.checkAll = this.checkedArr.length === this.dataList.length + } else { + this.$message.warning(res.message) + } + }) } }) }, // 批量删除 handleBatchDel () { - batchDeleteSearchHistory({ id: this.checkedArr.join(',') }).then(res => { - if (res.success) { - this.$message.success(res.message) - this.checkedArr = [] - this.model = {} - this.dataList = [] - this.initData(1) - this.indeterminate = !!this.checkedArr.length && this.checkedArr.length < this.dataList.length - this.checkAll = this.checkedArr.length > 0 && this.checkedArr.length === this.dataList.length - } else { - this.$message.warning(res.message) + this.$confirm({ + title: this.$t('confirmDeletion'), + content: this.$t('areYouSure'), + onOk: () => { + batchDeleteSearchHistory({ id: this.checkedArr.join(',') }).then(res => { + if (res.success) { + this.$message.success(res.message) + this.checkedArr = [] + this.model = {} + this.dataList = [] + this.initData(1) + this.indeterminate = !!this.checkedArr.length && this.checkedArr.length < this.dataList.length + this.checkAll = this.checkedArr.length > 0 && this.checkedArr.length === this.dataList.length + } else { + this.$message.warning(res.message) + } + }) } }) },