From 2a2d753357f4d3c26b3622513ffb6e647f64704a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期日, 27 四月 2025 13:19:19 +0800
Subject: [PATCH] 工艺路线修改

---
 src/views/technology/routing/routing-form.vue |   70 +++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/src/views/technology/routing/routing-form.vue b/src/views/technology/routing/routing-form.vue
index 1458ba5..b8b272c 100644
--- a/src/views/technology/routing/routing-form.vue
+++ b/src/views/technology/routing/routing-form.vue
@@ -531,8 +531,8 @@
   },
 
   computed: {
-    editable: function () {
-      if (!this.dataForm.id) {
+    editable() {
+      if (!this.dataForm.id && this.itemKey) {
         return true
       }
       if (this.dataForm.id && this.dataForm.state == '01draft') {
@@ -543,9 +543,9 @@
   },
   watch: {
     'dataForm.partId'(newValue, oldValue) {
-      if (oldValue) {
-        this.dataForm.bomId = null
-      }
+      // if (oldValue) {
+      //   this.dataForm.bomId = null
+      // }
       if (newValue) {
         getBomList(
           Object.assign({
@@ -580,10 +580,67 @@
       } else {
         this.bomList = []
       }
-    }
+    },
+    '$route.query.id': {
+      immediate: true,
+      handler(newVal, oldVal) {
+        if (newVal) {
+          this.dataForm.id = this.$route.query.id
+          this.getParamType()
+          this.init()
+          this.itemKey = Math.random()
+          this.getBomTypeDbOptions()
+          this.getWorkCenterOptions()
+          this.getRunTimeCodeDbOptions()
+          this.getLaborClassNo()
+        } else {
+          this.dataForm.id = null
+          this.getParamType()
+          this.init()
+          this.dataForm = {
+            id: null,
+            routingNo: null,
+            name: null,
+            partId: null,
+            partNo: null,
+            partName: null,
+            description: null,
+            state: null,
+            master: false,
+            bomId: null,
+            operations: [],
+            refs: [],
+            bomTypeDb: 'M',
+            alternativeNo: '*',
+            alternativeDesc: null,
+            ifsSync: false,
+            phaseInDate: null,
+            phaseOutDate: null,
+            version: null,
+            wireCore: null
+          }
+          this.operationPart = {}
+          this.itemKey = Math.random()
+          this.getBomTypeDbOptions()
+          this.getWorkCenterOptions()
+          this.getRunTimeCodeDbOptions()
+          this.getLaborClassNo()
+        }
+      },
+    },
   },
 
   created() {
+    // this.dataForm.id = this.$route.query.id
+    // this.getParamType()
+    // this.init()
+    // this.itemKey = Math.random()
+    // this.getBomTypeDbOptions()
+    // this.getWorkCenterOptions()
+    // this.getRunTimeCodeDbOptions()
+    // this.getLaborClassNo()
+  },
+  activated() {
     this.dataForm.id = this.$route.query.id
     this.getParamType()
     this.init()
@@ -593,7 +650,6 @@
     this.getRunTimeCodeDbOptions()
     this.getLaborClassNo()
   },
-
   methods: {
     // 鏌ヨ缁撴瀯绫诲瀷瀛楀吀
     getBomTypeDbOptions() {

--
Gitblit v1.9.3