From 9ddf303ca99059fac2d6b83829f2d39c04d1cf5f Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期三, 13 九月 2023 18:04:20 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.22:9001/r/mom-before

---
 src/components/view/laboratoryManagement.vue |  206 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 136 insertions(+), 70 deletions(-)

diff --git a/src/components/view/laboratoryManagement.vue b/src/components/view/laboratoryManagement.vue
index 5fb48be..38548d3 100644
--- a/src/components/view/laboratoryManagement.vue
+++ b/src/components/view/laboratoryManagement.vue
@@ -1,8 +1,8 @@
 <template>
-  <div>
+  <div class="laboratoryMangement">
     <el-row>
       <el-col :span="12" class="top_left_name">璁惧缁存姢</el-col>
-      <el-col :span="12" style="text-align: right;">
+      <el-col :span="12" style="text-align: right;" class="title">
         <el-button
           @click="testItem()"
           type="primary"
@@ -39,6 +39,7 @@
                 <el-form-item label="璁惧鐢ㄩ��" prop="type">
                   <el-select
                     v-model="ruleForm.type"
+                    @change="selectinstall"
                     placeholder="璇烽�夋嫨璁惧鐢ㄩ��"
                   >
                     <el-option label="鐢熶骇璁惧" value="1"></el-option>
@@ -207,12 +208,11 @@
           :data="towTree"
           ref="tree"
           :props="{ children: 'children', label: 'father' }"
-          node-key="id"
+          node-key="father"
           default-expand-all
           highlight-current
           style="margin-top: 20px;"
           @node-click="handleNodeClick"
-          
         >
           <div class="custom-tree-node" slot-scope="{ node, data }">
             <span
@@ -397,8 +397,10 @@
   name: "LaboratoryManagement",
   data() {
     return {
+
       value: "",
       dialogVisible: false,
+      checkTreeNode:{},
       isCollapse: true, //榛樿涓哄睍寮�
       radio1: "true", // 鍒嗙被鍒囨崲
       tableData: [], // 涓婚〉琛ㄦ牸鏁版嵁
@@ -411,7 +413,7 @@
       staue_value: "", // 涓婚〉琛ㄦ牸涓婃柟鐨勭姸鎬侀�夋嫨
       // BOM鏍戞暟鎹粨鏋�
       towTree: [],
-      equipment: '',
+      equipment: '1',
       equaip:'',
       ruleForm: {
         // 鏂板浠櫒琛ㄥ崟
@@ -424,10 +426,11 @@
         name: "",
         rawInsProductId: "",
         type: "",
-        treedata:{
-            father:'璁惧缁�1',
-        },
+        // treedata:{
+        //     father:'璁惧缁�1',
+        // },
         equr:'',
+       
       },
       delete:{},
       equip:1,
@@ -473,25 +476,29 @@
     this.twoTreeApi();
     // 鍒濆鍖栬皟鐢ㄨ〃鏍兼暟鎹�
     // this.tableDataApi();
-    this.selectDevice()//鍙宠竟
+    // this.selectDevice()
   },
   methods: {
-    selectDevice() {//鍙宠竟鏁版嵁
-      console.log(this.ruleForm.treedata.father);
-      console.log(this.equip);
-      this.$axios.get(this.$api.url.selectDevice,{
-        params:{
-          father:this.ruleForm.treedata.father,
-          type:this.equip,
-        }
-      }).then(res =>{
-        console.log(res);
-        this.tableData = res.data
-      }, {
-				headers: {
-                		"Content-Type": "application/json"
-              		}
-      })
+    handleNodeClick(val) {
+      this.checkTreeNode = val
+      console.log(this.checkTreeNode);
+        this.selectDevice()
+    },
+   
+    staueValueChange() {
+      this.selectDevice()
+      // this.tableData = [];
+      // let val = 1;
+      // if (this.radio1 === "false") {
+      //   val = 2;
+      // }
+      // this.$axios
+      //   .get(this.$api.url.tableDeviceList, {
+      //     params: { type: val, deviceStatue: this.staue_value }
+      //   })
+      //   .then(res => {
+      //     this.tableData = res.data;
+      //   });
     },
     // 鍔ㄦ�佹帶鍒跺睍寮�涓庢敹璧峰拰鍒囨崲瀵瑰簲鍥炬爣
     isC() {
@@ -535,14 +542,21 @@
         .catch(_ => {});
     },
     testItem() {
-      this.listgroup()
       this.dialogVisible = true;
       this.$axios.get(this.$api.url.addDeviceKeeper).then(res => {
         this.keeperList = res.data;
       });
     },
+    selectinstall(val) {
+      this.equip = val
+      this.listgroup()
+    },
     listgroup() {
-        this.$axios.get(this.$api.url.listgroup).then(res =>{
+        this.$axios.get(this.$api.url.listgroup,{
+            params:{
+              type:this.equip
+            }
+        }).then(res =>{
             this.equaip = res.data
             console.log(this.equip);
         })
@@ -567,7 +581,51 @@
         //   }
         // });
         this.towTree = res.data;
-      });
+        this.$nextTick(() => {
+				this.$refs.tree.setCurrentKey(this.towTree[0].father) // 榛樿閫変腑鑺傜偣绗竴涓�
+			})
+      console.log(this.towTree);
+        let one=this.towTree[0]
+        console.log(one);
+        let name =one.father
+			  console.log(name);
+        this.selectDeviceStart(name)
+        });
+    },
+    selectDeviceStart(name,) {//鍙宠竟鏁版嵁
+      this.$axios.get(this.$api.url.selectDevice,{
+        params:{
+          father:name,
+          type:this.equip,
+          deviceStatus:this.staue_value,
+          message:this.codeNameModel,
+        }
+      }).then(res =>{
+        console.log(res);
+        this.tableData = res.data
+      }, {
+				headers: {
+                		"Content-Type": "application/json"
+              		}
+      })
+    },
+
+    selectDevice() {//鍙宠竟鏁版嵁
+      this.$axios.get(this.$api.url.selectDevice,{
+        params:{
+          father:this.checkTreeNode.father,
+          type:this.equip,
+          deviceStatus:this.staue_value,
+          message:this.codeNameModel,
+        }
+      }).then(res =>{
+        console.log(res);
+        this.tableData = res.data
+      }, {
+				headers: {
+                		"Content-Type": "application/json"
+              		}
+      })
     },
     addApi() {
       this.$axios.post(this.$api.url.addApi,{
@@ -581,9 +639,9 @@
         type:this.ruleForm.type,
       }, {headers: {"Content-Type": "application/json"}
     }).then(res =>{
-      this.selectDevice()
       this.$message.success('鏂板鎴愬姛')
       this.ruleForm = {}
+      this.selectDevice()
     })
     },
     // tableDataApi() {
@@ -592,15 +650,13 @@
     //   });
     // },
     reset() {
-      this.tableDataApi();
-      this.radio1 = "true";
-      this.codeNameModel = "";
-      this.staue_value = "";
-    },
-    handleNodeClick(data) {
-      console.log(data);
-        // this.treedata = data
-        this.selectDevice()
+      // this.tableDataApi();
+      // this.radio1 = "true";
+      // this.codeNameModel = "";
+      // this.staue_value = "";
+      this.staue_value = ""
+      this.codeNameModel = ""
+      this.selectDevice()
     },
     handlerDeptList() {
       this.towTree = [];
@@ -617,24 +673,25 @@
         });
     },
     selectSearch() {
-      this.tableData = [];
-      if (this.radio1 === "false") {
-        this.$axios
-          .get(this.$api.url.tableDeviceList, {
-            params: { type: 1, codeNameModel: this.codeNameModel }
-          })
-          .then(res => {
-            this.tableData = res.data;
-          });
-      } else if (this.radio1 === "true") {
-        this.$axios
-          .get(this.$api.url.tableDeviceList, {
-            params: { type: 2, codeNameModel: this.codeNameModel }
-          })
-          .then(res => {
-            this.tableData = res.data;
-          });
-      }
+      this.selectDevice()
+      // this.tableData = [];
+      // if (this.radio1 === "false") {
+      //   this.$axios
+      //     .get(this.$api.url.tableDeviceList, {
+      //       params: { type: 1, codeNameModel: this.codeNameModel }
+      //     })
+      //     .then(res => {
+      //       this.tableData = res.data;
+      //     });
+      // } else if (this.radio1 === "true") {
+      //   this.$axios
+      //     .get(this.$api.url.tableDeviceList, {
+      //       params: { type: 2, codeNameModel: this.codeNameModel }
+      //     })
+      //     .then(res => {
+      //       this.tableData = res.data;
+      //     });
+      // }
     },
     delDeviceById() {
       this.$axios.post(this.$api.url.delDeviceById,{
@@ -722,20 +779,7 @@
         }
       });
     },
-    staueValueChange() {
-      this.tableData = [];
-      let val = 1;
-      if (this.radio1 === "false") {
-        val = 2;
-      }
-      this.$axios
-        .get(this.$api.url.tableDeviceList, {
-          params: { type: val, deviceStatue: this.staue_value }
-        })
-        .then(res => {
-          this.tableData = res.data;
-        });
-    }
+  
   },
  
   watch: {
@@ -951,3 +995,25 @@
   line-height: 14px;
 }
 </style>
+<style>
+	.laboratoryMangement .title *{
+		font-size: 14px;
+	}
+	
+	.laboratoryMangement .table_top_div *{
+		font-size: 14px;
+	}
+	
+	.laboratoryMangement .title .el-button {
+	  height: 32px;
+	  border: 1px solid rgba(190, 190, 190, 0.44);
+	  box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41);
+	  padding: 0 12px;
+	}
+	.laboratoryMangement .table_top_div .el-button {
+	  height: 32px;
+	  border: 1px solid rgba(190, 190, 190, 0.44);
+	  box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41);
+	  padding: 0 12px;
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3