From 8cc901ed214f3885b34a07d0520fbcfd50063439 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 十一月 2025 14:30:39 +0800
Subject: [PATCH] fix: 完成绞线自检,生产确认等功能新增

---
 src/pages/production/index.vue |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/src/pages/production/index.vue b/src/pages/production/index.vue
index 1fbe803..73d3f94 100644
--- a/src/pages/production/index.vue
+++ b/src/pages/production/index.vue
@@ -4,7 +4,7 @@
       <wd-col :span="21">
         <wd-search
           v-model="searchKeyword"
-          placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
+          placeholder="璇疯緭鍏�"
           placeholder-left
           hide-cancel
           @search="handleSearch"
@@ -24,18 +24,8 @@
           :key="`wait-${searchKey}`"
           :api="ManageApi.getProductList"
           state="寰呭畬鎴�"
-          :model="searchKeyword"
+          :search="searchKeyword"
           @ok="changeWait"
-        />
-      </wd-tab>
-      <wd-tab :title="`閮ㄥ垎瀹屾垚(${total.partial})`" class="tab_bg">
-        <ProductList
-          ref="partialRef"
-          :key="`partial-${searchKey}`"
-          :api="ManageApi.getProductList"
-          state="閮ㄥ垎瀹屾垚"
-          :model="searchKeyword"
-          @ok="changePartial"
         />
       </wd-tab>
       <wd-tab :title="`宸茬敓浜�(${total.already})`" class="tab_bg">
@@ -44,7 +34,7 @@
           :key="`already-${searchKey}`"
           :api="ManageApi.getProductList"
           state="宸插畬鎴�"
-          :model="searchKeyword"
+          :search="searchKeyword"
           @ok="changeAlready"
         />
       </wd-tab>
@@ -69,14 +59,12 @@
 const toast = useToast();
 
 const waitRef = ref();
-const partialRef = ref();
 const alreadyRef = ref();
 const tab = ref<number>(0);
 const searchKeyword = ref("");
 const searchKey = ref(0);
 const total = reactive({
   wait: 0,
-  partial: 0,
   already: 0,
 });
 
@@ -84,16 +72,31 @@
   total.wait = num;
 };
 
-const changePartial = (num: number) => {
-  total.partial = num;
-};
-
 const changeAlready = (num: number) => {
   total.already = num;
 };
 
+// 鑾峰彇缁熻鏁版嵁
+const getStatistics = async () => {
+  try {
+    const params: any = {};
+    if (searchKeyword.value) {
+      params.search = searchKeyword.value;
+    }
+    const { code, data } = await ManageApi.getProductStatistics(params);
+    if (code === 200 && data) {
+      total.wait = data["寰呭畬鎴�"] || 0;
+      total.already = data["宸插畬鎴�"] || 0;
+    }
+  } catch (error) {
+    console.error("鑾峰彇缁熻鏁版嵁澶辫触:", error);
+  }
+};
+
 const handleSearch = () => {
   searchKey.value++;
+  // 鎼滅储鏃舵洿鏂扮粺璁℃暟鎹�
+  getStatistics();
 };
 
 const handleClear = () => {
@@ -124,6 +127,8 @@
 onMounted(() => {
   // 寮�鍚箍鎾洃鍚簨浠�
   setupScanListener();
+  // 鑾峰彇缁熻鏁版嵁
+  getStatistics();
   console.log("鏄剧ず1");
 });
 onUnmounted(() => {

--
Gitblit v1.9.3