From cd1464ac3e1d232de22e28c8e7e9fd1072780f87 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 07 四月 2025 13:22:23 +0800
Subject: [PATCH] Merge branch 'radio-frequency-cable' of http://114.132.189.42:9002/r/lims-ruoyi-before into radio-frequency-cable

---
 vue.config.js                                |    4 +
 src/main.js                                  |    2 
 src/views/business/reliabilityPlan/plan.vue  |   27 ++++++++-----
 src/api/business/reliabilityPlan.js          |   18 +++++++++
 src/views/business/reliabilityPlan/index.vue |   68 +++++++++++++++++++++++++++------
 5 files changed, 94 insertions(+), 25 deletions(-)

diff --git a/src/api/business/reliabilityPlan.js b/src/api/business/reliabilityPlan.js
index edb2bf4..e97a1d8 100644
--- a/src/api/business/reliabilityPlan.js
+++ b/src/api/business/reliabilityPlan.js
@@ -68,6 +68,15 @@
   });
 }
 
+//鑾峰彇鍘熻緟鏉愪骇鍝佹楠岄」
+export function materialItem(query) {
+  return request({
+    url: "/reliabilityPlanProductItem/materialItem",
+    method: "get",
+    params: query,
+  });
+}
+
 //鑾峰彇浜у搧妫�楠岄」
 export function codeList(query) {
   return request({
@@ -77,6 +86,15 @@
   });
 }
 
+//鑾峰彇鍘熻緟鏉愪骇鍝佹楠岄」
+export function materialCodeList(query) {
+  return request({
+    url: "/reliabilityPlanProductItem/materialCodeList",
+    method: "get",
+    params: query,
+  });
+}
+
 //鏇存柊鎻掑叆浜у搧璁″垝
 export function addOrUpdateItem(query) {
   return request({
diff --git a/src/main.js b/src/main.js
index aa5d22e..7d6ac6b 100644
--- a/src/main.js
+++ b/src/main.js
@@ -66,7 +66,7 @@
 Vue.prototype.HaveJson = (val) => {
   return JSON.parse(JSON.stringify(val));
 };
-Vue.prototype.javaApi = "http://10.21.10.78:8089";
+Vue.prototype.javaApi = "http://192.168.18.50:7002"; //娴嬭瘯搴擄細192.168.18.50:7002
 Vue.prototype.checkPermi = checkPermi;
 Vue.prototype.uploadHeader = {
   Authorization: "Bearer " + getToken(),
diff --git a/src/views/business/reliabilityPlan/index.vue b/src/views/business/reliabilityPlan/index.vue
index c989737..a0d9c30 100644
--- a/src/views/business/reliabilityPlan/index.vue
+++ b/src/views/business/reliabilityPlan/index.vue
@@ -97,12 +97,16 @@
           <el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree"
             :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false, emitPath: false }"
             :show-all-levels="false" clearable filterable placeholder="璇烽�夋嫨鍘熻緟鏉愬悕绉�" size="small" style="width: 100%;"
-            :disabled="operationType === 'review' || operationType === 'submit'">
+            :disabled="operationType === 'review' || operationType === 'submit'" @change="handleMaterialNameChange">
           </el-cascader>
         </el-form-item>
         <el-form-item label="闆朵欢鍙�" prop="partNo">
-          <el-input v-model="materialForm.partNo" placeholder="璇峰~鍐欓浂浠跺彿"
-            :disabled="operationType === 'review' || operationType === 'submit'"></el-input>
+          <el-select v-model="materialForm.partNo" placeholder="璇烽�夋嫨" clearable filterable
+            :disabled="operationType === 'review' || !materialForm.materialName || operationType === 'submit'"
+            style="width: 100%;">
+            <el-option v-for="item in materialPartNoOption" :key="item.id" :label="item.partNo" :value="item.partNo">
+            </el-option>
+          </el-select>
         </el-form-item>
         <!-- <el-form-item label="瀹℃牳浜�" prop="reviewerId">
           <el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;"
@@ -159,6 +163,7 @@
       tableData: [],
       typeOption: [],
       partNoOption: [], // 娣诲姞浜у搧鍨嬪彿閫夐」鏁版嵁
+      materialPartNoOption:[],
       tableLoading: false,
       itemParameterData: {
         cascaderField: {
@@ -470,19 +475,56 @@
         }
       } else {
         this.materialDia = true
-        if (this.operationType === 'add') {
-          this.materialForm = {
-            id: '',
-            materialName: '',
-            partNo: '',
-            state: '',
-            reviewerId: ''
+          if (this.operationType === 'add') {
+            this.materialForm = {
+              id: '',
+              materialName: '',
+              partNo: '',
+              state: '',
+              reviewerId: ''
+            }
+          } else {
+            this.materialForm = { ...row }
+            // 缂栬緫鏃惰幏鍙栭�変腑鑺傜偣鐨処D骞跺姞杞界浉鍏虫暟鎹�
+            const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.materialName)
+            if (selectedNode) {
+              this.getMaterialPartNoOptions(selectedNode.id)
+            }
           }
-        } else {
-          this.materialForm = { ...row }
-        }
       }
     },
+
+    //鍘熻緟鏉愰浂浠跺彿閫夋嫨
+    handleMaterialNameChange(value) {
+        if (value) {
+          const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, value)
+          if (selectedNode) {
+            this.getMaterialPartNoOptions(selectedNode.id)
+          }
+        } else {
+          this.materialPartNoOption = []
+          this.materialForm.partNo = ''
+        }
+      },
+
+      // 鑾峰彇鍘熻緟鏉愰浂浠跺彿鍒楄〃
+      getMaterialPartNoOptions(materialId) {
+        if (!materialId) {
+          this.materialPartNoOption = []
+          return
+        }
+        getPartNoList({ productId: materialId }).then(res => {
+          if (res.code === 200) {
+            this.materialPartNoOption = res.data || []
+            if (this.materialPartNoOption.length === 0) {
+              this.materialForm.partNo = ''
+            }
+          }
+        }).catch(() => {
+          this.materialPartNoOption = []
+          this.materialForm.partNo = ''
+        })
+      },
     // 鎴愬搧淇℃伅鎻愪氦
     submitProForm(state) {
       this.submitProLoading = true
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) {
diff --git a/vue.config.js b/vue.config.js
index 8e990ec..467e75f 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -36,7 +36,8 @@
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://10.21.10.78:8089`,
+        // target: `http://10.21.10.124:8001`, //鏈湴
+        target: `http://192.168.18.50:7002`, //娴嬭瘯搴�
         changeOrigin: true,
         pathRewrite: {
           ["^" + process.env.VUE_APP_BASE_API]: "",
@@ -67,6 +68,7 @@
             loader: "worker-loader",
             options: {
               inline: "fallback",
+              filename: "[name].[contenthash].worker.js", // 娣诲姞鍐呭鍝堝笇鍒版枃浠跺悕
             },
           },
         },

--
Gitblit v1.9.3