Commit 14eb4907 by LJM

批量扫描

parent 1ffa2413
...@@ -57,10 +57,10 @@ ...@@ -57,10 +57,10 @@
font-size: 18rpx; font-size: 18rpx;
color: #292b33; color: #292b33;
font-weight: bold; font-weight: bold;
margin-bottom: 10rpx;
} }
} }
.list { .list {
padding-bottom: 80rpx;
.box { .box {
position: relative; position: relative;
padding: 15px 17rpx 20rpx 17rpx; padding: 15px 17rpx 20rpx 17rpx;
...@@ -69,6 +69,24 @@ ...@@ -69,6 +69,24 @@
border-radius: 10rpx; border-radius: 10rpx;
margin-bottom: 15rpx; margin-bottom: 15rpx;
flex-wrap: wrap; flex-wrap: wrap;
border: 1px solid transparent;
.check-box-icon {
position: absolute;
right: 18rpx;
top: 17rpx;
width: 20rpx;
height: 20rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/11/0bf30da3e8ce6c476c210173b5f13d51.png') no-repeat center;
background-size: contain;
display: block;
}
&.curr {
border: 1px solid #1969f9;
.check-box-icon {
background: url('https://img.ichunt.com/images/ichunt/202304/11/71a74e52e94bcf2e89f8df9817d494c6.png') no-repeat center;
background-size: contain;
}
}
.input-box { .input-box {
margin-bottom: 11rpx; margin-bottom: 11rpx;
flex: 0 0 50%; flex: 0 0 50%;
...@@ -166,6 +184,29 @@ ...@@ -166,6 +184,29 @@
} }
} }
} }
.fix-btn {
position: fixed;
bottom: 0;
width: 100%;
left: 0;
z-index: 999;
.btn2 {
width: 100%;
height: 75rpx;
background: #1969f9;
font-size: 23rpx;
color: #ffffff;
}
.btn3 {
width: 180rpx;
height: 75rpx;
background: #ffffff;
font-size: 23rpx;
color: #ff3700;
border-left: 1px solid #f0f0f2;
font-weight: bold;
}
}
} }
::v-deep .uni-drawer__content { ::v-deep .uni-drawer__content {
...@@ -269,6 +310,13 @@ ...@@ -269,6 +310,13 @@
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 99; z-index: 99;
.btn0 {
height: 75rpx;
background: #ffe0d7;
font-size: 23rpx;
color: #ff3700;
font-weight: bold;
}
.btn1 { .btn1 {
width: 100%; width: 100%;
height: 75rpx; height: 75rpx;
......
...@@ -168,10 +168,6 @@ ...@@ -168,10 +168,6 @@
width: 85% !important; width: 85% !important;
} }
::v-deep .uni-drawer__content {
width: 85% !important;
}
.uni-drawer-pack { .uni-drawer-pack {
width: 100%; width: 100%;
background-color: #ffffff; background-color: #ffffff;
...@@ -282,9 +278,9 @@ ...@@ -282,9 +278,9 @@
.btn1 { .btn1 {
width: 50%; width: 50%;
height: 75rpx; height: 75rpx;
background: #f5f5f7; background: #ffe0d7;
font-size: 23rpx; font-size: 23rpx;
color: #1969f9; color: #ff3700;
font-weight: bold; font-weight: bold;
} }
.btn2 { .btn2 {
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
} }
.box-info { .box-info {
margin-bottom: 10rpx; margin-bottom: 10rpx;
height: 40rpx;
.title { .title {
font-size: 18rpx; font-size: 18rpx;
color: #292b33; color: #292b33;
...@@ -436,9 +437,9 @@ ...@@ -436,9 +437,9 @@
.btn0 { .btn0 {
width: 50%; width: 50%;
height: 75rpx; height: 75rpx;
background: #f5f5f7; background: #ffe0d7;
font-size: 23rpx; font-size: 23rpx;
color: #1969f9; color: #ff3700;
font-weight: bold; font-weight: bold;
} }
.btn1 { .btn1 {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view class="picking-sort-wrap"> <view class="picking-sort-wrap">
<view class="search-type row bothSide verCenter"> <view class="search-type row bothSide verCenter">
<view class="left"> <view class="left">
<view class="title">库 位:</view> <view class="title row verCenter" style="height: 45rpx;">库 位:</view>
<view class="search-bar row bothSide verCenter"> <view class="search-bar row bothSide verCenter">
<view class="row verCenter"> <view class="row verCenter">
<text class="iconfont icon-juxing1"></text> <text class="iconfont icon-juxing1"></text>
...@@ -17,11 +17,22 @@ ...@@ -17,11 +17,22 @@
</view> </view>
<view class="right"> <view class="right">
<template v-if="curr == 0"> <template v-if="curr == 0">
<view class="title">入库批次号:</view> <view class="row bothSide verCenter" style="height: 45rpx;">
<view class="title">入库批次号:</view>
<view class="row verCenter">
<switch @change="switchChange" :checked="is_batch" color="#1969f9" style="transform:scale(0.7);width: 77rpx;" />
<text style="font-size: 18rpx;white-space: nowrap;">批量扫描</text>
</view>
</view>
<view class="search-bar row bothSide verCenter" :class="{ 'disabled-color': searchParams.position_name == '' ? true : false }"> <view class="search-bar row bothSide verCenter" :class="{ 'disabled-color': searchParams.position_name == '' ? true : false }">
<view class="row verCenter"> <view class="row verCenter">
<text class="iconfont icon-juxing1"></text> <text class="iconfont icon-juxing1"></text>
<input class="uni-input" placeholder="请扫描入库标签" :disabled="searchParams.position_name == '' ? true : false" placeholder-style="color:#919399" v-model="searchParams.stock_in_batch_sn" @input="handleInput(2, searchParams.stock_in_batch_sn)" maxlength="15" /> <template v-if="is_batch">
<input class="uni-input" placeholder="请扫描入库标签" :disabled="searchParams.position_name == '' ? true : false" placeholder-style="color:#919399" v-model="search_keyword" @input="handleInput(2, search_keyword)" maxlength="15" ref="myInput" />
</template>
<template v-else>
<input class="uni-input" placeholder="请扫描入库标签" :disabled="searchParams.position_name == '' ? true : false" placeholder-style="color:#919399" v-model="searchParams.stock_in_batch_sn" @input="handleInput(2, searchParams.stock_in_batch_sn)" maxlength="15" />
</template>
</view> </view>
<text class="iconfont icon-a-juxing11" @click="clearInput(2)" v-if="input_flag_stock_in_batch_sn"></text> <text class="iconfont icon-a-juxing11" @click="clearInput(2)" v-if="input_flag_stock_in_batch_sn"></text>
</view> </view>
...@@ -41,7 +52,8 @@ ...@@ -41,7 +52,8 @@
<!-- 按货品拣货列表 --> <!-- 按货品拣货列表 -->
<template v-if="curr == 0"> <template v-if="curr == 0">
<view class="list" v-if="list.length > 0"> <view class="list" v-if="list.length > 0">
<view class="box row" v-for="(item, index) in list" :key="index"> <view class="box row" v-for="(item, index) in list" :key="index" :class="{ curr: filter_list[index] }">
<view class="check-box-icon" @click="filterChange(index)" v-if="is_batch_active"></view>
<view class="input-box row verCenter"> <view class="input-box row verCenter">
<text class="label">库 位:</text> <text class="label">库 位:</text>
<text class="tt">{{ item.position_name }}</text> <text class="tt">{{ item.position_name }}</text>
...@@ -113,6 +125,9 @@ ...@@ -113,6 +125,9 @@
<text class="iconfont icon-a-juxing21"></text> <text class="iconfont icon-a-juxing21"></text>
<text class="text">查不到当前数据</text> <text class="text">查不到当前数据</text>
</view> </view>
<view class="fix-btn row verCenter" v-if="is_batch_active">
<view class="btn2 row rowCenter verCenter" @click="showDrawer(3)">批量拣货({{ filter_id.length || 0 }})</view>
</view>
</template> </template>
<!-- 按容器拣货列表 --> <!-- 按容器拣货列表 -->
<template v-else-if="curr == 1"> <template v-else-if="curr == 1">
...@@ -384,21 +399,71 @@ ...@@ -384,21 +399,71 @@
<view class="btn row verCenter bothSide"><view class="btn1 row rowCenter verCenter" @click="makeMultiPickingFinish()">拣 货</view></view> <view class="btn row verCenter bothSide"><view class="btn1 row rowCenter verCenter" @click="makeMultiPickingFinish()">拣 货</view></view>
</view> </view>
</uni-drawer> </uni-drawer>
<!-- 批量拣货弹窗 -->
<uni-drawer ref="showRightPackMultiPick" mode="right">
<view class="uni-drawer-picking">
<view class="title row rowCenter verCenter">
<text class="iconfont icon-juxing2" @click="closeDrawer(3)"></text>
<text class="text">{{ stock_out_sn }}</text>
</view>
<view class="field-item row" style="margin-top: 39rpx;">
<view class="item row verCenter" style="flex: 0 0 100%;">
<view class="label" style="width: 100%;">
您已选中
<text style="color: #1969f9;font-size: 13rpx;font-weight: bold;padding: 0 5rpx;">{{ filter_id.length || 0 }}</text>
个拣货任务
</view>
</view>
</view>
<view class="bor"></view>
<view class="h2 row bothSide verCenter" style="margin-top: 25rpx;">
<view>
<text>拣货图片:</text>
<text class="tt">最多只支持{{ maxNum }}张图</text>
</view>
<view class="num">
<text class="t1">{{ image_list.length }}</text>
<text class="t2">/10</text>
</view>
</view>
<view class="pic-list row">
<template v-if="image_list.length > 0">
<view class="box" v-for="(item, index) in image_list" :key="index">
<image :src="item.small_image_url" mode="aspectFill" @click="previewChange(image_list, index)"></image>
<text class="iconfont icon-a-juxing11" @click="deletePic(index)"></text>
</view>
</template>
<view class="default row rowCenter verCenter" @click="chooseImageChange()" v-if="image_list.length < maxNum"><text class="iconfont icon-a-juxing3"></text></view>
</view>
<view class="btn row verCenter bothSide">
<view class="btn0 row rowCenter verCenter" @click="closeDrawer(3)" style="width: 50%;">取消</view>
<view class="btn1 row rowCenter verCenter" @click="makeMultiPickingFinish()" style="width: 50%;">拣 货</view>
</view>
</view>
</uni-drawer>
</view> </view>
</template> </template>
<script> <script>
import { API } from '@/util/api.js'; import { API } from '@/util/api.js';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import { createArray } from '@/util/util.js';
export default { export default {
data() { data() {
return { return {
is_batch: false, //是否开启批量
is_batch_active: false, //是否开启批量激活s
history_id: [], //批量记录id
search_keyword: '', //批量搜索值
noexebshowFalg: true, //控制是否会触发生命周期 noexebshowFalg: true, //控制是否会触发生命周期
stock_out_sn: '', //标题显示出库单号 stock_out_sn: '', //标题显示出库单号
lock_ids: [], //出库id集合 lock_ids: [], //出库id集合
input_flag_position_name: false, input_flag_position_name: false,
input_flag_stock_in_batch_sn: false, input_flag_stock_in_batch_sn: false,
input_flag_container_sn: false, input_flag_container_sn: false,
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
page: 1, page: 1,
limit: 1000, limit: 1000,
curr: 0, curr: 0,
...@@ -437,31 +502,210 @@ export default { ...@@ -437,31 +502,210 @@ export default {
} }
}, },
methods: { methods: {
/**
* 批量扫描监听
* @param {Object} e
*/
switchChange(e) {
console.log('switch 发生 change 事件,携带值为', e.detail.value);
this.is_batch = e.detail.value;
//重置相关数据
this.history_id = [];
this.list = [];
this.page = 1;
this.filter_id = [];
this.is_batch_active = false;
this.search_keyword = '';
this.searchParams.stock_in_batch_sn = '';
this.getData();
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, val) {
if (val) {
if (type == 1) {
this.input_flag_position_name = true;
this.getData();
} else if (type == 2) {
//入库批次号 开启批量扫描
if (this.is_batch) {
this.input_flag_stock_in_batch_sn = false;
//记录历史搜索批次号
if (!this.history_id.includes(val)) {
this.history_id.push(val);
}
this.searchParams.stock_in_batch_sn = this.history_id.join(',');
this.getData(data => {
if (data.length > 0) {
const list = data;
this.is_batch_active = true;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
try {
this.$refs.myInput.focus(); // 获取焦点
} catch (e) {
//TODO handle the exception
}
//若识别物料标签不在上架任务中,则弹窗提示:该物料不在上架任务中,需关闭弹窗才可继续操作
let isInList = list.some(function(item) {
return item.stock_in_batch_sn === val;
});
if (!isInList) {
uni.showModal({
title: '提示',
content: '该物料不在拣货任务中',
confirmText: '关闭',
showCancel: false,
success: res => {
var index_history_id = this.history_id.indexOf(val);
this.history_id.splice(index_history_id, 1);
}
});
}
}
});
} else {
this.input_flag_stock_in_batch_sn = true;
this.getData();
setTimeout(() => {
if (this.searchParams.stock_in_batch_sn.length == 15 && this.list.length == 1) {
this.showDrawer(1, this.list[0]);
}
}, 1000);
}
} else if (type == 3) {
this.input_flag_container_sn = true;
this.getData();
setTimeout(() => {
if (this.searchParams.container_sn != '' && this.list.length == 1) {
this.showDrawer(2, this.list[0]);
}
}, 1000);
}
} else {
if (type == 1) {
this.input_flag_position_name = false;
} else if (type == 2) {
this.input_flag_stock_in_batch_sn = false;
} else if (type == 3) {
this.input_flag_container_sn = false;
}
}
}, 500),
/**
* tab切换
* @param {Object} index
*/
tab(index) { tab(index) {
this.curr = index; this.curr = index;
this.getData(); this.getData();
this.image_list = []; this.image_list = [];
}, },
/**
* 展开弹窗
* @param {Object} type
* @param {Object} data
*/
showDrawer(type, data) { showDrawer(type, data) {
if (type == 1) { if (type == 1) {
//按货品拣货
this.$refs.showRight.open(); this.$refs.showRight.open();
this.detail = data; this.detail = data;
this.picked_num = Number(data.lock_qty) - Number(data.pick_qty); this.picked_num = Number(data.lock_qty) - Number(data.pick_qty);
this.formParams.pick_qty = Number(data.lock_qty) - Number(data.pick_qty); this.formParams.pick_qty = Number(data.lock_qty) - Number(data.pick_qty);
this.image_list = []; this.image_list = []; //清空图片列表
} else if (type == 2) { } else if (type == 2) {
//按容器拣货
this.$refs.showRightPack.open(); this.$refs.showRightPack.open();
this.detailContainer = data; this.detailContainer = data;
this.image_list = []; //清空图片列表
this.lock_ids = data.list.map(function(item) { this.lock_ids = data.list.map(function(item) {
return item.lock_id; return item.lock_id;
}); });
} else if (type == 3) {
//批量拣货
if (this.filter_id == 0) {
uni.showToast({
title: '请选择拣货任务',
icon: 'none'
});
return false;
}
this.$refs.showRightPackMultiPick.open();
this.image_list = []; //清空图片列表
} }
}, },
/**
* 关闭弹窗
* @param {Object} type
*/
closeDrawer(type) { closeDrawer(type) {
if (type == 1) { if (type == 1) {
//按货品拣货
this.$refs.showRight.close(); this.$refs.showRight.close();
} else if (type == 2) { } else if (type == 2) {
//按容器拣货
this.$refs.showRightPack.close(); this.$refs.showRightPack.close();
} else if (type == 3) {
//批量拣货
this.$refs.showRightPackMultiPick.close();
}
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
}
});
return result;
},
/**
* 筛选过滤出选中的元素
*/
filterChange(index) {
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index]));
let filter_arr = this.findIndex(this.filter_list, true);
this.filter_id = filter_arr.map(i => this.list[i].lock_id);
//开启了批量搜索,如果取消勾选则删除
if (this.is_batch) {
if (!this.filter_list[index]) {
this.history_id.splice(index, 1);
this.searchParams.stock_in_batch_sn = this.history_id.join(',');
//当检测到全部取消的时候不应该调用接口
if (this.history_id.length == 0) {
this.list = [];
this.search_keyword = '';
return false;
}
//搜索之后添加选择状态
this.getData(data => {
if (data.length > 0) {
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
}
});
}
} }
}, },
/** /**
...@@ -555,7 +799,7 @@ export default { ...@@ -555,7 +799,7 @@ export default {
/** /**
* 获取列表数据 * 获取列表数据
*/ */
getData() { getData(callback) {
var URL = ''; var URL = '';
if (this.curr == 0) { if (this.curr == 0) {
URL = API.getLockedList; URL = API.getLockedList;
...@@ -568,10 +812,12 @@ export default { ...@@ -568,10 +812,12 @@ export default {
this.request(URL, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => { this.request(URL, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.list = res.data.list; this.list = res.data.list;
this.filter_list = createArray(this.list.length, false);
typeof callback == 'function' && callback(res.data.list);
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'error' icon: 'none'
}); });
} }
}); });
...@@ -626,18 +872,44 @@ export default { ...@@ -626,18 +872,44 @@ export default {
}); });
}, },
/** /**
* 按容器拣货提交 * 按容器拣货提交 || 批量拣货
*/ */
makeMultiPickingFinish() { makeMultiPickingFinish() {
this.request(API.makeMultiPickingFinish, 'POST', { stock_out_id: this.searchParams.stock_out_id, lock_ids: this.lock_ids.join(',') }, true).then(res => { //图片集合
var pic_ids = this.image_list.map(item => {
return item.pic_id;
});
var lock_ids = '';
var flag = false;
if (this.filter_id.length > 0 && this.lock_ids.length == 0) {
//批量拣货
lock_ids = this.filter_id.join(',');
flag = true;
} else {
//按容器拣货
lock_ids = this.lock_ids.join(',');
flag = false;
}
this.request(API.makeMultiPickingFinish, 'POST', { stock_out_id: this.searchParams.stock_out_id, lock_ids: lock_ids, pic_ids: pic_ids.join(',') }, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
title: '拣货成功', title: '拣货成功',
icon: 'success' icon: 'success'
}); });
setTimeout(() => { setTimeout(() => {
if (flag) {
this.history_id = [];
this.filter_id = [];
this.search_keyword = '';
this.searchParams.stock_in_batch_sn = '';
this.is_batch_active = false;
this.closeDrawer(3);
} else {
this.closeDrawer(2);
}
this.getData(); this.getData();
this.closeDrawer(2);
}, 2000); }, 2000);
} else { } else {
uni.showModal({ uni.showModal({
...@@ -647,43 +919,7 @@ export default { ...@@ -647,43 +919,7 @@ export default {
}); });
} }
}); });
}, }
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, val) {
if (val) {
if (type == 1) {
this.input_flag_position_name = true;
this.getData();
} else if (type == 2) {
this.input_flag_stock_in_batch_sn = true;
this.getData();
setTimeout(() => {
if (this.searchParams.stock_in_batch_sn.length == 15 && this.list.length == 1) {
this.showDrawer(1, this.list[0]);
}
}, 1000);
} else if (type == 3) {
this.input_flag_container_sn = true;
this.getData();
setTimeout(() => {
if (this.searchParams.container_sn != '' && this.list.length == 1) {
this.showDrawer(2, this.list[0]);
}
}, 1000);
}
} else {
if (type == 1) {
this.input_flag_position_name = false;
} else if (type == 2) {
this.input_flag_stock_in_batch_sn = false;
} else if (type == 3) {
this.input_flag_container_sn = false;
}
}
}, 500)
} }
}; };
</script> </script>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<text class="iconfont icon-juxing1"></text> <text class="iconfont icon-juxing1"></text>
<template v-if="index == 0"> <template v-if="index == 0">
<template v-if="is_batch"> <template v-if="is_batch">
<input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" focus v-model="search_keyword" @input="handleInput(1, $event)" maxlength="15" /> <input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" focus v-model="search_keyword" @input="handleInput(1, $event)" maxlength="15" ref="myInput" />
</template> </template>
<template v-else> <template v-else>
<input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" focus v-model="searchParams.search_keyword" @input="handleInput(1, $event)" maxlength="15" /> <input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" focus v-model="searchParams.search_keyword" @input="handleInput(1, $event)" maxlength="15" />
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
</view> </view>
</view> </view>
<view class="row verCenter"> <view class="row verCenter">
<switch @change="switchChange" :checked="is_batch" color="#1969f9" style="transform:scale(0.7);width: 77rpx;" /> <switch @change="switchChange" :checked="is_batch" color="#1969f9" style="transform:scale(0.8);width: 77rpx;" />
<text style="font-size: 24rpx;white-space: nowrap;">批量扫描</text> <text style="font-size: 18rpx;white-space: nowrap;">批量扫描</text>
</view> </view>
</view> </view>
<!-- 列表数据 -->
<view class="list row bothSide" v-if="list.length > 0"> <view class="list row bothSide" v-if="list.length > 0">
<view class="box box-width" v-for="(item, index) in list" :key="index" :class="{ curr: filter_list[index] }"> <view class="box box-width" v-for="(item, index) in list" :key="index" :class="{ curr: filter_list[index] }">
<view class="check-box-icon" @click="filterChange(index)"></view> <view class="check-box-icon" @click="filterChange(index)"></view>
...@@ -333,6 +333,12 @@ export default { ...@@ -333,6 +333,12 @@ export default {
}); });
this.search_keyword = ''; this.search_keyword = '';
try {
this.$refs.myInput.focus(); // 获取焦点
} catch (e) {
//TODO handle the exception
}
//若识别物料标签不在上架任务中,则弹窗提示:该物料不在上架任务中,需关闭弹窗才可继续操作 //若识别物料标签不在上架任务中,则弹窗提示:该物料不在上架任务中,需关闭弹窗才可继续操作
let isInList = list.some(function(item) { let isInList = list.some(function(item) {
return item.stock_in_batch_sn === val; return item.stock_in_batch_sn === val;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view class="picking-sort-wrap"> <view class="picking-sort-wrap">
<view class="search-type row bothSide verCenter"> <view class="search-type row bothSide verCenter">
<view class="left"> <view class="left">
<view class="box-info row bothSide"> <view class="box-info row bothSide verCenter">
<view class="title row bothSide verCenter">打包箱号:</view> <view class="title row bothSide verCenter">打包箱号:</view>
<view class="info" @click="showBox()">箱信息</view> <view class="info" @click="showBox()">箱信息</view>
</view> </view>
...@@ -23,11 +23,22 @@ ...@@ -23,11 +23,22 @@
</view> </view>
<view class="right"> <view class="right">
<template v-if="curr == 0"> <template v-if="curr == 0">
<view class="box-info row bothSide"><view class="title row bothSide verCenter">入库批次号:</view></view> <view class="box-info row bothSide verCenter">
<view class="title">入库批次号:</view>
<view class="row verCenter">
<switch @change="switchChange" :checked="is_batch" color="#1969f9" style="transform:scale(0.7);width: 77rpx;" />
<text style="font-size: 18rpx;white-space: nowrap;">批量扫描</text>
</view>
</view>
<view class="search-bar row bothSide verCenter"> <view class="search-bar row bothSide verCenter">
<view class="row verCenter"> <view class="row verCenter">
<text class="iconfont icon-juxing1"></text> <text class="iconfont icon-juxing1"></text>
<input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" v-model="searchParams.stock_in_batch_sn" @input="handleInput(2, searchParams.stock_in_batch_sn)" maxlength="15" /> <template v-if="is_batch">
<input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" v-model="search_keyword" @input="handleInput(2, search_keyword)" maxlength="15" ref="myInput" />
</template>
<template v-else>
<input class="uni-input" placeholder="请扫描入库标签" placeholder-style="color:#919399" v-model="searchParams.stock_in_batch_sn" @input="handleInput(2, searchParams.stock_in_batch_sn)" maxlength="15" />
</template>
</view> </view>
<text class="iconfont icon-a-juxing11" @click="clearInput(2)" v-if="input_flag_stock_in_batch_sn"></text> <text class="iconfont icon-a-juxing11" @click="clearInput(2)" v-if="input_flag_stock_in_batch_sn"></text>
</view> </view>
...@@ -547,6 +558,9 @@ import debounce from 'lodash/debounce'; ...@@ -547,6 +558,9 @@ import debounce from 'lodash/debounce';
export default { export default {
data() { data() {
return { return {
is_batch: false, //是否开启批量
history_id: [], //批量记录id
search_keyword: '', //批量搜索值
noexebshowFalg: true, //控制是否会触发生命周期 noexebshowFalg: true, //控制是否会触发生命周期
company_id: uni.getStorageSync('company_id') || '', company_id: uni.getStorageSync('company_id') || '',
stock_out_sn: '', //标题显示出库单号 stock_out_sn: '', //标题显示出库单号
...@@ -599,6 +613,24 @@ export default { ...@@ -599,6 +613,24 @@ export default {
} }
}, },
methods: { methods: {
/**
* 批量扫描监听
* @param {Object} e
*/
switchChange(e) {
console.log('switch 发生 change 事件,携带值为', e.detail.value);
this.is_batch = e.detail.value;
//重置相关数据
this.history_id = [];
this.list = [];
this.page = 1;
this.filter_id = [];
this.search_keyword = '';
this.searchParams.stock_in_batch_sn = '';
this.getData();
},
bindPickerBoxChange: function(e, index) { bindPickerBoxChange: function(e, index) {
console.log('picker发送选择改变,携带值为', e.detail.value); console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value; this.index = e.detail.value;
...@@ -628,6 +660,32 @@ export default { ...@@ -628,6 +660,32 @@ export default {
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index])); this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index]));
let filter_arr = this.findIndex(this.filter_list, true); let filter_arr = this.findIndex(this.filter_list, true);
this.filter_id = filter_arr.map(i => this.list[i].stock_out_item_id); this.filter_id = filter_arr.map(i => this.list[i].stock_out_item_id);
//开启了批量搜索,如果取消勾选则删除
if (this.is_batch) {
if (!this.filter_list[index]) {
this.history_id.splice(index, 1);
this.searchParams.stock_in_batch_sn = this.history_id.join(',');
//当检测到全部取消的时候不应该调用接口
if (this.history_id.length == 0) {
this.list = [];
this.search_keyword = '';
return false;
}
//搜索之后添加选择状态
this.getData(data => {
if (data.length > 0) {
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
}
});
}
}
}, },
/** /**
* 全选 * 全选
...@@ -787,11 +845,67 @@ export default { ...@@ -787,11 +845,67 @@ export default {
handleInput: debounce(function(type, val) { handleInput: debounce(function(type, val) {
if (val) { if (val) {
if (type == 1) { if (type == 1) {
//箱号
this.input_flag_box_name = true; this.input_flag_box_name = true;
this.getData();
} else if (type == 2) { } else if (type == 2) {
this.input_flag_stock_in_batch_sn = true; //入库批次号 开启批量扫描
if (this.is_batch) {
this.input_flag_stock_in_batch_sn = false;
//记录历史搜索批次号
if (!this.history_id.includes(val)) {
this.history_id.push(val);
}
this.searchParams.stock_in_batch_sn = this.history_id.join(',');
this.getData(data => {
if (data.length > 0) {
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
try {
this.$refs.myInput.focus(); // 获取焦点
} catch (e) {
//TODO handle the exception
}
//若识别物料标签不在上架任务中,则弹窗提示:该物料不在上架任务中,需关闭弹窗才可继续操作
let isInList = list.some(function(item) {
return item.stock_in_batch_sn === val;
});
if (!isInList) {
uni.showModal({
title: '提示',
content: '该物料不在复核任务中',
confirmText: '关闭',
showCancel: false,
success: res => {
var index_history_id = this.history_id.indexOf(val);
this.history_id.splice(index_history_id, 1);
}
});
}
}
});
} else {
this.input_flag_stock_in_batch_sn = true;
this.getData();
setTimeout(() => {
if (this.searchParams.stock_in_batch_sn.length == 15 && this.list.length == 1) {
this.showDrawer(1, this.list[0]);
}
}, 1000);
}
} else if (type == 3) { } else if (type == 3) {
//容器
this.input_flag_container_sn = true; this.input_flag_container_sn = true;
this.getData();
} }
} else { } else {
if (type == 1) { if (type == 1) {
...@@ -802,7 +916,6 @@ export default { ...@@ -802,7 +916,6 @@ export default {
this.input_flag_container_sn = false; this.input_flag_container_sn = false;
} }
} }
this.getData();
}, 500), }, 500),
/** /**
* tab切换 * tab切换
...@@ -816,7 +929,7 @@ export default { ...@@ -816,7 +929,7 @@ export default {
/** /**
* 获取列表数据 * 获取列表数据
*/ */
getData() { getData(callback) {
var URL = ''; var URL = '';
if (this.curr == 0) { if (this.curr == 0) {
URL = API.getRecheckTaskItems; URL = API.getRecheckTaskItems;
...@@ -830,10 +943,11 @@ export default { ...@@ -830,10 +943,11 @@ export default {
if (res.code === 0) { if (res.code === 0) {
this.list = res.data.list; this.list = res.data.list;
this.filter_list = createArray(this.list.length, false); this.filter_list = createArray(this.list.length, false);
typeof callback == 'function' && callback(res.data.list);
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'error' icon: 'none'
}); });
} }
}); });
...@@ -856,6 +970,8 @@ export default { ...@@ -856,6 +970,8 @@ export default {
}); });
return false; return false;
} }
//图片集合
var pic_ids = this.image_list.map(item => { var pic_ids = this.image_list.map(item => {
return item.pic_id; return item.pic_id;
}); });
...@@ -891,9 +1007,12 @@ export default { ...@@ -891,9 +1007,12 @@ export default {
}); });
return false; return false;
} }
//图片集合
var pic_ids = this.image_list.map(item => { var pic_ids = this.image_list.map(item => {
return item.pic_id; return item.pic_id;
}); });
this.request(API.multiMarkChecked, 'POST', { stock_out_item_ids: this.stock_out_item_ids.join(','), box_name: this.box_name, pic_ids: pic_ids.join(',') }, true).then(res => { this.request(API.multiMarkChecked, 'POST', { stock_out_item_ids: this.stock_out_item_ids.join(','), box_name: this.box_name, pic_ids: pic_ids.join(',') }, true).then(res => {
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
...@@ -951,19 +1070,29 @@ export default { ...@@ -951,19 +1070,29 @@ export default {
this.index = -1; this.index = -1;
this.$refs.showBoxInfo.open(); this.$refs.showBoxInfo.open();
}, },
/**
* 关闭弹窗
*/
closeBox() { closeBox() {
this.$refs.showBoxInfo.close(); this.$refs.showBoxInfo.close();
}, },
/**
* 打开弹窗
* @param {Object} type
* @param {Object} data
*/
showDrawer(type, data) { showDrawer(type, data) {
if (type == 1) { if (type == 1) {
//按货品复核 //按货品复核
this.$refs.showRight.open(); this.$refs.showRight.open();
this.detail = data; this.detail = data;
this.formParams.recheck_qty = data.no_recheck_qty; this.formParams.recheck_qty = data.no_recheck_qty;
this.image_list = []; //清空图片列表
} else if (type == 2) { } else if (type == 2) {
//按容器复核 //按容器复核
this.$refs.showRightPack.open(); this.$refs.showRightPack.open();
this.detailContainer = data; this.detailContainer = data;
this.image_list = []; //清空图片列表
this.stock_out_item_ids = data.list.map(function(item) { this.stock_out_item_ids = data.list.map(function(item) {
return item.stock_out_item_id; return item.stock_out_item_id;
}); });
...@@ -978,6 +1107,7 @@ export default { ...@@ -978,6 +1107,7 @@ export default {
} }
this.stock_out_item_ids = this.filter_id; this.stock_out_item_ids = this.filter_id;
this.$refs.showRightAll.open(); this.$refs.showRightAll.open();
this.image_list = []; //清空图片列表
} }
}, },
closeDrawer(type) { closeDrawer(type) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment