|
@@ -2,8 +2,9 @@
|
|
|
|
|
|
<view class='container '>
|
|
|
<view class='content'>
|
|
|
- <view class='item-table' scroll-y v-for="(item,index) in products" :key='index'>
|
|
|
- <text class='title'>{{title}}</text>
|
|
|
+ <text class='title'>{{title}}</text>
|
|
|
+ <view :class="{'item-table':true, 'selected':isSelected(item)}" scroll-y v-for="(item,index) in products"
|
|
|
+ @click="handleSelection(item,index)">
|
|
|
<view class="uni-row table-layout">
|
|
|
<text class='tbhead left'>产品描述</text>
|
|
|
<text class='tbhead right'>{{item['productDescription']}}</text>
|
|
@@ -45,15 +46,19 @@
|
|
|
store
|
|
|
} from '@/store/index.js'
|
|
|
|
|
|
- const title = ref('热处理')
|
|
|
+ const title = ref(null)
|
|
|
const sum = ref(0)
|
|
|
const products = ref([])
|
|
|
const confirm = ref(null)
|
|
|
+ const flag = ref(false)
|
|
|
+ const selection = ref([])
|
|
|
|
|
|
onLoad(() => {
|
|
|
-
|
|
|
})
|
|
|
|
|
|
+ function init() {
|
|
|
+ }
|
|
|
+
|
|
|
function handleScanCode() {
|
|
|
uni.scanCode({
|
|
|
scanType: ['qrCode'],
|
|
@@ -65,19 +70,24 @@
|
|
|
carrierId: vehicleObj.carrierId,
|
|
|
status: 6
|
|
|
}).then(response => {
|
|
|
- for (let i = 0; i < products.value.length; i++) {
|
|
|
- if (Object.entries(products.value[i]).toString() === Object.entries(res
|
|
|
- .data)
|
|
|
- .toString()) {
|
|
|
- uni.showToast({
|
|
|
- icon: "error",
|
|
|
- title: "该批次已存在"
|
|
|
- })
|
|
|
- console.log("该批次已存在")
|
|
|
- return;
|
|
|
- }
|
|
|
+ console.log(response)
|
|
|
+ // for (let i = 0; i < products.value.length; i++) {
|
|
|
+ // if (products.value[i].lotCode === res.data[0].lotCode) {
|
|
|
+ // console.log(products.value[i].lotCode);
|
|
|
+ // console.log(res.data[0].lotCode)
|
|
|
+ // uni.showToast({
|
|
|
+ // icon: "error",
|
|
|
+ // title: "该批次已存在"
|
|
|
+ // })
|
|
|
+ // console.log("该批次已存在")
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ for (let i = 0; i < response.data.length; i++) {
|
|
|
+ products.value.push(response.data[i]);
|
|
|
+ console.log(products.value)
|
|
|
}
|
|
|
- products.value.push(response.data);
|
|
|
+ console.log(products.value)
|
|
|
let sum = 0; //总箱数
|
|
|
for (let i = 0; i < products.value.length; i++) {
|
|
|
products.value[i].carriers = products.value[i].carrierName.split('、').length;
|
|
@@ -85,25 +95,40 @@
|
|
|
}
|
|
|
title.value = products.value[0].deptName + ' (' + sum + '箱)';
|
|
|
console.log(products.value)
|
|
|
+ init();
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function handleConfirmReceipt() {
|
|
|
- if (products.value.length > 0) {
|
|
|
+ if (selection.value.length > 0) {
|
|
|
let msg = "是否确认接收";
|
|
|
confirm.value.open(msg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function isSelected(item) {
|
|
|
+ return selection.value.includes(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleSelection(item, index) {
|
|
|
+ const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
+ if (buttonIndex > -1) {
|
|
|
+ selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
+ } else {
|
|
|
+ selection.value.push(item); // 选中
|
|
|
+ }
|
|
|
+ console.log(selection.value, "selection");
|
|
|
+ }
|
|
|
+
|
|
|
function handleDoReceipt() {
|
|
|
// 设置周转状态
|
|
|
- for (var i = 0; i < products.value.length; i++) {
|
|
|
- products.value[i].status = '7';
|
|
|
- products.value[i].recipientId = store.userInfo.userId;
|
|
|
+ for (var i = 0; i < selection.value.length; i++) {
|
|
|
+ selection.value[i].status = '7';
|
|
|
+ selection.value[i].recipientId = store.userInfo.userId;
|
|
|
}
|
|
|
- updateDayWorkItemBatch(products.value).then(res => {
|
|
|
+ updateDayWorkItemBatch(selection.value).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
uni.showToast({
|
|
|
icon: 'success',
|
|
@@ -120,6 +145,8 @@
|
|
|
}
|
|
|
})
|
|
|
products.value = [];
|
|
|
+ selection.value = [];
|
|
|
+ title.value = null;
|
|
|
}
|
|
|
|
|
|
function handleDoIt() {
|
|
@@ -140,8 +167,12 @@
|
|
|
margin: 50rpx auto;
|
|
|
border-radius: 12rpx;
|
|
|
|
|
|
+ .selected {
|
|
|
+ border: 1px solid #1684fc;
|
|
|
+ }
|
|
|
+
|
|
|
.title {
|
|
|
- margin: 10rpx auto;
|
|
|
+ margin-left: 10rpx;
|
|
|
width: 90%;
|
|
|
font-size: 36rpx;
|
|
|
font-weight: bold;
|