优化
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { reactive } from 'vue'
|
||||
import { RECEIVING_PHOTO_ROLES } from '@/api/receiving-adapter.js'
|
||||
|
||||
export const receiving = reactive({
|
||||
candidates: [], selected: null, current: null, photoSlots: [null, null, null],
|
||||
@@ -33,13 +34,10 @@ export function setCurrentReceiving(value) {
|
||||
if (!chosen || Number(chosen.pendingPackages || 0) <= 0) {
|
||||
receiving.selectedInboundCode = (value?.inbounds || []).find((item) => Number(item.pendingPackages || 0) > 0)?.inboundCode || value?.inbounds?.[0]?.inboundCode || ''
|
||||
}
|
||||
if (value?.photos?.length) {
|
||||
const roles = ['LICENSE_PLATE', 'CONTAINER_SEAL', 'DOOR_OPEN']
|
||||
receiving.photoSlots = roles.map((role) => {
|
||||
const photo = value.photos.find((item) => item.role === role)
|
||||
return photo ? { ...photo, fileId: String(photo.fileId), role, uploaded: true } : null
|
||||
})
|
||||
}
|
||||
receiving.photoSlots = RECEIVING_PHOTO_ROLES.map((role) => {
|
||||
const photo = value?.photos?.find((item) => item.role === role)
|
||||
return photo ? { ...photo, fileId: String(photo.fileId), role, uploaded: true } : null
|
||||
})
|
||||
}
|
||||
|
||||
export function resetReceivingDraft({ keepCurrent = false } = {}) {
|
||||
|
||||
Reference in New Issue
Block a user