提交
This commit is contained in:
1 parent
2eb1807fe6
commit
93f5801aa9
18 files changed
+3045
-2319
No files matched your search
@@ -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 = []
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user