From efdd02d3d80253bf93f1c58e3ae25016db2d6b31 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 09 四月 2025 17:25:50 +0800
Subject: [PATCH] 检验任务,进货检验车间文件选择

---
 src/views/business/reliabilityPlan/plan.vue |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/views/business/reliabilityPlan/plan.vue b/src/views/business/reliabilityPlan/plan.vue
index 54b38f9..3574af0 100644
--- a/src/views/business/reliabilityPlan/plan.vue
+++ b/src/views/business/reliabilityPlan/plan.vue
@@ -83,7 +83,7 @@
 </template>
 
 <script>
-import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem } from "@/api/business/reliabilityPlan";
+import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem, materialItem, materialCodeList } from "@/api/business/reliabilityPlan";
 
 export default {
   dicts: ["planned_frequency"],
@@ -115,7 +115,10 @@
   },
   methods: {
     getTableData() {
-      selectProductItem({ rePlanId: this.planId }).then(res => {
+      selectProductItem({
+        rePlanId: this.planId,
+        type: this.planType
+      }).then(res => {
         if (res.code === 200) {
           this.tableData = res.data || [];
         }
@@ -126,12 +129,13 @@
 
     // 鑾峰彇妫�楠岄」鍒楄〃
     getItemList() {
-      itemList({ rePlanId: this.planId }).then(res => {
+      const api = this.planType === '鎴愬搧' ? itemList : materialItem;
+      api({ rePlanId: this.planId }).then(res => {
         if (res.code === 200) {
           this.itemList = res.data.map(item => ({
-            label: item.inspectionItem,  // 淇敼涓� inspectionItem
+            label: item.inspectionItem,
             value: item.id,
-            inspectionItem: item.inspectionItem  // 娣诲姞 inspectionItem 瀛楁
+            inspectionItem: item.inspectionItem
           })) || [];
         }
       }).catch(err => {
@@ -141,13 +145,14 @@
 
     // 鑾峰彇娴嬭瘯鏍囧噯鍒楄〃
     getCodeList() {
-      codeList({ rePlanId: this.planId }).then(res => {
+      const api = this.planType === '鎴愬搧' ? codeList : materialCodeList;
+      api({ rePlanId: this.planId }).then(res => {
         if (res.code === 200) {
-          this.codeList = res.data.map(item => ({
+          this.codeList = res.data ? res.data.map(item => ({
             label: item.standard,
             value: item.id,
             standard: item.standard
-          })) || [];
+          })) : [];
         }
       }).catch(err => {
         console.error('鑾峰彇娴嬭瘯鏍囧噯鍒楄〃澶辫触:', err);
@@ -176,7 +181,8 @@
           inspectionItem: item.inspectionItem,
           standard: item.standard,
           frequency: item.frequency,
-          remark: item.remark
+          remark: item.remark,
+          type: this.planType
         };
         return addOrUpdateItem(params);
       });
@@ -212,7 +218,8 @@
             inspectionItem: this.addForm.name,
             standard: this.addForm.standard,
             frequency: this.addForm.frequency,
-            remark: this.addForm.remark
+            remark: this.addForm.remark,
+            type: this.planType
           }
           addOrUpdateItem(params).then(res => {
             if (res.code === 200) {

--
Gitblit v1.9.3