From e611a1e0dce2d8c5430c43cc15c37dc3df475d60 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期五, 15 九月 2023 15:43:33 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.22:9001/r/mom-before

---
 src/components/view/equipmentmaintain.vue |   99 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/src/components/view/equipmentmaintain.vue b/src/components/view/equipmentmaintain.vue
index 528295c..7ed148f 100644
--- a/src/components/view/equipmentmaintain.vue
+++ b/src/components/view/equipmentmaintain.vue
@@ -108,7 +108,7 @@
             <!-- 鏂板寮圭獥 -->
         <div>
             <el-dialog
-            title="鎶�鏈寚鏍囨柊澧�"
+            title="鐢熶骇宸ヨ壓鏂板"
             :visible.sync="dialogVisible"
             width="40%">
             <el-form ref="form" :model="form" label-width="80px">
@@ -141,7 +141,7 @@
                     <el-col :span="11" :offset="2">
                         <el-form-item label="宸ヨ壓鍚嶇О">
                             <template>
-                        <el-select v-model="form.craft" placeholder="璇烽�夋嫨" >
+                        <el-select v-model="form.craft" @change="carftapi" placeholder="璇烽�夋嫨" >
                             <el-option
                             v-for="item in craftapi"
                             :key="item.id"
@@ -265,6 +265,7 @@
                     style="width: 100%;margin-bottom: 20px;height: 600px;overflow: auto;"
                     row-key="rowId"
                     border
+                    @select-all="selectAll"
                     @select="selectTr"
                     @selection-change="handleSelectionChange"
                     default-expand-all
@@ -369,6 +370,7 @@
                 tableData: [],
                 higherlevel:{},
                 quota:{},
+                carftrow:"",
                 unitrow:'',
             }
             
@@ -398,27 +400,25 @@
             // //鏂板
             choosePro() {//椤圭洰
 			this.$axios.get(this.$api.url.choosePro,{
-                params:{techTemId:this.checkTreeNode.id}
+                params:{techTemId:this.carftrow}
             }).then(res => {
 				this.project = res.data;
                 console.log(this.process);
-			}, {
-				headers: {
-                		"Content-Type": "application/json"
-              		}
-            })
+			})
+            },
+            carftapi(val) {
+                console.log(val);
+                this.carftrow = val
+                this.chooseDeiv()
+                this.choosePro()
             },
             chooseDeiv() {//璁惧
 			this.$axios.get(this.$api.url.chooseDeiv,{
-                params:{techTemId:this.checkTreeNode.id}
+                params:{techTemId:this.carftrow}
             }).then(res => {
 				this.higherlevel = res.data;
                 console.log(this.process);
-			}, {
-				headers: {
-                		"Content-Type": "application/json"
-              		}
-            })
+			})
             },
             //鏂板
             edittype(val) {
@@ -539,9 +539,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.checkTreeNode.id = name
+                this.selectAllTequeStart(name)
+                this.selectDataList();
 			})
 			},
-    
+            selectAllTequeStart(name) {
+			this.$axios.get(this.$api.url.selectAllTeque,{
+				params:{id:this.checkTreeNode.id}
+			}).then(res => {
+				this.tableData = res.data;
+                console.log(this.tableData);
+                this.formatData(res.data)
+			})
+			},
             //涓讳綋鍙�
             selectAllTeque() {
 			this.$axios.get(this.$api.url.selectAllTeque,{
@@ -590,18 +607,17 @@
 			},
 
             dels() {
-				this.selects.forEach(a => {
-					for (var b = 0; b < this.tableData.length; b++) {
-						if (this.tableData[b].id == a.id) {
-							this.tableData.splice(b, 1)
-							b--
-						}
-					}
-				})
-                let cc = this.selects.map(el => {
-					return el.id
-				})
-				this.delete = cc.join(',')
+                let ee = []
+                console.log(this.selects);
+                this.selects.forEach(el =>{ 
+                    if(el.children){
+                        el.children.forEach(ele =>{
+                            ee.push(ele.id)
+                        })   
+                    } 
+                })
+                console.log(ee);
+				this.delete = ee.join(',')
 				console.log(this.delete);
 				this.delAllQue()
 				this.$message.success('鍒犻櫎瀹屾垚')
@@ -617,6 +633,8 @@
 
             // },
             handleSelectionChange(val) {
+                this.selects = val
+                // console.log(this.selects);
                 this.deleteList = [];
                 val.forEach((v) => {
                 if (v.id !== undefined) {
@@ -624,13 +642,15 @@
                 }
                 });
 			},
-             // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆
-                // 鍏ㄩ��/鍙栨秷閫夋搷浣�
-                selectAll(val) {
-                    this.isAllSelect = !this.isAllSelect;
-                    let data = this.tableData;
+            // 鍏ㄩ��/鍙栨秷閫夋搷浣�
+            selectAll(val) {
+                // console.log(val);
+                this.isAllSelect = !this.isAllSelect;
+                let data = this.tableData;
+                this.$nextTick(() =>{
                     this.toggleSelect(data, this.isAllSelect, "all");
-                },
+                })
+            },
              //閫夋嫨鏌愯
 		    selectTr(selection, row) {
                 console.log(selection,row);
@@ -639,11 +659,21 @@
                     this.isAllSelect = row.isChecked;
                     this.toggleSelect(row, row.isChecked, "tr");
                 });
+
+            },
+            toggleSelection(row, flag) {
+                this.$set(row, "isChecked", flag);
+                this.$nextTick(() => {
+                if (flag) {
+                    this.$refs.multipleTable.toggleRowSelection(row, flag);
+                } else {
+                    this.$refs.multipleTable.clearSelection();
+                }
+                });
             },
              //閫掑綊瀛愮骇
             toggleSelect(data, flag, type) {
                 if (type === "all") {
-                    console.log('222');
                     if (data.length > 0) {
                         data.forEach((item) => {
                         this.toggleSelection(item, flag);
@@ -662,7 +692,6 @@
                     }
                 }
             },
-          
         }
     }
 </script>

--
Gitblit v1.9.3