diff --git a/inventory-web/src/components/WarehouseSelector.vue b/inventory-web/src/components/WarehouseSelector.vue
index ced5383..52b2de2 100644
--- a/inventory-web/src/components/WarehouseSelector.vue
+++ b/inventory-web/src/components/WarehouseSelector.vue
@@ -56,12 +56,12 @@
-
+
当前层级无库位数据
- (), {
- modelValue: ''
+ modelValue: '',
+ allowedTopPrefixes: () => []
})
const emit = defineEmits<{
@@ -159,6 +162,15 @@ const currentParentId = computed(() => {
// 当前显示的列表(懒加载缓存)
const currentList = computed(() => cache[currentParentKey.value] || [])
+// 顶层按公司白名单前缀过滤后的显示列表(响应式:切换物料公司时实时变化)
+const displayList = computed(() => {
+ const list = currentList.value
+ if (currentParentKey.value === 'root' && props.allowedTopPrefixes.length > 0) {
+ return list.filter((item) => props.allowedTopPrefixes.some((p) => item.name.startsWith(p)))
+ }
+ return list
+})
+
// 懒加载某层子节点(已缓存则跳过)
const ensureLoaded = async (key: string, parentId: number | null) => {
if (cache[key]) return
diff --git a/inventory-web/src/utils/warehouseCompany.ts b/inventory-web/src/utils/warehouseCompany.ts
new file mode 100644
index 0000000..d0201bd
--- /dev/null
+++ b/inventory-web/src/utils/warehouseCompany.ts
@@ -0,0 +1,22 @@
+/**
+ * 公司 → 允许选择的库位顶层前缀(白名单)
+ *
+ * - 匹配到公司:顶层库位只显示 name 以这些前缀开头的节点(其子级随顶层隐藏不可达)
+ * - 未配置的公司 / 空数组:显示全部库位
+ *
+ * 如需调整规则(新增公司/改前缀),只需改这张表,无需改动组件。
+ */
+export const COMPANY_WAREHOUSE_PREFIXES: Record = {
+ // IRIS 仅显示 Y 开头(Y1~Y8)
+ IRIS: ['Y'],
+ // LICA 隐藏 Y,显示 C / L 开头
+ LICA: ['C', 'L'],
+}
+
+/**
+ * 根据公司名取允许的库位顶层前缀(未配置返回空数组 = 不过滤)
+ */
+export function getAllowedLocPrefixes(companyName?: string | null): string[] {
+ if (!companyName) return []
+ return COMPANY_WAREHOUSE_PREFIXES[companyName] || []
+}
diff --git a/inventory-web/src/views/stock/inbound/buy.vue b/inventory-web/src/views/stock/inbound/buy.vue
index 0ef4860..4fb0b34 100644
--- a/inventory-web/src/views/stock/inbound/buy.vue
+++ b/inventory-web/src/views/stock/inbound/buy.vue
@@ -384,7 +384,7 @@
-
+
@@ -806,6 +806,7 @@ import {getLabelPreview, executePrint} from '@/api/common/print'
import { usePasteUpload } from '@/hooks/usePasteUpload'
import WebRtcCamera from '@/components/Camera/WebRtcCamera.vue'
import WarehouseSelector from '@/components/WarehouseSelector.vue'
+import { getAllowedLocPrefixes } from '@/utils/warehouseCompany'
import SmartScannerDialog from '@/components/SmartScannerDialog.vue'
import { useUserStore } from '@/stores/user'
@@ -1166,6 +1167,9 @@ const handleCheckAllChange = (val: boolean) => {
}
};
+// 按物料公司限制可选库位顶层前缀(IRIS→Y,LICA→C/L,未配置→全部)
+const allowedLocPrefixes = computed(() => getAllowedLocPrefixes(form.company_name))
+
const form = reactive({
id: undefined, base_id: undefined as number | undefined,
company_name: '',
diff --git a/inventory-web/src/views/stock/inbound/product.vue b/inventory-web/src/views/stock/inbound/product.vue
index d8c72ea..7e085b4 100644
--- a/inventory-web/src/views/stock/inbound/product.vue
+++ b/inventory-web/src/views/stock/inbound/product.vue
@@ -354,7 +354,7 @@
-
+
@@ -614,6 +614,7 @@ import {
import { uploadFile, deleteFile } from '@/api/inbound/buy'
import WebRtcCamera from '@/components/Camera/WebRtcCamera.vue'
import WarehouseSelector from '@/components/WarehouseSelector.vue'
+import { getAllowedLocPrefixes } from '@/utils/warehouseCompany'
import SmartScannerDialog from '@/components/SmartScannerDialog.vue'
import TrackScanDialog from '@/components/TrackScanDialog.vue'
import { getLabelPreview, executePrint } from '@/api/common/print'
@@ -929,6 +930,9 @@ const displayData = computed(() => {
const defaultVisibleCols = ['company_name', 'material_name', 'sku', 'warehouse_loc', 'serial_number', 'in_quantity', 'stock_quantity', 'available_quantity', 'status', 'quality_status', 'product_photo', 'sale_price', 'order_id']
+// 按物料公司限制可选库位顶层前缀(IRIS→Y,LICA→C/L,未配置→全部)
+const allowedLocPrefixes = computed(() => getAllowedLocPrefixes(form.company_name))
+
const form = reactive({
id: undefined, base_id: undefined as number | undefined,
company_name: '', // [新增]
diff --git a/inventory-web/src/views/stock/inbound/semi.vue b/inventory-web/src/views/stock/inbound/semi.vue
index 44469d8..3fbc539 100644
--- a/inventory-web/src/views/stock/inbound/semi.vue
+++ b/inventory-web/src/views/stock/inbound/semi.vue
@@ -393,7 +393,7 @@
-
+
@@ -658,6 +658,7 @@ import {
import { uploadFile, deleteFile } from '@/api/inbound/buy'
import WebRtcCamera from '@/components/Camera/WebRtcCamera.vue'
import WarehouseSelector from '@/components/WarehouseSelector.vue'
+import { getAllowedLocPrefixes } from '@/utils/warehouseCompany'
import SmartScannerDialog from '@/components/SmartScannerDialog.vue'
import TrackScanDialog from '@/components/TrackScanDialog.vue'
import {getLabelPreview, executePrint} from '@/api/common/print'
@@ -973,6 +974,9 @@ const handleCheckAllChange = (val: boolean) => {
const defaultColumns = ['company_name', 'material_name', 'spec_model', 'unit', 'inbound_date', 'sn_bn', 'status', 'quality_status', 'bom_code', 'work_order_code', 'stock_quantity', 'available_quantity', 'unit_total_cost', 'arrival_photo', 'quality_report_link']
+// 按物料公司限制可选库位顶层前缀(IRIS→Y,LICA→C/L,未配置→全部)
+const allowedLocPrefixes = computed(() => getAllowedLocPrefixes(form.company_name))
+
const form = reactive({
id: undefined, base_id: undefined as number | undefined,
company_name: '',