|
@@ -8,12 +8,15 @@
|
|
|
<!-- 待周转页面 -->
|
|
|
<view class="padding-container" v-if='pendingShow'>
|
|
|
<view class="scroll-container" scroll-y>
|
|
|
- <view v-for="(item, index) in listData" :key="index"
|
|
|
- :class="{'list-item':true,'selected':isSelected(item)}">
|
|
|
+ <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
+ <text>暂无待周转批次</text>
|
|
|
+ </view>
|
|
|
+ <view v-else v-for="(item, index) in listData" :key="index"
|
|
|
+ :class="{'list-item':true,'selected':isSelected(item)}">
|
|
|
<!-- @click="handleSelection(item)" -->
|
|
|
- <view class="title-container uni-row">
|
|
|
+ <view class="title-container uni-row">
|
|
|
<view class="title uni-row">
|
|
|
- <text class="label">{{ item['dictDataLabel'] }}</text>
|
|
|
+ <text class="label">{{ item['turnoverArea'] }}</text>
|
|
|
<text class="label code">{{ item['preDeptName'] }}</text>
|
|
|
<text class="label code" style="margin-left: 16rpx;">→</text>
|
|
|
<text class="label code" style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
|
|
@@ -54,33 +57,43 @@
|
|
|
<!-- 周转中页面 -->
|
|
|
<view class='turnover-container' v-if='turnoverShow'>
|
|
|
<view class="scroll-container" scroll-y>
|
|
|
+ <view v-if="lotList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
+ <text>暂无周转中批次</text>
|
|
|
+ </view>
|
|
|
<!-- 循环周转中的数据 -->
|
|
|
- <view class='item-container'>
|
|
|
- <view v-if="products.length > 0" class="turnover-title uni-row">
|
|
|
+ <view v-else class='item-container'>
|
|
|
+ <!-- <view v-if="products.length > 0" class="turnover-title uni-row">
|
|
|
<view class="uni-row" style="align-items: center;">
|
|
|
<view><text class='title-color'>{{turnoverContentTitle}}箱</text></view>
|
|
|
<view><text class="second-info">{{turnoverSecondTitle}}</text></view>
|
|
|
</view>
|
|
|
<view><text class="label">周转中</text></view>
|
|
|
- </view>
|
|
|
- <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in products"
|
|
|
+ </view> -->
|
|
|
+ <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in lotList"
|
|
|
@click="handleSelection(item)" :key='index'>
|
|
|
- <!-- @click="handleSelection(item)" -->
|
|
|
- <view class="list-container-item product-description uni-row">
|
|
|
- <text class="label left-value">产品描述</text>
|
|
|
- <text class="label right-value">{{item['productDescription']}}</text>
|
|
|
- </view>
|
|
|
- <view class="list-container-item uni-row">
|
|
|
- <text class="label left-value">批次</text>
|
|
|
- <text class="label right-value">{{item['lotCode']}}</text>
|
|
|
- </view>
|
|
|
- <view class="list-container-item uni-row">
|
|
|
- <text class="label left-value">箱数</text>
|
|
|
- <text class="label right-value">{{item['carriers']}}</text>
|
|
|
+ <view class="turnover-title uni-row">
|
|
|
+ <view class="uni-row" style="align-items: center;">
|
|
|
+ <view><text class='title-color'>{{ item[0]['totalCarrier'] }}箱</text></view>
|
|
|
+ <view><text class="second-info">{{item[0].preDeptName + '→' + item[0].deptName }}</text></view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="list-container-item uni-row">
|
|
|
- <text class="label left-value">箱号</text>
|
|
|
- <text class="label right-value">{{item['carrierName']}}</text>
|
|
|
+ <view v-for="(lot,index) in item" :key="index" style="margin-bottom: 10rpx;">
|
|
|
+ <view class="list-container-item product-description uni-row">
|
|
|
+ <text class="label left-value">产品描述</text>
|
|
|
+ <text class="label right-value">{{lot['productDescription']}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">批次</text>
|
|
|
+ <text class="label right-value">{{lot['lotCode']}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱数</text>
|
|
|
+ <text class="label right-value">{{lot['carrierName'].split('、').length}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱号</text>
|
|
|
+ <text class="label right-value">{{lot['carrierName']}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -104,7 +117,7 @@
|
|
|
// import pending from './pending';
|
|
|
// import turnover from './turnover';
|
|
|
import {
|
|
|
- getDayWorkItemList
|
|
|
+ getDayWorkItemList,getItemList
|
|
|
} from '@/api/business/dayWorkItem.js'
|
|
|
import {
|
|
|
updateDayWorkItem,
|
|
@@ -117,8 +130,6 @@
|
|
|
|
|
|
const pendingTitle = ref('待周转')
|
|
|
const turnoverTitle = ref('周转中')
|
|
|
- const turnoverContentTitle = ref(0)
|
|
|
- const turnoverSecondTitle = ref('')
|
|
|
const sum = ref(0)
|
|
|
const pendingClass = ref({
|
|
|
selecter: true
|
|
@@ -133,6 +144,7 @@
|
|
|
const products = ref([])
|
|
|
const confirm = ref(null) // 弹窗组件
|
|
|
const turnoverTask = ref(null) // 弹窗组件
|
|
|
+ const lotList = ref([])
|
|
|
|
|
|
onLoad(() => {
|
|
|
uni.$once('confirmDelivery', function() {
|
|
@@ -142,7 +154,7 @@
|
|
|
})
|
|
|
|
|
|
function init() {
|
|
|
- getDayWorkItemList({
|
|
|
+ getItemList({
|
|
|
status: 4
|
|
|
}).then(res => {
|
|
|
if (res.code == 200) {
|
|
@@ -154,23 +166,38 @@
|
|
|
console.log(res)
|
|
|
}
|
|
|
})
|
|
|
- getDayWorkItemList({
|
|
|
+ getItemList({
|
|
|
status: 5
|
|
|
}).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- products.value = res.rows;
|
|
|
+ // 通过dayworkId再分组
|
|
|
+ const groupedRows = res.rows.reduce((acc, item) => {
|
|
|
+ const dept = item.deptId;
|
|
|
+ if (acc.hasOwnProperty(dept)) {
|
|
|
+ acc[dept].push(item);
|
|
|
+ } else {
|
|
|
+ acc[dept] = [item];
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ // groupedRows 是一个对象,其键是dayworkId,值是具有相同dayworkId的对象数组
|
|
|
+ // 如果需要将它转换为二维数组,您可以使用 Object.values 方法
|
|
|
+ lotList.value = Object.values(groupedRows);
|
|
|
// 设置箱数
|
|
|
- for (let i = 0; i < products.value.length; i++) {
|
|
|
- products.value[i].carriers = products.value[i].carrierName.split('、').length;
|
|
|
- turnoverContentTitle.value += products.value[i].carriers;
|
|
|
- turnoverSecondTitle.value = (products.value[i].preDeptName ? products.value[i].preDeptName : '') + " → " + products.value[i].deptName;
|
|
|
+ for (let i = 0; i < lotList.value.length; i++) {
|
|
|
+ lotList.value[i][0].totalCarrier = 0;
|
|
|
+ for (let j = 0; j < lotList.value[i].length; j++) {
|
|
|
+ lotList.value[i][0].totalCarrier += lotList.value[i][j].carrierName.split('、').length;
|
|
|
+ }
|
|
|
}
|
|
|
- console.log(res)
|
|
|
+ console.log(lotList.value)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function reflush() {
|
|
|
+ turnoverContentTitle.value = 0;
|
|
|
+ lotList.value = [];
|
|
|
init();
|
|
|
}
|
|
|
|
|
@@ -190,7 +217,7 @@
|
|
|
}
|
|
|
|
|
|
function handleConfirmDelivery() {
|
|
|
- if (products.value.length > 0) {
|
|
|
+ if (selection.value.length > 0) {
|
|
|
let msg = '是否确认送达?';
|
|
|
confirm.value.open(msg);
|
|
|
}
|
|
@@ -198,17 +225,17 @@
|
|
|
|
|
|
function handleDoTurn() {
|
|
|
// 设置周转状态
|
|
|
- for (var i = 0; i < products.value.length; i++) {
|
|
|
- products.value[i].status = '6';
|
|
|
+ for (let i = 0; i < selection.value.length; i++) {
|
|
|
+ selection.value[i].status = '6';
|
|
|
}
|
|
|
- updateDayWorkItemBatch(products.value).then(res => {
|
|
|
+ updateDayWorkItemBatch(selection.value).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
uni.showToast({
|
|
|
icon: 'success',
|
|
|
title: '操作成功',
|
|
|
duration: 2000
|
|
|
});
|
|
|
- init();
|
|
|
+ reflush();
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'error',
|
|
@@ -222,16 +249,28 @@
|
|
|
}
|
|
|
|
|
|
function isSelected(item) {
|
|
|
- return selection.value.includes(item);
|
|
|
+ //单选
|
|
|
+ return selection.value == item;
|
|
|
+
|
|
|
+ //多选
|
|
|
+ // return selection.value.includes(item);
|
|
|
}
|
|
|
|
|
|
function handleSelection(item) {
|
|
|
- const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
- if (buttonIndex > -1) {
|
|
|
- selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
- } else {
|
|
|
- selection.value.push(item); // 选中
|
|
|
+ // 单选
|
|
|
+ if(selection.value == item){
|
|
|
+ selection.value = []
|
|
|
+ }else{
|
|
|
+ selection.value = item;
|
|
|
}
|
|
|
+
|
|
|
+ // 多选
|
|
|
+ // 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");
|
|
|
}
|
|
|
|
|
@@ -263,6 +302,8 @@
|
|
|
|
|
|
.selected {
|
|
|
border: 1px solid #1684fc;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ padding: 8rpx;
|
|
|
}
|
|
|
|
|
|
.nav {
|
|
@@ -414,7 +455,9 @@
|
|
|
}
|
|
|
|
|
|
.list-container {
|
|
|
- margin: 0 24rpx 16rpx 24rpx;
|
|
|
+ // margin: 16rpx 24rpx 16rpx 24rpx;
|
|
|
+ width: calc(100% - 48rpx);
|
|
|
+ margin: 16rpx auto;
|
|
|
|
|
|
.list-container-item {
|
|
|
border-bottom: 1px solid #999999;
|