2024-07-23 14:50:17 +08:00
|
|
|
<template>
|
2024-08-01 22:42:33 +08:00
|
|
|
<div class="pl-6" v-if="storageLocationsTree.length" v-for="storageLocationTree in storageLocationsTree"
|
2024-07-23 14:50:17 +08:00
|
|
|
:key="storageLocationTree.storage_location.id">
|
|
|
|
<div class="flex items-center">
|
|
|
|
<i v-if="storageLocationTree.children.length > 0"
|
|
|
|
:class="{'sn-icon-up': opendedStorageLocations[storageLocationTree.storage_location.id],
|
|
|
|
'sn-icon-down': !opendedStorageLocations[storageLocationTree.storage_location.id]}"
|
|
|
|
@click="opendedStorageLocations[storageLocationTree.storage_location.id] = !opendedStorageLocations[storageLocationTree.storage_location.id]"
|
|
|
|
class="sn-icon p-2 pr-1 cursor-pointer"></i>
|
|
|
|
<i v-else class="sn-icon sn-icon-up p-2 pr-1 opacity-0"></i>
|
|
|
|
<div @click="$emit('selectStorageLocation', storageLocationTree.storage_location.id)"
|
|
|
|
class="cursor-pointer flex items-center pl-1 flex-1 gap-2
|
|
|
|
text-sn-blue hover:bg-sn-super-light-grey"
|
|
|
|
:class="{'!bg-sn-super-light-blue': storageLocationTree.storage_location.id == value}">
|
2024-07-29 21:41:40 +08:00
|
|
|
<i v-if="storageLocationTree.storage_location.container" class="sn-icon sn-icon-item"></i>
|
2024-07-23 14:50:17 +08:00
|
|
|
<div class="flex-1 truncate p-2 pl-0" :title="storageLocationTree.storage_location.name">
|
|
|
|
{{ storageLocationTree.storage_location.name }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<MoveTree v-if="opendedStorageLocations[storageLocationTree.storage_location.id]"
|
2024-08-01 22:42:33 +08:00
|
|
|
:storageLocationsTree="storageLocationTree.children"
|
2024-07-23 14:50:17 +08:00
|
|
|
:value="value"
|
|
|
|
@selectStorageLocation="$emit('selectStorageLocation', $event)" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'MoveTree',
|
|
|
|
emits: ['selectStorageLocation'],
|
|
|
|
props: {
|
2024-08-01 22:42:33 +08:00
|
|
|
storageLocationsTree: Array,
|
2024-07-23 14:50:17 +08:00
|
|
|
value: Number
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
MoveTree: () => import('./move_tree.vue')
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
opendedStorageLocations: {}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|