From 1553782fd262f97a336fecc8b38f8f309fc08ae6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期三, 01 四月 2026 11:07:31 +0800
Subject: [PATCH] #前端
---
rsf-design/src/views/basic-info/warehouse-areas/index.vue | 68 +++++++++++++++++++++++----------
1 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/rsf-design/src/views/basic-info/warehouse-areas/index.vue b/rsf-design/src/views/basic-info/warehouse-areas/index.vue
index 1043d16..6f6b31c 100644
--- a/rsf-design/src/views/basic-info/warehouse-areas/index.vue
+++ b/rsf-design/src/views/basic-info/warehouse-areas/index.vue
@@ -12,7 +12,7 @@
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
<template #left>
<ElSpace wrap>
- <ElButton v-auth="'add'" @click="showDialog('add')" v-ripple>鏂板搴撳尯</ElButton>
+ <ElButton v-auth="'add'" @click="openWarehouseAreasDialog('add')" v-ripple>鏂板搴撳尯</ElButton>
<ElButton
v-auth="'delete'"
type="danger"
@@ -102,6 +102,8 @@
const shipperOptions = ref([])
const supplierOptions = ref([])
const typeOptions = ref([])
+ const companyOptionsLoaded = ref(false)
+ const companyOptionsLoading = ref(null)
let handleDeleteAction = null
const searchItems = computed(() => [
@@ -182,6 +184,7 @@
async function openEditDialog(row) {
try {
+ await ensureCompanyOptions()
const detail = await guardRequestWithMessage(fetchWarehouseAreasDetail(row.id), {}, {
timeoutMessage: '搴撳尯璇︽儏鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟'
})
@@ -189,6 +192,11 @@
} catch (error) {
ElMessage.error(error?.message || '鑾峰彇搴撳尯璇︽儏澶辫触')
}
+ }
+
+ async function openWarehouseAreasDialog(type, record) {
+ await ensureCompanyOptions()
+ showDialog(type, record)
}
const { columns, columnChecks, data, loading, pagination, getData, replaceSearchParams, resetSearchParams, handleSizeChange, handleCurrentChange, refreshData, refreshCreate, refreshUpdate, refreshRemove } =
@@ -251,6 +259,43 @@
resetSearchParams()
}
+ async function ensureCompanyOptions() {
+ if (companyOptionsLoaded.value) {
+ return
+ }
+
+ if (companyOptionsLoading.value) {
+ await companyOptionsLoading.value
+ return
+ }
+
+ companyOptionsLoading.value = (async () => {
+ const records = await guardRequestWithMessage(fetchCompanysList(), [], {
+ timeoutMessage: '寰�鏉ヤ紒涓氶�夐」鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟'
+ })
+ const normalizedRecords = defaultResponseAdapter(records).records
+ shipperOptions.value = normalizedRecords
+ .filter((item) => item.type === 'shipper')
+ .map((item) => ({
+ label: item.name || item.code || `璐т富 ${item.id}`,
+ value: item.id
+ }))
+ supplierOptions.value = normalizedRecords
+ .filter((item) => item.type === 'supplier')
+ .map((item) => ({
+ label: item.name || item.code || `渚涘簲鍟� ${item.id}`,
+ value: item.id
+ }))
+ companyOptionsLoaded.value = true
+ })()
+
+ try {
+ await companyOptionsLoading.value
+ } finally {
+ companyOptionsLoading.value = null
+ }
+ }
+
async function loadWarehouseOptions() {
const records = await guardRequestWithMessage(fetchWarehouseList(), [], {
timeoutMessage: '浠撳簱閫夐」鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟'
@@ -259,25 +304,6 @@
label: item.name || item.code || `浠撳簱 ${item.id}`,
value: item.id
}))
- }
-
- async function loadCompanyOptions() {
- const records = await guardRequestWithMessage(fetchCompanysList(), [], {
- timeoutMessage: '寰�鏉ヤ紒涓氶�夐」鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟'
- })
- const normalizedRecords = defaultResponseAdapter(records).records
- shipperOptions.value = normalizedRecords
- .filter((item) => item.type === 'shipper')
- .map((item) => ({
- label: item.name || item.code || `璐т富 ${item.id}`,
- value: item.id
- }))
- supplierOptions.value = normalizedRecords
- .filter((item) => item.type === 'supplier')
- .map((item) => ({
- label: item.name || item.code || `渚涘簲鍟� ${item.id}`,
- value: item.id
- }))
}
async function loadTypeOptions() {
@@ -298,6 +324,6 @@
}
onMounted(async () => {
- await Promise.all([loadWarehouseOptions(), loadCompanyOptions(), loadTypeOptions(), getData()])
+ await Promise.all([loadWarehouseOptions(), loadTypeOptions(), getData()])
})
</script>
--
Gitblit v1.9.1