From a1361a1e9e2999b864859a33aa1d4dc830d86818 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 16 一月 2026 15:13:32 +0800
Subject: [PATCH] fix: 生产工单、生产入库调整

---
 src/views/productionManagement/productionReporting/index.vue |  109 +++++++--------------------
 src/views/productionManagement/workOrder/index.vue           |  108 ++++++++++++++++++++------
 src/views/productionManagement/productionReporting/Input.vue |    2 
 3 files changed, 113 insertions(+), 106 deletions(-)

diff --git a/src/views/productionManagement/productionReporting/Input.vue b/src/views/productionManagement/productionReporting/Input.vue
index 7959848..8015265 100644
--- a/src/views/productionManagement/productionReporting/Input.vue
+++ b/src/views/productionManagement/productionReporting/Input.vue
@@ -59,7 +59,7 @@
     prop: 'productNo',
   },
   {
-    label: '浜у搧鍨嬪彿',
+    label: '鎶曞叆浜у搧鍨嬪彿',
     prop: 'model',
   },
   {
diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index b34b14e..f4137af 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -115,7 +115,7 @@
               </template>
             </el-table-column>
             <el-table-column label="鎿嶄綔"
-                             width="60">
+                             >
               <template #default="scope">
                 <el-button link
                            type="primary"
@@ -139,9 +139,6 @@
     <input-modal v-if="isShowInput"
                  v-model:visible="isShowInput"
                  :production-product-main-id="isShowingId" />
-    <output-modal v-if="isShowOutput"
-                  v-model:visible="isShowOutput"
-                  :production-product-main-id="isShowingId" />
   </div>
 </template>
 
@@ -157,7 +154,6 @@
   import { productionProductMainListPage } from "@/api/productionManagement/productionProductMain.js";
   import { userListNoPageByTenantId } from "@/api/system/user.js";
   import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
-  import OutputModal from "@/views/productionManagement/productionReporting/Output.vue";
 
   const data = reactive({
     searchForm: {
@@ -187,92 +183,52 @@
       width: 120,
     },
     {
-      label: "鎶ュ伐鐘舵��",
-      prop: "status",
-      dataType: "tag",
-      formatData: params => {
-        if (params == 3) {
-          return "宸叉姤宸�";
-        } else if (params == 1) {
-          return "寰呯敓浜�";
-        } else {
-          return "鐢熶骇涓�";
-        }
-      },
-      formatType: params => {
-        if (params == 3) {
-          return "success";
-        } else if (params == 1) {
-          return "primary";
-        } else {
-          return "warning";
-        }
-      },
+      label: "閿�鍞悎鍚屽彿",
+      prop: "salesContractNo",
+      width: 120,
     },
     {
-      label: "宸ュ崟鐘舵��",
-      prop: "workOrderStatus",
-      dataType: "tag",
-      formatData: params => {
-        switch (params) {
-          case "1":
-            return "寰呯‘璁�";
-          case "2":
-            return "寰呯敓浜�";
-          case "3":
-            return "鐢熶骇涓�";
-          case "4":
-            return "宸茬敓浜�";
-          default:
-            return "";
-        }
-      },
-      formatType: params => {
-        switch (params) {
-          case "1":
-            return "primary";
-          case "2":
-            return "info";
-          case "3":
-            return "warning";
-          case "4":
-            return "success";
-          default:
-            return "";
-        }
-      },
+      label: "浜у搧鍚嶇О",
+      prop: "productName",
+      width: 120,
     },
     {
-      label: "鐢熶骇鏃堕棿",
+      label: "浜у搧瑙勬牸鍨嬪彿",
+      prop: "productModelName",
+      width: 120,
+    },
+    {
+      label: "浜у嚭鏁伴噺",
+      prop: "quantity",
+      width: 120,
+    },
+    // {
+    //   label: "鎶ュ簾鏁伴噺",
+    //   prop: "scrapQuantity",
+    //   width: 120,
+    // },
+    {
+      label: "鍗曚綅",
+      prop: "unit",
+      width: 120,
+    },
+    
+    {
+      label: "鍒涘缓鏃堕棿",
       prop: "createTime",
       width: 120,
-      formatData: params => {
-        const date = new Date(params);
-        return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
-          2,
-          "0"
-        )}-${String(date.getDate()).padStart(2, "0")}`;
-      },
     },
     {
       dataType: "action",
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 230,
       operation: [
         {
           name: "鏌ョ湅鎶曞叆",
           type: "text",
           clickFun: row => {
             showInput(row);
-          },
-        },
-        {
-          name: "鏌ョ湅浜у嚭",
-          type: "text",
-          clickFun: row => {
-            showOutput(row);
           },
         },
         {
@@ -449,13 +405,6 @@
   const isShowingId = ref(0);
   const showInput = row => {
     isShowInput.value = true;
-    isShowingId.value = row.id;
-  };
-
-  // 鎵撳紑浜у嚭妯℃�佹
-  const isShowOutput = ref(false);
-  const showOutput = row => {
-    isShowOutput.value = true;
     isShowingId.value = row.id;
   };
 
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index 34b368d..f5d2bc1 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -23,7 +23,11 @@
                 :tableData="tableData"
                 :page="page"
                 :tableLoading="tableLoading"
-                @pagination="pagination"></PIMTable>
+                @pagination="pagination">
+                <template #completionStatus="{ row }">
+                  <el-progress :percentage="toProgressPercentage(row?.completionStatus)" :color="progressColor(toProgressPercentage(row?.completionStatus))" :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
+                </template>
+              </PIMTable>
     </div>
     <el-dialog v-model="editDialogVisible"
                title="缂栬緫鏃堕棿"
@@ -90,7 +94,7 @@
               <span class="info-label">浜у搧瑙勬牸</span>
               <span class="info-value">{{ transferCardRowData.model }}</span>
             </div>
-            <div class="info-item">
+            <!-- <div class="info-item">
               <span class="info-label">宸ュ崟鐘舵��</span>
               <span class="info-value">{{ 
                 transferCardRowData.status === 1 ? '寰呯‘璁�' : 
@@ -99,7 +103,8 @@
                 transferCardRowData.status === 4 ? '宸茬敓浜�' : 
                 transferCardRowData.status 
               }}</span>
-            </div>
+            </div> -->
+           
             <div class="info-item">
               <span class="info-label">璁″垝寮�濮嬫椂闂�</span>
               <span class="info-value">{{ transferCardRowData.planStartTime }}</span>
@@ -115,12 +120,12 @@
           </div>
           <div class="info-group">
             <div class="info-item">
-              <span class="info-label">&nbsp;</span>
-              <span class="info-value">&nbsp;</span>
+              <span class="info-label">闇�姹傛暟閲�</span>
+              <span class="info-value">{{ transferCardRowData.planQuantity }}</span>
             </div>
             <div class="info-item">
-              <span class="info-label">璁″垝鏁伴噺</span>
-              <span class="info-value">{{ transferCardRowData.planQuantity }}</span>
+              <span class="info-label">瀹屾垚鏁伴噺</span>
+              <span class="info-value">{{ transferCardRowData.completeQuantity }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">鑹搧鏁伴噺</span>
@@ -176,10 +181,17 @@
                     placeholder="璇疯緭鍏ユ湰娆$敓浜ф暟閲�" />
         </el-form-item>
         <el-form-item label="鐝粍淇℃伅">
-          <el-input v-model="reportForm.userName"
-                    style="width: 300px"
-                    readonly
-                    placeholder="璇疯緭鍏ョ彮缁勪俊鎭�" />
+          <el-select v-model="reportForm.userId"
+                     style="width: 300px"
+                     placeholder="璇烽�夋嫨鐝粍淇℃伅"
+                     clearable
+                     filterable
+                     @change="handleUserChange">
+            <el-option v-for="user in userOptions"
+                       :key="user.userId"
+                       :label="user.userName"
+                       :value="user.userId" />
+          </el-select>
         </el-form-item>
       </el-form>
       <template #footer>
@@ -202,7 +214,7 @@
     updateProductWorkOrder,
     addProductMain,
   } from "@/api/productionManagement/workOrder.js";
-  import { getUserProfile } from "@/api/system/user.js";
+  import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js";
   import QRCode from "qrcode";
   import { getCurrentInstance, reactive, toRefs } from "vue";
   const { proxy } = getCurrentInstance();
@@ -236,13 +248,20 @@
       prop: "processName",
     },
     {
-      label: "寰呯敓浜ф暟閲�",
+      label: "闇�姹傛暟閲�",
       prop: "planQuantity",
       width: "140",
     },
     {
-      label: "璁″垝鐢熶骇鏁伴噺",
-      prop: "quantity",
+      label: "瀹屾垚鏁伴噺",
+      prop: "completeQuantity",
+      width: "140",
+    },
+    {
+      label: "瀹屾垚杩涘害",
+      prop: "completionStatus",
+      dataType: "slot",
+      slot: "completionStatus",
       width: "140",
     },
     {
@@ -304,6 +323,7 @@
   const transferCardQrUrl = ref("");
   const transferCardRowData = ref(null);
   const reportDialogVisible = ref(false);
+  const userOptions = ref([]);
   const reportForm = reactive({
     planQuantity: 0,
     quantity: 0,
@@ -327,6 +347,20 @@
     },
   });
   const { searchForm } = toRefs(data);
+  const toProgressPercentage = val => {
+    const n = Number(val);
+    if (!Number.isFinite(n)) return 0;
+    if (n <= 0) return 0;
+    if (n >= 100) return 100;
+    return Math.round(n);
+  };
+  const progressColor = percentage => {
+    const p = toProgressPercentage(percentage);
+    if (p < 30) return "#f56c6c";
+    if (p < 50) return "#e6a23c";
+    if (p < 80) return "#409eff";
+    return "#67c23a";
+  };
   let editrow = ref(null);
 
   // 鏌ヨ鍒楄〃
@@ -356,9 +390,7 @@
 
   const showTransferCard = async row => {
     transferCardRowData.value = row;
-    const qrContent =
-      proxy.javaApi + "/work-order?orderRow=" + JSON.stringify(row);
-    console.log(qrContent, "qrContent");
+    const qrContent = String(row.id);
 
     transferCardQrUrl.value = await QRCode.toDataURL(qrContent);
     transferCardVisible.value = true;
@@ -395,7 +427,17 @@
     reportForm.workOrderId = row.id;
     reportForm.reportWork = row.reportWork;
     reportForm.productMainId = row.productMainId;
-    // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
+    // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅锛岃缃负榛樿閫変腑
+    getUserProfile()
+      .then(res => {
+        if (res.code === 200) {
+          reportForm.userId = res.data.userId;
+          reportForm.userName = res.data.userName;
+        }
+      })
+      .catch(err => {
+        console.error("鑾峰彇鐢ㄦ埛淇℃伅澶辫触", err);
+      });
 
     reportDialogVisible.value = true;
   };
@@ -433,18 +475,34 @@
     });
   };
 
-  onMounted(() => {
-    getList();
-    getUserProfile()
+  // 鑾峰彇鐢ㄦ埛鍒楄〃
+  const getUserList = () => {
+    userListNoPageByTenantId()
       .then(res => {
         if (res.code === 200) {
-          reportForm.userName = res.data.userName;
-          reportForm.userId = res.data.userId;
+          userOptions.value = res.data || [];
         }
       })
       .catch(err => {
-        console.error("鑾峰彇鐢ㄦ埛淇℃伅澶辫触", err);
+        console.error("鑾峰彇鐢ㄦ埛鍒楄〃澶辫触", err);
       });
+  };
+
+  // 鐢ㄦ埛閫夋嫨鍙樺寲鏃舵洿鏂� userName
+  const handleUserChange = (userId) => {
+    if (userId) {
+      const selectedUser = userOptions.value.find(user => user.userId === userId);
+      if (selectedUser) {
+        reportForm.userName = selectedUser.userName;
+      }
+    } else {
+      reportForm.userName = "";
+    }
+  };
+
+  onMounted(() => {
+    getList();
+    getUserList();
   });
 </script>
 

--
Gitblit v1.9.3