diff --git a/src/views/setting/KnowledgeBase.vue b/src/views/setting/KnowledgeBase.vue index 5b83d4d1..dde0dc66 100644 --- a/src/views/setting/KnowledgeBase.vue +++ b/src/views/setting/KnowledgeBase.vue @@ -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: { } diff --git a/src/views/setting/KnowledgeFilter.vue b/src/views/setting/KnowledgeFilter.vue index 17723a1a..0bc4c774 100644 --- a/src/views/setting/KnowledgeFilter.vue +++ b/src/views/setting/KnowledgeFilter.vue @@ -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 () {