From 2ee83b3756f98579acec9786633d37ce87d0f747 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 28 九月 2023 14:12:44 +0800
Subject: [PATCH] 代码提交

---
 Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java   |    5 ++
 Source/UBCS-WEB/src/page/login/userlogin.vue                                                               |    1 
 Source/UBCS-WEB/src/views/system/user.vue                                                                  |   46 +++++++++++-----------
 Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java |   18 ++++++++
 4 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/Source/UBCS-WEB/src/page/login/userlogin.vue b/Source/UBCS-WEB/src/page/login/userlogin.vue
index 301be98..441ce6d 100644
--- a/Source/UBCS-WEB/src/page/login/userlogin.vue
+++ b/Source/UBCS-WEB/src/page/login/userlogin.vue
@@ -40,7 +40,6 @@
       </el-form-item>
 
       <el-form-item>
-        <el-button @click="ChandleLogin">娴嬭瘯鍗曠偣鐧诲綍</el-button>
         <el-button class="login-submit"
                    size="small"
                    type="primary"
diff --git a/Source/UBCS-WEB/src/views/system/user.vue b/Source/UBCS-WEB/src/views/system/user.vue
index ba45302..0f92d14 100644
--- a/Source/UBCS-WEB/src/views/system/user.vue
+++ b/Source/UBCS-WEB/src/views/system/user.vue
@@ -373,7 +373,7 @@
                   trigger: "click"
                 }],
                 span: 24,
-                value:"211833"
+                value:""
               },
               {
                 label: "鐧诲綍璐﹀彿",
@@ -1034,33 +1034,33 @@
       })
     },
     beforeOpen(done, type) {
-      // console.log(type)
+      //console.log(type)
       // console.log('this.tenantId',this.tenantId)
       // const column = this.findObject(this.option.group,'tenantId');
       // column.value=this.tenantId;
       // console.log('column',column)
-      if(this.treeDeptId){
-        if (["edit", "view"].includes(type)) {
-          getUser(this.form.id).then(res => {
-            this.form = res.data.data;
-            if (this.form.hasOwnProperty("deptId")) {
-              this.form.deptId = this.form.deptId.split(",");
-            }
-            if (this.form.hasOwnProperty("roleId")) {
-              this.form.roleId = this.form.roleId.split(",");
-            }
-            if (this.form.hasOwnProperty("postId")) {
-              this.form.postId = this.form.postId.split(",");
-            }
-          });
-        }
-        const prop = this.findObject(this.option.group, 'tenantId');
-        console.log('1',prop)
-        this.initFlag = true;
-        done();
-      }else {
-        this.$message.warning('璇烽�夋嫨涓�鏉℃墍灞炵鎴�')
+      // if(this.treeDeptId){
+      if (["edit", "view"].includes(type)) {
+        getUser(this.form.id).then(res => {
+          this.form = res.data.data;
+          if (this.form.hasOwnProperty("deptId")) {
+            this.form.deptId = this.form.deptId.split(",");
+          }
+          if (this.form.hasOwnProperty("roleId")) {
+            this.form.roleId = this.form.roleId.split(",");
+          }
+          if (this.form.hasOwnProperty("postId")) {
+            this.form.postId = this.form.postId.split(",");
+          }
+        });
       }
+      const prop = this.findObject(this.option.group, 'tenantId');
+      //console.log('1',prop)
+      this.initFlag = true;
+      done();
+      // }else {
+      //   this.$message.warning('璇烽�夋嫨涓�鏉℃墍灞炵鎴�')
+      // }
     },
     currentChange(currentPage) {
       this.page.currentPage = currentPage;
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java
index 8ec1b9b..d90ff86 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java
@@ -196,8 +196,11 @@
 			}
 		}
 		if (Func.isEmpty(role.getParentId())) {
-			role.setTenantId(AuthUtil.getTenantId());
 			role.setParentId(BladeConstant.TOP_PARENT_ID);
+			// 鍓嶇浼犱簡鏄睘浜庨偅涓鎴穒d涓嬬殑瑙掕壊
+			if(Func.isEmpty(role.getTenantId())){
+				role.setTenantId(AuthUtil.getTenantId());
+			}
 		}
 		if (role.getParentId() > 0) {
 			Role parent = getById(role.getParentId());
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java
index f85f3f4..799420e 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java
@@ -212,7 +212,7 @@
 	@Override
 	public List<Map<String,Object>> selectMaps(){
 		List<Map<String, Object>> mapList = listMaps(new QueryWrapper<Tenant>().select("TENANT_ID", "TENANT_NAME"));
-		if(Func.isNotEmpty(nacosConfigCache.getAdminUserInfo().getTenantId())){
+		if(Func.isNotEmpty(nacosConfigCache.getAdminUserInfo().getTenantId()) && !this.containsSameKeys(mapList,nacosConfigCache.getAdminUserInfo().getTenantId())){
 			Map<String, Object> map = new HashMap<>();
 			map.put("TENANT_ID",nacosConfigCache.getAdminUserInfo().getTenantId());
 			map.put("TENANT_NAME","绠$悊缁�");
@@ -222,6 +222,22 @@
 	}
 
 	/**
+	 * 鍒ゆ柇鏁版嵁搴撲腑鏄惁瀛樺湪浜庨厤缃枃浠朵腑涓�鑷寸殑瓒呯淇℃伅
+	 * @param collection
+	 * @param value
+	 * @return
+	 */
+	private boolean containsSameKeys(List<Map<String, Object>> collection, String value) {
+		for (Map<String, Object> map : collection) {
+			Collection<Object> values = map.values();
+			if (values.contains(value)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
 	 * 涓夊憳鐩稿叧閰嶇疆
 	 * @return
 	 */

--
Gitblit v1.9.3