仓库送料筛选逻辑

This commit is contained in:
2026-03-12 15:25:48 +08:00
parent 566ac88c89
commit 91ce022c61
2 changed files with 17 additions and 15 deletions

View File

@@ -36,7 +36,6 @@
<thead> <thead>
<tr> <tr>
<th @tap="toAllCheck"><uni-icons :type="allCheck ? 'checkbox' : 'circle'" size="24" color="#4e6ef2"></uni-icons></th> <th @tap="toAllCheck"><uni-icons :type="allCheck ? 'checkbox' : 'circle'" size="24" color="#4e6ef2"></uni-icons></th>
<!-- <th></uni-icons></th> -->
<th>物料编码</th> <th>物料编码</th>
<th>物料名称</th> <th>物料名称</th>
<th>物料类别</th> <th>物料类别</th>
@@ -83,6 +82,7 @@
title: '', title: '',
keyword: null, keyword: null,
options1: [], options1: [],
// options1: [{text: '点位01', value: '01'}, {text: '点位02', value: '02'}, {text: '点位03', value: '03'}],
index1: '', index1: '',
options2: [], options2: [],
index2: '', index2: '',
@@ -152,8 +152,13 @@
}, },
toSure () { toSure () {
if (this.index1 && this.checkedArr.length) { if (this.index1 && this.checkedArr.length) {
// let selobj = this.options1.find(item => item.value === this.index1)
this.checkedArr.forEach(item => {
item.point_code = this.index1
item.pcsn = ''
item.qty = ''
})
this.$store.dispatch('setPublicArr', this.checkedArr) this.$store.dispatch('setPublicArr', this.checkedArr)
this.$store.dispatch('setPublicObj', this.index1)
uni.navigateBack() uni.navigateBack()
} }
}, },

View File

@@ -62,22 +62,19 @@
this.title = options.title this.title = options.title
}, },
onShow () { onShow () {
this.pointCode = this.$store.getters.publicObj
if (this.$store.getters.publicArr.length) { if (this.$store.getters.publicArr.length) {
const newItems = this.$store.getters.publicArr; const combined = [...this.dataList, ...this.$store.getters.publicArr];
const existingCodes = new Set(this.dataList.map(item => item.material_code)); const map = new Map();
newItems.forEach(item => { combined.forEach(item => {
// 若物料编码不存在于现有集合中,则添加 const key = `${item.material_code}_${item.point_code}`;
if (!existingCodes.has(item.material_code)) { // 仅当键不存在时才添加,这样先出现的记录会被保留
item.point_code = this.pointCode if (!map.has(key)) {
item.pcsn = '' map.set(key, item);
item.qty = ''
this.dataList.push(item)
existingCodes.add(item.material_code)
} }
}); });
this.dataList = Array.from(map.values());
this.$store.dispatch('setPublicArr', '') this.$store.dispatch('setPublicArr', '')
console.log(90)
} }
}, },
methods: { methods: {