From 375c6bf44baea5dd35fe92cfe1ebb7af80256d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E6=80=80=E7=A3=8A=E2=80=9D?= <2280131253@qq.com> Date: Mon, 14 Feb 2022 17:21:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9C=A8=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=90=8E=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E6=98=AF=E5=B8=83?= =?UTF-8?q?=E5=B0=94=E7=B1=BB=E5=9E=8B=E6=97=B6=E9=A1=B5=E9=9D=A2=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=AD=E6=96=87=E9=97=AE=E9=A2=98=201?= =?UTF-8?q?=E3=80=81=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96url=E4=B8=AD?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E7=9A=84=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TagSearch/index.vue | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/components/TagSearch/index.vue b/src/components/TagSearch/index.vue index 2048ecd6b..be90adc30 100644 --- a/src/components/TagSearch/index.vue +++ b/src/components/TagSearch/index.vue @@ -151,32 +151,39 @@ export default { // this.$nextTick(() => this.$emit('tagSearch', this.filterMaps)) }, methods: { - // 判断url中的查询条件 + // 获取url中的查询条件,判断是不是包含在当前查询条件里 checkInTableColumns() { const routeQuery = this.getUrlQuery ? this.$route?.query : {} const routeQueryKeys = Object.keys(routeQuery) + const routeQueryKeysLength = routeQueryKeys.length const keys = {} - if (routeQueryKeys.length < 1) return keys - if (routeQueryKeys.length > 0) { - for (let i = 0; i < routeQueryKeys.length; i++) { + if (routeQueryKeysLength < 1) return keys + if (routeQueryKeysLength > 0) { + for (let i = 0; i < routeQueryKeysLength; i++) { const key = routeQueryKeys[i] - const valueDecode = decodeURI(routeQuery[key]) + let valueDecode = decodeURI(routeQuery[key]) const isSearch = key !== 'search' - for (let k = 0, len = this.options.length; k < len; k++) { - const cur = this.options[k] + const curOptions = this.options || [] + for (let k = 0, len = curOptions.length; k < len; k++) { + const cur = curOptions[k] + if (cur?.type === 'boolean') { + valueDecode = !!valueDecode + } if (key === cur.value || !isSearch) { const curChildren = cur.children || [] keys[key] = { + ...cur, key, label: isSearch ? cur.label : '', value: valueDecode } if (isSearch && curChildren.length > 0) { - curChildren.forEach(item => { + for (const item of curChildren) { if (valueDecode === item.value) { keys[key].valueLabel = item.label + break } - }) + } } } }