Explorar el Código

项目初始化

zhaohuanhuan hace 1 año
padre
commit
bdae8e99b4

+ 15 - 10
src/views/outbound/components/ContainerNoInput.vue

@@ -21,7 +21,7 @@
   </div>
   </div>
 </template>
 </template>
 <script setup lang="ts">
 <script setup lang="ts">
-import { ref } from 'vue'
+import { computed, ref } from 'vue'
 import { showToast } from 'vant'
 import { showToast } from 'vant'
   const store = useStore()
   const store = useStore()
   const warehouse = store.warehouse
   const warehouse = store.warehouse
@@ -30,9 +30,14 @@ import { showToast } from 'vant'
   const containerCodeRef=ref(null)
   const containerCodeRef=ref(null)
   const containerCode=ref('');
   const containerCode=ref('');
   const scanType=ref(2)
   const scanType=ref(2)
-  const containerList=ref([])
-  const show = async (code,type,selectTask) => {
-    containerList.value = [...new Set(selectTask.flatMap(item => [item.container]))]
+  const props = defineProps({
+    selectTask: Array,
+  });
+  const containerList = computed(() => {
+    return [...new Set(props.selectTask.flatMap(item => [item.container]))]
+  });
+
+  const show = async (code,type) => {
     containerNoTrueFalseBy.value = true
     containerNoTrueFalseBy.value = true
     containerCode.value=code
     containerCode.value=code
     scanType.value=type
     scanType.value=type
@@ -68,9 +73,9 @@ import { showToast } from 'vant'
       }else {
       }else {
         containerCode.value=item
         containerCode.value=item
       }
       }
-      setTimeout(()=>{
-        containerCodeRef.value?.focus()
-      },200)
+      // setTimeout(()=>{
+      //   containerCodeRef.value?.focus()
+      // },200)
 
 
     }
     }
     defineExpose({show})
     defineExpose({show})
@@ -82,16 +87,16 @@ import { showToast } from 'vant'
        font-weight: bold
        font-weight: bold
        border-bottom: 2px solid #0077ff
        border-bottom: 2px solid #0077ff
      .completion
      .completion
-       text-align: left
+       text-align: right
        font-size: 12px
        font-size: 12px
-       padding: 0 0 5px 10px
+       padding: 5px 20px
        cursor: pointer
        cursor: pointer
        text-decoration: underline
        text-decoration: underline
      .container-list
      .container-list
        max-height: 100px
        max-height: 100px
        font-size: 12px
        font-size: 12px
        display: flex
        display: flex
-       padding: 5px 10px
+       padding: 5px 20px
        justify-content: space-between
        justify-content: space-between
        flex-wrap: wrap
        flex-wrap: wrap
        overflow: auto
        overflow: auto

+ 32 - 13
src/views/outbound/picking/list/index.vue

@@ -13,7 +13,7 @@
         <van-icon name="list-switch" size="20"   @click="onClickRight" />
         <van-icon name="list-switch" size="20"   @click="onClickRight" />
       </template>
       </template>
     </van-nav-bar>
     </van-nav-bar>
-    <van-pull-refresh v-model="loading" @refresh="onRefresh" style="min-height: 93.1vh;">
+<!--    <van-pull-refresh v-model="loading" @refresh="onRefresh" style="min-height: 93.1vh;">-->
      <div v-if="locationList.length>0">
      <div v-if="locationList.length>0">
       <div class="code">
       <div class="code">
         <div class="code-title">
         <div class="code-title">
@@ -24,19 +24,20 @@
         <van-field class="code-input"
         <van-field class="code-input"
                    v-model="containerNo"
                    v-model="containerNo"
                    readonly
                    readonly
-                   @click="onContainerNo(containerNo===''?2:scanType,selectTask)"
+                   @click="onContainerNo(containerNo===''?2:scanType)"
                    placeholder="拣货容器号" >
                    placeholder="拣货容器号" >
           <template #button>
           <template #button>
-            <van-button size="mini" type="primary" v-if="containerNo===''" plain  @click="onContainerNo(2,selectTask)" >设置拣货容器</van-button>
-            <van-button size="mini" type="primary" v-else plain  @click="onContainerNo(scanType,selectTask)" >更换拣货容器</van-button>
+            <van-button size="mini" type="primary" v-if="containerNo===''" plain  @click="onContainerNo(2)" >设置拣货容器</van-button>
+            <van-button size="mini" type="primary" v-else plain  @click="onContainerNo(scanType)" >更换拣货容器</van-button>
           </template>
           </template>
         </van-field>
         </van-field>
       </div>
       </div>
       <van-row  class="list">
       <van-row  class="list">
         <van-col span="7">
         <van-col span="7">
           <div class="left">
           <div class="left">
-            <div class="item " :class="index==activeIndex?'active':allPicking(location)"
+            <div class="item"  ref="itemRefs" :class="index==activeIndex?'active':allPicking(location)"
                  v-for="(location,index) in locationList"
                  v-for="(location,index) in locationList"
+                 :key="index"
                  @click="onLocation(index)">
                  @click="onLocation(index)">
               {{ location.location }}
               {{ location.location }}
             </div>
             </div>
@@ -83,7 +84,7 @@
           description="暂无拣货数据"
           description="暂无拣货数据"
         />
         />
       </div>
       </div>
-    </van-pull-refresh>
+<!--    </van-pull-refresh>-->
     <van-action-sheet
     <van-action-sheet
       v-model:show="modeTrueFalseBy"
       v-model:show="modeTrueFalseBy"
       :actions="actions"
       :actions="actions"
@@ -92,15 +93,15 @@
       @select="onSelectMode"
       @select="onSelectMode"
     />
     />
     <!--    拣货容器号-->
     <!--    拣货容器号-->
-    <container-no-input ref="containerNoInputRef" @setContainer="setContainer"  />
+    <container-no-input ref="containerNoInputRef" @setContainer="setContainer" :selectTask="selectTask"  />
     <!--    拣货任务号-->
     <!--    拣货任务号-->
     <picking-no-input  ref="pickingNoInputRef" @loadData="loadData" />
     <picking-no-input  ref="pickingNoInputRef" @loadData="loadData" />
-    <van-floating-bubble v-if="locationList.length>0"  gap="50" axis="xy" magnetic="x"  @click="onContainerNo(containerNo===''?2:scanType,selectTask)">容器</van-floating-bubble>
+    <van-floating-bubble v-if="locationList.length>0"  gap="50" axis="xy" magnetic="x"  @click="onContainerNo(containerNo===''?2:scanType)">容器</van-floating-bubble>
 
 
   </div>
   </div>
 </template>
 </template>
 <script lang="ts" setup>
 <script lang="ts" setup>
-import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue'
+import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
 import { showDialog, showToast } from 'vant'
 import { showDialog, showToast } from 'vant'
 import { fetchPickingData, getPickingTask } from '@/views/outbound/picking/list/hooks/list'
 import { fetchPickingData, getPickingTask } from '@/views/outbound/picking/list/hooks/list'
 import { getOwnerList } from '@/hooks/basic'
 import { getOwnerList } from '@/hooks/basic'
@@ -156,9 +157,9 @@ const scanBarcode=ref('')
 const taskItem=ref([])
 const taskItem=ref([])
 // 切换容器号
 // 切换容器号
 const containerNoInputRef=ref(null)
 const containerNoInputRef=ref(null)
-const onContainerNo=(type,task)=>{
+const onContainerNo=(type)=>{
   setTimeout(()=>{
   setTimeout(()=>{
-    containerNoInputRef.value?.show(containerNo.value,type,task)
+    containerNoInputRef.value?.show(containerNo.value,type)
   },500)
   },500)
 }
 }
 const allQuantity=ref(0)
 const allQuantity=ref(0)
@@ -175,7 +176,11 @@ const loadData =  async (pickingCode) => {
   // 对数组进行分组
   // 对数组进行分组
   taskMap.value = {}
   taskMap.value = {}
   taskItem.value.forEach(item => {
   taskItem.value.forEach(item => {
-    item.count=''
+    if(item.operationTime){
+      item.count=item.quantity
+    }else{
+      item.count=''
+    }
     const { location } = item
     const { location } = item
     // 使用对象的简写形式初始化分组
     // 使用对象的简写形式初始化分组
     if (!taskMap.value[location]) {
     if (!taskMap.value[location]) {
@@ -266,7 +271,21 @@ const onLocation = (index) => {
       onScan(2)
       onScan(2)
     })
     })
 }
 }
-//扫描监听
+const itemRefs = ref([]);
+// 监听 activeIndex 变化,滚动到指定位置
+watch(activeIndex, (newIndex) => {
+  nextTick(() => {
+    const item = itemRefs.value[newIndex];
+    if (item) {
+      item.scrollIntoView({
+        behavior: 'smooth',  // 平滑滚动
+        block: 'start',      // 滚动到顶部 nearest center
+      });
+    }
+  });
+});
+
+//设置扫描类型 1容器、2库位、3条码
 const onScan = (type) => {
 const onScan = (type) => {
   nextTick(() => {
   nextTick(() => {
     scanType.value = type
     scanType.value = type