From 1ab8aeae7617bf798e702c29824d03420f130987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Wed, 13 Sep 2023 13:59:30 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=9B=BD=E5=86=85=E6=A0=87=E5=87=86-?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E9=A1=B5=E9=9D=A2=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=A0=91=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/ConfigurableTableMixin.js | 56 +++++++++++-------- .../domesticStandard/DomesticStandardList.vue | 15 ++++- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/mixins/ConfigurableTableMixin.js b/src/mixins/ConfigurableTableMixin.js index 7731842d..26ffca67 100644 --- a/src/mixins/ConfigurableTableMixin.js +++ b/src/mixins/ConfigurableTableMixin.js @@ -372,30 +372,40 @@ export const ConfigurableTableMixin = { } if (this.selectedRowKeys.length <= 0) { this.$message.warning(this.$t('selectARecord')) - } else { - let ids = this.selectedRowKeys.join(',') - const that = this - this.$confirm({ - title: this.$t('confirmBatchDeletion'), - content: this.$t('deleteAData'), - onOk: function () { - that.loading = true - postAction(that.url.delete, { ids: ids }).then((res) => { - if (res.success) { - // 重新计算分页问题 - that.reCalculatePage(that.selectedRowKeys.length) - that.$message.success(res.message) - that.loadData() - that.onClearSelected() - } else { - that.$message.warning(res.message) - } - }).finally(() => { - that.loading = false - }) - } - }) + return } + const ids = this.selectedRowKeys.join(',') + this.$confirm({ + title: this.$t('confirmBatchDeletion'), + content: this.$t('deleteAData'), + onOk: () => { + this.loading = true + postAction(this.url.delete, { ids: ids }).then((res) => { + if (res.success) { + // 重新计算分页问题 + this.reCalculatePage(this.selectedRowKeys.length) + this.$message.success(res.message) + this.loadData() + this.onClearSelected() + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } + }) + }, + reCalculatePage (count) { + // 总数量-count + const total = this.ipagination.total - count + // 获取删除后的分页数 + const currentIndex = Math.ceil(total / this.ipagination.pageSize) + // 删除后的分页数<所在当前页 + if (currentIndex < this.ipagination.current) { + this.ipagination.current = currentIndex + } + console.log('currentIndex', currentIndex) }, /** * 删除 diff --git a/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue b/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue index dc7edd0d..35fe2fbe 100644 --- a/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue +++ b/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue @@ -2,12 +2,12 @@
- + - + @@ -252,7 +252,8 @@ export default { noValue: YesOrNoEnum.NO.value, nowShareInfo: {}, // 当前正在分享的数据 selectedTreeKeys: [], // 选中的树节点 - tableSlotField: ['standard_name', 'standard_number'] // 表格中需要插槽的字段 + tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段 + treeLoading: false } }, computed: { @@ -268,13 +269,19 @@ export default { * 获取树数据 */ initTreeData () { + this.treeLoading = true getDomesticStandardTree({ nodeName: this.treeInput }).then(res => { + this.treeData = [] + this.selectedTreeKeys = [] + this.filters.nodeCode = null if (res.success) { const treeData = res.result || [] this.treeData = this.dealTreeData(treeData) } else { this.$message.warn(res.message) } + }).finally(() => { + this.treeLoading = false }) }, /** @@ -433,6 +440,8 @@ export default { */ handleSelectTreeNode ({ dataRef }) { this.selectedTreeKeys = [dataRef.key] + this.filters.nodeCode = dataRef.nodeCode + this.loadData(1) }, /** * 配置标准