From aca7aa9ce32acc4c8795342f945b027d3bc9f62a Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期二, 10 六月 2025 17:37:34 +0800
Subject: [PATCH] feat: 添加时效报工,修复扫码内存泄漏

---
 src/pages/production/list/index.vue |   43 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/src/pages/production/list/index.vue b/src/pages/production/list/index.vue
index 7d6c9ac..92862f8 100644
--- a/src/pages/production/list/index.vue
+++ b/src/pages/production/list/index.vue
@@ -13,16 +13,12 @@
       <ProductCard
         v-for="(item, index) in list"
         :key="index"
-        :data="{
-          deviceModel: item.deviceModel,
-          model: item.model,
-          totalAmount: item.totalLength,
-          amount: item.length,
-          unAmount: item.unLength,
-        }"
+        :data="item"
+        :map="map"
         @click="toDetail(item.id, item.type)"
       />
     </z-paging>
+    <wd-toast />
   </view>
 </template>
 
@@ -31,9 +27,20 @@
 import ProductCard from "@/components/product_card/index.vue";
 import { useUserStore } from "@/store/modules/user";
 import zPaging from "@/components/z-paging/z-paging.vue";
+import { useToast } from "wot-design-uni";
+
+const toast = useToast();
 const userStore = useUserStore();
 const userInfo: any = computed(() => userStore.userInfo);
 const pagingRef = ref();
+const map = reactive({
+  deviceModel: "deviceModel",
+  model: "model",
+  totalAmount: "totalAmount",
+  amount: "amount",
+  unAmount: "unAmount",
+  unit: "unit",
+});
 const props = defineProps({
   api: {
     type: Function,
@@ -49,6 +56,7 @@
 const list = ref<any[]>([]);
 
 const toDetail = (id: number, type: string) => {
+  toast.show("鐐瑰嚮鍗$墖");
   if (type == "鎷変笣") {
     uni.navigateTo({
       url: `/pages/production/detail/wireDetail?id=${id}`,
@@ -68,18 +76,31 @@
     size: pageSize,
   });
   if (code == 200) {
-    if (data.total == 0) {
+    if (data.type == "缁炵嚎") {
+      map.deviceModel = "deviceModel";
+      map.model = "model";
+      map.totalAmount = "totalLength";
+      map.amount = "length";
+      map.unAmount = "unLength";
+    } else if (data.type == "鎷変笣") {
+      map.deviceModel = "deviceModel";
+      map.model = "model";
+      map.totalAmount = "totalAmount";
+      map.amount = "amount";
+      map.unAmount = "unAmount";
+    }
+    if (data.data.total == 0) {
       pagingRef.value.complete(true);
     } else {
-      pagingRef.value.complete(data.records);
+      pagingRef.value.complete(data.data.records);
     }
-    emits("ok", data.total);
+    emits("ok", data.data.total);
   }
 };
 </script>
 
 <style lang="scss" scoped>
 .card_box {
-  height: calc(100vh - 140px);
+  height: calc(100vh - 120px);
 }
 </style>

--
Gitblit v1.9.3