From 1988d77f4df3c01a9137303e0c959b3442c14377 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期一, 30 九月 2024 22:10:30 +0800
Subject: [PATCH] 1

---
 src/views/master/person/main/save.vue |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/views/master/person/main/save.vue b/src/views/master/person/main/save.vue
index c8f3180..585b4c7 100644
--- a/src/views/master/person/main/save.vue
+++ b/src/views/master/person/main/save.vue
@@ -38,9 +38,7 @@
 				</el-col>
 				<el-col :span="12">
 					<el-form-item label="閮ㄩ棬">
-						<el-select v-model="addPersonForm.organizationId" filterable style="width: 100%" placeholder="閮ㄩ棬">
-							<el-option v-for="item in organizationList" :key="item.id" :label="item.name" :value="item.id"/>
-						</el-select>
+						<el-tree-select @change= "parentIdChange" v-model="addPersonForm.organizationId" clearable placeholder="涓婄骇閮ㄩ棬" default-expand-all check-on-click-nod :data="departmentList" check-strictly :props="{ label: 'name' }" node-key="id" ref="parentTree" style="width: 100%" />
 					</el-form-item>
 				</el-col>
 				<el-col :span="12">
@@ -81,6 +79,9 @@
 		emits: ['success', 'closed'],
 		data() {
 			return {
+				departmentList: [],
+				parentData: {},
+				selectedIds: [],
 				deptIdList: [],
 				userIdList: [],
 				organizationList: [],
@@ -102,7 +103,7 @@
 					status: "",
 					postId: "",
 					email: "",
-					organizationId: "",
+					organizationId: [],
 					pinCode: "",
 					hireDate: "",
 					jobNumber: "",
@@ -139,6 +140,10 @@
 			this.getdeptId();  //鏁版嵁鏉冮檺璋冩暣
 		},
 		methods: {
+			parentIdChange(val) {
+				// var $parentId = this.$refs.parentTree.getCurrentNode().title;
+				// this.depatmentForm.$parentId = $parentId;
+			},
 			getdeptId() {  //鏁版嵁鏉冮檺璋冩暣
 				this.$HTTP.get(`/api/blade-system/data-scope-manager/tree`).then(res=> {
 					if(res.code == 200) {
@@ -153,10 +158,11 @@
 					}
 				})
 			},
-			getOrganizationList() {  //閮ㄩ棬
+			getOrganizationList() {
 				this.$HTTP.get(`/api/blade-cps/organization/tree?groupType=group_organization&groupCategory=1`).then(res=> {
 					if(res.code == 200) {
-						this.organizationList = res.data;
+						this.departmentList = res.data;
+						this.addPersonForm.organizationId = res.data[0].id;
 					}
 				})
 			},
@@ -219,10 +225,19 @@
 			setData(data){
 				this.$HTTP.get(`/api/blade-cps/employee/detail/${data.id}`).then(res=> {
 					if(res.code == 200) {
-						res.data.postId = res.data.postId.split(",");
-						res.data.deptId = res.data.deptId.split(",");
+						if(res.data.postId) {
+							res.data.postId = res.data.postId.split(",");
+						}else {
+							res.data.postId = [];
+						}
+						if(res.data.deptId) {
+							res.data.deptId = res.data.deptId.split(",");
+						}else {
+							res.data.deptId = [];
+						}
+						res.data.status = String(res.data.status);
 						//鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
-						Object.assign(this.addPersonForm, res.data)
+						Object.assign(this.addPersonForm, res.data);
 					}
 				})
 			}

--
Gitblit v1.9.3