From 37c5e71e2ad11f6b0f047d6843cd1983c9deccea Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 23 三月 2026 16:59:20 +0800
Subject: [PATCH] 修改报工提交字段

---
 src/views/productionManagement/productionOrder/Detail/index.vue |  176 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 130 insertions(+), 46 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/Detail/index.vue b/src/views/productionManagement/productionOrder/Detail/index.vue
index 7b7c2e2..14d11d2 100644
--- a/src/views/productionManagement/productionOrder/Detail/index.vue
+++ b/src/views/productionManagement/productionOrder/Detail/index.vue
@@ -50,7 +50,13 @@
                     }"
                     @click="selectProcess(idx)"
                   >
-                    <span v-if="idx === active" class="step-current-badge">鐢熶骇涓�</span>
+                    <span
+                      v-if="p?.status"
+                      class="step-status-badge"
+                      :class="`step-status-badge-${p.status}`"
+                    >
+                      {{ statusTagText(p.status) }}
+                    </span>
                     <div v-if="p.status !== 'wait'" class="current-progress">
                       <div class="current-progress-head">
                         <span class="current-progress-title">宸ュ簭杩涘害</span>
@@ -114,13 +120,13 @@
             <div v-else class="right-content">
               <el-table :data="reports" border height="420" v-loading="reportLoading">
                 <el-table-column label="搴忓彿" type="index" width="60" align="center" />
-                <el-table-column label="鎶ュ伐鍗曞彿" prop="reportNo" min-width="140" show-overflow-tooltip />
-                <el-table-column label="鎶ュ伐浜哄憳" prop="reportUser" min-width="120" show-overflow-tooltip />
-                <el-table-column label="鎶ュ伐鏃堕棿" prop="reportTime" min-width="160" show-overflow-tooltip />
-                <el-table-column label="浜у嚭鏁伴噺" prop="outputQty" min-width="110" />
+                <el-table-column label="鎶ュ伐鍗曞彿" prop="productNo" min-width="140" show-overflow-tooltip />
+                <el-table-column label="鎶ュ伐浜哄憳" prop="nickName" min-width="120" show-overflow-tooltip />
+                <el-table-column label="鎶ュ伐鏃堕棿" prop="createTime" min-width="160" show-overflow-tooltip />
+                <el-table-column label="浜у嚭鏁伴噺" prop="quantity" min-width="110" />
                 <el-table-column label="鍚堟牸鏁伴噺" prop="qualifiedQty" min-width="110" />
-                <el-table-column label="涓嶈壇鏁伴噺" prop="badQty" min-width="110" />
-                <el-table-column label="涓嶅悎鏍煎鐞�" prop="remark" min-width="160" show-overflow-tooltip />
+                <el-table-column label="涓嶈壇鏁伴噺" prop="scrapQty" min-width="110" />
+                <el-table-column label="涓嶅悎鏍煎鐞�" prop="dealResult" min-width="160" show-overflow-tooltip />
                 <el-table-column label="鎿嶄綔" width="150" fixed="right">
                   <template #default="{ row }">
                     <el-button type="primary" link @click="viewReportRecord(row)">
@@ -134,21 +140,45 @@
         </div>
       </div>
     </el-card>
-    <el-dialog
-      v-model="reportRecordDialogVisible"
-      title="鎶ュ伐鐢熶骇璁板綍"
-      width="680px"
-      destroy-on-close
-    >
-      <div class="report-record-placeholder">
-        <div>鎶ュ伐鍗曞彿锛歿{ currentReportRow?.reportNo || "-" }}</div>
-        <div>宸ュ簭锛歿{ selectedProcess?.processName || "-" }}</div>
-        <div class="placeholder-tip">寮规鍐呭寰呭畾锛堝悗缁ˉ鍏呰缁嗙敓浜ц褰曪級銆�</div>
-      </div>
-      <template #footer>
-        <el-button @click="reportRecordDialogVisible = false">鍏抽棴</el-button>
-      </template>
-    </el-dialog>
+<!--    <el-dialog-->
+<!--      v-model="reportRecordDialogVisible"-->
+<!--      title="鎶ュ伐鐢熶骇璁板綍"-->
+<!--      width="680px"-->
+<!--      destroy-on-close-->
+<!--    >-->
+<!--      <div class="report-record-placeholder">-->
+<!--        <div>鎶ュ伐鍗曞彿锛歿{ currentReportRow?.reportNo || "-" }}</div>-->
+<!--        <div>宸ュ簭锛歿{ selectedProcess?.processName || "-" }}</div>-->
+<!--        <div class="placeholder-tip">寮规鍐呭寰呭畾锛堝悗缁ˉ鍏呰缁嗙敓浜ц褰曪級銆�</div>-->
+<!--      </div>-->
+<!--      <template #footer>-->
+<!--        <el-button @click="reportRecordDialogVisible = false">鍏抽棴</el-button>-->
+<!--      </template>-->
+<!--    </el-dialog>-->
+
+    <CopperPrintingForm
+        v-if="copperPrintingFormVisible"
+        v-model:isShow="copperPrintingFormVisible"
+        :isEdit="false"
+        :row="currentReportRow"
+        @refreshData="fetchReportsForProcess(selectedProcess.value)"/>
+    <VoltageSortingForm
+        v-if="voltageSortingFormVisible"
+        v-model:isShow="voltageSortingFormVisible"
+        :isEdit="false"
+        :row="currentReportRow"
+        @refreshData="fetchReportsForProcess(selectedProcess.value)"/>
+    <GranulationForm
+        v-if="granulationFormVisible"
+        v-model:isShow="granulationFormVisible"
+        :isEdit="false"
+        :row="currentReportRow"
+        @refreshData="fetchReportsForProcess(selectedProcess.value)"/>
+    <Detail
+        v-if="reportRecordDialogVisible"
+        v-model:isShow="reportRecordDialogVisible"
+        @refreshData="fetchReportsForProcess(selectedProcess.value)"
+        :row="currentReportRow"/>
   </div>
 </template>
 
@@ -157,7 +187,10 @@
 import { useRoute } from "vue-router";
 import { getByProductOrderId } from "@/api/productionManagement/workOrder.js";
 import { getByProductWorkOrderId } from "@/api/productionManagement/productionProductMain.js";
-
+const VoltageSortingForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/VoltageSortingForm.vue"));
+const CopperPrintingForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/CopperPrintingForm.vue"));
+const GranulationForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/GranulationForm.vue"));
+const Detail = defineAsyncComponent(() => import("@/views/productionManagement/productionReporting/components/Detail.vue"));
 const route = useRoute();
 
 const header = computed(() => ({
@@ -171,16 +204,19 @@
 // 宸ュ簭鏁版嵁锛堟帴鍙f浛鎹級
 const processes = ref([]);
 
+const copperPrintingFormVisible = ref(false);
+const voltageSortingFormVisible = ref(false);
+const granulationFormVisible = ref(false);
+
 const normalizeStatus = (statusText, completionStatus, inputQty, outputQty) => {
   const s = statusText === null || statusText === undefined ? "" : String(statusText).trim();
-  const lower = s.toLowerCase();
 
-  // 甯歌涓枃鐘舵�佸厹搴曪細杩涜涓�/宸插畬鎴�/绛夊緟
-  if (s.includes("杩涜") || lower.includes("process") || lower.includes("doing") || lower.includes("running")) return "process";
-  if (s.includes("瀹屾垚") || s.includes("宸插畬") || lower.includes("success") || lower.includes("done") || lower.includes("completed")) return "success";
-  if (s.includes("寰�") || s.includes("鏈紑濮�") || lower.includes("wait") || lower.includes("pending") || lower.includes("not_start")) return "wait";
+  // 鎸夋帴鍙e疄闄呬笁绉嶇姸鎬侊細宸茬敓鎴� / 鐢熶骇涓� / 寰呯敓浜�
+  if (s.includes("鐢熶骇涓�")) return "process";
+  if (s.includes("寰呯敓浜�")) return "wait";
+  if (s.includes("宸茬敓浜�")) return "success";
 
-  // 鐢� completionStatus 鍋氬厹搴曪紙涓�鑸负 0~100锛�
+  // 鍏滃簳锛氫粛鎸� completionStatus 鍋� 0~100 鍒ゆ柇
   const cs = Number(completionStatus);
   if (Number.isFinite(cs)) {
     if (cs >= 100) return "success";
@@ -188,7 +224,7 @@
     return "wait";
   }
 
-  // 鏈�鍚庡啀鐢ㄦ暟閲忓厹搴�
+  // 鍐嶅厹搴曪細鐢ㄦ暟閲忓垽鏂�
   if (Number.isFinite(inputQty) && inputQty > 0 && Number.isFinite(outputQty) && outputQty >= inputQty) return "success";
   if (Number.isFinite(outputQty) && outputQty > 0) return "process";
   return "wait";
@@ -266,19 +302,11 @@
 const reportLoading = ref(false);
 
 const normalizeReport = (item) => {
-  // 鎶ュ伐璁板綍锛歱roductNo/userName/createTime/quantity/qualifiedQty/scrapQty
-  const outputQty = Number(item?.quantity ?? item?.outputQty ?? 0);
-  const qualifiedQty = Number(item?.qualifiedQty ?? item?.completeQty ?? item?.goodQty ?? 0);
-  const badQty = Number(item?.scrapQty ?? item?.badQty ?? 0);
-
   return {
-    reportNo: item?.productNo ?? item?.reportNo ?? item?.productionReportNo ?? item?.id ?? "",
-    reportUser: item?.userName ?? item?.reportUser ?? item?.createdByName ?? item?.reportUserName ?? "",
-    reportTime: item?.createTime ?? item?.reportTime ?? item?.createdAt ?? item?.reportDate ?? "",
-    outputQty: Number.isFinite(outputQty) ? outputQty : 0,
-    qualifiedQty: Math.max(0, Number.isFinite(qualifiedQty) ? qualifiedQty : 0),
-    badQty: Number.isFinite(badQty) ? Math.max(0, badQty) : 0,
-    remark: item?.remark ?? item?.remarkText ?? item?.description ?? "",
+    ...item,
+    quantity:  Math.max(0, Number.isFinite(item.quantity) ? item.quantity : 0),
+    scrapQty:  Math.max(0, Number.isFinite(item.scrapQty) ? item.scrapQty : 0),
+    qualifiedQty:  Math.max(0, Number.isFinite(item.qualifiedQty) ? item.qualifiedQty : 0),
   };
 };
 
@@ -318,9 +346,17 @@
 );
 
 const viewReportRecord = (row) => {
-  if (!row?.reportNo) return;
+  if (!row?.productNo) return;
   currentReportRow.value = row;
-  reportRecordDialogVisible.value = true;
+  if (row.process ==='鍗伴摐' || row.process ==='鍗伴摱') {
+    copperPrintingFormVisible.value = true;
+  } else if (row.process === '鐢靛帇鍒嗛��') {
+    voltageSortingFormVisible.value = true;
+  } else if (row.process === '閫犵矑') {
+    granulationFormVisible.value = true;
+  } else {
+    reportRecordDialogVisible.value = true;
+  }
 };
 
 const reportRecordDialogVisible = ref(false);
@@ -334,11 +370,26 @@
   return Math.round(n);
 };
 
+const statusTagText = (status) => {
+  if (status === "success") return "宸茬敓浜�";
+  if (status === "process") return "鐢熶骇涓�";
+  if (status === "wait") return "寰呯敓浜�";
+  return String(status ?? "");
+};
+
 // el-steps: active 涓哄綋鍓嶈繘琛屼腑鐨勬楠や笅鏍囷紙妯℃嫙锛�
 const active = computed(() => {
   const list = processes.value || [];
-  const idx = list.findIndex((p) => p.status === "process");
-  return idx >= 0 ? idx : 0;
+  // 婵�娲荤姸鎬佷负鈥滃緟鐢熶骇鈥濈殑涓婁竴鏉�
+  const firstWaitIdx = list.findIndex((p) => p?.status === "wait");
+  if (firstWaitIdx > 0) return firstWaitIdx - 1;
+
+  // 濡傛灉娌℃湁寰呯敓浜э細
+  // - 涓旀渶鍚庝竴鏉℃槸鐢熶骇涓細婵�娲绘渶鍚庝竴鏉�
+  // - 鍚﹀垯锛氭病鏈夋縺娲绘牱寮�
+  const lastIdx = list.length - 1;
+  if (lastIdx >= 0 && list[lastIdx]?.status === "process") return lastIdx;
+  return null;
 });
 
 // 宸ュ簭杩涘害锛氱敤浜у嚭/鎶曞叆浼扮畻锛圲I 鍏堣窇閫氾紝鍚庣画鎸夌湡瀹炶鍒欐浛鎹級
@@ -563,6 +614,39 @@
     pointer-events: none;
   }
 
+  .step-status-badge {
+    position: absolute;
+    top: 8px;
+    right: 10px;
+    z-index: 1;
+    font-size: 11px;
+    font-weight: 600;
+    border-radius: 4px;
+    padding: 2px 8px;
+    line-height: 1.2;
+    pointer-events: none;
+    white-space: nowrap;
+    border: 1px solid transparent;
+  }
+
+  .step-status-badge-success {
+    color: #67c23a;
+    background: rgba(103, 194, 58, 0.14);
+    border-color: rgba(103, 194, 58, 0.35);
+  }
+
+  .step-status-badge-process {
+    color: #b88230;
+    background: rgba(230, 162, 60, 0.18);
+    border-color: rgba(230, 162, 60, 0.45);
+  }
+
+  .step-status-badge-wait {
+    color: #909399;
+    background: rgba(144, 147, 153, 0.12);
+    border-color: rgba(144, 147, 153, 0.35);
+  }
+
   .right-panel {
     border: 1px solid #ebeef5;
     border-radius: 10px;

--
Gitblit v1.9.3