From eacbd6d2f0a4fb7820fcf856f9cc025bea1ea39a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 29 十月 2026 09:27:04 +0800
Subject: [PATCH] fix: 原型编制

---
 src/pages/timely/detail.vue |  144 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 2 deletions(-)

diff --git a/src/pages/timely/detail.vue b/src/pages/timely/detail.vue
index 84b6beb..79f3016 100644
--- a/src/pages/timely/detail.vue
+++ b/src/pages/timely/detail.vue
@@ -39,7 +39,11 @@
           </view>
           <view>
             <text class="label">宸查鐢�</text>
-            {{ items.length }} 浠�
+            <!-- 浠舵暟鍙偣鍑伙細灞曞紑棰嗙敤缁熻锛堜骇鍝佸ぇ绫� / 瑙勬牸鍨嬪彿 / 鏁伴噺锛� -->
+            <view class="count-link" @click="openRequisitionStats">
+              <text class="count-link-text">{{ items.length }} 浠�</text>
+              <text class="count-link-arrow">鈻�</text>
+            </view>
           </view>
           <view>
             <text class="label">娓╁害</text>
@@ -169,6 +173,52 @@
         </wd-card>
       </view>
     </scroll-view>
+
+    <wd-popup
+      v-model="statsPopupVisible"
+      position="bottom"
+      :z-index="31"
+      :close-on-click-modal="true"
+      custom-style="max-height: 60vh; border-radius: 24rpx 24rpx 0 0;"
+    >
+      <view class="popup-layout">
+        <view class="popup-header">
+          <view>
+            <text class="popup-title">棰嗙敤缁熻</text>
+            <text class="popup-subtitle">浜у搧澶х被 / 瑙勬牸鍨嬪彿 / 鏁伴噺</text>
+          </view>
+          <wd-icon name="close" size="20px" @click="statsPopupVisible = false" />
+        </view>
+
+        <scroll-view class="stats-list" scroll-y>
+          <view v-if="statsLoading" class="state-box">
+            <wd-loading />
+            <text>缁熻涓�...</text>
+          </view>
+          <wd-status-tip v-else-if="!statsRows.length" image="content" tip="鏆傛棤棰嗙敤鏁版嵁" />
+          <block v-else>
+            <view
+              v-for="(row, index) in statsRows"
+              :key="`${row.categoryName}-${row.model}-${index}`"
+              class="stats-item"
+            >
+              <view class="stats-item-main">
+                <text class="stats-category">{{ row.categoryName || "-" }}</text>
+                <text class="stats-model">{{ row.model || "-" }}</text>
+              </view>
+              <text class="stats-count">{{ row.count }} 浠�</text>
+            </view>
+          </block>
+        </scroll-view>
+
+        <view class="popup-footer">
+          <text>鍚堣 {{ statsTotal }} 浠�</text>
+          <wd-button custom-class="footer-action-button" @click="statsPopupVisible = false">
+            鍏抽棴
+          </wd-button>
+        </view>
+      </view>
+    </wd-popup>
 
     <wd-popup
       v-model="rackSelectorVisible"
@@ -365,7 +415,10 @@
 import type { TagType } from "wot-design-uni/components/wd-tag/types";
 import CardTitle from "@/components/card-title/index.vue";
 import Scan from "@/components/scan/index.vue";
-import TimeSensitiveTaskApi, { type TimelinessMaterialType } from "@/api/timeSensitiveTask";
+import TimeSensitiveTaskApi, {
+  type RequisitionStatVO,
+  type TimelinessMaterialType,
+} from "@/api/timeSensitiveTask";
 
 const toast = useToast();
 const message = useMessage();
@@ -390,6 +443,33 @@
 const selectedRackNos = ref<string[]>([]);
 const rackSelectorVisible = ref(false);
 const rackSelectionRows = ref<Array<{ label: string; value: string; selected: boolean }>>([]);
+
+/* ==================== 棰嗙敤缁熻 ==================== */
+const statsPopupVisible = ref(false);
+const statsLoading = ref(false);
+const statsRows = ref<RequisitionStatVO[]>([]);
+const statsTotal = computed(() =>
+  statsRows.value.reduce((sum, item) => sum + Number(item.count || 0), 0)
+);
+
+/** 鐐瑰嚮銆屽凡棰嗙敤 N 浠躲�嶏細璇锋眰棰嗙敤缁熻骞跺脊鍑� */
+const openRequisitionStats = async () => {
+  statsRows.value = [];
+  statsPopupVisible.value = true;
+  statsLoading.value = true;
+  try {
+    const { code, data } = await TimeSensitiveTaskApi.getRequisitionStats(
+      taskId.value,
+      materialType.value
+    );
+    statsRows.value = code === 200 ? data || [] : [];
+  } catch (error) {
+    statsRows.value = [];
+    toast.error("棰嗙敤缁熻鏌ヨ澶辫触");
+  } finally {
+    statsLoading.value = false;
+  }
+};
 const activeRackNo = ref("");
 const candidateRackNo = ref("");
 const pendingScanEvent = ref<any>(null);
@@ -1157,6 +1237,66 @@
   color: #7e8987;
 }
 
+/* 宸查鐢ㄤ欢鏁帮細鍙偣鍑伙紝灞曞紑棰嗙敤缁熻 */
+.count-link {
+  display: flex;
+  gap: 2px;
+  align-items: center;
+}
+
+.count-link-text {
+  color: #0d867f;
+  border-bottom: 1px solid rgba(13, 134, 127, 0.4);
+}
+
+.count-link-arrow {
+  font-size: 12px;
+  color: #0d867f;
+}
+
+/* 棰嗙敤缁熻寮规 */
+.stats-list {
+  max-height: 40vh;
+  padding: 4px 0;
+}
+
+.stats-item {
+  display: flex;
+  gap: 12px;
+  align-items: center;
+  justify-content: space-between;
+  padding: 14px 16px;
+  border-bottom: 1px solid #f2f4f3;
+}
+
+.stats-item-main {
+  display: flex;
+  flex: 1;
+  flex-direction: column;
+  gap: 4px;
+  min-width: 0;
+}
+
+.stats-category {
+  font-size: 15px;
+  font-weight: 500;
+  color: #252525;
+  overflow-wrap: anywhere;
+}
+
+.stats-model {
+  font-size: 13px;
+  color: #7e8987;
+  overflow-wrap: anywhere;
+}
+
+.stats-count {
+  flex-shrink: 0;
+  font-size: 16px;
+  font-weight: 600;
+  color: #0d867f;
+}
+
 .scan-tip {
   display: flex;
   gap: 8px;

--
Gitblit v1.9.3