From 32d2e292be458cdbb25ca2ab9db42a04da30a496 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Tue, 18 Mar 2025 10:25:32 +0800 Subject: [PATCH] 知识库规则文档调整 --- forms/chinaArea/CChinaArea.vue | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/forms/chinaArea/CChinaArea.vue b/forms/chinaArea/CChinaArea.vue index c329e5e..d16511d 100644 --- a/forms/chinaArea/CChinaArea.vue +++ b/forms/chinaArea/CChinaArea.vue @@ -102,7 +102,7 @@ // 省 if (codes[0]) { const proviceIndex = locationTree.findIndex( - provice => provice.value === codes[0] + provice => provice.value === codes[0], ); if (proviceIndex >= 0) { range[1] = locationTree[proviceIndex].children; @@ -112,7 +112,7 @@ // 市 if (codes[1]) { const cityIndex = range[1].findIndex( - city => city.value === codes[1] + city => city.value === codes[1], ); if (cityIndex >= 0) { range[2] = range[1][cityIndex].children; @@ -121,22 +121,20 @@ // 区 if (codes[2]) { const distIndex = range[2].findIndex( - dist => dist.value === codes[2] + dist => dist.value === codes[2], ); if (distIndex >= 0) { current[2] = distIndex; } // 街 - if (this.level === 4 && codes[3]) { - if (distIndex >= 0) { - range[3] = - range[2][distIndex].children || []; - const streetIndex = range[3].findIndex( - street => street.value === codes[3] - ); - if (streetIndex >= 0) { - current[3] = streetIndex; - } + if (this.level === 4) { + range[3] = + range[2][current[2]].children || []; + const streetIndex = range[3].findIndex( + street => street.value === codes[3], + ); + if (streetIndex >= 0) { + current[3] = streetIndex; } } } @@ -146,7 +144,9 @@ }); } this.range = range; - this.current = current; + setTimeout(() => { + this.current = current; + }, 100); }); }, updateColumns(roll) { @@ -228,8 +228,10 @@ address.province.replace(/省|市|自治区|特别行政区/g, ''), address.city, address.district, - address.street, ]; + if (this.level === 4) { + regions.push(address.street); + } $locations.getRegionCodes(regions, codes => { if (codes && codes.length > 0) { $locations.getRegionNames(codes, names => { -- Gitblit v1.9.1