You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
5.3 KiB

<template>
<view class="" style="background-color: #fff;">
<u-collapse ref="collapse1" >
<u-collapse-item :open="true">
<template v-slot:title>
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowStdPack="false">
</item-compare-qty>
</template>
<view class="" v-for="(item,index) in dataContent.subList" :key="index">
<u-swipe-action ref="swipeAction"
:options="item.scaned?scanOptions:detailOptions"
style='padding:0px 0px 5px 0px;align-items: center;'
@click="(...event)=>swipeClick(event,item)">
<view v-if="item.isRecommend" class="uni-flex" style="flex-direction: row; align-items: center;background-color: antiquewhite;">
<view class="" style="font-size: 32rpx; color: black; font-weight: bold; text-align: center;">
</view>
<recommend :detail="item" :isShowStatus="isShowStatus" :isShowFromLocation="isShowFromLocation" :isShowToLocation="isShowToLocation" style="flex:1" :isShowBatch='item.batch ? true:false' :isShowPack='isShowPack'>
</view>
<view v-else class="uni-flex" style="flex-direction: row; align-items: center;background-color: antiquewhite; margin-top: 5rpx;">
<view class="" style="font-size: 32rpx; color: red; font-weight: bold; text-align: center;">
</view>
<recommend :detail="item" :isShowStatus="isShowStatus" :isShowFromLocation="isShowFromLocation" :isShowToLocation="isShowToLocation" style="flex:1" :isShowBatch='item.batch? true:false' :isShowPack='isShowPack'></recommend>
</view>
</u-swipe-action>
</view>
</u-collapse-item>
</u-collapse>
<<recommend-qty-edit ref="recommendQtyEditRef" :dataContent="editItem" :handleQty="editItem.qty" @confirm="confirm" :settingParam='settingParam'
:isShowStatus="isShowStatus"></recommend-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location>
<comMessage ref="message"></comMessage>
</view>
</template>
<script setup>
import {ref, watch, onMounted, nextTick} from 'vue'
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue'
import {
getDetailOption,
getPurchaseReceiptOption
} from '@/common/array.js'
const props = defineProps({
dataContent: {
type: Object,
default: null
},
settingParam: {
type: Object,
default: null
},
isShowPack: {
type: Boolean,
default: true
},
isShowBatch: {
type: Boolean,
default: true
},
isShowLocation: {
type: Boolean,
default: true
},
locationAreaTypeList: {
type: Array,
default: null
},
queryBalance: {
type: Boolean,
default: true
},
isShowStatus: {
type: Boolean,
default: true
}
})
const emit = defineEmits(['openDetail', 'remove', 'updateData'])
const collapse1 = ref(null)
const qtyEdit = ref(null)
const message = ref(null)
const scanLocationCode = ref(null)
const option = ref([])
const showItem = ref({})
const locatonItem = ref({})
const editItem = ref({})
const detailOptions = ref([])
const scanOptions = ref([])
const recommendQtyEditRef = ref()
watch(() => props.dataContent, (newDataContent, oldDataContent) => {
if (newDataContent?.subList.length > 0) {
nextTick(() => {
setTimeout(() => {
if (collapse1.value) {
collapse1.value.init()
}
}, 500)
})
}
}, { immediate: true, deep: true })
onMounted(() => {
if (scanOptions.value.length === 0) {
scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, false)
}
// showLocation();
if(import.meta.env.VITE_MANAGE_MODEL=='BY_PACKAGING'){
if (detailOptions.value.length == 0) {
detailOptions.value = getDetailOption()
}
}else {
scanOptions.value.splice(0,1)
}
})
const swipeClick = (e, item) => {
switch (e.content.text) {
case '详情':
detail(item)
break
case '编辑':
edit(item)
break
case '库位':
showLocation(item)
break
case '移除':
remove(item)
break
}
}
const edit = (item) => {
editItem.value = item
qtyEdit.value.openEditPopup(item.balance, item.handleQty)
recommendQtyEditRef.value.openTaskEditPopup(item.qty,item.handleQty,item.labelQty)
}
const detail = (item) => {
emit('openDetail', item)
// showItem.value = item;
// jobDetailPopup.value.openPopup(item);
}
const remove = (item) => {
message.value.showQuestionMessage('确定移除扫描信息?', (res) => {
if (res) {
item.scaned = false
item.balance = {}
item.handleQty = null
emit('remove', item)
}
})
}
const confirm = (qty) => {
editItem.value.handleQty = qty
emit('updateData')
}
const showLocation = (item) => {
locatonItem.value = item
scanLocationCode.value.openScanPopup()
}
const getLocation = (location, code) => {
locatonItem.value.toLocationCode = code
emit('updateData')
}
</script>
<style>
</style>