Pārlūkot izejas kodu

长江水利,白求恩需求开发

maotao 1 mēnesi atpakaļ
vecāks
revīzija
0aad0e7e2f

+ 34 - 4
src/app/views/login/login.component.ts

@@ -294,6 +294,7 @@ export class LoginComponent implements OnInit {
294 294
     let roleMenus = data.user.menu;
295 295
     let canLogin = false; //是否可以进入系统主页面(无护士端,调度台,药房端权限)
296 296
     let successLoginMsg = true; //登录成功提示,true是提示,false不提示
297
+		let sy = false;
297 298
     let fwt = false;
298 299
     let ddt = false;
299 300
 		let bbj = false;
@@ -302,8 +303,13 @@ export class LoginComponent implements OnInit {
302 303
 		let blk = false;
303 304
 		let web = false;
304 305
     let yfang = false;
306
+		let gglb = false;
307
+		let gzgd = false;
305 308
     roleMenus.forEach((e) => {
306
-      if (e.link == "pharmacy") {
309
+			if (e.link == "home") {
310
+			  sy = true;
311
+			  console.log("首页");
312
+			}else if (e.link == "pharmacy") {
307 313
         yfang = true;
308 314
         console.log("药房端");
309 315
       } else if (e.link == "nurse") {
@@ -328,6 +334,12 @@ export class LoginComponent implements OnInit {
328 334
       } else if (e.link == "webRepairs") {
329 335
         web = true;
330 336
         console.log("web报修");
337
+      }else if (e.link == "orderManagement") {
338
+        gglb = true;
339
+        console.log("工单列表");
340
+      }else if (e.link == "incidentManagement") {
341
+        gzgd = true;
342
+        console.log("故障工单");
331 343
       }
332 344
       canLogin = true;
333 345
     });
@@ -445,18 +457,36 @@ export class LoginComponent implements OnInit {
445 457
     }
446 458
     // 有菜单可以进入系统主页面
447 459
     if (!canLogin) {
448
-      this.msg.success("暂无权限进入系统!", {
460
+      this.msg.error("暂无权限进入系统!", {
449 461
         nzDuration: 2000,
450 462
       });
451 463
     } else {
464
+			if(!gglb && !gzgd && !sy){
465
+				this.msg.error("暂无权限进入系统!", {
466
+				  nzDuration: 2000,
467
+				});
468
+				return
469
+			}
452 470
       if (successLoginMsg) {
453 471
         this.msg.success("登录成功!", {
454 472
           nzDuration: 2000,
455 473
         });
456 474
       }
457 475
       successLoginMsg = false;
458
-      localStorage.setItem("user", JSON.stringify(data.user));
459
-      this.router.navigateByUrl("/main/home");
476
+			localStorage.setItem("user", JSON.stringify(data.user));
477
+			if(gglb){
478
+				this.router.navigateByUrl("/main/orderManagement");
479
+				return
480
+			}else if(gzgd){
481
+				this.router.navigateByUrl("/main/incidentManagement");
482
+				return
483
+			}
484
+			if(gglb && gzgd && sy){
485
+				this.router.navigateByUrl("/main/home");
486
+			}
487
+			if(!gglb && !gzgd && sy){
488
+				this.router.navigateByUrl("/main/home");
489
+			}
460 490
     }
461 491
   }
462 492
   // 处理树数据(parent格式转为children格式)

+ 1 - 1
src/app/views/main/main.component.html

@@ -7,7 +7,7 @@
7 7
     </div>
8 8
     <!-- 导航重写,兼容chrome39 -->
9 9
     <ul id="ds-menu">
10
-      <li class="mainMenuOne" (click)="totoMenu('首页')" [ngClass]="{mainMenuSelected:indexFlag}">
10
+      <li class="mainMenuOne" *ngIf="homeRole" (click)="totoMenu('首页')" [ngClass]="{mainMenuSelected:indexFlag}">
11 11
         <i nz-icon nzType="home"></i>
12 12
         <span nzTooltipPlacement="right" nz-tooltip nzTooltipTitle="首页">首页</span>
13 13
       </li>

+ 5 - 1
src/app/views/main/main.component.ts

@@ -40,7 +40,7 @@ export class MainComponent implements OnInit, OnDestroy {
40 40
   menus: any = JSON.parse(localStorage.getItem("menu"));
41 41
   currentHospital; //当前院区
42 42
   routerEventsListener; //监听路由
43
-
43
+	homeRole: boolean = false; //首页权限
44 44
 	speediness: boolean = false; //新增报修权限
45 45
   deskRole: boolean = false; //调度台权限
46 46
   nurseRole: boolean = false; //护士端权限
@@ -316,6 +316,10 @@ export class MainComponent implements OnInit, OnDestroy {
316 316
     let menus = JSON.parse(localStorage.getItem("menu"));
317 317
     let arr = [];
318 318
     menus.forEach((e) => {
319
+			if (e.link == "home") {
320
+			  this.homeRole = true;
321
+			  console.log("首页权限");
322
+			}
319 323
       if (e.link == "nurse") {
320 324
         this.nurseRole = true;
321 325
         console.log("护士端权限");