Przeglądaj źródła

车间图片修改为从接口获取

wangyani 1 rok temu
rodzic
commit
68d65ed25d

+ 20 - 1
src/components/separationPoint/workshop.vue

@@ -65,7 +65,9 @@
       </el-form>
     </div>
     <div class="leftbottom">
-      <img src="../../assets/images/workshop.png" alt="" />
+      <!-- <img src="../../assets/images/workshop.png" alt="" /> -->
+      <img :src="imgsrc" alt="" v-if="imgsrc" />
+      <p v-else>—————— 请选择车间 ——————</p>
     </div>
   </div>
 </template>
@@ -97,6 +99,7 @@ export default {
       },
       workShopOptions: [],
       producLineOptions: [],
+      imgsrc: "",
     };
   },
   watch: {
@@ -183,11 +186,13 @@ export default {
     // 获取车间列表
     getworkshopList() {
       listAllWorkshop().then((response) => {
+        console.log(response, "车间信息");
         this.workShopOptions = response.data.map((item) => {
           return {
             label: item.workshopName,
             value: item.workshopId,
             key: item.workshopCode,
+            attr1: item.attr1,
           };
         });
       });
@@ -207,6 +212,16 @@ export default {
               };
             });
 
+            // 根据选择的车间更新 imgsrc
+            const selectedWorkshop = this.workShopOptions.find(
+              (item) => item.value === value
+            );
+            if (selectedWorkshop) {
+              this.imgsrc = selectedWorkshop.attr1;
+            } else {
+              this.imgsrc = ""; // 如果没有找到,清空 imgsrc
+            }
+
             console.log(this.producLineOptions, "this.producLineOptions");
             resolve(); // 异步操作成功后 resolve
           })
@@ -277,6 +292,10 @@ export default {
       width: 100%;
       height: 100%;
     }
+    p {
+      text-align: center;
+      margin: 30% 0;
+    }
   }
 }
 </style>

+ 3 - 3
src/views/mes/job/jobm/NewOperations.vue

@@ -938,7 +938,7 @@ export default {
           const res = await updateJobTicket(editdata);
           if (res.code === 200) {
             // this.$router.go(-1);
-            this.$router.push("/job");
+            this.$router.push("/job/jobm");
           } else {
             console.error("编辑工单失败", res);
           }
@@ -947,7 +947,7 @@ export default {
           const res = await addJobTicket(data);
           if (res.code === 200) {
             // this.$router.go(-1);
-            this.$router.push("/job");
+            this.$router.push("/job/jobm");
           } else {
             console.error("提交工单失败", res);
           }
@@ -1063,7 +1063,7 @@ export default {
 
     // 侧边x关闭
     goBack() {
-      this.$router.push("/job");
+      this.$router.push("/job/jobm");
     },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {