|
@@ -2,15 +2,15 @@
|
|
|
<view class='container uni-column'>
|
|
|
<view class='nav uni-row'>
|
|
|
<view v-for="(item,index) in statusList" :key="index" :class="{'selecter':singleSelectd(item)}">
|
|
|
- <!-- <text :class='pendingClass' @click='selectPending'>带周转</text>
|
|
|
+ <!-- <text :class='pendingClass' @click='selectPending'>带周转</text>
|
|
|
<text :class='turnoverClass' @click='selectTurnover'>周转中</text> -->
|
|
|
- <!-- <image class='img' src="../../static/screen.png"></image> -->
|
|
|
- <text @click='selectedStatus(item)'> {{item['name']}}</text>
|
|
|
+ <!-- <image class='img' src="../../static/screen.png"></image> -->
|
|
|
+ <text @click='selectedStatus(item)'> {{item['name']}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 待周转页面 -->
|
|
|
<view class="padding-container" v-if='selectedInfo.id == 4'>
|
|
|
- <view class="scroll-container" >
|
|
|
+ <view class="scroll-container">
|
|
|
<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
<text>暂无待周转批次</text>
|
|
|
</view>
|
|
@@ -59,7 +59,7 @@
|
|
|
</view>
|
|
|
<!-- 周转中页面 -->
|
|
|
<view class='turnover-container' v-if='selectedInfo.id == 5'>
|
|
|
- <view class="scroll-container" >
|
|
|
+ <view class="scroll-container">
|
|
|
<view v-if="lotList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
<text>暂无周转中批次</text>
|
|
|
</view>
|
|
@@ -102,97 +102,51 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class='bottom-btn-container uni-row' >
|
|
|
- <button type='primary' class='bottom-btn' @click="handleConfirmDelivery" >确认送达</button>
|
|
|
- <button type='primary' class='bottom-btn' @click="handleBackturnover" style="margin-left: 24rpx;" >退回上一级</button>
|
|
|
+ <view class='bottom-btn-container uni-row'>
|
|
|
+ <button type='primary' class='bottom-btn'
|
|
|
+ @click="handleConfirm('确认送达',store.itemStatus.delivered)">确认送达</button>
|
|
|
+ <button class='bottom-btn' @click="handleConfirm('取消周转',store.itemStatus.pendingTurnover)"
|
|
|
+ style="margin-left: 24rpx;background-color: coral;">取消周转</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 已送达页面 -->
|
|
|
<view class='turnover-container' v-if='selectedInfo.id == 6'>
|
|
|
- <view class="scroll-container" >
|
|
|
+ <view class="scroll-container">
|
|
|
<view v-if="deliveredList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
<text>暂无已送达批次</text>
|
|
|
</view>
|
|
|
<!-- 循环已送达的数据 -->
|
|
|
<view v-else class='item-container'>
|
|
|
- <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in deliveredList"
|
|
|
- @click="handleSelection(item)" :key='index'>
|
|
|
- <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 :class="{'list-container':true,'selected':isSelectedDelivered(item)}"
|
|
|
+ v-for="(item,index) in deliveredList" @click="handleSelectionDelivered(item)" :key='index'>
|
|
|
+ <view class="list-container-item product-description uni-row">
|
|
|
+ <text class="label left-value">周转路径</text>
|
|
|
+ <text class="">{{item.preDeptName + '→' + item.deptName }}</text>
|
|
|
</view>
|
|
|
- <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 class="list-container-item product-description uni-row">
|
|
|
+ <text class="label left-value">产品描述</text>
|
|
|
+ <text class="label right-value">{{item['productDescription']}}</text>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class='bottom-btn-container uni-row'>
|
|
|
- <button type='primary' class='bottom-btn' @click="handleConfirmDelivery">确认送达</button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 已接收页面 -->
|
|
|
- <view class='turnover-container' v-if='selectedInfo.id == 7'>
|
|
|
- <view class="scroll-container" >
|
|
|
- <view v-if="receivedList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
- <text>暂无已接收批次</text>
|
|
|
- </view>
|
|
|
- <!-- 循环已接收的数据 -->
|
|
|
- <view v-else class='item-container'>
|
|
|
- <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in receivedList"
|
|
|
- @click="handleSelection(item)" :key='index'>
|
|
|
- <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 class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">批次</text>
|
|
|
+ <text class="label right-value">{{item['lotCode']}}</text>
|
|
|
</view>
|
|
|
- <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'] ? lot['carrierName'].split('、').length : 0 }}</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 class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱数</text>
|
|
|
+ <text class="label right-value">{{item['carrierName'].split('、').length}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱号</text>
|
|
|
+ <text class="label right-value">{{item['carrierName']}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class='bottom-btn-container uni-row'>
|
|
|
- <button type='primary' class='bottom-btn' @click="handleConfirmDelivery">确认送达</button>
|
|
|
+ <button type='primary' class='bottom-btn' @click="handleConfirm('取消送达',store.itemStatus.turnoveing)">取消送达</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <dialog-confirm ref="confirm" @submit="handleConfirmUnbind" @backTurnover="handleConfirmBack" @reflush="reflush"></dialog-confirm>
|
|
|
<dialog-turnoverTask ref="turnoverTask"></dialog-turnoverTask>
|
|
|
</template>
|
|
|
|
|
@@ -216,6 +170,9 @@
|
|
|
import {
|
|
|
getDictInfoByType
|
|
|
} from '@/api/dict/dict.js'
|
|
|
+ import {
|
|
|
+ store
|
|
|
+ } from '../../store'
|
|
|
|
|
|
|
|
|
const sum = ref(0)
|
|
@@ -236,11 +193,18 @@
|
|
|
const lotList = ref([])
|
|
|
const deliveredList = ref([])
|
|
|
const receivedList = ref([])
|
|
|
- const statusList = ref([
|
|
|
- {"id": 4,"name": "待周转"},
|
|
|
- {"id": 5,"name": "周转中"},
|
|
|
- {"id": 6,"name": "已送达"},
|
|
|
- {"id": 7,"name": "已接收"}
|
|
|
+ const statusList = ref([{
|
|
|
+ "id": 4,
|
|
|
+ "name": "待周转"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "id": 5,
|
|
|
+ "name": "周转中"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "id": 6,
|
|
|
+ "name": "已送达"
|
|
|
+ }
|
|
|
])
|
|
|
|
|
|
onLoad(() => {
|
|
@@ -252,107 +216,56 @@
|
|
|
})
|
|
|
|
|
|
function init() {
|
|
|
- //待周转
|
|
|
- getItemList({
|
|
|
- status: 4
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- listData.value = res.rows;
|
|
|
- // 设置箱数
|
|
|
- for (var i = 0; i < listData.value.length; i++) {
|
|
|
- listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
|
|
|
- }
|
|
|
- console.log(res)
|
|
|
- }
|
|
|
- })
|
|
|
- //周转中
|
|
|
- getItemList({
|
|
|
- status: 5
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- // 通过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 < 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(lotList.value)
|
|
|
- }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
})
|
|
|
- //已送达
|
|
|
- getItemList({
|
|
|
- status: 6
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- // 通过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 方法
|
|
|
- deliveredList.value = Object.values(groupedRows);
|
|
|
- // 设置箱数
|
|
|
- for (let i = 0; i < deliveredList.value.length; i++) {
|
|
|
- deliveredList.value[i][0].totalCarrier = 0;
|
|
|
- for (let j = 0; j < deliveredList.value[i].length; j++) {
|
|
|
- deliveredList.value[i][0].totalCarrier += deliveredList.value[i][j].carrierName.split('、').length;
|
|
|
+ Promise.all([getItemList({
|
|
|
+ status: 4
|
|
|
+ }), getItemList({
|
|
|
+ status: 5
|
|
|
+ }), getItemList({
|
|
|
+ status: 6,
|
|
|
+ updaterId: store.userInfo.userId
|
|
|
+ })])
|
|
|
+ .then(([res1, res2, res3]) => {
|
|
|
+ //待周转
|
|
|
+ if (res1.code == 200) {
|
|
|
+ listData.value = res1.rows;
|
|
|
+ // 设置箱数
|
|
|
+ for (var i = 0; i < listData.value.length; i++) {
|
|
|
+ listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
|
|
|
}
|
|
|
+ console.log(res1)
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
- //已接收
|
|
|
- getItemList({
|
|
|
- status: 7
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- // 通过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 方法
|
|
|
- receivedList.value = Object.values(groupedRows);
|
|
|
- // 设置箱数
|
|
|
- for (let i = 0; i < receivedList.value.length; i++) {
|
|
|
- receivedList.value[i][0].totalCarrier = 0;
|
|
|
- for (let j = 0; j < receivedList.value[i].length; j++) {
|
|
|
- if (receivedList.value[i][j].carrierName) {
|
|
|
- receivedList.value[i][0].totalCarrier += receivedList.value[i][j].carrierName.split('、').length;
|
|
|
+ //周转
|
|
|
+ if (res2.code == 200) {
|
|
|
+ // 通过dayworkId再分组
|
|
|
+ const groupedRows = res2.rows.reduce((acc, item) => {
|
|
|
+ const dept = item.deptId;
|
|
|
+ if (acc.hasOwnProperty(dept)) {
|
|
|
+ acc[dept].push(item);
|
|
|
} else {
|
|
|
- receivedList.value[i][0].totalCarrier += 0;
|
|
|
+ acc[dept] = [item];
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ // groupedRows 是一个对象,其键是dayworkId,值是具有相同dayworkId的对象数组
|
|
|
+ // 如果需要将它转换为二维数组,您可以使用 Object.values 方法
|
|
|
+ lotList.value = Object.values(groupedRows);
|
|
|
+ // 设置箱数
|
|
|
+ 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;
|
|
|
}
|
|
|
- // receivedList.value[i][0].totalCarrier += receivedList.value[i][j].carrierName.split('、').length;
|
|
|
}
|
|
|
+ console.log(lotList.value)
|
|
|
}
|
|
|
- console.log(receivedList.value)
|
|
|
- }
|
|
|
- })
|
|
|
+ if (res3.code == 200) {
|
|
|
+ deliveredList.value = res3.rows;
|
|
|
+ }
|
|
|
+ uni.hideLoading();
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function reflush() {
|
|
@@ -361,10 +274,6 @@
|
|
|
init();
|
|
|
}
|
|
|
|
|
|
- function handleConfirmUnbind() {
|
|
|
- handleDoTurn();
|
|
|
- }
|
|
|
-
|
|
|
function handleStartTurn() {
|
|
|
// if(selection.value.length > 0){
|
|
|
// let msg = '是否确认周转?';
|
|
@@ -376,29 +285,33 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- function handleConfirmDelivery() {
|
|
|
+ function handleConfirm(str, status) {
|
|
|
if (selection.value.length > 0) {
|
|
|
- let msg = '是否确认送达?';
|
|
|
- confirm.value.open(msg);
|
|
|
- }else{
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否${str}?`,
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ handleUpadteStatus(status);
|
|
|
+ } else if (res.cancel) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
- title: '请选择后再点击确认送达按钮',
|
|
|
+ title: `请选择后再点击${str}按钮`,
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- function handleBackturnover() {
|
|
|
- if(selection.value.length>0) {
|
|
|
- let msg ='是否返回待周转?'
|
|
|
- confirm.value.open(msg);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- function handleDoTurn() {
|
|
|
+
|
|
|
+ function handleUpadteStatus(status) {
|
|
|
// 设置周转状态
|
|
|
for (let i = 0; i < selection.value.length; i++) {
|
|
|
- selection.value[i].status = '6';
|
|
|
+ selection.value[i].status = status;
|
|
|
}
|
|
|
updateDayWorkItemBatch(selection.value).then(res => {
|
|
|
if (res.code === 200) {
|
|
@@ -419,32 +332,7 @@
|
|
|
// 清空选中数组
|
|
|
selection.value = [];
|
|
|
}
|
|
|
- //回退状态
|
|
|
- function handleConfirmBack() {
|
|
|
- // 设置周转状态
|
|
|
- for (let i = 0; i < selection.value.length; i++) {
|
|
|
- selection.value[i].status = '4';
|
|
|
- }
|
|
|
- // updateBackDayWorkItemBatch(selection.value).then(res => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'success',
|
|
|
- // title: '操作成功',
|
|
|
- // duration: 2000
|
|
|
- // });
|
|
|
- // reflush();
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'error',
|
|
|
- // title: '操作失败',
|
|
|
- // duration: 2000
|
|
|
- // });
|
|
|
- // }
|
|
|
- // })
|
|
|
- // // 清空选中数组
|
|
|
- // selection.value = [];
|
|
|
- console.log(selection.value)
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
function isSelected(item) {
|
|
|
//单选
|
|
@@ -461,16 +349,23 @@
|
|
|
} 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");
|
|
|
}
|
|
|
+
|
|
|
+ function isSelectedDelivered(item) {
|
|
|
+ //多选
|
|
|
+ return selection.value.includes(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleSelectionDelivered(item){
|
|
|
+ //多选
|
|
|
+ const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
+ if (buttonIndex > -1) {
|
|
|
+ selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
+ } else {
|
|
|
+ selection.value.push(item); // 选中
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
function selectPending() {
|
|
|
pendingClass.value['selecter'] = true;
|
|
@@ -485,10 +380,12 @@
|
|
|
pendingShow.value = false;
|
|
|
turnoverShow.value = true;
|
|
|
}
|
|
|
+
|
|
|
function selectedStatus(item) {
|
|
|
console.log(item)
|
|
|
selectedInfo.value = item
|
|
|
}
|
|
|
+
|
|
|
function singleSelectd(item) {
|
|
|
return selectedInfo.value == item
|
|
|
}
|
|
@@ -499,7 +396,8 @@
|
|
|
|
|
|
/* 导航栏样式 */
|
|
|
.container {
|
|
|
- height: calc(100% - $navHeight);
|
|
|
+ // height: calc(100% - $navHeight);
|
|
|
+ height: 1500rpx;
|
|
|
position: relative;
|
|
|
top: $navHeight;
|
|
|
background-color: #f5f5f5;
|
|
@@ -577,9 +475,10 @@
|
|
|
}
|
|
|
|
|
|
.padding-container {
|
|
|
- .scroll-container {
|
|
|
+ .scroll-container {
|
|
|
max-height: 90%;
|
|
|
overflow: auto;
|
|
|
+
|
|
|
.list-item {
|
|
|
background-color: #fff;
|
|
|
padding: 0 24rpx;
|
|
@@ -643,6 +542,7 @@
|
|
|
.scroll-container {
|
|
|
height: 90%;
|
|
|
overflow: scroll;
|
|
|
+
|
|
|
.item-container {
|
|
|
// height: 90%;
|
|
|
// padding: 8rpx 0 32rpx 0;
|