CN-1016 Filter与查找条件组合操作调试及问题修改

This commit is contained in:
hyx
2023-06-04 21:18:41 +08:00
parent 65487f47f6
commit 6a2764ade4
3 changed files with 55 additions and 57 deletions

View File

@@ -343,6 +343,8 @@ export default {
}, },
search (params) { search (params) {
this.pageObj.pageNo = 1 this.pageObj.pageNo = 1
delete this.searchLabel.category
delete this.searchLabel.source
this.getTableData(params) this.getTableData(params)
}, },
getTimeString () { getTimeString () {

View File

@@ -6,6 +6,7 @@
<div class="knowledge-base__content" > <div class="knowledge-base__content" >
<div class="left-filter" style=""> <div class="left-filter" style="">
<knowledge-filter ref="knowledgeFilter" <knowledge-filter ref="knowledgeFilter"
:keyWord="keyWord"
@reload="reload" @reload="reload"
@clearList="clearList"></knowledge-filter> @clearList="clearList"></knowledge-filter>
</div> </div>
@@ -166,10 +167,11 @@ export default {
methods: { methods: {
onSearch () { onSearch () {
const params = { const params = {
q: this.keyWord name: this.keyWord
} }
this.clearList() this.clearList()
this.search(params) this.search(params)
this.$refs.knowledgeFilter.reloadFilter(params)
}, },
handleClose () { handleClose () {
this.showConfirmDialog = false this.showConfirmDialog = false
@@ -299,6 +301,10 @@ export default {
this.isSelectedStatus = false this.isSelectedStatus = false
this.batchDeleteObjs = [] this.batchDeleteObjs = []
this.secondBatchDeleteObjs = [] this.secondBatchDeleteObjs = []
params = {
...params,
name: this.keyWord
}
this.getTableData(params, isAll, isClearType) this.getTableData(params, isAll, isClearType)
}, },
clearList () { clearList () {

View File

@@ -37,6 +37,7 @@ import { knowledgeCategoryValue, knowledgeSourceValue } from '@/utils/constants'
export default { export default {
name: 'KnowledgeFilter', name: 'KnowledgeFilter',
props: { props: {
keyWord: String
}, },
data () { data () {
return { return {
@@ -61,8 +62,7 @@ export default {
children: 'children', children: 'children',
label: 'label' label: 'label'
}, },
allTableData: [], allTableData: []
allCount: 0
} }
}, },
watch: { watch: {
@@ -76,37 +76,45 @@ export default {
}, },
handleCheckedItemChange (data, checkinfo, index) { handleCheckedItemChange (data, checkinfo, index) {
this.$nextTick(() => { this.$nextTick(() => {
let typeCheckedNodes = this.$refs.knowledgeTree0.getCheckedNodes() setTimeout(() => {
const typeHalfCheckedNodes = checkinfo.halfCheckedNodes let typeCheckedNodes = this.$refs.knowledgeTree0.getCheckedNodes()
typeCheckedNodes = typeCheckedNodes.concat(typeHalfCheckedNodes) const typeHalfCheckedNodes = checkinfo.halfCheckedNodes
const statusCheckedNodes = this.$refs.knowledgeTree1.getCheckedNodes() typeCheckedNodes = typeCheckedNodes.concat(typeHalfCheckedNodes)
const typeCheckedLen = typeCheckedNodes.length const statusCheckedNodes = this.$refs.knowledgeTree1.getCheckedNodes()
const statusCheckedLen = statusCheckedNodes.length const typeCheckedLen = typeCheckedNodes.length
let params = {} const statusCheckedLen = statusCheckedNodes.length
if (typeCheckedLen === 0 || statusCheckedLen === 0) { let params = {}
this.$emit('clearList') let allSourceNum = 0
} else { this.filterData[0].data.forEach(item => {
const categorys = [] allSourceNum = allSourceNum + item.children.length
const sources = []
typeCheckedNodes.forEach(val => {
if (val.type === 0) {
categorys.push(val.value)
} else if (val.type === 1) {
sources.push(val.value)
}
}) })
params = { if (typeCheckedLen === 0 || statusCheckedLen === 0) {
category: categorys.toString(), this.$emit('clearList')
source: sources.toString() } else {
} const categorys = []
if (statusCheckedLen === 1) { const sources = []
params = { typeCheckedNodes.forEach(val => {
...params, if (val.type === 0) {
status: statusCheckedNodes[0].value categorys.push(val.value)
} else if (val.type === 1) {
sources.push(val.value)
}
})
if (!(categorys.length === this.filterData[0].data.length && sources.length === allSourceNum)) {
params = {
category: categorys.toString(),
source: sources.toString()
}
} }
if (statusCheckedLen === 1) {
params = {
...params,
status: statusCheckedNodes[0].value
}
}
this.$emit('reload', params, true)
} }
this.$emit('reload', params, true) }, 200)
}
}) })
}, },
getAllTableData (params) { getAllTableData (params) {
@@ -126,16 +134,12 @@ export default {
}) })
}, },
initAllData () { initAllData () {
this.allCount = this.allTableData.length
let webSketchCount = 0 let webSketchCount = 0
let fqdnCategoryCount = 0 let fqdnCategoryCount = 0
let iocMalwareCount = 0 let iocMalwareCount = 0
let iocDarkwebCount = 0 let iocDarkwebCount = 0
let ipLocationCount = 0 let ipLocationCount = 0
let asnCount = 0 let asnCount = 0
const fqdnWhoCount = 0
const fqdnIcpCount = 0
const appCategoryCount = 0
let aiTaggingCount = 0 let aiTaggingCount = 0
let psiphon3Count = 0 let psiphon3Count = 0
@@ -212,25 +216,7 @@ export default {
value: knowledgeSourceValue.asn, value: knowledgeSourceValue.asn,
count: asnCount, count: asnCount,
type: 1 type: 1
}/*, { }
id: 16,
label: 'FQDN Who',
value: 'cn_fqdn_who_isBuiltIn',
count:fqdnWhoCount,
children: []
},{
id: 17,
label: 'FQDN Icp',
value: 'cn_fqdn_icp_built_in',
count:fqdnIcpCount,
children: []
},{
id: 18,
label: 'APP Category',
value: 'cn_app_category_built_indad',
count:appCategoryCount,
children: []
} */
] ]
}, },
{ {
@@ -294,12 +280,16 @@ export default {
{ id: 2, label: 'disable', value: 0, count: disableCount, type: 0 } { id: 2, label: 'disable', value: 0, count: disableCount, type: 0 }
] ]
}, },
reloadFilter () { reloadFilter (params) {
this.getAllTableData() this.getAllTableData(params)
} }
}, },
mounted () { mounted () {
this.getAllTableData() let params = {}
params = {
name: this.keyWord
}
this.getAllTableData(params)
}, },
computed: { computed: {
} }