This commit is contained in:
zlwu committed 2026-05-24 10:42:11 +08:00
1 parent 2eb1807fe6
commit 93f5801aa9
18 files changed
+3045 -2319

No files matched your search

@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_types_import_components_d_ts", "label": "components.d.ts", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/components.d.ts", "source_location": "L1"}], "edges": [], "raw_calls": []}
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "label": "App.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L1"}, {"id": "src_app_refreshbuttonautoicons", "label": "refreshButtonAutoIcons()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L51"}, {"id": "src_app_refreshpaneltitleicons", "label": "refreshPanelTitleIcons()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L113"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "pinia", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L17", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_store_modules_user", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L18", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "zh_cn", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L19", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "en", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L20", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_sys", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L21", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_ui_animation", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L22", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L23", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_hooks_core_usetheme", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L24", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "src_app_refreshbuttonautoicons", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L51", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_app_vue", "target": "src_app_refreshpaneltitleicons", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L113", "weight": 1.0}], "raw_calls": [{"caller_nid": "src_app_refreshbuttonautoicons", "callee": "join", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L56"}, {"caller_nid": "src_app_refreshbuttonautoicons", "callee": "forEach", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L57"}, {"caller_nid": "src_app_refreshpaneltitleicons", "callee": "forEach", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/App.vue", "source_location": "L116"}]}
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_consumable_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/consumable/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "label": "useTaskStepEditor.ts", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L1"}, {"id": "production_work_order_usetaskstepeditor_toapiflag", "label": "toApiFlag()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L35"}, {"id": "production_work_order_usetaskstepeditor_fromapiflag", "label": "fromApiFlag()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L39"}, {"id": "production_work_order_usetaskstepeditor_normalizestepsubtables", "label": "normalizeStepSubTables()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L42"}, {"id": "production_work_order_usetaskstepeditor_parseordernum", "label": "parseOrderNum()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L57"}, {"id": "production_work_order_usetaskstepeditor_usetaskstepeditor", "label": "useTaskStepEditor()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L64"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_api_production_task", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L1", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_api_production", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L16", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_api_admin", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L24", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_api_cell_product", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L25", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_api_admin", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L26", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L32", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "production_work_order_usetaskstepeditor_toapiflag", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L35", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_usetaskstepeditor_ts", "target": "production_work_order_usetaskstepeditor_fromapiflag", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts", "source_location": "L39", "weight": 1.0}, {"source"Line truncated
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_reagent_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/reagent/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_cell_product_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/cell-product/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "label": "storage-slot-options.ts", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L1"}, {"id": "utils_storage_slot_options_getstoragefacilityordernum", "label": "getStorageFacilityOrderNum()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L8"}, {"id": "utils_storage_slot_options_getstorageslotordernum", "label": "getStorageSlotOrderNum()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L15"}, {"id": "utils_storage_slot_options_parsestorageslotcode", "label": "parseStorageSlotCode()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L22"}, {"id": "utils_storage_slot_options_comparestoragefacilityslots", "label": "compareStorageFacilitySlots()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L31"}, {"id": "utils_storage_slot_options_sortstoragefacilityslots", "label": "sortStorageFacilitySlots()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L51"}, {"id": "utils_storage_slot_options_collectleaffacilitynodesintreeorder", "label": "collectLeafFacilityNodesInTreeOrder()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L60"}, {"id": "utils_storage_slot_options_mapslotstoselectoptions", "label": "mapSlotsToSelectOptions()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L112"}, {"id": "utils_storage_slot_options_loadstorageslotselectoptions", "label": "loadStorageSlotSelectOptions()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L128"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_tree_path", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L4", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_getstoragefacilityordernum", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L8", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_getstorageslotordernum", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L15", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_parsestorageslotcode", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L22", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_comparestoragefacilityslots", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L31", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_sortstoragefacilityslots", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L51", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_collectleaffacilitynodesintreeorder", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_location": "L60", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_utils_storage_slot_options_ts", "target": "utils_storage_slot_options_mapslotstoselectoptions", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/utils/storage-slot-options.ts", "source_locLine truncated
+149
View File
@@ -0,0 +1,149 @@
/**
* 储物格下拉选项:设施树 DFS(order_num)+ 盒内格位按行/列升序
*/
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
export type StorageSlotSelectOption = { id: string; name: string }
export function getStorageFacilityOrderNum(item: Record<string, unknown>): number {
const raw =
item?.orderNum ?? item?.order_num ?? item?.sortOrder ?? item?.sort_order ?? 0
const parsed = Number(raw)
return Number.isFinite(parsed) ? parsed : 0
}
export function getStorageSlotOrderNum(slot: Record<string, unknown>): number {
const raw = slot?.orderNum ?? slot?.order_num ?? 0
const parsed = Number(raw)
return Number.isFinite(parsed) ? parsed : 0
}
/** 解析 slotCode「{prefix}{row}-{col}」 */
export function parseStorageSlotCode(
code: string
): { row: number; col: number } | null {
const match = (code || '').trim().match(/^(.*?)(\d+)-(\d+)$/)
if (!match) return null
return { row: parseInt(match[2], 10), col: parseInt(match[3], 10) }
}
/** 盒内格位:order_num → 行 → 列 → 编码 */
export function compareStorageFacilitySlots(
a: Record<string, unknown>,
b: Record<string, unknown>
): number {
const orderDiff = getStorageSlotOrderNum(a) - getStorageSlotOrderNum(b)
if (orderDiff !== 0) return orderDiff
const codeA = String(a.slotCode ?? a.slot_code ?? '')
const codeB = String(b.slotCode ?? b.slot_code ?? '')
const pa = parseStorageSlotCode(codeA)
const pb = parseStorageSlotCode(codeB)
if (pa && pb) {
if (pa.row !== pb.row) return pa.row - pb.row
if (pa.col !== pb.col) return pa.col - pb.col
} else if (pa && !pb) return -1
else if (!pa && pb) return 1
const codeCmp = codeA.localeCompare(codeB, 'zh-Hans-CN', { numeric: true })
if (codeCmp !== 0) return codeCmp
return String(a.id ?? '').localeCompare(String(b.id ?? ''))
}
export function sortStorageFacilitySlots<T extends Record<string, unknown>>(
slots: T[]
): T[] {
return [...slots].sort(compareStorageFacilitySlots)
}
/**
* 按设施树顺序收集叶子节点(罐 → 层 → 盒…),同级按 order_num、名称排序。
*/
export function collectLeafFacilityNodesInTreeOrder(
flatList: Record<string, unknown>[]
): Record<string, unknown>[] {
const map = new Map<string, Record<string, unknown> & { children: unknown[] }>()
const roots: (Record<string, unknown> & { children: unknown[] })[] = []
for (const item of flatList || []) {
const id = String(item?.id ?? '').trim()
if (!id) continue
map.set(id, { ...item, children: [] })
}
for (const item of flatList || []) {
const id = String(item?.id ?? '').trim()
const node = map.get(id)
if (!node) continue
const parentId = String(item?.parentId ?? item?.parent_id ?? '').trim()
if (parentId && parentId !== '0' && map.has(parentId)) {
;(map.get(parentId)!.children as typeof roots).push(node)
} else {
roots.push(node)
}
}
const sortNodes = (nodes: (typeof roots)[number][]) => {
nodes.sort((a, b) => {
const orderDiff = getStorageFacilityOrderNum(a) - getStorageFacilityOrderNum(b)
if (orderDiff !== 0) return orderDiff
return String(a.nodeName ?? '').localeCompare(String(b.nodeName ?? ''), 'zh-Hans-CN')
})
nodes.forEach((node) => {
const ch = node.children
if (Array.isArray(ch) && ch.length) sortNodes(ch as typeof roots)
})
}
sortNodes(roots)
const leaves: Record<string, unknown>[] = []
const walk = (nodes: typeof roots) => {
for (const n of nodes) {
const isLeaf = n.isLeaf === 1 || n.is_leaf === 1
const ch = n.children
if (isLeaf) {
leaves.push(n)
} else if (Array.isArray(ch) && ch.length) {
walk(ch as typeof roots)
}
}
}
walk(roots)
return leaves
}
export function mapSlotsToSelectOptions(
facilityNodeId: string,
facilities: Record<string, unknown>[],
slots: Record<string, unknown>[]
): StorageSlotSelectOption[] {
const nodePath = buildTreePathLabelFromFlat(facilityNodeId, facilities, {
nameKey: 'nodeName',
})
return sortStorageFacilitySlots(slots).map((slot) => {
const id = String(slot.id ?? '').trim()
const code = String(slot.slotCode ?? slot.slot_code ?? '')
const name = nodePath && code ? `${nodePath} / ${code}` : code || nodePath
return { id, name }
})
}
export async function loadStorageSlotSelectOptions(
facilities: Record<string, unknown>[],
fetchStorageSlotList: (params: { facilityNodeId: string }) => Promise<unknown>
): Promise<StorageSlotSelectOption[]> {
const leafNodes = collectLeafFacilityNodesInTreeOrder(facilities)
if (!leafNodes.length) return []
const results = await Promise.allSettled(
leafNodes.map(async (node) => {
const nodeId = String(node.id ?? '').trim()
const res: any = await fetchStorageSlotList({ facilityNodeId: nodeId })
const slots = (res?.list || res || []) as Record<string, unknown>[]
return mapSlotsToSelectOptions(nodeId, facilities, slots)
})
)
const options: StorageSlotSelectOption[] = []
results.forEach((r) => {
if (r.status === 'fulfilled') options.push(...r.value)
})
return options
}
@@ -650,7 +650,7 @@
fetchStorageSlotList,
fetchItemUnitList,
} from '@/api/admin'
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
import { loadStorageSlotSelectOptions } from '@/utils/storage-slot-options'
import { fetchUploadAttachment } from '@/api/business'
import { downloadAttachmentFile } from '@/utils/download-attachment'
@@ -956,30 +956,10 @@
}
async function loadStorageSlotOptions(facilities: any[]) {
const leafNodes = facilities.filter((n) => n.isLeaf === 1)
if (!leafNodes.length) {
storageSlotOptions.value = []
return
}
const results = await Promise.allSettled(
leafNodes.map(async (node) => {
const res: any = await fetchStorageSlotList({ facilityNodeId: node.id })
const slots = res?.list || res || []
const nodePath = buildTreePathLabelFromFlat(node.id, facilities, {
nameKey: 'nodeName',
})
return slots.map((slot: any) => {
const code = slot.slotCode || ''
const name = nodePath && code ? `${nodePath} / ${code}` : code || nodePath
return { id: slot.id, name }
})
})
storageSlotOptions.value = await loadStorageSlotSelectOptions(
facilities,
fetchStorageSlotList
)
const options: Array<{ id: string; name: string }> = []
results.forEach((r) => {
if (r.status === 'fulfilled') options.push(...r.value)
})
storageSlotOptions.value = options
}
async function loadDropdownData() {
@@ -29,7 +29,7 @@ import {
fetchStorageFacilityList,
fetchStorageSlotList
} from '@/api/admin'
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
import { loadStorageSlotSelectOptions } from '@/utils/storage-slot-options'
// ── helpers ──────────────────────────────────────────────────────────
function toApiFlag(val: boolean | number | string | undefined): string {
@@ -511,28 +511,10 @@ export function useTaskStepEditor() {
try {
const facilityRes = await fetchStorageFacilityList()
const facilities = facilityRes?.list || facilityRes || []
const leafNodes = facilities.filter((n: any) => n.isLeaf === 1)
if (!leafNodes.length) {
storageSlotOptions.value = []
return
}
const results = await Promise.allSettled(
leafNodes.map(async (node: any) => {
const res: any = await fetchStorageSlotList({ facilityNodeId: node.id })
const slots = res?.list || res || []
const nodePath = buildTreePathLabelFromFlat(node.id, facilities, { nameKey: 'nodeName' })
return slots.map((slot: any) => {
const code = slot.slotCode || ''
const name = nodePath && code ? `${nodePath} / ${code}` : code || nodePath
return { id: slot.id, name }
})
})
storageSlotOptions.value = await loadStorageSlotSelectOptions(
facilities,
fetchStorageSlotList
)
const options: Array<{ id: string; name: string }> = []
results.forEach((r) => {
if (r.status === 'fulfilled') options.push(...r.value)
})
storageSlotOptions.value = options
} catch {
storageSlotOptions.value = []
}