From 860b02427388bb9869d4a1d049f2ac2d795a3b03 Mon Sep 17 00:00:00 2001 From: WUSIJIAN <13825895+wsj0228@user.noreply.gitee.com> Date: Wed, 10 Dec 2025 15:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=9F=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=9F=8E=E5=B8=82=E5=9B=9E=E6=98=BE=E9=80=BB=E8=BE=91?= =?UTF-8?q?,=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8cityCode=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=B9=B6=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/tenant/component/editTenant.vue | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/views/system/tenant/component/editTenant.vue b/src/views/system/tenant/component/editTenant.vue index fea30d4..e877f5b 100644 --- a/src/views/system/tenant/component/editTenant.vue +++ b/src/views/system/tenant/component/editTenant.vue @@ -212,30 +212,23 @@ const passwordStrengthClass = computed(() => { const openDialog = (row?: any) => { resetForm(); if (row) { - // 处理城市回显:如果是字符串且以00结尾,去掉00并转为数组(这里简化处理,实际可能需要根据code反查路径) - // 假设 row.city 是 "110100",element-china-area-data 的 provinceAndCityData 对应的是 "110000", "110100" - // 注意:provinceAndCityData 的二级(市)code 通常不带后缀 00,或者需要具体看数据源 - // 这里假设后端存的是 "110100",前端组件需要 ["110000", "110100"] 形式的路径数组 - // 由于没有反查函数,这里如果 row.city 是字符串,我们暂时将其直接放入数组,或者需要调用专门的工具函数 - // 简单处理:如果 row.city 是字符串,尝试回显 + // 处理城市回显:根据 cityCode 转换为级联选择器需要的数组格式 + // cityCode 是6位代码如 "220100",级联选择器需要 ["22", "2201"] 格式 let cityArray: string[] = []; - if (row.cityMergerName && typeof row.cityMergerName === 'string') { - const storedCode = row.cityMergerName; + const storedCode = row.cityCode; + if (storedCode && typeof storedCode === 'string') { // 判断是否为直辖市代码 (11xxxx, 12xxxx, 31xxxx, 50xxxx) if (/^(11|12|31|50)/.test(storedCode)) { - // 直辖市,回显为 [2位代码] (如 '11') + // 直辖市,回显为省级代码(2位) cityArray = [storedCode.substring(0, 2)]; } else { - // 普通省市,回显为 [2位省代码, 4位市代码] (如 '13', '1301') - // 假设 storedCode 是 6 位,如 130100 + // 普通省市,回显为 [省代码(2位), 市代码(4位)] if (storedCode.length >= 4) { const provinceCode = storedCode.substring(0, 2); const cityCode = storedCode.substring(0, 4); cityArray = [provinceCode, cityCode]; } } - } else if (Array.isArray(row.cityMergerName)) { - cityArray = row.cityMergerName; } state.ruleForm = {