From feaeb3e3ac6d9e7606fce5e3ae80de3cca9c846f Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 20 五月 2026 09:30:54 +0800
Subject: [PATCH] feat:1.库存成品展示电压,工序类别 2.销售页面调整

---
 src/views/productionManagement/workOrder/components/CopperPrintingForm.vue |  285 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 219 insertions(+), 66 deletions(-)

diff --git a/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue b/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
index 7a11105..0a27bd0 100644
--- a/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
+++ b/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
@@ -2,6 +2,7 @@
 import {computed, onMounted, reactive, ref} from "vue";
 import dayjs from "dayjs";
 import {userListNoPageByTenantId} from "@/api/system/user.js";
+import {getDeviceLedger} from "@/api/equipmentManagement/ledger.js";
 import {ElMessage} from "element-plus";
 import {addProductMain} from "@/api/productionManagement/workOrder.js";
 
@@ -18,10 +19,6 @@
     type: Boolean,
     default: false
   },
-  detailData: {
-    type: Object,
-    default: () => ({}),
-  },
   row: {
     type: Object,
     default: () => ({}),
@@ -35,6 +32,21 @@
   set: (value: boolean) => emits("update:isShow", value),
 });
 
+/** 宸ュ簭灞曠ず鍚嶏細宸ュ崟涓� processName锛屾姤宸ュ垪琛ㄤ负 process锛岀己鐪佷笌鏃х増涓�鑷翠负銆屽嵃閾溿�� */
+const processTitlePrefix = computed(() => {
+  const row = props.row as Record<string, unknown> | null | undefined;
+  if (!row) return "鍗伴摐";
+  const name = row.processName ?? row.process;
+  if (name != null && String(name).trim() !== "") {
+    return String(name).trim();
+  }
+  return "鍗伴摐";
+});
+
+const dialogTitle = computed(() =>
+  props.isEdit ? `${processTitlePrefix.value}鎶ュ伐` : `${processTitlePrefix.value}璇︽儏`
+);
+
 const formData = reactive({
   productProcessRouteItemId: undefined,
   workOrderId: undefined,
@@ -42,6 +54,7 @@
   reportWork: undefined,
   productMainId: undefined,
   quantity: undefined, // 鐑ч摐浜у嚭婵�
+  scrapQty: undefined, // 鎶ュ簾鏁伴噺
   userId: undefined, // 浣滀笟鍛�
   userName: undefined, // 浣滀笟鍛�
   otherData: {
@@ -87,6 +100,17 @@
         console.error("鑾峰彇鐢ㄦ埛鍒楄〃澶辫触", err);
       });
 };
+
+const deviceOptions = ref<any[]>([]);
+const getDeviceList = async () => {
+  try {
+    const {data} = await getDeviceLedger();
+    deviceOptions.value = data || [];
+  } catch (err) {
+    console.error("鑾峰彇璁惧鍒楄〃澶辫触", err);
+    deviceOptions.value = [];
+  }
+};
 // 鐢ㄦ埛閫夋嫨鍙樺寲鏃舵洿鏂� userName
 const handleUserChange = (userId: any, reportType: string) => {
   if (userId) {
@@ -126,11 +150,22 @@
     ElMessage.error('璇疯緭鍏ョ敓浜ф暟閲�')
     return;
   }
+  const scrapQty =
+    formData.scrapQty === null ||
+    formData.scrapQty === undefined ||
+    formData.scrapQty === ""
+      ? 0
+      : Number(formData.scrapQty);
+  if (isNaN(scrapQty) || !Number.isInteger(scrapQty) || scrapQty < 0) {
+    ElMessage.error('鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0');
+    return;
+  }
   formData.userId = formData.otherData.surfaceCopperPasteUserId || formData.otherData.underlyingCopperPasteUserId;
 
   const otherData = JSON.stringify(formData.otherData);
   const submitData = {
     ...formData,
+    scrapQty,
     otherData: otherData
   };
 
@@ -150,8 +185,9 @@
 
 const initData = () => {
   if (!props.isEdit) {
-    formData.otherData = JSON.parse(props.detailData.otherData || '{}');
-    formData.quantity = props.detailData.quantity;
+    formData.otherData = JSON.parse(props.row.otherData || '{}');
+    formData.quantity = props.row.quantity;
+    formData.scrapQty = props.row.scrapQty;
   } else {
     const row = props.row;
     formData.planQuantity = row.planQuantity
@@ -166,28 +202,35 @@
   return value === undefined || value === null || value === "" ? "-" : value;
 };
 
+/** 琛ㄦ牸缁熶竴 21 鍒楁爡鏍硷紝姣忚 colspan 涔嬪拰椤荤瓑浜庤鍊� */
+const GRID_COLS = 21;
+
 onMounted(() => {
   getUserList();
-  initData()
-})
+  getDeviceList();
+  initData();
+});
 </script>
 
 <template>
   <el-dialog v-model="visible"
-             title="鍗伴摐鎶ュ伐"
+             :title="dialogTitle"
              width="90%">
     <el-form :model="formData">
       <table class="report-table">
+        <colgroup>
+          <col v-for="n in GRID_COLS" :key="n" />
+        </colgroup>
         <tbody>
         <tr>
           <td class="tip" colspan="4">鐡风墖娓呮礂鍚庢斁缃椂闂磋秴杩�72H锛岄噸鏂扮儤鐗囧悗鎵嶈兘鍗板埛骞跺~鍐欐湰鏍�</td>
           <td class="label" colspan="3">鐑樺共娓╁害</td>
-          <td colspan="2">
+          <td colspan="2" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.dryingTemperature" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.dryingTemperature) }}</span>
           </td>
           <td class="label">寮�濮嬫椂闂�</td>
-          <td colspan="2">
+          <td colspan="2" class="cell-field">
             <el-date-picker
                 v-if="props.isEdit"
                 v-model="formData.otherData.startTime"
@@ -195,12 +238,11 @@
                 value-format="YYYY-MM-DD HH:mm:ss"
                 format="YYYY-MM-DD HH:mm:ss"
                 placeholder="璇烽�夋嫨"
-                style="width: 100%"
             />
             <span v-else class="view-value">{{ displayValue(formData.otherData.startTime) }}</span>
           </td>
-          <td class="label"  colspan="3">缁撴潫鏃堕棿</td>
-          <td colspan="2">
+          <td class="label" colspan="3">缁撴潫鏃堕棿</td>
+          <td colspan="2" class="cell-field">
             <el-date-picker
                 v-if="props.isEdit"
                 v-model="formData.otherData.endTime"
@@ -208,12 +250,11 @@
                 value-format="YYYY-MM-DD HH:mm:ss"
                 format="YYYY-MM-DD HH:mm:ss"
                 placeholder="璇烽�夋嫨"
-                style="width: 100%"
             />
             <span v-else class="view-value">{{ displayValue(formData.otherData.endTime) }}</span>
           </td>
           <td class="label" colspan="2">浣滀笟鍛�</td>
-          <td  colspan="2">
+          <td colspan="2" class="cell-field">
             <el-select v-model="formData.otherData.userId"
                        v-if="props.isEdit"
                        style="width: 100%"
@@ -229,37 +270,55 @@
             <span v-else class="view-value">{{ displayValue(formData.otherData.userName || formData.otherData.userId) }}</span>
           </td>
         </tr>
+        <!-- 搴曞眰閾滄祮 -->
         <tr>
-          <td class="label" colspan="2">搴曞眰閾滄祮</td>
-          <td>
+          <td class="label label--section" colspan="21">搴曞眰閾滄祮</td>
+        </tr>
+        <tr class="report-row report-row--triple">
+          <td class="label" colspan="2">閾滄祮</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPaste" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPaste) }}</span>
           </td>
-          <td class="label">鍗板埛娆℃暟</td>
-          <td colspan="2">
+          <td class="label" colspan="2">鍗板埛娆℃暟</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPastePrintingQuantity" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPastePrintingQuantity) }}</span>
           </td>
-          <td class="label">鏈哄彴鍙�</td>
-          <td>
-            <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteMachineNumber" placeholder="璇疯緭鍏�"/>
+          <td class="label" colspan="2">鏈哄彴鍙�</td>
+          <td colspan="5" class="cell-field cell-field--machine">
+            <el-select
+                v-if="props.isEdit"
+                v-model="formData.otherData.underlyingCopperPasteMachineNumber"
+                placeholder="璇烽�夋嫨璁惧"
+                clearable
+                filterable
+            >
+              <el-option
+                  v-for="device in deviceOptions"
+                  :key="device.id ?? device.deviceName"
+                  :label="device.deviceName"
+                  :value="device.deviceName"
+              />
+            </el-select>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteMachineNumber) }}</span>
           </td>
-          <td class="label">涓濈綉鏃忓彿</td>
-          <td colspan="2">
+        </tr>
+        <tr class="report-row report-row--triple">
+          <td class="label" colspan="2">涓濈綉鏃忓彿</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteSilkScreenFamilyNumber" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteSilkScreenFamilyNumber) }}</span>
           </td>
-          <td class="label">鐩暟</td>
-          <td colspan="2">
+          <td class="label" colspan="2">鐩暟</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteNumberOfEyes" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteNumberOfEyes) }}</span>
           </td>
-          <td class="label">浣滀笟鍛�</td>
-          <td colspan="2">
+          <td class="label" colspan="2">浣滀笟鍛�</td>
+          <td colspan="5" class="cell-field">
             <el-select v-model="formData.otherData.underlyingCopperPasteUserId"
                        v-if="props.isEdit"
-                       style="width: 100%"
                        placeholder="璇烽�夋嫨浣滀笟鍛�"
                        clearable
                        filterable
@@ -271,43 +330,64 @@
             </el-select>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteUserName || formData.otherData.underlyingCopperPasteUserId) }}</span>
           </td>
+        </tr>
+        <tr class="report-row report-row--triple">
           <td class="label" colspan="2">鐑樺共娓╁害</td>
-          <td colspan="2">
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteDryingTemperature" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteDryingTemperature) }}</span>
           </td>
+          <td colspan="14"></td>
         </tr>
+        <!-- 琛ㄥ眰閾滄祮 -->
         <tr>
-          <td class="label" colspan="2">琛ㄥ眰閾滄祮</td>
-          <td>
+          <td class="label label--section" colspan="21">琛ㄥ眰閾滄祮</td>
+        </tr>
+        <tr class="report-row report-row--triple">
+          <td class="label" colspan="2">閾滄祮</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPaste" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPaste) }}</span>
           </td>
-          <td class="label">鍗板埛娆℃暟</td>
-          <td colspan="2">
+          <td class="label" colspan="2">鍗板埛娆℃暟</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPastePrintingQuantity" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPastePrintingQuantity) }}</span>
           </td>
-          <td class="label">鏈哄彴鍙�</td>
-          <td>
-            <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteMachineNumber" placeholder="璇疯緭鍏�"/>
+          <td class="label" colspan="2">鏈哄彴鍙�</td>
+          <td colspan="5" class="cell-field cell-field--machine">
+            <el-select
+                v-if="props.isEdit"
+                v-model="formData.otherData.surfaceCopperPasteMachineNumber"
+                placeholder="璇烽�夋嫨璁惧"
+                clearable
+                filterable
+            >
+              <el-option
+                  v-for="device in deviceOptions"
+                  :key="device.id ?? device.deviceName"
+                  :label="device.deviceName"
+                  :value="device.deviceName"
+              />
+            </el-select>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteMachineNumber) }}</span>
           </td>
-          <td class="label">涓濈綉鏃忓彿</td>
-          <td colspan="2">
+        </tr>
+        <tr class="report-row report-row--triple">
+          <td class="label" colspan="2">涓濈綉鏃忓彿</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteSilkScreenFamilyNumber" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteSilkScreenFamilyNumber) }}</span>
           </td>
-          <td class="label">鐩暟</td>
-          <td colspan="2">
+          <td class="label" colspan="2">鐩暟</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteNumberOfEyes" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteNumberOfEyes) }}</span>
           </td>
-          <td class="label">浣滀笟鍛�</td>
-          <td colspan="2">
+          <td class="label" colspan="2">浣滀笟鍛�</td>
+          <td colspan="5" class="cell-field">
             <el-select v-model="formData.otherData.surfaceCopperPasteUserId"
                        v-if="props.isEdit"
-                       style="width: 100%"
                        placeholder="璇烽�夋嫨浣滀笟鍛�"
                        clearable
                        filterable
@@ -319,15 +399,18 @@
             </el-select>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteUserName || formData.otherData.surfaceCopperPasteUserId) }}</span>
           </td>
+        </tr>
+        <tr class="report-row report-row--triple">
           <td class="label" colspan="2">鐑樺共娓╁害</td>
-          <td colspan="2">
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteDryingTemperature" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteDryingTemperature) }}</span>
           </td>
+          <td colspan="14"></td>
         </tr>
-        <tr>
-          <td class="label" colspan="2">鐑ч挗鏃ユ湡</td>
-          <td colspan="2">
+        <tr class="report-row report-row--triple">
+          <td class="label" colspan="2">鐑ч摐鏃ユ湡</td>
+          <td colspan="5" class="cell-field">
             <el-date-picker
                 v-if="props.isEdit"
                 v-model="formData.otherData.steelBurningDate"
@@ -335,12 +418,11 @@
                 value-format="YYYY-MM-DD"
                 format="YYYY-MM-DD"
                 placeholder="璇烽�夋嫨"
-                style="width: 100%"
             />
             <span v-else class="view-value">{{ displayValue(formData.otherData.steelBurningDate) }}</span>
           </td>
-          <td class="label" colspan="3">鐑ч摐杩涚倝鏃堕棿</td>
-          <td colspan="2">
+          <td class="label label--compact" colspan="2">鐑ч摐杩涚倝鏃堕棿</td>
+          <td colspan="5" class="cell-field">
             <el-date-picker
                 v-if="props.isEdit"
                 v-model="formData.otherData.copperFiringTime"
@@ -348,12 +430,11 @@
                 value-format="YYYY-MM-DD HH:mm:ss"
                 format="YYYY-MM-DD HH:mm:ss"
                 placeholder="璇烽�夋嫨"
-                style="width: 100%"
             />
             <span v-else class="view-value">{{ displayValue(formData.otherData.copperFiringTime) }}</span>
           </td>
-          <td class="label">鐑ч挗鍑虹倝鏃堕棿</td>
-          <td colspan="2">
+          <td class="label label--compact" colspan="2">鐑ч摐鍑虹倝鏃堕棿</td>
+          <td colspan="5" class="cell-field">
             <el-date-picker
                 v-if="props.isEdit"
                 v-model="formData.otherData.steelFiringTime"
@@ -361,24 +442,37 @@
                 value-format="YYYY-MM-DD HH:mm:ss"
                 format="YYYY-MM-DD HH:mm:ss"
                 placeholder="璇烽�夋嫨"
-                style="width: 100%"
             />
             <span v-else class="view-value">{{ displayValue(formData.otherData.steelFiringTime) }}</span>
           </td>
-          <td class="label" colspan="3">鐑ч摐浜у嚭婵�</td>
-          <td colspan="2">
+        </tr>
+        <tr class="report-row report-row--triple">
+          <td class="label" colspan="2">鐑ч摐浜у嚭</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.quantity" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.quantity) }}</span>
           </td>
-          <td class="label" colspan="2">閲嶉噺(kg/pos)</td>
-          <td colspan="2">
+          <td class="label" colspan="2">鎶ュ簾鏁伴噺</td>
+          <td colspan="5" class="cell-field">
+            <el-input
+                v-if="props.isEdit"
+                v-model.number="formData.scrapQty"
+                type="number"
+                min="0"
+                step="1"
+                placeholder="璇疯緭鍏�"
+            />
+            <span v-else class="view-value">{{ displayValue(formData.scrapQty) }}</span>
+          </td>
+          <td class="label label--compact" colspan="2">閲嶉噺(kg/pos)</td>
+          <td colspan="5" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.weight" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.weight) }}</span>
           </td>
         </tr>
-        <tr>
+        <tr class="report-row report-row--double">
           <td class="label" colspan="2">鐑ч摐娓╁害鏇茬嚎</td>
-          <td colspan="7">
+          <td colspan="9" class="cell-field">
             <el-input
                 v-if="props.isEdit"
                 v-model="formData.otherData.copperSmeltingTemperatureProfile"
@@ -388,8 +482,8 @@
             />
             <span v-else class="view-value">{{ displayValue(formData.otherData.copperSmeltingTemperatureProfile) }}</span>
           </td>
-          <td class="label">澶囨敞</td>
-          <td colspan="11">
+          <td class="label" colspan="2">澶囨敞</td>
+          <td colspan="8" class="cell-field">
             <el-input v-if="props.isEdit" v-model="formData.otherData.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏�"/>
             <span v-else class="view-value">{{ displayValue(formData.otherData.remark) }}</span>
           </td>
@@ -415,17 +509,36 @@
   font-size: 13px;
 }
 
+.report-table col {
+  width: calc(100% / 21);
+}
+
 .report-table td {
   border: 1px solid #dcdfe6;
-  padding: 6px;
+  padding: 6px 8px;
   vertical-align: middle;
+  overflow: hidden;
 }
 
 .report-table .label {
-  width: 90px;
   background: #f5f7fa;
   text-align: center;
   font-weight: 500;
+  white-space: nowrap;
+}
+
+.report-table .label--compact {
+  font-size: 12px;
+  line-height: 1.35;
+  white-space: normal;
+  word-break: keep-all;
+}
+
+.report-table .label--section {
+  text-align: left;
+  padding-left: 12px;
+  font-weight: 600;
+  background: #eef1f6;
 }
 
 .report-table .tip {
@@ -435,9 +548,49 @@
   background: #fafafa;
 }
 
+.report-table .cell-field {
+  min-width: 0;
+}
+
+.report-table .cell-field :deep(.el-input),
+.report-table .cell-field :deep(.el-date-editor),
+.report-table .cell-field :deep(.el-select) {
+  width: 100%;
+}
+
+.report-table .cell-field :deep(.el-textarea) {
+  width: 100%;
+}
+
+.report-table .cell-field--machine :deep(.el-select) {
+  width: 100%;
+}
+
+.report-table .cell-field--machine :deep(.el-select .el-select__wrapper) {
+  min-height: 32px;
+}
+
+.report-table .cell-field :deep(.el-input__wrapper) {
+  box-sizing: border-box;
+}
+
+/* 闅愯棌 number 杈撳叆妗嗕笂涓嬬澶达紝涓庡叾浠栨枃鏈瑙嗚涓�鑷� */
+.report-table .cell-field :deep(input[type="number"]::-webkit-outer-spin-button),
+.report-table .cell-field :deep(input[type="number"]::-webkit-inner-spin-button) {
+  -webkit-appearance: none;
+  margin: 0;
+}
+
+.report-table .cell-field :deep(input[type="number"]) {
+  -moz-appearance: textfield;
+  appearance: textfield;
+}
+
 .view-value {
   display: inline-block;
+  width: 100%;
   min-height: 32px;
   line-height: 32px;
+  word-break: break-all;
 }
 </style>

--
Gitblit v1.9.3