From e03f39a06c9f17ee0bf9a2b1fa24b7de0ea2e3d4 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 15 九月 2023 11:47:29 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.22:9001/r/mom-before

---
 src/components/view/equipmentmaintain.vue |  123 +++++++++++++++++++++++++++++++++-------
 1 files changed, 100 insertions(+), 23 deletions(-)

diff --git a/src/components/view/equipmentmaintain.vue b/src/components/view/equipmentmaintain.vue
index 0de5776..18aefff 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"
@@ -245,7 +245,6 @@
                 placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" 
                 size="small" clearable ></el-input>
                     <el-tree :data="list" ref="tree" 
-                    style="height: 500px;overflow-y: auto;"
                     :props="{children: 'children',label: 'name'}" highlight-current node-key="name" default-expand-all
                          
                         @node-click="handleNodeClick"
@@ -263,11 +262,13 @@
 			<div class="right">
                 <el-table
                     :data="tableData"
-                    style="width: 100%;margin-bottom: 20px;"
-                    row-key="name"
+                    style="width: 100%;margin-bottom: 20px;height: 600px;overflow: auto;"
+                    row-key="rowId"
                     border
+                    @select="selectTr"
                     @selection-change="handleSelectionChange"
                     default-expand-all
+                    ref="multipleTable"
                     :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                     <el-table-column
                     type="selection"
@@ -318,7 +319,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>
@@ -368,6 +369,7 @@
                 tableData: [],
                 higherlevel:{},
                 quota:{},
+                carftrow:"",
                 unitrow:'',
             }
             
@@ -397,27 +399,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) {
@@ -538,9 +538,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,{
@@ -548,12 +565,21 @@
 			}).then(res => {
 				this.tableData = res.data;
                 console.log(this.tableData);
-
+                this.formatData(res.data)
 			})
 			},
             modify(){
                 this.modifyevent = true
             },
+            formatData(data){
+                let arr = data;
+                for(var i=0;i<arr.length;i++){
+                        arr[i].rowId = Math.random();
+                        if(arr[i].children != undefined){
+                        this.formatData(arr[i].children);
+                        }
+                    }
+                },
             //delQueById
             delQueById() {
 				this.$axios.post(this.$api.url.delQueById,{
@@ -568,9 +594,6 @@
 				this.upData.id = row.id
                 console.log(this.upData.id);
 				this.delQueById()
-			},
-            handleSelectionChange(val) {
-				this.selects = val
 			},
             //鎵归噺鍒犻櫎
 			delAllQue() {
@@ -594,6 +617,11 @@
                 let cc = this.selects.map(el => {
 					return el.id
 				})
+                // cc.forEach((el,idx) =>{
+                //     delete  idx[0]
+                // })
+                cc.splice(0,1)
+                console.log(cc);
 				this.delete = cc.join(',')
 				console.log(this.delete);
 				this.delAllQue()
@@ -609,6 +637,54 @@
             // // filterNode(){
 
             // },
+            handleSelectionChange(val) {
+                this.selects = 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);
+                        });
+                    }
+                }
+            },
           
         }
     }
@@ -662,6 +738,7 @@
 		height: calc(100% - 20px);
 		border-right: 3px solid rgb(245, 247, 251);
 		padding: 16px;
+		overflow-y: auto;
 	}
 
 	.thing .left .custom-tree-node span {

--
Gitblit v1.9.3