From 5b62f70d5df5731a571d709f0f9ff312a7cec5dc Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 20 十一月 2025 16:25:59 +0800
Subject: [PATCH] fix: 巡检加上绞合外径可选

---
 src/pages/production/index.vue |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/src/pages/production/index.vue b/src/pages/production/index.vue
index 017062f..73d3f94 100644
--- a/src/pages/production/index.vue
+++ b/src/pages/production/index.vue
@@ -2,7 +2,14 @@
   <view>
     <wd-row>
       <wd-col :span="21">
-        <wd-search placeholder-left hide-cancel></wd-search>
+        <wd-search
+          v-model="searchKeyword"
+          placeholder="璇疯緭鍏�"
+          placeholder-left
+          hide-cancel
+          @search="handleSearch"
+          @clear="handleClear"
+        ></wd-search>
       </wd-col>
       <wd-col :span="3">
         <view class="scan_box" @click="openScan">
@@ -14,16 +21,20 @@
       <wd-tab :title="`寰呯敓浜�(${total.wait})`" class="tab_bg">
         <ProductList
           ref="waitRef"
+          :key="`wait-${searchKey}`"
           :api="ManageApi.getProductList"
           state="寰呭畬鎴�"
+          :search="searchKeyword"
           @ok="changeWait"
         />
       </wd-tab>
       <wd-tab :title="`宸茬敓浜�(${total.already})`" class="tab_bg">
         <ProductList
           ref="alreadyRef"
+          :key="`already-${searchKey}`"
           :api="ManageApi.getProductList"
           state="宸插畬鎴�"
+          :search="searchKeyword"
           @ok="changeAlready"
         />
       </wd-tab>
@@ -50,6 +61,8 @@
 const waitRef = ref();
 const alreadyRef = ref();
 const tab = ref<number>(0);
+const searchKeyword = ref("");
+const searchKey = ref(0);
 const total = reactive({
   wait: 0,
   already: 0,
@@ -61,6 +74,34 @@
 
 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 = () => {
+  searchKeyword.value = "";
+  handleSearch();
 };
 
 const openScan = () => {
@@ -86,6 +127,8 @@
 onMounted(() => {
   // 寮�鍚箍鎾洃鍚簨浠�
   setupScanListener();
+  // 鑾峰彇缁熻鏁版嵁
+  getStatistics();
   console.log("鏄剧ず1");
 });
 onUnmounted(() => {

--
Gitblit v1.9.3