zhou zhou
13 小时以前 c579731e0c206d6062f8442ec9df70ca781b26f6
rsf-design/src/views/basic-info/device-site/index.vue
@@ -92,7 +92,7 @@
  import ListExportPrint from '@/components/biz/list-export-print/index.vue'
  import { defaultResponseAdapter } from '@/utils/table/tableUtils'
  import { guardRequestWithMessage } from '@/utils/sys/requestGuard'
  import { fetchBasStationPage } from '@/api/bas-station'
  import { fetchBasStationOptionPage } from '@/api/bas-station'
  import { fetchWarehouseAreasList } from '@/api/warehouse-areas'
  import { fetchDictDataPage } from '@/api/system-manage'
  import {
@@ -138,6 +138,8 @@
  const deviceOptions = ref([])
  const areaOptions = ref([])
  const stationOptions = ref([])
  const stationOptionsLoaded = ref(false)
  const stationOptionsLoading = ref(null)
  const detailDrawerVisible = ref(false)
  const detailLoading = ref(false)
  const detailData = ref({})
@@ -235,7 +237,45 @@
    }
  }
  function openInitDialog(record = null) {
  async function ensureStationOptions() {
    if (stationOptionsLoaded.value) {
      return
    }
    if (stationOptionsLoading.value) {
      await stationOptionsLoading.value
      return
    }
    stationOptionsLoading.value = (async () => {
      const response = await guardRequestWithMessage(
        fetchBasStationOptionPage(
          {
            current: 1,
            pageSize: 100
          },
          {
            showErrorMessage: false
          }
        ),
        { records: [] },
        {
          timeoutMessage: '站点列表加载超时,已停止等待'
        }
      )
      stationOptions.value = buildSelectOptions(defaultResponseAdapter(response).records, ['stationName', 'name'])
      stationOptionsLoaded.value = true
    })()
    try {
      await stationOptionsLoading.value
    } finally {
      stationOptionsLoading.value = null
    }
  }
  async function openInitDialog(record = null) {
    await ensureStationOptions()
    currentInitData.value = record ? createInitRecordFromRow(record) : buildDeviceSiteInitModel()
    initDialogVisible.value = true
  }
@@ -417,23 +457,7 @@
    areaOptions.value = resolveDeviceSiteAreaOptions(defaultResponseAdapter(response).records)
  }
  async function loadStationOptions() {
    const response = await guardRequestWithMessage(
      fetchBasStationPage({
        current: 1,
        pageSize: 500
      }, {
        showErrorMessage: false
      }),
      { records: [] },
      {
        timeoutMessage: '站点列表加载超时,已停止等待'
      }
    )
    stationOptions.value = buildSelectOptions(defaultResponseAdapter(response).records, ['stationName', 'name'])
  }
  onMounted(async () => {
    await Promise.all([loadTypeOptions(), loadDeviceOptions(), loadAreaOptions(), loadStationOptions()])
    await Promise.all([loadTypeOptions(), loadDeviceOptions(), loadAreaOptions()])
  })
</script>