From 4a407279f0c9757f0714eaf385fdd5cd68c038c2 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 21 五月 2026 16:55:43 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' of http://114.132.189.42:9002/r/product-inventory-management into dev_NEW_pro

---
 src/views/index.vue |   54 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/src/views/index.vue b/src/views/index.vue
index 3176042..0d71970 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -114,6 +114,7 @@
             <div class="panel-title">鐢熶骇璁㈠崟杩涘害</div>
             <el-radio-group v-model="orderFilter" size="small">
               <el-radio-button label="all">鍏ㄩ儴({{ orderProgressMeta.total }})</el-radio-button>
+              <el-radio-button label="waiting">寰呭紑濮�({{ orderProgressMeta.waitingCount }})</el-radio-button>
               <el-radio-button label="inProgress">杩涜涓�({{ orderProgressMeta.inProgressCount }})</el-radio-button>
               <el-radio-button label="completed">宸插畬鎴�({{ orderProgressMeta.completedCount }})</el-radio-button>
               <el-radio-button label="paused">宸叉殏鍋�({{ orderProgressMeta.pausedCount }})</el-radio-button>
@@ -454,10 +455,13 @@
 });
 
 const orderProgressMeta = ref({
+  status: "all",
   tab: "all",
+  bizDate: null,
   total: 0,
   pageNum: 1,
   pageSize: 10,
+  waitingCount: 0,
   inProgressCount: 0,
   completedCount: 0,
   pausedCount: 0,
@@ -832,8 +836,36 @@
 
 const productionOrders = ref([]);
 
+const orderFilterOptions = ["all", "waiting", "inProgress", "completed", "paused"];
+const orderFilterAliasMap = {
+  1: "waiting",
+  2: "inProgress",
+  3: "completed",
+  4: "paused",
+};
 const orderFilter = ref("all");
 const filteredOrders = computed(() => productionOrders.value);
+
+const normalizeOrderFilter = (value, fallback = "all") => {
+  const safeFallback = orderFilterOptions.includes(fallback) ? fallback : "all";
+  const text = String(value ?? "").trim();
+  if (orderFilterAliasMap[text]) {
+    return orderFilterAliasMap[text];
+  }
+  return orderFilterOptions.includes(text) ? text : safeFallback;
+};
+
+const parseCount = (value) => {
+  if (value === null || value === undefined || value === "") return null;
+  const num = Number(value);
+  return Number.isFinite(num) ? num : null;
+};
+
+const resolveProgressCount = (rawValue, currentStatus, targetStatus, total) => {
+  const count = parseCount(rawValue);
+  if (count !== null) return count;
+  return currentStatus === targetStatus ? total : 0;
+};
 
 const getCompareTrend = (value) => {
   const num = Number(value || 0);
@@ -1198,27 +1230,36 @@
 const refreshProductionOrderProgress = async () => {
   try {
     const res = await productionOrderProgress({
+      status: orderFilter.value,
       tab: orderFilter.value,
       pageNum: 1,
       pageSize: 10,
     });
     const data = res?.data || {};
+    const statusValue = normalizeOrderFilter(data.status, orderFilter.value);
+    const total = Number(data.total || 0);
     orderProgressMeta.value = {
+      status: statusValue,
       tab: data.tab || orderFilter.value,
-      total: Number(data.total || 0),
+      bizDate: data.bizDate || null,
+      total,
       pageNum: Number(data.pageNum || 1),
       pageSize: Number(data.pageSize || 10),
-      inProgressCount: Number(data.inProgressCount || 0),
-      completedCount: Number(data.completedCount || 0),
-      pausedCount: Number(data.pausedCount || 0),
+      waitingCount: resolveProgressCount(data.waitingCount, statusValue, "waiting", total),
+      inProgressCount: resolveProgressCount(data.inProgressCount, statusValue, "inProgress", total),
+      completedCount: resolveProgressCount(data.completedCount, statusValue, "completed", total),
+      pausedCount: resolveProgressCount(data.pausedCount, statusValue, "paused", total),
     };
     productionOrders.value = (data.records || []).map(mapOrderProgressRecord);
   } catch {
     orderProgressMeta.value = {
+      status: orderFilter.value,
       tab: orderFilter.value,
+      bizDate: null,
       total: 0,
       pageNum: 1,
       pageSize: 10,
+      waitingCount: 0,
       inProgressCount: 0,
       completedCount: 0,
       pausedCount: 0,
@@ -1229,7 +1270,10 @@
 
 const refreshTodayProductionPlan = async () => {
   try {
-    const res = await todayProductionPlan({ limit: 4 });
+    const res = await todayProductionPlan({
+      limit: 4,
+      planDate: nowDate.value,
+    });
     const data = res?.data || {};
     todayPlanTotal.value = Number(data.total || 0);
     todayPlanList.value = (data.records || []).map(mapTodayPlanRecord);

--
Gitblit v1.9.3