From e5b9da3aee25769bc19a7982a7a8fc5886a56f15 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期二, 19 九月 2023 12:38:16 +0800
Subject: [PATCH] 	modified:   src/components/view/Processingproducts.vue 	modified:   src/components/view/sale.vue 	modified:   src/main.js

---
 src/components/view/Technicalindex.vue |  207 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 135 insertions(+), 72 deletions(-)

diff --git a/src/components/view/Technicalindex.vue b/src/components/view/Technicalindex.vue
index 03d8f56..905643d 100644
--- a/src/components/view/Technicalindex.vue
+++ b/src/components/view/Technicalindex.vue
@@ -94,7 +94,11 @@
 				<!-- 涓讳綋鍙� -->
 				<div class="right">
 					<el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%"
-						max-height="100%" row-key="name" border @selection-change="handleSelectionChange"
+						max-height="100%" row-key="name" border 
+						@select-all="selectAll"
+						@select="selectTr"
+						ref="multipleTable"
+						@selection-change="handleSelectionChange"
 						default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
 						<el-table-column type="selection" width="55">
 						</el-table-column>
@@ -196,7 +200,7 @@
 							<el-form-item label="绫诲瀷">
 								<template>
 									<el-select v-model="form.type" size="small" placeholder="璇烽�夋嫨" @change="edittype"
-										style="width: 554px;margin-right: 30px;">
+										style="width: 98%;margin-right: 30px;">
 										<el-option label="姗¤兌杩炴帴鍣�" :value="0"></el-option>
 										<el-option label="閲戝睘杩炴帴鍣�" :value="1"></el-option>
 										<el-option label="婀挎彃鎷旂數杩炴帴鍣�" :value="2"></el-option>
@@ -219,7 +223,7 @@
 								<el-col :span="11" :offset="2">
 									<el-form-item label="宸ヨ壓">
 										<template>
-											<el-select v-model="form.name" placeholder="璇烽�夋嫨" allow-create filterable>
+											<el-select v-model="form.name" style="width: 95%;" placeholder="璇烽�夋嫨" @change="craftrow" allow-create filterable>
 												<el-option v-for="item in craftapi" :key="item.id" :label="item.name" :value="item.id">
 												</el-option>
 											</el-select>
@@ -258,13 +262,13 @@
 								</el-col>
 								<el-col :span="11" :offset="2">
 									<el-form-item label="椤圭洰">
-										<el-input v-model="form.project" style="width: 200px;" placeholder="璇疯緭鍏ラ」鐩�"></el-input>
+										<el-input v-model="form.project" style="width: 95%;" placeholder="璇疯緭鍏ラ」鐩�"></el-input>
 									</el-form-item>
 								</el-col>
 							</el-row>
 
 							<el-form-item label="鍗曚綅">
-								<el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" style="width: 200px;"></el-input>
+								<el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" style="width: 35.95%;"></el-input>
 							</el-form-item>
 						</el-form>
 						<span slot="footer" class="dialog-footer">
@@ -281,53 +285,111 @@
 	export default {
 		data() {
 			return {
-				search: {
-					type: 0,
-					technology: null,
-				},
-				//   handleClose:[],
-				checkTreeNode: {
-					id: '',
-				},
-				higherlevel: [],
-				value: {},
-				options: [],
-				process: [],
-				filterNode: [],
-				list: [],
-				form: {
-					father: '',
-					work: '',
-					name: '',
-					unit: '',
-					project: '',
-				},
-				children: [],
-				modifyevent: false,
-				dialogVisible: false,
-				tableData: [],
-				typeselect: 0,
-				upData: {},
-				upDia: false,
-				craftapi: [],
-				edit: {
-					techFather: '',
-					techName: '',
-					father: '',
-					name: '',
-					unit: '',
-					id: ''
-				}
-			}
-		},
-		mounted() {
+              search:{
+                type:0,
+                technology:null,
+              },
+            //   handleClose:[],
+                checkTreeNode :{
+                    id:'',
+                },
+                higherlevel:[],
+                value:{},
+                options:[],
+                process:[],
+                filterNode:[],
+                list: [],
+                form:{
+                    father:'',
+                    work:'',
+                    name:'',
+                    unit:'',
+                    project:'',
+                },
+                children:[],
+                modifyevent:false,
+                dialogVisible:false,
+                tableData: [],
+				crafval:'',
+                typeselect:0,
+                upData:{},
+                upDia:false,
+                craftapi:[],
+                edit:{
+                    techFather:'',
+                    techName:'',
+                    father:'',
+                    name:'',
+                    unit:'',
+                    id:'',
+
+                },
+                isAllSelect:false,
+            }
+
+        },
+        mounted() {
 			this.selectAllleft()
 			this.selectAllright()
 		},
-		methods: {
-			handleClose() {
-
+        methods:{
+			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) {
+                this.$set(row, "isChecked", !row.isChecked);
+                this.$nextTick(() => {
+                    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) {
+				// console.log('222');
+                if (type === "all") {
+                    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(){},
 			selectDataList() {
 				this.list.forEach(a => {
 					a.code = '[1]'
@@ -372,7 +434,8 @@
 						"Content-Type": "application/json"
 					}
 				}).then(res => {
-					this.selectAllright()
+					/* this.selectAllright() */
+        			this.$parent.removeAllTab()	
 				})
 			},
 			submitUpData() { //纭畾
@@ -385,8 +448,9 @@
 				this.$axios.post(this.$api.url.delTechBy, {
 					id: this.upData.id
 				}).then(res => {
-					this.selectAllright()
+					/* this.selectAllright() */
 					this.$message.success('鍒犻櫎瀹屾垚')
+					this.$parent.removeAllTab()	
 				})
 			},
 			deleteRow(index, rows) {
@@ -400,22 +464,23 @@
 				this.$axios.post(this.$api.url.delAllTechskill, {
 					ids: this.delete
 				}).then(res => {
-					this.selectAllright()
+					/* this.selectAllright() */
+					this.$parent.removeAllTab()	
 				})
 			},
 			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)
+                        })   
+                    } 
+                })
+				// cc.splice(0,1)
+				this.delete = ee.join(',')
 				console.log(this.delete);
 				this.delAllTechskill()
 				this.$message.success('鍒犻櫎瀹屾垚')
@@ -474,6 +539,7 @@
 					})[0]
 					console.log(one);
 					let name = one.children[0].id
+					this.checkTreeNode.id = name
 					console.log(name);
 					this.selectAllrightStart(name)
 					this.selectDataList();
@@ -505,12 +571,16 @@
 					console.log(this.tableData);
 				});
 			},
+			craftrow(val){
+				this.crafval = val
+				this.chooseProFath()
+			},
 			//涓婄骇
 			chooseProFath() {
 				console.log(this.checkTreeNode.id);
 				this.$axios.get(this.$api.url.chooseProFath, {
 					params: {
-						techTemId: this.checkTreeNode.id
+						techTemId:this.crafval
 					}
 				}).then(res => {
 					this.higherlevel = res.data;
@@ -554,13 +624,6 @@
 			},
 			modify() {
 				this.modifyevent = true
-			},
-			// deleteRow(index, rows) {
-			// console.log();
-			// rows.splice(index, 1);
-			// },
-			handleSelectionChange(val) {
-				this.selects = val;
 			},
 			//缂栬緫
 
@@ -693,4 +756,4 @@
 		height: 30px;
 		border-radius: 2px;
 	}
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3