From bd5f7c8da7a46fe8fb12cd68373739931b268890 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 08 一月 2026 17:47:12 +0800
Subject: [PATCH] 修改bug

---
 src/pages/productionManagement/productionReport/index.vue |   67 +++++++++++++++++----------------
 1 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/src/pages/productionManagement/productionReport/index.vue b/src/pages/productionManagement/productionReport/index.vue
index 4117f82..f60eba5 100644
--- a/src/pages/productionManagement/productionReport/index.vue
+++ b/src/pages/productionManagement/productionReport/index.vue
@@ -12,20 +12,23 @@
       <!-- 鍩烘湰淇℃伅 -->
       <view class="form-section">
         <u-form-item label="寰呯敓浜ф暟閲�"
-                     prop="remainingQuantity"
+                     prop="planQuantity"
                      required>
-          <u-input v-model="form.remainingQuantity"
+          <u-input v-model="form.planQuantity"
                    placeholder="鑷姩濉厖"
                    disabled />
         </u-form-item>
         <u-form-item label="鏈鐢熶骇鏁伴噺"
                      prop="quantity"
                      required>
-          <u-number-box v-model="form.quantity"
+          <u-input v-model="form.quantity"
+                   placeholder="璇疯緭鍏�"
+                   type="number" />
+          <!-- <u-number-box v-model="form.quantity"
                         step="0.1"
                         bgColor="#fff"
                         decimal-length="1"
-                        :min="0"></u-number-box>
+                        :min="0"></u-number-box> -->
         </u-form-item>
         <u-form-item label="鐝粍淇℃伅"
                      prop="schedulingUserId"
@@ -53,6 +56,7 @@
 
 <script setup>
   import { ref, onMounted } from "vue";
+  import { onLoad } from "@dcloudio/uni-app";
   import FooterButtons from "@/components/FooterButtons.vue";
 
   const showToast = message => {
@@ -61,10 +65,7 @@
       icon: "none",
     });
   };
-
-  import { formatDateToYMD } from "@/utils/ruoyi";
-  import { userListNoPageByTenantId } from "@/api/system/user";
-  import { productionReport } from "@/api/productionManagement/productionReporting";
+  import { addProductMain } from "@/api/productionManagement/productionReporting";
   import { getInfo } from "@/api/login";
 
   // 琛ㄥ崟寮曠敤
@@ -72,7 +73,7 @@
 
   // 琛ㄥ崟鏁版嵁
   let form = ref({
-    remainingQuantity: 0,
+    planQuantity: 0,
     quantity: 0,
     userName: "",
     workOrderId: "",
@@ -105,7 +106,6 @@
   const goBack = () => {
     uni.navigateBack();
   };
-  const parsedOrderRow = ref({});
   // 鎻愪氦琛ㄥ崟
   const submitForm = async () => {
     submitting.value = true;
@@ -115,17 +115,20 @@
       showToast("璇疯緭鍏ユ湰娆$敓浜ф暟閲�");
       return;
     }
-    if (form.value.quantity > form.value.remainingQuantity) {
+    if (form.value.quantity > form.value.planQuantity) {
       submitting.value = false;
       showToast("鏈鐢熶骇鏁伴噺涓嶈兘澶т簬寰呯敓浜ф暟閲�");
       return;
     }
+    console.log(form.value, "form.value");
 
-    addProductMain(reportForm).then(res => {
+    addProductMain(form.value).then(res => {
       if (res.code === 200) {
         showToast("鎶ュ伐鎴愬姛");
         submitting.value = false;
-        goBack();
+        setTimeout(() => {
+          goBack();
+        }, 1000);
       } else {
         showToast(res.msg || "鎶ュ伐澶辫触");
         submitting.value = false;
@@ -134,26 +137,26 @@
   };
 
   // 椤甸潰鍔犺浇鏃跺垵濮嬪寲鏁版嵁
-  onMounted(() => {
-    // 鑾峰彇浼犻�掕繃鏉ョ殑orderRow鍙傛暟
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    const orderRow = currentPage.options.orderRow;
-    form.value.remainingQuantity = 1;
-    if (orderRow) {
-      parsedOrderRow.value = JSON.parse(orderRow);
-
-      form.value.quantity = parsedOrderRow.value.quantity;
-      form.value.productProcessRouteItemId =
-        parsedOrderRow.value.productProcessRouteItemId;
-      form.value.workOrderId = parsedOrderRow.value.id;
-      form.value.reportWork = parsedOrderRow.value.reportWork;
-      form.value.productMainId = parsedOrderRow.value.productMainId;
+  onLoad(options => {
+    console.log(options, "options");
+    try {
+      const orderRow = JSON.parse(options.orderRow);
+      console.log(orderRow, "orderRow======########");
+      form.value.planQuantity = orderRow.planQuantity;
+      form.value.quantity = orderRow.quantity;
+      form.value.productProcessRouteItemId = orderRow.productProcessRouteItemId;
+      form.value.workOrderId = orderRow.id;
+      form.value.reportWork = orderRow.reportWork;
+      form.value.productMainId = orderRow.productMainId;
+      getInfo().then(res => {
+        form.value.userId = res.user.userId;
+        form.value.userName = res.user.userName;
+      });
+    } catch (error) {
+      modal.msgError("璁㈠崟瑙f瀽澶辫触");
+      goBack();
+      return;
     }
-    getInfo().then(res => {
-      form.value.userId = res.user.userId;
-      form.value.userName = res.user.userName;
-    });
   });
 </script>
 

--
Gitblit v1.9.3