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

180
src/mycomponents/detail/comJobDetailCardBatch.vue

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

192
src/mycomponents/detail/comLableDetailCard.vue

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

195
src/mycomponents/detail/comRecommendDetailCard.vue

@ -1,45 +1,37 @@
<template>
<view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" >
<uni-collapse-item :open="true">
<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">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions"
style='padding:0px 0px 5px 0px;align-items: center;'>
<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" :isShowToLocation="false">
</recommend>
</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" :isShowToLocation="false">
</recommend>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</u-swipe-action>
</view>
</uni-collapse-item>
</uni-collapse>
</u-collapse-item>
</u-collapse>
<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>
@ -47,7 +39,7 @@
</view>
</template>
<script>
<script setup>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
@ -57,15 +49,9 @@
getPurchaseReceiptOption
} from '@/common/array.js';
export default {
emits: ['openDetail', "updateData"],
components: {
itemCompareQty,
recommend,
balanceQtyEdit,
winScanLocation
},
props: {
import {ref, watch, onMounted, nextTick} from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: null
@ -97,97 +83,98 @@
isShowStatus: {
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)
})
});
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();
}
},
immediate: true,
deep: true
}, 500);
});
}
},
}, { immediate: true, deep: true });
data() {
return {
option: [],
showItem: {},
locatonItem: {},
editItem: {},
detailOptions: [],
scanOptions: []
onMounted(() => {
if (detailOptions.value.length === 0) {
detailOptions.value = getDetailOption();
}
},
mounted() {
if (this.detailOptions.length == 0) {
this.detailOptions = getDetailOption();
if (scanOptions.value.length === 0) {
scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, false);
}
if (this.scanOptions.length == 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, false)
// 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;
}
};
// this.showLocation();
},
const edit = (item) => {
editItem.value = item;
qtyEdit.value.openEditPopup(item.balance, item.handleQty);
};
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);
},
const detail = (item) => {
emit('openDetail', item);
// showItem.value = item;
// jobDetailPopup.value.openPopup(item);
};
detail(item) {
this.$emit('openDetail', item);
// this.showItem = item;
// this.$refs.jobDetailPopup.openPopup(item)
},
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
const remove = (item) => {
message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
item.scaned = false
item.balance = {}
item.scaned = false;
item.balance = {};
item.handleQty = null;
this.$forceUpdate()
this.$emit('remove', item)
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')
},
}
}
};
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>

235
src/mycomponents/detail/comRecommendDetailCardBatch.vue

@ -1,19 +1,16 @@
<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;'>
<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;">
<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>
@ -23,11 +20,10 @@
</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;">
<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>
@ -39,20 +35,18 @@
<!-- <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>
<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>
<script setup>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
@ -67,19 +61,9 @@
getEditRemoveOption
} from '@/common/array.js';
export default {
emits: ['openDetail', "updateData"],
components: {
itemCompareQty,
recommend,
balanceQtyEdit,
winScanLocation,
location,
toLocation,
itemCompareQty,
batch,
},
props: {
import { ref, watch, onMounted, nextTick } from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: null
@ -115,112 +99,119 @@
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)
})
});
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();
}
},
immediate: true,
deep: true
}, 500);
});
}
},
}, { immediate: true, deep: true });
data() {
return {
option: [],
showItem: {},
locatonItem: {},
editItem: {},
detailOptions: [],
scanOptions: [],
options: [],
removeOptions: [],
editAndRemoveOptions: []
}
},
onMounted(() => {
removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption();
// showLocation();
});
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();
this.editAndRemoveOptions = getEditRemoveOption()
// this.showLocation();
},
const edit = (item) => {
editItem.value = item;
qtyEdit.value.openEditPopup(item.balance, item.handleQty);
};
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);
},
const detail = (item) => {
emit('openDetail', item);
// showItem.value = item;
// jobDetailPopup.value.openPopup(item);
};
detail(item) {
this.$emit('openDetail', item);
// this.showItem = item;
// this.$refs.jobDetailPopup.openPopup(item)
},
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
const remove = (item) => {
message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
item.scaned = false
item.balance = {}
item.scaned = false;
item.balance = {};
item.handleQty = null;
this.$forceUpdate()
this.$emit('remove', item)
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() {
};
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;
},
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
};
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
this.$copyText(content).then(
res => {
navigator.clipboard.writeText(content).then(
() => {
uni.showToast({
title: '复制采购标签成功',
icon: 'none'
})
});
},
() => {
uni.showToast({
title: '复制失败',
icon: 'none'
});
}
)
);
// #endif
// #ifndef H5
uni.setClipboardData({
@ -228,13 +219,11 @@
success: () => {
uni.showToast({
title: '复制采购标签成功'
})
});
}
})
});
// #endif
},
}
}
};
</script>
<style>

Loading…
Cancel
Save