CN-1062 fix:右侧列表进行条件查询后,左侧filter应保持之前的选中

This commit is contained in:
hyx
2023-06-11 10:52:28 +08:00
parent e8483e8e91
commit e62573391a
2 changed files with 31 additions and 8 deletions

View File

@@ -157,6 +157,9 @@ export default {
listUrl: api.knowledgeBaseList,
tableId: 'knowledgeBaseTable', // 需要分页的table的id用于记录每页数量
isSelectedStatus: false,
filterParams: {},
checkedCategoryIds: [],
checkedStatusIds: [],
keyWord: '',
showConfirmDialog: false,
delItemList: [],
@@ -168,12 +171,13 @@ export default {
},
methods: {
onSearch () {
const params = {
let params = {
...this.filterParams,
name: this.keyWord
}
this.clearList()
this.search(params)
this.$refs.knowledgeFilter.reloadFilter()
this.$refs.knowledgeFilter.reloadFilter(this.checkedCategoryIds,this.checkedStatusIds)
},
reloadRowList () {
this.getTableData()
@@ -314,11 +318,14 @@ export default {
}
})
},
reload (params, isAll, isClearType) {
reload (params, isAll, isClearType,checkedCategoryIds,checkedStatusIds) {
this.disableDelete = true
this.isSelectedStatus = false
this.batchDeleteObjs = []
this.secondBatchDeleteObjs = []
this.filterParams = params
this.checkedCategoryIds = checkedCategoryIds
this.checkedStatusIds = checkedStatusIds
params = {
...params,
name: this.keyWord
@@ -426,6 +433,7 @@ export default {
mounted () {
const curMode = this.$router.currentRoute.value.query.listMode
this.listMode = curMode || 'list'
this.filterParams = {}
},
computed: {
}

View File

@@ -80,7 +80,7 @@ export default {
typeData: [],
statusData: [],
defaultCheckedCategory: [],
defaultCheckedStatus: [0, 1],
defaultCheckedStatus: [],
filterParams: {}
}
},
@@ -196,7 +196,7 @@ export default {
}
}
this.filterParams = params
this.$emit('reload', params, true)
this.$emit('reload', params, true,false,this.defaultCheckedCategory,this.defaultCheckedStatus)
}
},
getAllTableData (params) {
@@ -227,6 +227,7 @@ export default {
},
initTypeData () {
this.filterCategoryData.data = []
let categoryIds = []
this.typeData.forEach((type, typeIndex) => {
const categoryLabel = knowledgeBaseCategory.find(t => t.value === type.name)
const categoryId = typeIndex
@@ -238,7 +239,7 @@ export default {
type: 0,
children: []
}
this.defaultCheckedCategory.push(categoryId)
categoryIds.push(categoryId)
this.filterCategoryData.data.push(category)
const sourceList = type.sourceList
sourceList.forEach((item, sourceIndex) => {
@@ -253,11 +254,15 @@ export default {
category.children.push(source)
})
})
if(this.defaultCheckedCategory.length === 0){
this.defaultCheckedCategory = categoryIds
}
},
initStatusData () {
const enableCount = 0
const disableCount = 0
this.filterStatusData.data = []
let statusIds = []
this.statusData.forEach((data, index) => {
this.filterStatusData.data.push({
id: index,
@@ -266,10 +271,20 @@ export default {
count: data.count,
type: 0
})
statusIds.push(index)
})
if(this.defaultCheckedStatus.length === 0){
this.defaultCheckedStatus = statusIds
}
},
reloadFilter (params) {
this.getAllTableData(params)
reloadFilter (checkedCategoryIds ,checkedStatusIds) {
if(checkedCategoryIds && checkedCategoryIds.length > 0){
this.defaultCheckedCategory = checkedCategoryIds
}
if(checkedStatusIds && checkedStatusIds.length > 0){
this.defaultCheckedStatus = checkedStatusIds
}
this.getAllTableData()
}
},
mounted () {