Browse Source

mycomponents/detail 文件迁移Vue2升级Vue3 8/2-10/25

hella_vue3
王志国 3 weeks ago
parent
commit
042ebdecde
  1. 218
      src/mycomponents/detail/comDetailCardBatch.vue
  2. 180
      src/mycomponents/detail/comJobDetailCardBatch.vue
  3. 192
      src/mycomponents/detail/comLableDetailCard.vue
  4. 195
      src/mycomponents/detail/comRecommendDetailCard.vue
  5. 235
      src/mycomponents/detail/comRecommendDetailCardBatch.vue

218
src/mycomponents/detail/comDetailCardBatch.vue

@ -3,14 +3,10 @@
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowStdPack="false"> <item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowStdPack="false">
</item-compare-qty> </item-compare-qty>
<view class="" v-for="(item,index) in dataContent.subList" :key="index" :class="item.scaned?'scan_view':''"> <view class="" v-for="(item,index) in dataContent.subList" :key="index" :class="item.scaned?'scan_view':''">
<uni-swipe-action ref="swipeAction" v-if='index==0'> <u-swipe-action ref="swipeAction"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
<uni-swipe-action-item @click="(...event)=>swipeClick(event,item,'parent')"
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" v-if='index==0'>
@click="swipeClick($event,item,'parent')" style='padding:0px 0px 5px 0px;align-items: center;'>
<!-- <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false" isShowPack='false'>
</recommend> -->
<div style="display: flex;"> <div style="display: flex;">
<div style="flex: 1;"> <div style="flex: 1;">
<batch v-if="item.batch" :batch="item.batch"></batch> <batch v-if="item.batch" :batch="item.batch"></batch>
@ -18,9 +14,7 @@
</div> </div>
<text style="font-size: 30rpx;color: #2979ff; " @click="copy(item)" v-if="isDevlement()">复制</text> <text style="font-size: 30rpx;color: #2979ff; " @click="copy(item)" v-if="isDevlement()">复制</text>
</div> </div>
</u-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</view> </view>
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" <balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance"
@confirm="confirm"></balance-qty-edit> @confirm="confirm"></balance-qty-edit>
@ -30,7 +24,7 @@
</view> </view>
</template> </template>
<script> <script setup>
import config from '@/static/config.js' import config from '@/static/config.js'
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue' import recommend from '@/mycomponents/recommend/recommend.vue'
@ -47,18 +41,10 @@
getEditRemoveOption getEditRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
export default {
emits: ['openDetail', "updateData"], import { ref, watch, onMounted, nextTick } from 'vue';
components: {
itemCompareQty, const props = defineProps({
recommend,
balanceQtyEdit,
winScanLocation,
location,
toLocation,
batch,
},
props: {
dataContent: { dataContent: {
type: Object, type: Object,
default: null default: null
@ -94,118 +80,109 @@
isEdit: { isEdit: {
type: Boolean, type: Boolean,
default: true 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)
})
} }
}, });
const emit = defineEmits(['openDetail', 'remove', 'updateData']);
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([]);
immediate: true, const collapse1Ref = ref(null);
deep: true const qtyEditRef = ref(null);
} const messageRef = ref(null);
}, const scanLocationCodeRef = ref(null);
data() { watch(() => props.dataContent, (newDataContent, oldDataContent) => {
return { if (newDataContent?.subList?.length > 0) {
option: [], nextTick(() => {
showItem: {}, setTimeout(() => {
locatonItem: {}, if (collapse1Ref.value) {
editItem: {}, collapse1Ref.value.resize();
detailOptions: [],
scanOptions: [],
options: [],
removeOptions: [],
editAndRemoveOptions: []
} }
}, }, 500);
});
}
}, { immediate: true, deep: true });
mounted() { onMounted(() => {
if (this.detailOptions.length == 0) { if (detailOptions.value.length === 0) {
this.detailOptions = getDetailOption(); detailOptions.value = getDetailOption();
} }
if (this.scanOptions.length == 0) { if (scanOptions.value.length === 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, false) scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, false);
} }
this.removeOptions = getRemoveOption(); removeOptions.value = getRemoveOption();
this.editAndRemoveOptions = getEditRemoveOption() editAndRemoveOptions.value = getEditRemoveOption();
// this.showLocation(); });
},
methods: { const swipeClick = (e, item) => {
swipeClick(e, item) { if (e.content.text === "详情") {
if (e.content.text == "详情") { detail(item);
this.detail(item) } else if (e.content.text === "编辑") {
} else if (e.content.text == "编辑") { edit(item);
this.edit(item) } else if (e.content.text === "库位") {
} else if (e.content.text == "库位") { showLocation(item);
this.showLocation(item) } else if (e.content.text === "移除") {
} else if (e.content.text == "移除") { remove(item);
this.remove(item)
} }
}, };
edit(item) {
this.editItem = item;
this.$refs.qtyEdit.openEditPopup(item.balance, item.handleQty);
},
detail(item) { const edit = (item) => {
this.$emit('openDetail', item); editItem.value = item;
// this.showItem = item; qtyEditRef.value.openEditPopup(item.balance, item.handleQty);
// this.$refs.jobDetailPopup.openPopup(item) };
},
remove(item) { const detail = (item) => {
this.$refs.message.showQuestionMessage("确定移除扫描信息?", emit('openDetail', item);
res => { };
const remove = (item) => {
messageRef.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) { if (res) {
item.scaned = false item.scaned = false;
item.balance = {} item.balance = {};
item.handleQty = null; item.handleQty = null;
this.$forceUpdate() emit('remove', item);
this.$emit('remove', item)
} }
}); });
}, };
confirm(qty) {
this.editItem.handleQty = qty; const confirm = (qty) => {
this.$emit('updateData') editItem.value.handleQty = qty;
}, emit('updateData');
showLocation(item) { };
this.locatonItem = item;
this.$refs.scanLocationCode.openScanPopup(); const showLocation = (item) => {
}, locatonItem.value = item;
// scanLocationCodeRef.value.openScanPopup();
getLocation(location, code) { };
this.locatonItem.toLocationCode = code;
this.$emit('updateData') const getLocation = (location, code) => {
}, locatonItem.value.toLocationCode = code;
isDevlement() { emit('updateData');
};
const isDevlement = () => {
return config.isDevelopment; return config.isDevelopment;
}, };
copy(detail) {
console.log(detail) const copy = (detail) => {
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100 console.log(detail);
var content = "HPQ;V1.0;I" + detail.itemCode + ";P" + detail.packingNumber + ";B" + detail const content = `HPQ;V1.0;I${detail.itemCode};P${detail.packingNumber};B${detail.batch};Q${detail.qty}`;
.batch + ";Q" + detail.qty
// #ifdef H5 // #ifdef H5
this.$copyText(content).then( uni.copyText(content).then(() => {
res => {
uni.showToast({ uni.showToast({
title: '复制采购标签成功', title: '复制采购标签成功',
icon: 'none' icon: 'none'
}) });
} });
)
// #endif // #endif
// #ifndef H5 // #ifndef H5
uni.setClipboardData({ uni.setClipboardData({
@ -213,13 +190,12 @@
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: '复制采购标签成功' title: '复制采购标签成功'
}) });
} }
}) });
// #endif // #endif
}, };
}
}
</script> </script>
<style> <style>

180
src/mycomponents/detail/comJobDetailCardBatch.vue

@ -1,26 +1,24 @@
<!-- 采购上架任务详情按批次显示详情的组件 --> <!-- 采购上架任务详情按批次显示详情的组件 -->
<template> <template>
<view class="" style="background-color: #fff;"> <view class="" style="background-color: #fff;">
<uni-swipe-action> <u-swipe-action
<uni-swipe-action-item @click="(...event)=>swipeClick(event,dataContent,'parent')"
:right-options="(dataContent.scaned&&isEdit)?editAndRemoveOptions : dataContent.scaned? removeOptions:options" :options="(dataContent.scaned&&isEdit)?editAndRemoveOptions : dataContent.scaned? removeOptions:options">
@click="swipeClick($event,dataContent,'parent')">
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowPackUnit="true"> <itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowPackUnit="true">
</itemCompareQty> </itemCompareQty>
<batch v-if="dataContent.subList[0].batch" :batch="dataContent.subList[0].batch"></batch> <batch v-if="dataContent.subList[0].batch" :batch="dataContent.subList[0].batch"></batch>
<location title="来源库位" v-if="dataContent.subList[0].fromLocationCode" <location title="来源库位" v-if="dataContent.subList[0].fromLocationCode"
:locationCode="dataContent.subList[0].fromLocationCode"> :locationCode="dataContent.subList[0].fromLocationCode">
</location> </location>
</uni-swipe-action-item> </u-swipe-action>
</uni-swipe-action>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm"> <recommend-qty-edit ref="receiptEditRef" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit> </recommend-qty-edit>
<comMessage ref="message"></comMessage> <comMessage ref="messageRef"></comMessage>
</view> </view>
</template> </template>
<script> <script setup>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue' import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
@ -41,21 +39,9 @@
getPurchaseReceiptOption getPurchaseReceiptOption
} from '@/common/array.js'; } from '@/common/array.js';
export default { import { ref, onMounted, nextTick } from 'vue';
emits: ["updateData"],
components: { const props = defineProps({
itemCompareQty,
recommend,
recommendQtyEdit,
jobDetailPopup,
receiptDetailInfoPopup,
detailList,
packageList,
location,
toLocation,
batch,
},
props: {
dataContent: { dataContent: {
type: Object, type: Object,
default: null default: null
@ -80,104 +66,94 @@
type: Boolean, type: Boolean,
default: true default: true
} }
}, });
watch: {
}, const showItem = ref({});
const editItem = ref({ record: {} });
const locatonItem = ref({});
const detailOptions = ref([]);
const scanOptions = ref([]);
const options = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
data() { const collapseRef = ref(null);
return { const receiptEditRef = ref(null);
showItem: {}, const messageRef = ref(null);
editItem: {
record: {
}
},
locatonItem: {},
detailOptions: [],
scanOptions: [],
options: [],
removeOptions: [],
editAndRemoveOptions: []
}
},
mounted() { onMounted(() => {
if (this.detailOptions.length == 0) { if (detailOptions.value.length === 0) {
this.detailOptions = getDetailOption(); detailOptions.value = getDetailOption();
} }
if (this.scanOptions.length == 0) { if (scanOptions.value.length === 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, this.settingParam scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, props.settingParam.allowModifyLocation);
.allowModifyLocation)
} }
this.removeOptions = getRemoveOption(); removeOptions.value = getRemoveOption();
this.editAndRemoveOptions = getEditRemoveOption() editAndRemoveOptions.value = getEditRemoveOption();
});
},
updated() {
console.log('updated')
},
methods: { const collapseChange = () => {
collapseChange() {
setTimeout(() => { setTimeout(() => {
this.resizeCollapse(); resizeCollapse();
}, 500) }, 500);
}, };
resizeCollapse() { const resizeCollapse = () => {
this.$nextTick(r => { nextTick(() => {
this.$refs.collapse.resize() if (collapseRef.value) {
collapseRef.value.resize();
}
}); });
this.$forceUpdate(); };
},
const refreshCollapse = () => {
refreshCollapse() { nextTick(() => {
this.$nextTick(r => { if (collapseRef.value) {
this.$refs.collapse.forEach(r => { collapseRef.value.forEach(r => {
r.childrens.forEach(i => { r.childrens.forEach(i => {
i.init(); i.init();
}) });
r.resize(); r.resize();
})
}); });
this.$forceUpdate(); }
}, });
};
swipeClick(e, item, type) { const swipeClick = (e, item, type) => {
if (e.content.text == "编辑") { if (e.content.text === "编辑") {
this.edit(item) edit(item);
} else if (e.content.text == "移除") { } else if (e.content.text === "移除") {
this.remove(item) remove(item);
} }
}, };
edit(item) {
this.editItem = item; const edit = (item) => {
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty); editItem.value = item;
}, receiptEditRef.value.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
remove(item) { };
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => { const remove = (item) => {
messageRef.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) { if (res) {
item.scaned = false item.scaned = false;
item.handleQty = null item.handleQty = null;
this.$forceUpdate() emit('remove', item);
this.$emit('remove', item)
} }
}); });
}, };
confirm(qty) {
this.editItem.handleQty = qty; const confirm = (qty) => {
this.$emit('updateData') editItem.value.handleQty = qty;
}, emit('updateData');
updateData() { };
this.$emit('updateData')
} const updateData = () => {
} emit('updateData');
} };
const emit = defineEmits(['remove', 'updateData']);
</script> </script>
<style> <style>

192
src/mycomponents/detail/comLableDetailCard.vue

@ -1,7 +1,7 @@
<template> <template>
<view class="" style="background-color: #fff;"> <view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" @change=""> <u-collapse ref="collapse1" @change="">
<uni-collapse-item :open="true"> <u-collapse-item :open="true">
<template v-slot:title> <template v-slot:title>
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" <item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowStdPack="false"> :isShowStdPack="false">
@ -9,30 +9,26 @@
</template> </template>
<view class="" v-for="(item,index) in dataContent.subList" :key="index"> <view class="" v-for="(item,index) in dataContent.subList" :key="index">
<uni-swipe-action ref="swipeAction"> <u-swipe-action ref="swipeAction"
<uni-swipe-action-item @click="swipeClick($event,item)" @click="(...event)=>swipeClick(event,item)"
:right-options="item.scaned?scanOptions:detailOptions" style='padding:0px 0px 5px 0px;align-items: center;'
style='padding:0px 0px 5px 0px;align-items: center;'> :options="item.scaned?scanOptions:detailOptions">
<recommend :detail="item" :isShowFromLocation="isShowFromLocation" <recommend :detail="item" :isShowFromLocation="isShowFromLocation"
:isShowStatus="isShowStatus" :isShowToLocation="isShowToLocation"> :isShowStatus="isShowStatus" :isShowToLocation="isShowToLocation">
</recommend> </recommend>
</u-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</view> </view>
</uni-collapse-item> </u-collapse-item>
</uni-collapse> </u-collapse>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm"> <recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit> </recommend-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' <win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> :locationAreaTypeList="locationAreaTypeList"></win-scan-location>
<comMessage ref="message"></comMessage> <comMessage ref="message"></comMessage>
</view> </view>
</template> </template>
<script> <script setup>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue' import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
@ -42,15 +38,9 @@
getPurchaseReceiptOption getPurchaseReceiptOption
} from '@/common/array.js'; } from '@/common/array.js';
export default { import { ref, watch, onMounted, nextTick } from 'vue';
emits: ['openDetail', "updateData","remove"],
components: { const props = defineProps({
itemCompareQty,
recommend,
recommendQtyEdit,
winScanLocation
},
props: {
dataContent: { dataContent: {
type: Object, type: Object,
default: null default: null
@ -79,7 +69,6 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
locationAreaTypeList: { locationAreaTypeList: {
type: Array, type: Array,
default: null default: null
@ -91,99 +80,98 @@
isShowStatus: { isShowStatus: {
type: Boolean, type: Boolean,
default: true 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) });
})
}
},
const collapse1 = ref(null);
const receiptEdit = ref(null);
const message = ref(null);
const scanLocationCode = ref(null);
immediate: true, const option = ref([]);
deep: true const showItem = ref({});
} const locatonItem = ref({});
}, const editItem = ref({});
const detailOptions = ref([]);
const scanOptions = ref([]);
data() { watch(() => props.dataContent, (newDataContent, oldDataContent) => {
return { if (newDataContent?.subList.length > 0) {
option: [], nextTick(() => {
showItem: {}, setTimeout(() => {
locatonItem: {}, if (collapse1.value) {
editItem: {}, collapse1.value.resize();
detailOptions: [],
scanOptions: []
} }
}, }, 500);
});
}
}, { immediate: true, deep: true });
mounted() { onMounted(() => {
if (this.detailOptions.length == 0) { if (detailOptions.value.length === 0) {
this.detailOptions = getDetailOption(); detailOptions.value = getDetailOption();
} }
if (this.scanOptions.length == 0) { if (scanOptions.value.length === 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, false) scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, false);
} }
// showLocation();
});
// this.showLocation(); const swipeClick = (e, item) => {
}, switch (e.content.text) {
case "详情":
methods: { detail(item);
swipeClick(e, item) { break;
if (e.content.text == "详情") { case "编辑":
this.detail(item) edit(item);
} else if (e.content.text == "编辑") { break;
this.edit(item) case "库位":
} else if (e.content.text == "库位") { showLocation(item);
this.showLocation(item) break;
} else if (e.content.text == "移除") { case "移除":
this.remove(item) remove(item);
break;
} }
}, };
edit(item) {
this.editItem = item;
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
},
detail(item) { const edit = (item) => {
this.$emit('openDetail', item); editItem.value = item;
// this.showItem = item; receiptEdit.value.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
// this.$refs.jobDetailPopup.openPopup(item) };
},
remove(item) { const detail = (item) => {
this.$refs.message.showQuestionMessage("确定移除扫描信息?", emit('openDetail', item);
res => { // showItem.value = item;
// jobDetailPopup.value.openPopup(item);
};
const remove = (item) => {
message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) { if (res) {
item.scaned = false item.scaned = false;
item.balance = {} item.balance = {};
item.handleQty = null; item.handleQty = null;
this.$forceUpdate() emit('remove', item);
this.$emit('remove', item)
} }
}); });
}, };
confirm(qty) {
this.editItem.handleQty = qty; const confirm = (qty) => {
this.$emit('updateData') editItem.value.handleQty = qty;
}, emit('updateData');
showLocation(item) { };
this.locatonItem = item;
this.$refs.scanLocationCode.openScanPopup(); const showLocation = (item) => {
}, locatonItem.value = item;
// scanLocationCode.value.openScanPopup();
getLocation(location, code) { };
this.locatonItem.toLocationCode = code;
this.$emit('updateData') const getLocation = (location, code) => {
}, locatonItem.value.toLocationCode = code;
} emit('updateData');
} };
const emit = defineEmits(['openDetail', 'remove', 'updateData']);
</script> </script>
<style> <style>

195
src/mycomponents/detail/comRecommendDetailCard.vue

@ -1,45 +1,37 @@
<template> <template>
<view class="" style="background-color: #fff;"> <view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" > <u-collapse ref="collapse1" >
<uni-collapse-item :open="true"> <u-collapse-item :open="true">
<template v-slot:title> <template v-slot:title>
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" <item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowStdPack="false"> :isShowStdPack="false">
</item-compare-qty> </item-compare-qty>
</template> </template>
<view class="" v-for="(item,index) in dataContent.subList" :key="index"> <view class="" v-for="(item,index) in dataContent.subList" :key="index">
<uni-swipe-action ref="swipeAction"> <u-swipe-action ref="swipeAction"
<uni-swipe-action-item @click="swipeClick($event,item)" :options="item.scaned?scanOptions:detailOptions"
:right-options="item.scaned?scanOptions:detailOptions" style='padding:0px 0px 5px 0px;align-items: center;'
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 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 class="" style="font-size: 32rpx; color: black; font-weight: bold; text-align: center;">
</view> </view>
<recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false"> <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false">
</recommend> </recommend>
</view> </view>
<view v-else class="uni-flex" style="flex-direction: row; align-items: center;background-color: antiquewhite; margin-top: 5rpx;"> <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 class="" style="font-size: 32rpx; color: red; font-weight: bold; text-align: center;">
</view> </view>
<recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false"> <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false">
</recommend> </recommend>
</view> </view>
</u-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</view> </view>
</uni-collapse-item> </u-collapse-item>
</uni-collapse> </u-collapse>
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" @confirm="confirm"></balance-qty-edit> <balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" @confirm="confirm"></balance-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' <win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> :locationAreaTypeList="locationAreaTypeList"></win-scan-location>
@ -47,7 +39,7 @@
</view> </view>
</template> </template>
<script> <script setup>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue' import recommend from '@/mycomponents/recommend/recommend.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
@ -57,15 +49,9 @@
getPurchaseReceiptOption getPurchaseReceiptOption
} from '@/common/array.js'; } from '@/common/array.js';
export default { import {ref, watch, onMounted, nextTick} from 'vue';
emits: ['openDetail', "updateData"],
components: { const props = defineProps({
itemCompareQty,
recommend,
balanceQtyEdit,
winScanLocation
},
props: {
dataContent: { dataContent: {
type: Object, type: Object,
default: null default: null
@ -97,97 +83,98 @@
isShowStatus: { isShowStatus: {
type: Boolean, type: Boolean,
default: true 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) });
}) 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([]);
watch(() => props.dataContent, (newDataContent, oldDataContent) => {
if (newDataContent?.subList.length > 0) {
nextTick(() => {
setTimeout(() => {
if (collapse1.value) {
collapse1.value.resize();
} }
}, }, 500);
immediate: true, });
deep: true
} }
}, }, { immediate: true, deep: true });
data() { onMounted(() => {
return { if (detailOptions.value.length === 0) {
option: [], detailOptions.value = getDetailOption();
showItem: {},
locatonItem: {},
editItem: {},
detailOptions: [],
scanOptions: []
} }
}, if (scanOptions.value.length === 0) {
scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, false);
mounted() {
if (this.detailOptions.length == 0) {
this.detailOptions = getDetailOption();
} }
if (this.scanOptions.length == 0) { // showLocation();
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, false) });
const swipeClick = (e, item) => {
switch (e.content.text) {
case "详情":
detail(item);
break;
case "编辑":
edit(item);
break;
case "库位":
showLocation(item);
break;
case "移除":
remove(item);
break;
} }
};
// this.showLocation(); const edit = (item) => {
}, editItem.value = item;
qtyEdit.value.openEditPopup(item.balance, item.handleQty);
};
methods: { const detail = (item) => {
swipeClick(e, item) { emit('openDetail', item);
if (e.content.text == "详情") { // showItem.value = item;
this.detail(item) // jobDetailPopup.value.openPopup(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) { const remove = (item) => {
this.$emit('openDetail', item); message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
// this.showItem = item;
// this.$refs.jobDetailPopup.openPopup(item)
},
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) { if (res) {
item.scaned = false item.scaned = false;
item.balance = {} item.balance = {};
item.handleQty = null; item.handleQty = null;
this.$forceUpdate() emit('remove', item);
this.$emit('remove', item)
} }
}); });
}, };
confirm(qty) {
this.editItem.handleQty = qty; const confirm = (qty) => {
this.$emit('updateData') editItem.value.handleQty = qty;
}, emit('updateData');
showLocation(item) { };
this.locatonItem = item;
this.$refs.scanLocationCode.openScanPopup(); const showLocation = (item) => {
}, locatonItem.value = item;
// scanLocationCode.value.openScanPopup();
getLocation(location, code) { };
this.locatonItem.toLocationCode = code;
this.$emit('updateData') const getLocation = (location, code) => {
}, locatonItem.value.toLocationCode = code;
} emit('updateData');
} };
</script> </script>
<style> <style>

235
src/mycomponents/detail/comRecommendDetailCardBatch.vue

@ -1,19 +1,16 @@
<template> <template>
<view class="" style="background-color: #fff;"> <view class="" style="background-color: #fff;">
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" <item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowStdPack="false"> :isShowStdPack="false">
</item-compare-qty> </item-compare-qty>
<view class="" v-for="(item,index) in dataContent.subList" :key="index"> <view class="" v-for="(item,index) in dataContent.subList" :key="index">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction"
<uni-swipe-action-item @click="swipeClick($event,item)" style='padding:0px 0px 5px 0px;align-items: center;'
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" :options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
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;"> <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;"> <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/> <br/>
</view> </view>
@ -23,11 +20,10 @@
</location> </location>
</view> </view>
<text style="font-size: 30rpx;color: #2979ff; " @click="copy(item)" v-if="isDevlement()">复制</text> <text style="font-size: 30rpx;color: #2979ff; " @click="copy(item)" v-if="isDevlement()">复制</text>
</view> </view>
<view v-else class="uni-flex" style="flex-direction: row; margin-top: 5rpx;"> <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;"> <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/> <br/>
</view> </view>
@ -39,20 +35,18 @@
<!-- <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false"> <!-- <recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="false">
</recommend> --> </recommend> -->
</view> </view>
</uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
</view> </view>
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" @confirm="confirm"></balance-qty-edit> <balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance"
@confirm="confirm"></balance-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' <win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> :locationAreaTypeList="locationAreaTypeList"></win-scan-location>
<comMessage ref="message"></comMessage> <comMessage ref="message"></comMessage>
</view> </view>
</template> </template>
<script> <script setup>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue' import recommend from '@/mycomponents/recommend/recommend.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
@ -67,19 +61,9 @@
getEditRemoveOption getEditRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
export default { import { ref, watch, onMounted, nextTick } from 'vue';
emits: ['openDetail', "updateData"],
components: { const props = defineProps({
itemCompareQty,
recommend,
balanceQtyEdit,
winScanLocation,
location,
toLocation,
itemCompareQty,
batch,
},
props: {
dataContent: { dataContent: {
type: Object, type: Object,
default: null default: null
@ -115,112 +99,119 @@
isEdit: { isEdit: {
type: Boolean, type: Boolean,
default: true 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) });
}) 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
} }
}, }, { immediate: true, deep: true });
data() { onMounted(() => {
return { removeOptions.value = getRemoveOption();
option: [], editAndRemoveOptions.value = getEditRemoveOption();
showItem: {}, // showLocation();
locatonItem: {}, });
editItem: {},
detailOptions: [],
scanOptions: [],
options: [],
removeOptions: [],
editAndRemoveOptions: []
}
},
mounted() { const swipeClick = (e, item) => {
switch (e.content.text) {
case "详情":
detail(item);
break;
case "编辑":
edit(item);
break;
case "库位":
showLocation(item);
break;
case "移除":
remove(item);
break;
}
};
this.removeOptions = getRemoveOption(); const edit = (item) => {
this.editAndRemoveOptions = getEditRemoveOption() editItem.value = item;
// this.showLocation(); qtyEdit.value.openEditPopup(item.balance, item.handleQty);
}, };
methods: { const detail = (item) => {
swipeClick(e, item) { emit('openDetail', item);
if (e.content.text == "详情") { // showItem.value = item;
this.detail(item) // jobDetailPopup.value.openPopup(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) { const remove = (item) => {
this.$emit('openDetail', item); message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
// this.showItem = item;
// this.$refs.jobDetailPopup.openPopup(item)
},
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) { if (res) {
item.scaned = false item.scaned = false;
item.balance = {} item.balance = {};
item.handleQty = null; item.handleQty = null;
this.$forceUpdate() emit('remove', item);
this.$emit('remove', item)
} }
}); });
}, };
confirm(qty) {
this.editItem.handleQty = qty; const confirm = (qty) => {
this.$emit('updateData') editItem.value.handleQty = qty;
}, emit('updateData');
showLocation(item) { };
this.locatonItem = item;
this.$refs.scanLocationCode.openScanPopup(); const showLocation = (item) => {
}, locatonItem.value = item;
// scanLocationCode.value.openScanPopup();
getLocation(location, code) { };
this.locatonItem.toLocationCode = code;
this.$emit('updateData') const getLocation = (location, code) => {
}, locatonItem.value.toLocationCode = code;
isDevlement() { emit('updateData');
};
const isDevlement = () => {
return config.isDevelopment; return config.isDevelopment;
}, };
copy(detail) {
console.log(detail) const copy = (detail) => {
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100 console.log(detail);
var content = "HPQ;V1.0;I" + detail.itemCode + ";P" + detail.packingNumber + ";B" + detail const content = `HPQ;V1.0;I${detail.itemCode};P${detail.packingNumber};B${detail.batch};Q${detail.qty}`;
.batch + ";Q" + detail.qty
// #ifdef H5 // #ifdef H5
this.$copyText(content).then( navigator.clipboard.writeText(content).then(
res => { () => {
uni.showToast({ uni.showToast({
title: '复制采购标签成功', title: '复制采购标签成功',
icon: 'none' icon: 'none'
}) });
},
() => {
uni.showToast({
title: '复制失败',
icon: 'none'
});
} }
) );
// #endif // #endif
// #ifndef H5 // #ifndef H5
uni.setClipboardData({ uni.setClipboardData({
@ -228,13 +219,11 @@
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: '复制采购标签成功' title: '复制采购标签成功'
}) });
} }
}) });
// #endif // #endif
}, };
}
}
</script> </script>
<style> <style>

Loading…
Cancel
Save