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.

151 lines
4.3 KiB

2 years ago
<template>
1 year ago
<view class="" style="background-color: #fff">
<u-collapse ref="collapse1">
<u-collapse-item :open="true">
<template v-slot:title>
1 year ago
<u-swipe-action :show="false" style="width: 90%" :options="removeOptions" bg-color="rgba(255,255,255,0)" @click="(...event) => removeItem(event, dataContent)">
1 year ago
<item-qty :dataContent="dataContent" :isShowBalance="true" :isShowBalanceQty="isShowBalanceQty"></item-qty>
</u-swipe-action>
</template>
<u-swipe-action :show="detail.show" :index="index" v-for="(detail, index) in dataContent.subList" :key="index" :options="detail.scaned ? scanOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="(...event) => swipeClick(event, detail)">
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus" :isShowPack="true" :isShowFromLocation="isShowFromLocation" :isShowToLocation="isShowToLocation"> </balance>
1 year ago
</u-swipe-action>
</u-collapse-item>
</u-collapse>
<balance-qty-edit ref="balanceQtyEditRef" @confirm="confirm"></balance-qty-edit>
<record-detail-popup ref="recordDetailPopupRef"></record-detail-popup>
<com-message ref="comMessageRef" />
</view>
2 years ago
</template>
1 year ago
<script setup lang="ts">
import { ref, onMounted, nextTick, watch } from 'vue'
import itemQty from '@/mycomponents/item/itemQty.vue'
// import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import recordDetailPopup from '@/mycomponents/detail/recordDetailPopup.vue'
2 years ago
1 year ago
import { getDetailOption, getDetailEditRemoveOption, getClearOption } from '@/common/array.js'
2 years ago
1 year ago
const props = defineProps({
dataContent: {
type: Object,
default: {}
},
settingParam: {
type: Object,
default: {}
},
2 years ago
1 year ago
isShowStatus: {
type: Boolean,
default: false
},
2 years ago
1 year ago
isShowFromLocation: {
type: Boolean,
default: true
},
1 year ago
isShowToLocation: {
type: Boolean,
default: true
},
2 years ago
1 year ago
isShowBalanceQty: {
type: Boolean,
default: false
}
})
const collapse1 = ref()
// 监视属性
watch(
() => props.dataContent,
(val) => {
if (val.subList.length > 0) {
if (collapse1.value != undefined && collapse1.value != null) {
nextTick((res) => {
collapse1.value.init()
})
}
}
},
{ immediate: true, deep: true }
)
const option = ref([])
const title = ref('推荐详情')
const showItem = ref({})
const editItem = ref({})
const detailOptions = ref([])
const scanOptions = ref([])
const removeOptions = ref([])
const dataList = ref([])
const comMessageRef = ref('')
const balanceQtyEditRef = ref('')
const recordDetailPopupRef = ref('')
const dataContent = ref(props.dataContent)
dataContent.value.subList.forEach((item) => {
item.show = false
})
onMounted(() => {
detailOptions.value = getDetailOption()
scanOptions.value = getDetailEditRemoveOption()
removeOptions.value = getClearOption()
})
const removeItem = (params, dataContent) => {
const { text } = removeOptions.value[params[1]]
if (text == '清空') {
comMessageRef.value.showQuestionMessage('确定清空物料及箱码信息?', (res) => {
if (res) {
emit('removeItem')
}
})
}
}
const swipeClick = (params, item) => {
let text = ''
if (item.scaned) {
text = scanOptions.value[params[1]].text
} else {
text = detailOptions.value[params[1]].text
}
if (text == '详情') {
detail(item)
} else if (text == '编辑') {
edit(item)
} else if (text == '移除') {
remove(item, params[0])
}
}
const edit = (item) => {
editItem.value = item
balanceQtyEditRef.value.openEditPopup(editItem.value, editItem.value.handleQty)
}
const detail = (item) => {
showItem.value = item
recordDetailPopupRef.value.openPopup(item)
}
const remove = (item, index) => {
comMessageRef.value.showQuestionMessage('确定清空物料及箱码信息', (res) => {
if (res) {
dataContent.value.subList.splice(index, 1)
emit('removePack')
}
})
}
const confirm = (qty) => {
editItem.value.handleQty = qty
emit('updateData')
}
2 years ago
1 year ago
// 传递给父类
const emit = defineEmits(['updateData', 'removePack'])
2 years ago
</script>
<style>
1 year ago
::v-deep .u-arrow-down-icon {
margin-right: 0px !important;
}
2 years ago
</style>