Przeglądaj źródła

托盘/批次历史修复

Hello小健 2 tygodni temu
rodzic
commit
dcc00f5433

+ 21 - 1
src/pages.json

@@ -146,7 +146,27 @@
     {
       "path": "pages/scanLotno/scanLotno",
       "style": {
-        "navigationBarTitleText": "托盘/批次"
+        "navigationBarTitleText": "托盘/批次",
+        "app-plus": {
+          "bounce": "none",
+          "titleNView": {
+            "buttons": [
+              {
+                "fontSize": "16px",
+                "text": "历史"
+              }
+            ],
+            "backButton": {
+              "background": "#00FF00"
+            }
+          }
+        }
+      }
+    },
+    {
+      "path": "pages/scanLotno/logList",
+      "style": {
+        "navigationBarTitleText": "录入历史"
       }
     },
     {

+ 1 - 1
src/pages/printer/logList.vue

@@ -21,7 +21,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue'
+import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 const printLogHistory = ref([] as any)
 const getHistory = () => {

+ 77 - 0
src/pages/scanLotno/logList.vue

@@ -0,0 +1,77 @@
+<template>
+  <view class="history">
+    <view class="item" v-for="(item, i) in scanLotnoHistory" :key="i">
+      <text class="type">{{ item.type }}</text>
+      <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
+        item.orderNum
+      }}</text>
+      <uni-icons
+        v-if="item.status"
+        type="checkmarkempty"
+        class="status"
+        size="16"
+        color="green"
+      ></uni-icons>
+      <text class="status fail" v-else>F</text>
+      <text style="margin-left: 10rpx; font-weight: 300">
+        {{ '\r\n' + item.createTime }}
+      </text>
+    </view>
+    <view v-if="scanLotnoHistory.length === 0" class="is-empty">暂无历史</view>
+  </view>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+const scanLotnoHistory = ref([] as any)
+const getHistory = () => {
+  scanLotnoHistory.value = uni.getStorageSync('scanLotnoHistory')
+}
+onLoad(() => {
+  getHistory()
+})
+</script>
+
+<style lang="scss" scoped>
+.history {
+  display: flex;
+  width: 100%;
+  flex-direction: column;
+  justify-items: start;
+
+  .title {
+    padding: 20rpx;
+    font-size: 24rpx;
+    font-weight: 600;
+  }
+  .type {
+    padding-right: 20rpx;
+    font-size: 24rpx;
+  }
+  .code {
+    font-weight: 600;
+  }
+
+  .item {
+    padding: 20rpx;
+    font-size: 20rpx;
+    color: #666;
+
+    .status {
+      padding-left: 20rpx;
+    }
+
+    .fail {
+      font-weight: 600;
+      color: #f00;
+    }
+  }
+
+  .is-empty {
+    text-align: center;
+    margin: 40px 0;
+    color: #999;
+  }
+}
+</style>

+ 28 - 28
src/pages/scanLotno/scanLotno.vue

@@ -66,11 +66,11 @@
         提交
       </button>
     </view>
-    <view v-if="lotnoLogHistory.length > 0" class="history">
+    <view v-if="scanLotnoHistory.length > 0" class="history">
       <text class="title">记录(最近5条)</text>
     </view>
     <view class="history">
-      <view class="item" v-for="(item, i) in lotnoLogHistory.slice(0, 5)" :key="i">
+      <view class="item" v-for="(item, i) in scanLotnoHistory.slice(0, 5)" :key="i">
         <text class="type">{{ item.type }}</text>
         <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
           item.orderNum
@@ -118,7 +118,7 @@ const hidePage = ref(false)
 const focusType = ref(true)
 const editBatchNum = ref(false)
 const editPalletNum = ref(false)
-const lotnoLogHistory = ref([] as any)
+const scanLotnoHistory = ref([] as any)
 const messageRef = ref()
 const messageType = ref()
 const messageText = ref()
@@ -157,7 +157,7 @@ const scanInput = async () => {
   uni.scanCode({
     success: (res: any) => {
       valiFormData.value.orderNum = res.result
-      // onsubmit();
+      onsubmit()
     },
     fail: (err) => {
       // 需要注意的是小程序扫码不需要申请相机权限
@@ -291,29 +291,29 @@ const onsubmit = async () => {
       // 	window.open(path, '_blank');
       // });
     }
-    // const historyItem = {
-    //   orderNum: valiFormData.value.orderNum,
-    //   createTime: new Date(),
-    //   type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
-    //   status: true,
-    // }
-    // console.log('lotnoLogHistory--', lotnoLogHistory)
-    // lotnoLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('lotnoLogHistory', lotnoLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      orderNum: valiFormData.value.orderNum,
+      createTime: new Date(),
+      type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
+      status: true,
+    }
+    console.log('scanLotnoHistory--', scanLotnoHistory)
+    scanLotnoHistory.value.unshift(historyItem)
+    uni.setStorageSync('scanLotnoHistory', scanLotnoHistory.value)
+    getHistory()
   } else {
     messageType.value = 'error'
     messageText.value = res.msg
     messageRef.value.open()
-    // const historyItem = {
-    //   orderNum: valiFormData.value.orderNum,
-    //   createTime: new Date(),
-    //   type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
-    //   status: false,
-    // }
-    // lotnoLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('lotnoLogHistory', lotnoLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      orderNum: valiFormData.value.orderNum,
+      createTime: new Date(),
+      type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
+      status: false,
+    }
+    scanLotnoHistory.value.unshift(historyItem)
+    uni.setStorageSync('scanLotnoHistory', scanLotnoHistory.value)
+    getHistory()
   }
   st = setTimeout(() => {
     reset()
@@ -322,9 +322,9 @@ const onsubmit = async () => {
   }, 1000)
 }
 
-// const getHistory = () => {
-//   lotnoLogHistory.value = uni.getStorageSync('lotnoLogHistory') || []
-// }
+const getHistory = () => {
+  scanLotnoHistory.value = uni.getStorageSync('scanLotnoHistory') || []
+}
 const keypress = (e: any) => {
   // 102  左侧    103  右侧   104  中间按键
   if (e.keyCode === 102 || e.keyCode === 103 || e.keyCode === 104) {
@@ -377,7 +377,7 @@ onBackPress(() => {
 onShow(() => {
   hidePage.value = false
   _getBindParams()
-  // getHistory()
+  getHistory()
 })
 const setFocus = () => {
   if (hidePage.value) {
@@ -418,7 +418,7 @@ const _getBindParams = async () => {
 onNavigationBarButtonTap((event) => {
   if (event.index === 0) {
     uni.navigateTo({
-      url: '/pages/scanLotno/lotnoLog',
+      url: '/pages/scanLotno/logList',
     })
   }
 })

+ 1 - 1
src/pages/warehouseScan/logList.vue

@@ -22,7 +22,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue'
+import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 const warehouseLogHistory = ref([] as any)
 const getHistory = () => {

+ 1 - 1
src/pages/weigh/logList.vue

@@ -24,7 +24,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue'
+import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 const instockHistory = ref([] as any[])
 const getHistory = () => {