Browse Source

bug:省份回显时因为字典数据未返回,导致市下拉数据为空

lifanagju_citu 9 tháng trước cách đây
mục cha
commit
e1d587221e

+ 8 - 0
src/views/recruit/personal/remuse/components/basicInfo.vue

@@ -372,10 +372,18 @@ const getDictData = async (dictTypeName) => {
     item.items = data
   }
 }
+let timeCount = 0
 let workAreaId = ''
 const deal = async () => {
   if (workAreaId) { // 省份回显
     const province = items.value.options.find(pv => pv.key === 'workAreaProvinceId')
+    if (!province?.items.length) { // 字典数据未获取
+      setTimeout(() => {
+        timeCount++
+        if (timeCount < 6) deal()
+      }, 2000)
+      return
+    }
     if (province) {
       const dealReturnObj = await cityToProvince(workAreaId, {}, province.items || [])
       const city = items.value.options.find(pv => pv.key === 'areaId')