update 国内标准-批量删除页面效果修改,树查询数据

This commit is contained in:
赵霄
2023-09-13 13:59:30 +08:00
parent 495dfe5863
commit 1ab8aeae76
2 changed files with 45 additions and 26 deletions
+33 -23
View File
@@ -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)
},
/**
* 删除
@@ -2,12 +2,12 @@
<a-card :bordered="false" class="page-left-right-layout">
<!-- 树部分-->
<div class="page-left-box">
<a-spin :spinning="loading">
<a-spin :spinning="treeLoading">
<!-- $t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')-->
<a-input-search v-model="treeInput"
:placeholder="$t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')"
@search="handleTreeSearch" />
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData">
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData" :selected-keys="selectedTreeKeys">
<a-icon type="folder" slot="folder" class="tree-icon" />
<a-icon type="file" slot="file" class="tree-icon" />
@@ -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)
},
/**
* 配置标准