From c579731e0c206d6062f8442ec9df70ca781b26f6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期二, 31 三月 2026 17:41:51 +0800
Subject: [PATCH] #前端
---
rsf-design/src/views/basic-info/device-site/index.vue | 62 +++++++++++++++++++++---------
1 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/rsf-design/src/views/basic-info/device-site/index.vue b/rsf-design/src/views/basic-info/device-site/index.vue
index d6736ae..4a56639 100644
--- a/rsf-design/src/views/basic-info/device-site/index.vue
+++ b/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>
--
Gitblit v1.9.1