Преглед изворни кода

拣货任务-波次展示超过5条隐藏、列表有操作时间排序到下边

zhaohuanhuan пре 1 година
родитељ
комит
73cb97e2a5

+ 52 - 0
src/views/outbound/picking/components/WaveInfo.vue

@@ -0,0 +1,52 @@
+<template>
+  <div class="wave">
+    <template  v-for="(wave,index) in binds">
+      <div class="wave-item" v-if="index < number || (index >= number && isFold)">
+        <div>{{ wave.waveNo }}</div>
+        <div>格口:{{ wave.bin }},数量:{{ wave.quantity }}</div>
+      </div>
+    </template>
+    <div v-if="size > number">
+      <van-divider dashed @click="isFold=!isFold" :style="{ color: '#333', borderColor: '#333',fontSize:'13px', margin: '8px 0 0 0' }">
+        <span v-if="isFold">点击收起</span>
+        <span v-else-if="!isFold" v-text="'共'+ size +'条,点击展开'" />
+      </van-divider>
+    </div>
+  </div>
+</template>
+<script setup>
+import { onMounted, ref } from 'vue'
+import {  onBeforeUpdate, onUpdated } from '@vue/runtime-dom'
+
+const number=5
+const isFold=ref(false)
+const size=ref(0)
+const props = defineProps({
+  binds: Array
+});
+onMounted(()=>{
+  _initSize()
+})
+onUpdated(()=>{
+  _initSize()
+})
+onBeforeUpdate(()=>{
+  _initSize()
+})
+const _initSize=()=> {
+  if (props.binds) {
+    size.value = props.binds ? props.binds.length : 0
+  } else {
+    size.value = 0
+  }
+}
+</script>
+<style lang="sass" scoped>
+.wave
+  padding: 5px
+  .wave-item
+    display: flex
+    justify-content: space-between
+    font-size: 12px
+
+</style>

+ 18 - 7
src/views/outbound/picking/list/index.vue

@@ -72,12 +72,7 @@
                   <van-button  v-if="item.operationTime==null && item.count==0"   size="mini" type="primary"  plain  @click="jump(item)"  :loading="jumpLoading"  loading-text="加载中...">跳过</van-button>
                 </template>
               </van-field>
-              <div class="wave">
-                <div v-for="wave in item.binds" class="wave-item">
-                  <div>{{ wave.waveNo }}</div>
-                  <div>格口:{{ wave.bin }},数量:{{ wave.quantity }}</div>
-                </div>
-              </div>
+              <WaveInfo :binds="item.binds" />
             </div>
           </div>
         </van-col>
@@ -136,6 +131,7 @@ import { containerDef } from '@/views/outbound/picking/list/hooks/containerDef'
 import { getCarrierList } from '@/hooks/basic/carrier'
 import { basicStore } from '@/store/modules/basic'
 import { closeLoading, showLoading } from '@/utils/loading'
+import WaveInfo from '@/views/outbound/picking/components/WaveInfo.vue'
 onUnmounted(() => {
   closeListener()
 })
@@ -210,7 +206,12 @@ const loadData =  async (pickingCode) => {
     if (!taskMap.value[location]) {
       taskMap.value[location] = { location, list: [],scanLocation:'',scanBarcode:'' }
     }
-    taskMap.value[location].list.push(item)
+    //将有操作时间的放到后边
+    if (item.operationTime) {
+      taskMap.value[location].list.push(item);
+    } else {
+      taskMap.value[location].list.unshift(item);
+    }
   })
   locationList.value = Object.values(taskMap.value)
   // 将已拣货的数据放到一个数组
@@ -512,6 +513,16 @@ const _setPickingDetail=(params,type)=>{
         onScan(2)
       }
     }
+    //对有操作时间的进行排序放到下边
+    list.sort((a, b) => {
+      if (a.operationTime && !b.operationTime) {
+        return 1;
+      }
+      if (!a.operationTime && b.operationTime) {
+        return -1;
+      }
+      return 0;
+    });
     if(type==1){
       locationList.value[activeIndex.value].list.forEach(items=>{
         if(items.line==params[0].line){