change
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
title: '',
|
title: '',
|
||||||
val1: '',
|
val1: '',
|
||||||
dataList: [],
|
dataList: [],
|
||||||
// dataList: [{material_name: 'name1', checked: false, qty:1, pcsn:'p001'},{material_name: 'name2', checked: false},{material_name: 'name3', checked: false}],
|
// dataList: [{material_id: 'n1', material_name: 'name1', checked: false, qty:1, pcsn:'p001'},{material_id: 'n2', material_name: 'name2', qty:2, checked: false},{material_id: 'n3', material_name: 'name3', qty:1, checked: false}],
|
||||||
pkId: '',
|
pkId: '',
|
||||||
pkObj: {},
|
pkObj: {},
|
||||||
allCheck: false,
|
allCheck: false,
|
||||||
@@ -92,10 +92,10 @@
|
|||||||
e.qty = e.qty.replace(/^0+/, '') || '0'
|
e.qty = e.qty.replace(/^0+/, '') || '0'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '数量必填',
|
// title: '数量必填',
|
||||||
icon: 'none'
|
// icon: 'none'
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
searchList () {
|
searchList () {
|
||||||
@@ -154,16 +154,8 @@
|
|||||||
if (!this.checkedArr.length) {
|
if (!this.checkedArr.length) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const allValid = this.checkedArr.every(item => item.qty !== '');
|
|
||||||
if (allValid) {
|
|
||||||
this.$store.dispatch('setPublicArr', this.checkedArr)
|
this.$store.dispatch('setPublicArr', this.checkedArr)
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: '数量必填',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,16 @@
|
|||||||
<nav-bar :title="title"></nav-bar>
|
<nav-bar :title="title"></nav-bar>
|
||||||
<view class="zd_content">
|
<view class="zd_content">
|
||||||
<view class="zd_wrapper">
|
<view class="zd_wrapper">
|
||||||
|
<view class="zd-row border-bottom">
|
||||||
|
<view class="zd-col-7">
|
||||||
|
<span class="filter_label">站点信息</span>
|
||||||
|
</view>
|
||||||
|
<view class="zd-col-17">
|
||||||
|
<search-box
|
||||||
|
v-model="val2"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="zd-row border-bottom">
|
<view class="zd-row border-bottom">
|
||||||
<view class="zd-col-7">
|
<view class="zd-col-7">
|
||||||
<span class="filter_label">载具编码</span>
|
<span class="filter_label">载具编码</span>
|
||||||
@@ -49,7 +59,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="zd-row submit-bar">
|
<view class="zd-row submit-bar">
|
||||||
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
|
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
|
||||||
<button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !index}" :disabled="disabled" @tap="_confirmIn">确认</button>
|
<button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !val2 || !index}" :disabled="disabled" @tap="_confirmIn">确认</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -67,6 +77,7 @@
|
|||||||
return {
|
return {
|
||||||
title: '',
|
title: '',
|
||||||
val1: '',
|
val1: '',
|
||||||
|
val2: '',
|
||||||
// options: [{text:'堆叠托盘', value:'11111111'},{text:'料箱',value: '22222222'},{text:'白色EPH',value: '33333333'}],
|
// options: [{text:'堆叠托盘', value:'11111111'},{text:'料箱',value: '22222222'},{text:'白色EPH',value: '33333333'}],
|
||||||
options: [],
|
options: [],
|
||||||
index: '',
|
index: '',
|
||||||
@@ -105,7 +116,7 @@
|
|||||||
try {
|
try {
|
||||||
let res = await getVehicleMaterial(this.val1, this.val2, this.index)
|
let res = await getVehicleMaterial(this.val1, this.val2, this.index)
|
||||||
if (res) {
|
if (res) {
|
||||||
this.dataList = res.data
|
this.dataList = res
|
||||||
} else {
|
} else {
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
}
|
}
|
||||||
@@ -115,18 +126,19 @@
|
|||||||
},
|
},
|
||||||
clearUp () {
|
clearUp () {
|
||||||
this.val1 = ''
|
this.val1 = ''
|
||||||
|
this.val2 = ''
|
||||||
this.index = ''
|
this.index = ''
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
},
|
},
|
||||||
async _confirmIn () {
|
async _confirmIn () {
|
||||||
this.disabled = true
|
this.disabled = true
|
||||||
if (!this.val1 || !this.index) {
|
if (!this.val1 || !this.val2 || !this.index) {
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let res = await confirmIn(this.val1, this.index)
|
let res = await confirmIn(this.val1, this.val2, this.index)
|
||||||
if (res.code === '200') {
|
if (res.code === '200') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
|
|||||||
@@ -44,7 +44,8 @@
|
|||||||
<tr v-for="(e, i) in dataList" :key="i">
|
<tr v-for="(e, i) in dataList" :key="i">
|
||||||
<td>{{e.material_name}}</td>
|
<td>{{e.material_name}}</td>
|
||||||
<td>{{e.material_code}}</td>
|
<td>{{e.material_code}}</td>
|
||||||
<td>{{e.qty}}</td>
|
<!-- <td>{{e.qty}}</td> -->
|
||||||
|
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
||||||
<td>{{e.pcsn}}</td>
|
<td>{{e.pcsn}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -78,6 +79,7 @@
|
|||||||
val3: '',
|
val3: '',
|
||||||
wlxxtext: '',
|
wlxxtext: '',
|
||||||
dataList: [],
|
dataList: [],
|
||||||
|
curList: [],
|
||||||
disabled: false
|
disabled: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -86,10 +88,56 @@
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (this.$store.getters.publicArr.length) {
|
if (this.$store.getters.publicArr.length) {
|
||||||
this.dataList = this.$store.getters.publicArr
|
// this.dataList = [...this.dataList, ...this.$store.getters.publicArr]
|
||||||
|
this.dataList = this.mergeArrays(this.dataList, this.$store.getters.publicArr)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
mergeArrays (arr1, arr2) {
|
||||||
|
// 创建Map存储结果,以material_id为键
|
||||||
|
const resultMap = new Map();
|
||||||
|
|
||||||
|
// 先添加arr1的所有记录
|
||||||
|
arr1.forEach(item => {
|
||||||
|
resultMap.set(item.material_id, { ...item });
|
||||||
|
});
|
||||||
|
|
||||||
|
// 合并arr2的记录
|
||||||
|
arr2.forEach(item => {
|
||||||
|
const materialId = item.material_id;
|
||||||
|
if (resultMap.has(materialId)) {
|
||||||
|
// 存在相同material_id:更新qty为arr2的值
|
||||||
|
const existing = resultMap.get(materialId);
|
||||||
|
resultMap.set(materialId, {
|
||||||
|
...existing, // 保留原有字段
|
||||||
|
qty: item.qty, // 使用arr2的qty值
|
||||||
|
// 如果arr2有pcsn则更新,否则保留原来的pcsn
|
||||||
|
...(item.pcsn !== undefined && { pcsn: item.pcsn })
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 不存在相同material_id:直接添加新记录
|
||||||
|
resultMap.set(materialId, { ...item });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 将Map的值转为数组
|
||||||
|
return Array.from(resultMap.values());
|
||||||
|
},
|
||||||
|
handleBlur (e) {
|
||||||
|
if (e.qty) {
|
||||||
|
if (e.qty < 0) {
|
||||||
|
e.qty = 0
|
||||||
|
} else {
|
||||||
|
e.qty = e.qty.replace(/[^0-9]/g, '')
|
||||||
|
e.qty = e.qty.replace(/^0+/, '') || '0'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '数量必填',
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
},
|
||||||
toJump () {
|
toJump () {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/mater-list?title=查询物料'
|
url: '/pages/common/mater-list?title=查询物料'
|
||||||
@@ -107,6 +155,17 @@
|
|||||||
this.disabled = false
|
this.disabled = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let allValid = this.dataList.every(item => item.qty !== '');
|
||||||
|
console.log(allValid, 666)
|
||||||
|
console.log(this.dataList, 666)
|
||||||
|
if (!allValid) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '数量必填',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.disabled = false
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
let res = await groupPlate(this.dataList, this.val2, this.val1)
|
let res = await groupPlate(this.dataList, this.val2, this.val1)
|
||||||
if (res.code === '200') {
|
if (res.code === '200') {
|
||||||
|
|||||||
Reference in New Issue
Block a user