Browse Source

fix: 邮编分区邮编显示问题

lyc 2 days ago
parent
commit
19f93fcc98
1 changed files with 13 additions and 5 deletions
  1. 13 5
      src/utils/dealData.ts

+ 13 - 5
src/utils/dealData.ts

@@ -37,11 +37,19 @@ export function dealWithData(data: Recordable, type: string) {
         case BaseZoning.ZONING_POSTAL_CODE:
             // 并接邮编显示
             const filterData = newData.filter(item => item.startZipCode && item.endZipCode)
-            str = filterData.map(item => {
-                const startZipCode = item.startZipCode || ''
-                const endZipCode = item.endZipCode || ''
-                return startZipCode + ',' + endZipCode
-            }).join('|')
+            if (isArrayLength(filterData)) {
+                str = filterData.map(item => {
+                    const startZipCode = item.startZipCode || ''
+                    const endZipCode = item.endZipCode || ''
+                    return startZipCode + ',' + endZipCode
+                }).join('|')
+            } else {
+                str = newData.map(item => {
+                    const startZipCode = item.startZipCode || ''
+                    const endZipCode = item.endZipCode || ''
+                    return startZipCode + ',' + endZipCode
+                }).join('|')
+            }
             break;
         default:
             break;