扫码插入
This commit is contained in:
@@ -55,7 +55,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.mid === pkId}">
|
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.mid === pkId}">
|
||||||
<td @tap="toCheck(e)">{{i+1}}</td>
|
<td @tap="toCheck(e)">{{i+1}}</td>
|
||||||
<td><input type="text" class="sin_input" v-model="e.container_code"></td>
|
<td><input type="text" class="sin_input" style="width: 135px;" v-model="e.container_code"></td>
|
||||||
<td @tap="toJump(e)">{{e.material_code}}</td>
|
<td @tap="toJump(e)">{{e.material_code}}</td>
|
||||||
<td>{{e.material_name}}</td>
|
<td>{{e.material_name}}</td>
|
||||||
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
||||||
@@ -171,10 +171,6 @@
|
|||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// console.log('扫码成功:', res.result);
|
// console.log('扫码成功:', res.result);
|
||||||
// uni.showToast({
|
|
||||||
// title: res.result,
|
|
||||||
// icon: 'none'
|
|
||||||
// })
|
|
||||||
const parts = res.result.split(';')
|
const parts = res.result.split(';')
|
||||||
if (parts.length !== 5) {
|
if (parts.length !== 5) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@@ -15,15 +15,18 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-row">
|
<view class="zd-row">
|
||||||
<view class="zd-col-11">
|
<!-- <view class="zd-col-1">
|
||||||
|
</view> -->
|
||||||
|
<view class="zd-col-6" style="width: 27%;">
|
||||||
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toScanAdd">扫码插入</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-col-4">
|
<view class="zd-col-6" style="width: 22%;">
|
||||||
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toAdd">插入行</button>
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toAdd">插入行</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-col-4">
|
<view class="zd-col-6" style="width: 22%;">
|
||||||
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toDel">删除行</button>
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toDel">删除行</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-col-4">
|
<view class="zd-col-6" style="width: 22%;">
|
||||||
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toCopy">复制行</button>
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toCopy">复制行</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -44,7 +47,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.mid === pkId}">
|
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.mid === pkId}">
|
||||||
<td @tap="toCheck(e)">{{i+1}}</td>
|
<td @tap="toCheck(e)">{{i+1}}</td>
|
||||||
<td><input type="text" class="sin_input" v-model="e.container_code"></td>
|
<td><input type="text" class="sin_input" style="width: 135px;" v-model="e.container_code"></td>
|
||||||
<td @tap="toJump(e)">{{e.material_code}}</td>
|
<td @tap="toJump(e)">{{e.material_code}}</td>
|
||||||
<td>{{e.material_name}}</td>
|
<td>{{e.material_name}}</td>
|
||||||
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
||||||
@@ -137,6 +140,46 @@
|
|||||||
url: '/pages/ftdl/mater-list0?title=查询物料'
|
url: '/pages/ftdl/mater-list0?title=查询物料'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
toScanAdd () {
|
||||||
|
uni.scanCode({
|
||||||
|
success: (res) => {
|
||||||
|
// console.log('扫码成功:', res.result);
|
||||||
|
const parts = res.result.split(';')
|
||||||
|
if (parts.length !== 5) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '二维码格式不正确,请扫描符合格式的二维码',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let currObj = {
|
||||||
|
mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9),
|
||||||
|
container_code: parts[0],
|
||||||
|
material_code: parts[1],
|
||||||
|
material_name: parts[2],
|
||||||
|
qty: parts[3],
|
||||||
|
measure_unit_id: parts[4],
|
||||||
|
}
|
||||||
|
// 检查是否已存在相同卷号
|
||||||
|
const exists = this.dataList.some(item => item.container_code === currObj.container_code)
|
||||||
|
if (exists) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已存在',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.dataList.push(currObj)
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('扫码失败:', err)
|
||||||
|
// uni.showToast({
|
||||||
|
// title: err + '扫码失败',
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
toAdd () {
|
toAdd () {
|
||||||
let currObj = {
|
let currObj = {
|
||||||
mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9),
|
mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9),
|
||||||
|
|||||||
Reference in New Issue
Block a user