From 03a05815d7ea5612206b6cfe5d6537b4d4cedc0a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 九月 2026 11:41:32 +0800
Subject: [PATCH] 天津潜宇塑胶app 1.添加采购需求、库存盘点、计件单价配置、产量统计、材料消耗核算、成本核算分析页面

---
 src/pages/productionManagement/productionReporting/ledger.vue |   74 +++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/src/pages/productionManagement/productionReporting/ledger.vue b/src/pages/productionManagement/productionReporting/ledger.vue
index fb5d1dd..98d0250 100644
--- a/src/pages/productionManagement/productionReporting/ledger.vue
+++ b/src/pages/productionManagement/productionReporting/ledger.vue
@@ -19,6 +19,14 @@
                    color="#999"></up-icon>
         </view>
       </view>
+      <!-- 璁惧绛涢�� -->
+      <view class="device-filter"
+            @click="openDeviceFilter">
+        <text :class="{ placeholder: !searchForm.deviceName }">{{ searchForm.deviceName || "鍏ㄩ儴璁惧" }}</text>
+        <up-icon name="arrow-down"
+                 size="14"
+                 color="#999"></up-icon>
+      </view>
     </view>
     <!-- 鍒楄〃鍖哄煙 -->
     <scroll-view scroll-y
@@ -47,6 +55,10 @@
               <view class="detail-row">
                 <text class="detail-label">鎶ュ伐浜哄憳</text>
                 <text class="detail-value highlight">{{ item.nickName || '-' }}</text>
+              </view>
+              <view class="detail-row">
+                <text class="detail-label">浣跨敤璁惧</text>
+                <text class="detail-value">{{ item.deviceName || "-" }}</text>
               </view>
               <view class="detail-row">
                 <text class="detail-label">宸ユ椂(h)</text>
@@ -169,6 +181,12 @@
                   text="鏆傛棤鍙傛暟鏁版嵁" />
       </view>
     </up-modal>
+    <!-- 璁惧绛涢�� -->
+    <up-action-sheet :show="showDeviceSheet"
+                     :actions="deviceOptions"
+                     title="閫夋嫨璁惧"
+                     @select="selectDevice"
+                     @close="showDeviceSheet = false" />
   </view>
 </template>
 
@@ -181,6 +199,7 @@
     productionProductInputListPage,
   } from "@/api/productionManagement/productionProductMain.js";
   import PageHeader from "@/components/PageHeader.vue";
+  import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
   import modal from "@/plugins/modal";
 
   const tableData = ref([]);
@@ -195,7 +214,44 @@
 
   const searchForm = reactive({
     keyword: "",
+    deviceId: "",
+    deviceName: "",
   });
+
+  // 璁惧绛涢��
+  const showDeviceSheet = ref(false);
+  const deviceOptions = ref([
+    { name: "鍏ㄩ儴璁惧", value: "" },
+  ]);
+
+  const loadDevices = async () => {
+    if (deviceOptions.value.length > 1) return;
+    try {
+      const { data } = await getDeviceLedger();
+      const rows = Array.isArray(data) ? data : data?.records || [];
+      deviceOptions.value = [
+        { name: "鍏ㄩ儴璁惧", value: "" },
+        ...rows.map(item => ({
+          name: item.deviceName || item.name || "-",
+          value: item.id,
+        })),
+      ];
+    } catch (error) {
+      console.error("鍔犺浇璁惧鍒楄〃澶辫触:", error);
+    }
+  };
+
+  const openDeviceFilter = () => {
+    loadDevices();
+    showDeviceSheet.value = true;
+  };
+
+  const selectDevice = e => {
+    searchForm.deviceId = e.value;
+    searchForm.deviceName = e.value ? e.name : "";
+    showDeviceSheet.value = false;
+    handleQuery();
+  };
 
   // 鎶曞叆璇︽儏鐩稿叧
   const inputVisible = ref(false);
@@ -233,6 +289,7 @@
       current: page.current,
       size: page.size,
       workOrderNo: searchForm.keyword,
+      deviceId: searchForm.deviceId || undefined,
     };
 
     productionProductMainListPage(params)
@@ -321,6 +378,23 @@
     height: 0;
   }
 
+  .device-filter {
+    margin-top: 12px;
+    height: 40px;
+    background: #f5f5f5;
+    border-radius: 8px;
+    padding: 0 12px;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    font-size: 14px;
+    color: #333;
+
+    .placeholder {
+      color: #999;
+    }
+  }
+
   .ledger-item {
     .item-header {
       .item-tag {

--
Gitblit v1.9.3