From 612f2503f2b5ad3781f258f7b778f67a4fc074fe Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 17 十月 2025 11:15:45 +0800
Subject: [PATCH] fix:  优化领料页面

---
 src/pages/production/twist/receive/steelCore/edit.vue |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/pages/production/twist/receive/steelCore/edit.vue b/src/pages/production/twist/receive/steelCore/edit.vue
index 269154d..fb7ae58 100644
--- a/src/pages/production/twist/receive/steelCore/edit.vue
+++ b/src/pages/production/twist/receive/steelCore/edit.vue
@@ -1,7 +1,7 @@
 <template>
   <view>
-    <CardTitle title="缁炵嚎鐩樺叿棰嗙敤" :hideAction="false" />
-    <SteelCoreForm class="mx-4" />
+    <CardTitle title="缁炵嚎閽㈣姱棰嗙敤" :hideAction="false" />
+    <SteelCoreForm ref="formRef" class="mx-4" />
     <view class="footer">
       <wd-button
         class="submit_btn"
@@ -15,12 +15,48 @@
       </wd-button>
     </view>
   </view>
+  <wd-toast />
 </template>
 <script lang="ts" setup>
 import CardTitle from "@/components/card-title/index.vue";
 import SteelCoreForm from "./form.vue";
+import { useToast } from "wot-design-uni";
+import { onLoad, onUnload } from "@dcloudio/uni-app";
 
-const handleSubmit = () => {};
+const formRef = ref();
+const toast = useToast();
+
+const handleSubmit = async () => {
+  const success = await formRef.value.submitEdit();
+  if (success) {
+    setTimeout(() => {
+      uni.navigateBack();
+    }, 500);
+  }
+};
+
+// 鎺ユ敹鍒楄〃椤典紶閫掔殑鏁版嵁
+const receiveEditData = (data: any) => {
+  console.log("receiveEditData 鎺ユ敹鍒扮殑鏁版嵁:", data);
+  if (data && formRef.value) {
+    // 纭繚 list 鍜� editId 閮藉瓨鍦�
+    if (data.list && data.editId) {
+      formRef.value.setFormData(data.list, data.editId);
+    } else {
+      console.error("鏁版嵁鏍煎紡閿欒:", data);
+    }
+  }
+};
+
+onLoad((options: any) => {
+  // 鐩戝惉鏁版嵁浼犻�掍簨浠�
+  uni.$on("steelCoreEditData", receiveEditData);
+});
+
+onUnload(() => {
+  // 椤甸潰鍗歌浇鏃剁Щ闄ょ洃鍚�
+  uni.$off("steelCoreEditData", receiveEditData);
+});
 </script>
 <style lang="scss" scoped>
 .footer {

--
Gitblit v1.9.3