From bef0978ab26369e2000820fafe76a1494ef7a3f0 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期三, 13 九月 2023 14:34:50 +0800
Subject: [PATCH] 改bug

---
 src/components/view/laboratoryManagement.vue      |  180 ++++++++++++++++++-----------
 src/components/view/mbom.vue                      |   53 ++++++--
 src/components/view/equipmentmaintain.vue         |   55 ++++++++
 src/main.js                                       |    3 
 src/components/view/Technicalindex.vue            |   48 +++++++
 src/components/view/standard-table/technology.vue |    1 
 src/assets/api/controller.js                      |    1 
 7 files changed, 246 insertions(+), 95 deletions(-)

diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js
index 5c2b53c..70e6450 100644
--- a/src/assets/api/controller.js
+++ b/src/assets/api/controller.js
@@ -138,6 +138,7 @@
 	delQueById:"/techniqueModel/delQueById",//鍒犻櫎
 	delAllQue:"/techniqueModel/delAllQue",//鎵归噺鍒犻櫎
 	selecQueById:"/techniqueModel/selecQueById",//缂栬緫
+	writeQueById:"/techniqueModel/writeQueById",//缂栬緫浼犲弬
 
 }
 const url = {
diff --git a/src/components/view/Technicalindex.vue b/src/components/view/Technicalindex.vue
index 9211f57..54ba8fe 100644
--- a/src/components/view/Technicalindex.vue
+++ b/src/components/view/Technicalindex.vue
@@ -91,7 +91,7 @@
                 placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" 
                 size="small" 
                 clearable @input="query" ></el-input>
-                    <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'father'}" node-key="name" default-expand-all
+                    <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'father'}" style="height: 500px;overflow-y: auto;" node-key="name" default-expand-all
                     @node-click="handleNodeClick" highlight-current
                         >
                     <div class="custom-tree-node" slot-scope="{ node, data }">
@@ -107,11 +107,13 @@
 			<div class="right">
                 <el-table
                     :data="tableData"
-                    style="width: 100%;margin-bottom: 20px;"
+                    style="width: 100%;margin-bottom: 20px; height: 580px;overflow: auto;"
                     row-key="name"
                     border
+                    @select="selectTr"
                     @selection-change="handleSelectionChange"
                     default-expand-all
+                    ref="multipleTable"
                     :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                     <el-table-column
                     type="selection"
@@ -397,7 +399,8 @@
                     unit:'',
                     id:'',
 
-                }
+                },
+                isAllSelect:false,
             }
             
         },
@@ -407,6 +410,44 @@
             
 		},
         methods:{
+              // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆
+                // 鍏ㄩ��/鍙栨秷閫夋搷浣�
+                selectAll(val) {
+                    this.isAllSelect = !this.isAllSelect;
+                    let data = this.tableData;
+                    this.toggleSelect(data, this.isAllSelect, "all");
+                },
+             //閫夋嫨鏌愯
+		    selectTr(selection, row) {
+                console.log(selection,row);
+                this.$set(row, "isChecked", !row.isChecked);
+                this.$nextTick(() => {
+                    this.isAllSelect = row.isChecked;
+                    this.toggleSelect(row, row.isChecked, "tr");
+                });
+            },
+             //閫掑綊瀛愮骇
+            toggleSelect(data, flag, type) {
+                if (type === "all") {
+                    console.log('222');
+                    if (data.length > 0) {
+                        data.forEach((item) => {
+                        this.toggleSelection(item, flag);
+                        if (item.children && item.children.length > 0) {
+                            this.toggleSelect(item.children, flag, type);
+                        }
+                        });
+                    }
+                } else {
+                    if (data.children && data.children.length > 0) {
+                        data.children.forEach((item) => {
+                        item.isChecked = !item.isChecked;
+                        this.$refs.multipleTable.toggleRowSelection(item, flag);
+                        this.toggleSelect(item, flag, type);
+                        });
+                    }
+                }
+            },
             handleClose(){
 
             },
@@ -631,6 +672,7 @@
 				// rows.splice(index, 1);
 			// },
             handleSelectionChange(val) {
+                console.log(val);
 				this.selects = val;
 			},
             //缂栬緫
diff --git a/src/components/view/equipmentmaintain.vue b/src/components/view/equipmentmaintain.vue
index 0de5776..91e466e 100644
--- a/src/components/view/equipmentmaintain.vue
+++ b/src/components/view/equipmentmaintain.vue
@@ -263,11 +263,13 @@
 			<div class="right">
                 <el-table
                     :data="tableData"
-                    style="width: 100%;margin-bottom: 20px;"
+                    style="width: 100%;margin-bottom: 20px;height: 600px;overflow: auto;"
                     row-key="name"
                     border
+                    @select="selectTr"
                     @selection-change="handleSelectionChange"
                     default-expand-all
+                    ref="multipleTable"
                     :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                     <el-table-column
                     type="selection"
@@ -318,7 +320,7 @@
                         width="200px">
                         <template slot-scope="scope" style="text-align: center;">
                             <div v-if="!scope.row.children">
-                        <el-button type="text" size="mini" @click="childrenClick(scope.row)">缂栬緫</el-button>
+                        <!-- <el-button type="text" size="mini" @click="childrenClick(scope.row)">缂栬緫</el-button> -->
                         <el-button type="text" size="mini" @click="deleteRow(scope.$index, scope.row)">鍒犻櫎</el-button>
                             </div>
                     </template>
@@ -569,9 +571,6 @@
                 console.log(this.upData.id);
 				this.delQueById()
 			},
-            handleSelectionChange(val) {
-				this.selects = val
-			},
             //鎵归噺鍒犻櫎
 			delAllQue() {
 				this.$axios.post(this.$api.url.delAllQue,{
@@ -609,6 +608,52 @@
             // // filterNode(){
 
             // },
+            handleSelectionChange(val) {
+                this.deleteList = [];
+                val.forEach((v) => {
+                if (v.id !== undefined) {
+                    this.deleteList.push(v.id);
+                }
+                });
+			},
+             // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆
+                // 鍏ㄩ��/鍙栨秷閫夋搷浣�
+                selectAll(val) {
+                    this.isAllSelect = !this.isAllSelect;
+                    let data = this.tableData;
+                    this.toggleSelect(data, this.isAllSelect, "all");
+                },
+             //閫夋嫨鏌愯
+		    selectTr(selection, row) {
+                console.log(selection,row);
+                this.$set(row, "isChecked", !row.isChecked);
+                this.$nextTick(() => {
+                    this.isAllSelect = row.isChecked;
+                    this.toggleSelect(row, row.isChecked, "tr");
+                });
+            },
+             //閫掑綊瀛愮骇
+            toggleSelect(data, flag, type) {
+                if (type === "all") {
+                    console.log('222');
+                    if (data.length > 0) {
+                        data.forEach((item) => {
+                        this.toggleSelection(item, flag);
+                        if (item.children && item.children.length > 0) {
+                            this.toggleSelect(item.children, flag, type);
+                        }
+                        });
+                    }
+                } else {
+                    if (data.children && data.children.length > 0) {
+                        data.children.forEach((item) => {
+                        item.isChecked = !item.isChecked;
+                        this.$refs.multipleTable.toggleRowSelection(item, flag);
+                        this.toggleSelect(item, flag, type);
+                        });
+                    }
+                }
+            },
           
         }
     }
diff --git a/src/components/view/laboratoryManagement.vue b/src/components/view/laboratoryManagement.vue
index 5fb48be..f03f361 100644
--- a/src/components/view/laboratoryManagement.vue
+++ b/src/components/view/laboratoryManagement.vue
@@ -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: {
diff --git a/src/components/view/mbom.vue b/src/components/view/mbom.vue
index cfe1abd..5472b93 100644
--- a/src/components/view/mbom.vue
+++ b/src/components/view/mbom.vue
@@ -194,7 +194,7 @@
 				process:{},
 				// handleClose:[],
 				checkTreeNode:{
-					id:2,
+					id:'',
 				},
 				tableData:[],
 				tableapi:[{
@@ -253,16 +253,18 @@
             })
 			},
 			addMbom(data) {
-				this.$axios.post(this.$api.url.addMbom,data
-				// {
-					// name:this.tableapi.name,
-					// qualityTraceability:this.tableapi.qualityTraceability,
-					// specifications:this.tableapi.specifications,
-					// supplier:this.tableapi.supplier,
-					// techTemId:this.craftapi.id,
-					// unit:this.tableapi.unit,
-				// }
-				, {
+				this.$axios.post(this.$api.url.addMbom,data,{
+					// params:{
+					// 	techTemId:this.craftapi.id,
+					// 	mbomModelDto2List:[{
+					// 		name:this.tableapi.name,
+					// 		qualityTraceability:this.tableapi.qualityTraceability,
+					// 		specifications:this.tableapi.specifications,
+					// 		supplier:this.tableapi.supplier,
+					// 		unit:this.tableapi.unit,
+					// 	}]
+					// }
+				}, {
 					headers: {
                 		"Content-Type": "application/json"
               		}
@@ -305,6 +307,26 @@
 				this.$nextTick(() => {
 				this.$refs.tree.setCurrentKey(this.list[0].children[0].name) // 榛樿閫変腑鑺傜偣绗竴涓�
 			})
+				let one=this.list.filter(item=>{
+				return item.children.length>0
+				})[0]
+				console.log(one);
+				let name=one.children[0].id
+				console.log(name);
+				this.selectAllMbomStart(name)
+				this.selectDataList();
+			}, {
+				headers: {
+                		"Content-Type": "application/json"
+              		}
+            })
+			},
+			selectAllMbomStart(name) {
+			this.$axios.get(this.$api.url.selectAllMbom,{
+				params:{id:name}
+			}).then(res => {
+				this.tableData = res.data;
+				console.log(this.tableData);
 			}, {
 				headers: {
                 		"Content-Type": "application/json"
@@ -326,6 +348,7 @@
 			},
 			handleNodeClick(data){
                 this.checkTreeNode = data
+				console.log(data);
 				console.log(this.checkTreeNode.id);
 				this.selectAllMbom()
             },
@@ -336,28 +359,24 @@
 				})
 				.catch(_ => {});
 			},
+			//鏂板
             event(){
                 this.dialogVisible = true
 				this.chooseTechFath()
             },
+			//娣诲姞琛�
 			 Addrow() {
 			if (this.tableapi == undefined) {
 				this.tableapi = new Array();
 			}
 			let obj = [];
-			
 			this.tableapi.push(obj);
 			},
 			skipshow(){
 				console.log('666');
 				let data = this.tableapi.at(-1)
-				// this.addMbom()
 				data.techTemId = this.search.craft
-				// console.log(this.search.craft);
-				// console.log(data);
-
 				this.addMbom(data)
-				
 				this.dialogVisible = false
 			},
 			//delAllMbom 鎵归噺鍒犻櫎
diff --git a/src/components/view/standard-table/technology.vue b/src/components/view/standard-table/technology.vue
index cffdb58..3186948 100644
--- a/src/components/view/standard-table/technology.vue
+++ b/src/components/view/standard-table/technology.vue
@@ -69,7 +69,6 @@
       console.log(this.tableData)
     },
     mounted() {
-      
     },
     methods: {
       // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆
diff --git a/src/main.js b/src/main.js
index a3be056..9417325 100644
--- a/src/main.js
+++ b/src/main.js
@@ -12,6 +12,7 @@
 import swal from 'sweetalert'
 
 Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80/"; //鍓嶇鏈湴绔彛
+
 Vue.prototype.HaveJson = (val) => {
 	return JSON.parse(JSON.stringify(val))
 }
@@ -26,7 +27,7 @@
 const javaApi = 'http://192.168.0.23:8001'
 // localhost 127.0.0.1
 
-// const javaApi = 'http://127.0.0.1'
+// const javaApi = 'http://127.0.0.1:8001/'
 
 
 

--
Gitblit v1.9.3