Browse Source

采购收货申请增加移除功能

hella_online_20240829
niexiting 2 months ago
parent
commit
19ad1242fa
  1. 44
      src/mycomponents/package/packageList.vue
  2. 66
      src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue

44
src/mycomponents/package/packageList.vue

@ -4,14 +4,23 @@
<uni-collapse ref="collapse2" @change="collapseChange"> <uni-collapse ref="collapse2" @change="collapseChange">
<uni-collapse-item :disabled="false"> <uni-collapse-item :disabled="false">
<template v-slot:title> <template v-slot:title>
<package-card :dataContent="item" :isShowLocation="false" <uni-swipe-action>
:isShowFromLocation="isShowFromLocation" :isShowStatus="isShowStatus"></package-card> <uni-swipe-action-item
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="swipeClick($event,item,'parent')">
<package-card :dataContent="item" :isShowLocation="false"
:isShowFromLocation="isShowFromLocation"
:isShowStatus="isShowStatus"></package-card>
</uni-swipe-action-item>
</uni-swipe-action>
</template> </template>
<view v-for="(pack,index) in item.packList" :key="pack.id" <view v-for="(pack,index) in item.packList" :key="pack.id"
style=" width: 100%; background-color: antiquewhite;"> style=" width: 100%; background-color: antiquewhite;">
<uni-swipe-action> <uni-swipe-action>
<uni-swipe-action-item :right-options="(pack.scaned&&isEdit)?editAndRemoveOptions : pack.scaned? removeOptions:options" <uni-swipe-action-item
@click="swipeClick($event,pack)"> :right-options="(pack.scaned&&isEdit)?editAndRemoveOptions : pack.scaned? removeOptions:options"
@click="swipeClick($event,pack,'child')">
<package-card :dataContent="pack" :isShowLocation="false" :isShowFromLocation="false" <package-card :dataContent="pack" :isShowLocation="false" :isShowFromLocation="false"
:isShowToLocation="false" :isShowBatch="false"></package-card> :isShowToLocation="false" :isShowBatch="false"></package-card>
</uni-swipe-action-item> </uni-swipe-action-item>
@ -104,13 +113,36 @@
}, },
methods: { methods: {
swipeClick(e, item) { swipeClick(e, item, type) {
if (e.content.text == "编辑") { if (e.content.text == "编辑") {
this.edit(item) this.edit(item)
} else if (e.content.text == "移除") { } else if (e.content.text == "移除") {
this.remove(item) if (type == 'parent') {
this.removeParent(item);
} else {
this.remove(item)
}
} }
}, },
removeParent(item) {
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
item.scaned = false
item.handleQty = null;
item.packList.forEach(subItem => {
subItem.scaned = false
subItem.handleQty = null;
})
this.$emit('updateData')
this.$forceUpdate()
}
});
},
remove(item) { remove(item) {
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?",
res => { res => {

66
src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue

@ -3,10 +3,17 @@
<uni-collapse ref="collapse"> <uni-collapse ref="collapse">
<uni-collapse-item :open="true"> <uni-collapse-item :open="true">
<template v-slot:title> <template v-slot:title>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" <uni-swipe-action>
:isShowPackUnit="false"></itemCompareQty> <uni-swipe-action-item :right-options="dataContent.handleQty>0? removeOptions:options"
@click="swipeClick($event,dataContent)">
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowPackUnit="false"></itemCompareQty>
</uni-swipe-action-item>
</uni-swipe-action>
</template> </template>
<package-list :dataContent="dataContent.subList" :isEdit="settingParam.allowModifyQty=='TRUE'" :settingParam="settingParam" @collapseChange="collapseChange" @updateData="updateData" :isShowFromLocation="false"></package-list> <package-list :dataContent="dataContent.subList" :isEdit="settingParam.allowModifyQty=='TRUE'"
:settingParam="settingParam" @collapseChange="collapseChange" @updateData="updateData"
:isShowFromLocation="false"></package-list>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>
@ -32,11 +39,12 @@
import { import {
getDetailOption, getDetailOption,
getPurchaseReceiptOption getPurchaseReceiptOption,
getRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
export default { export default {
components: { components: {
itemCompareQty, itemCompareQty,
recommend, recommend,
@ -77,7 +85,9 @@
}, },
locatonItem: {}, locatonItem: {},
detailOptions: [], detailOptions: [],
scanOptions: [] scanOptions: [],
options: [],
removeOptions: [],
} }
}, },
@ -89,21 +99,23 @@
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, this.settingParam this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, this.settingParam
.allowModifyLocation) .allowModifyLocation)
} }
if (this.removeOptions.length == 0) {
this.removeOptions = getRemoveOption();
}
}, },
updated() { updated() {
console.log('updated') console.log('updated')
}, },
methods: { methods: {
collapseChange(){ collapseChange() {
setTimeout(() => { setTimeout(() => {
this.resizeCollapse(); this.resizeCollapse();
}, 500) }, 500)
}, },
resizeCollapse() { resizeCollapse() {
this.$nextTick(r => { this.$nextTick(r => {
this.$refs.collapse.resize() this.$refs.collapse.resize()
@ -132,7 +144,7 @@
} else if (e.content.text == "库位") { } else if (e.content.text == "库位") {
this.showLocation(item) this.showLocation(item)
} else if (e.content.text == "移除") { } else if (e.content.text == "移除") {
this.remove(item) this.removeScan(item)
} }
}, },
edit(item) { edit(item) {
@ -153,22 +165,42 @@
this.showItem = item; this.showItem = item;
this.$refs.jobDetailPopup.openPopup(item) this.$refs.jobDetailPopup.openPopup(item)
}, },
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?", removeScan(item) {
this.$refs.message.showQuestionMessage("确定移除物料的所有扫描信息?",
res => { res => {
if (res) { if (res) {
item.scaned = false
item.handleQty = null item.handleQty = null
this.$forceUpdate() item.subList.forEach(lst => {
this.$emit('remove', item) lst.scaned = false;
lst.handleQty = null;
lst.packList.forEach(pack => {
pack.scaned = false;
pack.handleQty = null;
})
})
// this.$forceUpdate()
// this.$emit('remove', item)
} }
}); });
}, },
// remove(item) {
// this.$refs.message.showQuestionMessage("?",
// res => {
// if (res) {
// item.scaned = false
// item.handleQty = null
// this.$forceUpdate()
// this.$emit('remove', item)
// }
// });
// },
confirm(qty) { confirm(qty) {
this.editItem.handleQty = qty; this.editItem.handleQty = qty;
this.$emit('updateData') this.$emit('updateData')
}, },
updateData(){ updateData() {
this.$emit('updateData') this.$emit('updateData')
} }
} }

Loading…
Cancel
Save