王志国
3 weeks ago
5 changed files with 828 additions and 912 deletions
@ -1,240 +1,229 @@ |
|||
<template> |
|||
<view class="" style="background-color: #fff;"> |
|||
|
|||
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" |
|||
:isShowStdPack="false"> |
|||
</item-compare-qty> |
|||
|
|||
|
|||
<view class="" v-for="(item,index) in dataContent.subList" :key="index"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<uni-swipe-action-item @click="swipeClick($event,item)" |
|||
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
|||
style='padding:0px 0px 5px 0px;align-items: center;'> |
|||
|
|||
<view v-if="item.isRecommend" class="uni-flex" style="flex-direction: row;"> |
|||
<view class="" style="font-size: 32rpx; color: black; font-weight: bold; text-align: center;background-color: antiquewhite;display: flex;align-items: center;justify-content: center;padding: 0px 10rpx;"> |
|||
推<br/> |
|||
荐 |
|||
</view> |
|||
<view class="" style="flex:1;"> |
|||
<batch v-if="item.batch" :batch="item.batch"></batch> |
|||
<location v-if="item.fromLocationCode" title="来源库位" :locationCode="item.fromLocationCode"> |
|||
</location> |
|||
</view> |
|||
<text style="font-size: 30rpx;color: #2979ff; " @click="copy(item)" v-if="isDevlement()">复制</text> |
|||
|
|||
</view> |
|||
|
|||
<view v-else class="uni-flex" style="flex-direction: row; margin-top: 5rpx;"> |
|||
<view class="" style="font-size: 32rpx; color: black; font-weight: bold; text-align: center;background-color: antiquewhite;display: flex;align-items: center;justify-content: center;padding: 0px 10rpx;"> |
|||
实<br/> |
|||
际 |
|||
</view> |
|||
<view class="scan_view" style="flex:1;"> |
|||
<batch v-if="item.batch" :batch="item.batch"></batch> |
|||
<location v-if="item.fromLocationCode" title="来源库位" :locationCode="item.fromLocationCode"> |
|||
</location> |
|||
</view> |
|||
<!-- <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false"> |
|||
</recommend> --> |
|||
</view> |
|||
|
|||
|
|||
</uni-swipe-action-item> |
|||
</uni-swipe-action> |
|||
</view> |
|||
|
|||
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" @confirm="confirm"></balance-qty-edit> |
|||
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' |
|||
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> |
|||
<comMessage ref="message"></comMessage> |
|||
</view> |
|||
<view class="" style="background-color: #fff;"> |
|||
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" |
|||
:isShowStdPack="false"> |
|||
</item-compare-qty> |
|||
<view class="" v-for="(item,index) in dataContent.subList" :key="index"> |
|||
<uni-swipe-action ref="swipeAction" |
|||
style='padding:0px 0px 5px 0px;align-items: center;' |
|||
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
|||
@click="(...event)=>swipeClick(event,item)"> |
|||
<view v-if="item.isRecommend" class="uni-flex" style="flex-direction: row;"> |
|||
<view class="" |
|||
style="font-size: 32rpx; color: black; font-weight: bold; text-align: center;background-color: antiquewhite;display: flex;align-items: center;justify-content: center;padding: 0px 10rpx;"> |
|||
推<br/> |
|||
荐 |
|||
</view> |
|||
<view class="" style="flex:1;"> |
|||
<batch v-if="item.batch" :batch="item.batch"></batch> |
|||
<location v-if="item.fromLocationCode" title="来源库位" :locationCode="item.fromLocationCode"> |
|||
</location> |
|||
</view> |
|||
<text style="font-size: 30rpx;color: #2979ff; " @click="copy(item)" v-if="isDevlement()">复制</text> |
|||
</view> |
|||
<view v-else class="uni-flex" style="flex-direction: row; margin-top: 5rpx;"> |
|||
<view class="" |
|||
style="font-size: 32rpx; color: black; font-weight: bold; text-align: center;background-color: antiquewhite;display: flex;align-items: center;justify-content: center;padding: 0px 10rpx;"> |
|||
实<br/> |
|||
际 |
|||
</view> |
|||
<view class="scan_view" style="flex:1;"> |
|||
<batch v-if="item.batch" :batch="item.batch"></batch> |
|||
<location v-if="item.fromLocationCode" title="来源库位" :locationCode="item.fromLocationCode"> |
|||
</location> |
|||
</view> |
|||
<!-- <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false"> |
|||
</recommend> --> |
|||
</view> |
|||
</uni-swipe-action> |
|||
</view> |
|||
|
|||
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" |
|||
@confirm="confirm"></balance-qty-edit> |
|||
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' |
|||
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> |
|||
<comMessage ref="message"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
|||
import location from '@/mycomponents/balance/location.vue' |
|||
import toLocation from '@/mycomponents/balance/toLocation.vue' |
|||
import batch from '@/mycomponents/balance/batch.vue' |
|||
import config from '@/static/config.js' |
|||
|
|||
import { |
|||
getRemoveOption, |
|||
getEditRemoveOption |
|||
} from '@/common/array.js'; |
|||
|
|||
export default { |
|||
emits: ['openDetail', "updateData"], |
|||
components: { |
|||
itemCompareQty, |
|||
recommend, |
|||
balanceQtyEdit, |
|||
winScanLocation, |
|||
location, |
|||
toLocation, |
|||
itemCompareQty, |
|||
batch, |
|||
}, |
|||
props: { |
|||
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 |
|||
}, |
|||
isEdit: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
}, |
|||
watch: { |
|||
dataContent: { |
|||
handler(newName, oldName) { |
|||
if (this.dataContent.subList.length > 0) { |
|||
this.$nextTick(res => { |
|||
setTimeout(() => { |
|||
if (this.$refs.collapse1) { |
|||
this.$refs.collapse1.resize(); |
|||
} |
|||
}, 500) |
|||
}) |
|||
} |
|||
}, |
|||
immediate: true, |
|||
deep: true |
|||
} |
|||
}, |
|||
|
|||
data() { |
|||
return { |
|||
option: [], |
|||
showItem: {}, |
|||
locatonItem: {}, |
|||
editItem: {}, |
|||
detailOptions: [], |
|||
scanOptions: [], |
|||
|
|||
options: [], |
|||
removeOptions: [], |
|||
editAndRemoveOptions: [] |
|||
} |
|||
}, |
|||
|
|||
mounted() { |
|||
|
|||
this.removeOptions = getRemoveOption(); |
|||
this.editAndRemoveOptions = getEditRemoveOption() |
|||
// this.showLocation(); |
|||
}, |
|||
|
|||
methods: { |
|||
swipeClick(e, item) { |
|||
if (e.content.text == "详情") { |
|||
this.detail(item) |
|||
} else if (e.content.text == "编辑") { |
|||
this.edit(item) |
|||
} else if (e.content.text == "库位") { |
|||
this.showLocation(item) |
|||
} else if (e.content.text == "移除") { |
|||
this.remove(item) |
|||
} |
|||
}, |
|||
edit(item) { |
|||
this.editItem = item; |
|||
this.$refs.qtyEdit.openEditPopup(item.balance, item.handleQty); |
|||
}, |
|||
|
|||
detail(item) { |
|||
this.$emit('openDetail', item); |
|||
// this.showItem = item; |
|||
// this.$refs.jobDetailPopup.openPopup(item) |
|||
}, |
|||
remove(item) { |
|||
this.$refs.message.showQuestionMessage("确定移除扫描信息?", |
|||
res => { |
|||
if (res) { |
|||
item.scaned = false |
|||
item.balance = {} |
|||
item.handleQty = null; |
|||
this.$forceUpdate() |
|||
this.$emit('remove', item) |
|||
} |
|||
}); |
|||
}, |
|||
confirm(qty) { |
|||
this.editItem.handleQty = qty; |
|||
this.$emit('updateData') |
|||
}, |
|||
showLocation(item) { |
|||
this.locatonItem = item; |
|||
this.$refs.scanLocationCode.openScanPopup(); |
|||
}, |
|||
//扫描源库位 |
|||
getLocation(location, code) { |
|||
this.locatonItem.toLocationCode = code; |
|||
this.$emit('updateData') |
|||
}, |
|||
isDevlement() { |
|||
return config.isDevelopment; |
|||
}, |
|||
copy(detail) { |
|||
console.log(detail) |
|||
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100 |
|||
var content = "HPQ;V1.0;I" + detail.itemCode + ";P" + detail.packingNumber + ";B" + detail |
|||
.batch + ";Q" + detail.qty |
|||
// #ifdef H5 |
|||
this.$copyText(content).then( |
|||
res => { |
|||
uni.showToast({ |
|||
title: '复制采购标签成功', |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
) |
|||
// #endif |
|||
// #ifndef H5 |
|||
uni.setClipboardData({ |
|||
data: content, |
|||
success: () => { |
|||
uni.showToast({ |
|||
title: '复制采购标签成功' |
|||
}) |
|||
} |
|||
}) |
|||
// #endif |
|||
}, |
|||
} |
|||
} |
|||
<script setup> |
|||
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
|||
import location from '@/mycomponents/balance/location.vue' |
|||
import toLocation from '@/mycomponents/balance/toLocation.vue' |
|||
import batch from '@/mycomponents/balance/batch.vue' |
|||
import config from '@/static/config.js' |
|||
|
|||
import { |
|||
getRemoveOption, |
|||
getEditRemoveOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import { ref, watch, onMounted, nextTick } from 'vue'; |
|||
|
|||
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 |
|||
}, |
|||
isEdit: { |
|||
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 options = ref([]); |
|||
const removeOptions = ref([]); |
|||
const editAndRemoveOptions = ref([]); |
|||
|
|||
watch(() => props.dataContent, (newDataContent, oldDataContent) => { |
|||
if (newDataContent?.subList.length > 0) { |
|||
nextTick(() => { |
|||
setTimeout(() => { |
|||
if (collapse1.value) { |
|||
collapse1.value.resize(); |
|||
} |
|||
}, 500); |
|||
}); |
|||
} |
|||
}, { immediate: true, deep: true }); |
|||
|
|||
onMounted(() => { |
|||
removeOptions.value = getRemoveOption(); |
|||
editAndRemoveOptions.value = getEditRemoveOption(); |
|||
// showLocation(); |
|||
}); |
|||
|
|||
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); |
|||
}; |
|||
|
|||
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'); |
|||
}; |
|||
|
|||
const isDevlement = () => { |
|||
return config.isDevelopment; |
|||
}; |
|||
|
|||
const copy = (detail) => { |
|||
console.log(detail); |
|||
const content = `HPQ;V1.0;I${detail.itemCode};P${detail.packingNumber};B${detail.batch};Q${detail.qty}`; |
|||
// #ifdef H5 |
|||
navigator.clipboard.writeText(content).then( |
|||
() => { |
|||
uni.showToast({ |
|||
title: '复制采购标签成功', |
|||
icon: 'none' |
|||
}); |
|||
}, |
|||
() => { |
|||
uni.showToast({ |
|||
title: '复制失败', |
|||
icon: 'none' |
|||
}); |
|||
} |
|||
); |
|||
// #endif |
|||
// #ifndef H5 |
|||
uni.setClipboardData({ |
|||
data: content, |
|||
success: () => { |
|||
uni.showToast({ |
|||
title: '复制采购标签成功' |
|||
}); |
|||
} |
|||
}); |
|||
// #endif |
|||
}; |
|||
</script> |
|||
|
|||
<style> |
|||
|
Loading…
Reference in new issue