From 3ca71791b839d7c9731643a8653c0b6fe1c6233a Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 10 四月 2024 17:08:19 +0800
Subject: [PATCH] 1

---
 src/views/master/person/main/personDepartment.vue     |   94 +++++++++----------------------
 src/views/master/person/main/personPerson.vue         |   14 +++-
 src/views/console/system/component-classification.vue |   21 +++++--
 src/views/master/person/main/personPost.vue           |   18 -----
 4 files changed, 53 insertions(+), 94 deletions(-)

diff --git a/src/views/console/system/component-classification.vue b/src/views/console/system/component-classification.vue
index 19889d3..ef11bb9 100644
--- a/src/views/console/system/component-classification.vue
+++ b/src/views/console/system/component-classification.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-04-09 22:18:47
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-04-10 10:26:42
+ * @LastEditTime: 2024-04-10 17:07:52
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/system/component-classification.vue
  * 鍒嗙被缁存姢
 -->
@@ -12,7 +12,7 @@
             <el-button @click="del" plain type="danger" :disabled="selection.length == 0">鍒犻櫎</el-button>
         </el-header>
         <el-main>
-            <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border default-expand-all lazy :load="tableLoad">
+            <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border default-expand-all>
                 <el-table-column type="selection" width="55" />
                 <el-table-column prop="name" label="鍒嗙被鍚嶇О" />
                 <el-table-column prop="icon" label="鍒嗙被鍥炬爣">
@@ -54,8 +54,18 @@
         this.queryList()
     },
     methods: {
-        tableLoad(row,treeNode,resolve) {
-                resolve(row.children);
+        removeHasChildren(arr) {  
+            return arr.map(item => {  
+                // 鍒涘缓涓�涓笉鍖呭惈hasChildren鐨勬柊瀵硅薄  
+                const newItem = { ...item };  
+                delete newItem.hasChildren; // 鍒犻櫎hasChildren瀛楁  
+                // 濡傛灉children瀛楁瀛樺湪涓旀槸鏁扮粍锛屽垯閫掑綊澶勭悊children  
+                if (Array.isArray(newItem.children)) {  
+                newItem.children = this.removeHasChildren(newItem.children);  
+                }  
+            
+                return newItem;  
+            });  
         },
         add () {
             alert(2)
@@ -65,8 +75,7 @@
         },
         queryList () {
             this.$API.setting.getList.get().then(res => {
-                this.tableData = res.data;
-                console.log(this.tableData,222)
+                this.tableData = this.removeHasChildren(res.data);
             })
             // this.$HTTP.get("/api/blade-system/menu/lazy-list",this.searchData).then(res=> {
 			// 		if(res.code == 200) {
diff --git a/src/views/master/person/main/personDepartment.vue b/src/views/master/person/main/personDepartment.vue
index ed3ea84..f2dde89 100644
--- a/src/views/master/person/main/personDepartment.vue
+++ b/src/views/master/person/main/personDepartment.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-04-09 21:00:31
+ * @LastEditTime: 2024-04-10 17:05:04
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -26,34 +26,16 @@
 				</div>
 			</div>
 			<div class="right-table">
-				<el-table
-					ref="multipleTableRef"
-					:data="departmentList"
-					border
-					style="width: 100%"
-					class="multipleTableRef"
-					@selection-change="handleSelectionChange"
-				>
+				<!-- lazy :load="tableLoad" -->
+				<el-table :data="departmentList" style="width: 100%;margin-bottom: 20px;"  row-key="id" border default-expand-all ref="treeRef" @selection-change="handleSelectionChange">
 					<el-table-column type="selection" width="55" />
-					<el-table-column
-					prop="date"
-					label="宀椾綅鍚嶇О">
-					</el-table-column>
-					<el-table-column
-					prop="name"
-					label="閮ㄩ棬浜烘暟">
-					</el-table-column>
-					<el-table-column
-					prop="name"
-					label="涓婄骇閮ㄩ棬">
-					</el-table-column>
-					<el-table-column
-					fixed="right"
-					label="鎿嶄綔">
-					<template #default="scope">
-						<el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
-						<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">鏌ョ湅</el-button>
-					</template>
+					<el-table-column prop="name" label="宀椾綅鍚嶇О"></el-table-column>
+					<el-table-column prop="peopleNum" label="閮ㄩ棬浜烘暟"></el-table-column>
+					<el-table-column prop="parentName" label="涓婄骇閮ㄩ棬"></el-table-column>
+					<el-table-column fixed="right" label="鎿嶄綔">
+						<template #default="scope">
+							<el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
+						</template>
 					</el-table-column>
 				</el-table>
 				<el-pagination
@@ -77,6 +59,7 @@
 		name: "bakalaka",
 		data(){
 			return {
+				selection: [],
 				total: 0,
 				searchData: {
 					groupType: 'group_organization',
@@ -86,26 +69,9 @@
 				},
 				statusList: [],
 				isSaveing: false,
-				groups: [],
-				departmentFrom: {
-					department: ""
-				},
-				departmentVisibleRules: {
-					department:[
-						{required: true, message: '璇烽�夋嫨閮ㄩ棬'}
-					]
-				},
-				departmentVisible: false,
 				dialog: {
 					save: false
 				},
-				leftActive: true,
-				input: '',
-				options: [{
-					value: '閫夐」1',
-					label: '榛勯噾绯�'
-				}],
-				input3: '',
 				departmentList: []
 			}
 		},
@@ -114,15 +80,29 @@
 		},
 		mounted(){
 			this.getStatus();
+			this.getOrganizationList();
 		},
 		components: {
 			saveDialog
 		},
 		methods: {
+			removeHasChildren(arr) {  
+				return arr.map(item => {  
+					// 鍒涘缓涓�涓笉鍖呭惈hasChildren鐨勬柊瀵硅薄  
+					const newItem = { ...item };  
+					delete newItem.hasChildren; // 鍒犻櫎hasChildren瀛楁  
+					// 濡傛灉children瀛楁瀛樺湪涓旀槸鏁扮粍锛屽垯閫掑綊澶勭悊children  
+					if (Array.isArray(newItem.children)) {  
+					newItem.children = this.removeHasChildren(newItem.children);  
+					}  
+				
+					return newItem;  
+				});  
+			},
 			getOrganizationList() {
 				this.$HTTP.get(`/api/blade-cps/organization/tree?` + this.$TOOL.qsStringify(this.searchData)).then(res=> {
 					if(res.code == 200) {
-						this.departmentList = res.data;
+						this.departmentList = this.removeHasChildren(res.data);
 					}
 				})
 			},
@@ -132,9 +112,6 @@
 						this.statusList = res.data;
 					}
 				})
-			},
-			departmentSubmit() {
-				this.departmentVisible=false;  //閮ㄩ棬璋冩暣
 			},
 			//娣诲姞
 			addPerson(){
@@ -149,25 +126,10 @@
 					this.$refs.saveDialog.open('edit').setData(row)
 				})
 			},
-			//鏌ョ湅
-			table_show(row){
-				this.dialog.save = true
-				this.$nextTick(() => {
-					this.$refs.saveDialog.open('show').setData(row)
-				})
+			handleSelectionChange (selection) {
+				this.selection = selection;
 			},
-			handleSelectionChange() {},
 			delPerson() {},
-			changeDepartment() {
-				this.departmentVisible = true;
-			},
-			changeTab(name) {
-				if(name == 1) {
-					this.leftActive = true;
-				}else {
-					this.leftActive = false;
-				}
-			},
 			handleSizeChange(val) {
 				console.log(`姣忛〉 ${val} 鏉);
 			},
diff --git a/src/views/master/person/main/personPerson.vue b/src/views/master/person/main/personPerson.vue
index 7f8584a..05d504b 100644
--- a/src/views/master/person/main/personPerson.vue
+++ b/src/views/master/person/main/personPerson.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-04-09 20:48:16
+ * @LastEditTime: 2024-04-10 15:37:41
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -17,7 +17,10 @@
 				<el-input v-model="input" placeholder="璇疯緭鍏ュ唴瀹�" size="small"></el-input>
 			</div>
 			<div class="person-tree">
-				<div v-for="(item,index) in titleList" :data-id="item.id" v-if="leftActive" :class="{treeActive: item.active}" @click="selectbtn(index)">{{item.name}}({{item.peopleNum}})</div>
+				<!-- 閮ㄩ棬 -->
+				<!-- <div v-for="(item,index) in titleList" :data-id="item.id" v-if="leftActive" :class="{treeActive: item.active}" @click="selectbtn(index)">{{item.name}}({{item.peopleNum}})</div> -->
+				<el-tree style="max-width: 600px" :data="titleList" :expand-on-click-node="false" default-expand-all :props="{label: 'name', children: 'children'}" class="treeActive" @node-click="titleListNode" />
+				<!-- 宀椾綅 -->
 				<div v-for="(item,index) in titleList" :data-id="item.id" v-if="!leftActive" :class="{treeActive: item.active}" @click="selectbtn(index)">{{item.postName}}</div>
 			</div>
 		</div>
@@ -176,6 +179,10 @@
 			saveDialog
 		},
 		methods: {
+			titleListNode(data) {
+				this.searchData.organizationCode = data.code;
+				this.searchPerson();
+			},
 			selectbtn(index) {
 				this.titleList.forEach(item=> {
 					item.active = false;
@@ -380,9 +387,6 @@
 	.person-tree {
 		font-size: 14px;
 		font-weight: 400;
-	}
-	.treeActive {
-		background-color: #d8e8e8;
 	}
 	.person-tree div {
 		margin-bottom: 8px;
diff --git a/src/views/master/person/main/personPost.vue b/src/views/master/person/main/personPost.vue
index 0d18ba3..fd8cf6c 100644
--- a/src/views/master/person/main/personPost.vue
+++ b/src/views/master/person/main/personPost.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-04-09 20:46:11
+ * @LastEditTime: 2024-04-10 15:44:08
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -80,16 +80,6 @@
 					keywords: ""
 				},
 				isSaveing: false,
-				groups: [],
-				departmentFrom: {
-					department: ""
-				},
-				departmentVisibleRules: {
-					department:[
-						{required: true, message: '璇烽�夋嫨閮ㄩ棬'}
-					]
-				},
-				departmentVisible: false,
 				dialog: {
 					save: false
 				},
@@ -137,9 +127,6 @@
 					}
 				})
 			},
-			departmentSubmit() {
-				this.departmentVisible=false;  //閮ㄩ棬璋冩暣
-			},
 			//娣诲姞
 			addPerson(){
 				this.dialog.save = true
@@ -177,9 +164,6 @@
 				})
 				this.selectId = selStr.replace(/,$/, '');
 				this.delPersonModel = true;
-			},
-			changeDepartment() {
-				this.departmentVisible = true;
 			},
 			handleSizeChange(val) {
 				console.log(`姣忛〉 ${val} 鏉);

--
Gitblit v1.9.3