Browse Source

新增登录账号权限判断

dev
陈鹏飞 3 years ago
parent
commit
9fb264d0eb
  1. 9
      src/app/pages/init3D.guard.ts
  2. 2
      src/app/pages/left-domain/left-domain.component.ts
  3. 21
      src/app/pages/plan/plan.component.ts

9
src/app/pages/init3D.guard.ts

@ -16,15 +16,6 @@ export class init3DGuard implements CanActivate {
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot,): Promise<boolean> {
return this.getGasStationBaseInfo().then((res: any) => {
sessionStorage.setItem("3dSceneData", JSON.stringify(res))
if (true) //是superadmin,是内部制作账号
{
ModeManager.s_isMakeMode = true;
}
else {
ModeManager.s_isMakeMode = true;
}
let isMakeMode = ModeManager.s_isMakeMode
if (isMakeMode || res.hasBuildingInfo) {
return true

2
src/app/pages/left-domain/left-domain.component.ts

@ -126,7 +126,7 @@ export class LeftDomainComponent implements OnInit {
return
}
PlanComponent.instance.isShowLoading = true //打开遮罩
let institutionKey = sessionStorage.getItem('unitId') || "ceshi"; //单位id
let institutionKey = PlanComponent.instance.companyData.id || "ceshi"; //单位id
let buildingKey = PlanComponent.instance.buildingUIItems.find(item => { return item.getBuildingID() == PlanComponent.instance.beforeOneBuildingID })
let url = DataManager.getResPath_facilityProperty(institutionKey, buildingKey.getBuildingID(), item.getType(), item.getID(), null)
ServeManager.instance.openFileSelect(file, url, (name: string, path: string) => { //上传

21
src/app/pages/plan/plan.component.ts

@ -50,7 +50,7 @@ export class PlanComponent implements OnInit {
public beforeOneSatus; //当前 satus
public canvas: HTMLCanvasElement; //canvas 实例
public editMode: boolean = true; //编辑/查看 模式
public userMode: boolean = ModeManager.s_isMakeMode; //是否为 内部权限
public userMode: boolean = false; //是否为 内部权限
public bucketName: string = ObjectsService.getFullPath("文件路径"); //当前桶名
public isShowLoading: boolean = true; //显隐 loading加载条
public companyData: any; //当前加油站所属组织机构 data
@ -63,7 +63,6 @@ export class PlanComponent implements OnInit {
ServeManager.Init(this.buildingBISrv, this.objectsSrv);
this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement;
this.game.init(this.canvas);
this.companyData = (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization || {}
let editMode = sessionStorage.getItem('isGasStation')
if (editMode == 'false') {
@ -73,7 +72,14 @@ export class PlanComponent implements OnInit {
this.editMode = false
ModeManager.currentMode = ModeType.Look
}
let userdata = JSON.parse(sessionStorage.getItem('userdata'))
if (userdata.userName == 'superadmin') { //是superadmin,是内部制作账号
this.userMode = true
ModeManager.s_isMakeMode = true;
} else {
this.userMode = false
ModeManager.s_isMakeMode = false;
}
//监听 delete键盘事件
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => {
if (event.keyCode == 46) { //delete
@ -110,6 +116,8 @@ export class PlanComponent implements OnInit {
let name = simpleData.name;
let id = simpleData.id;// 单位id
loginStatus.createInsitution(simpleData.key, name, id);
} else {
history.back(); //回退上一步路由
}
}
else //非内部制作模式,不开启
@ -434,7 +442,7 @@ export class PlanComponent implements OnInit {
return
}
this.isShowLoading = true //打开遮罩
let institutionKey = sessionStorage.getItem('unitId') || "ceshi"; //单位id
let institutionKey = this.companyData.id || "ceshi"; //单位id
let buildingKey = this.buildingUIItems.find(item => { return item.getBuildingID() == this.beforeOneBuildingID })
let facility = this.beforeOnePropertyData
let url = DataManager.getResPath_facilityProperty(institutionKey, buildingKey.getBuildingID(), facility.getType(), facility.getID(), null)
@ -695,16 +703,13 @@ export class PlanComponent implements OnInit {
return
}
this.isShowLoading = true //打开遮罩
let institutionKey = sessionStorage.getItem('unitId') || "ceshi"; //单位id
let institutionKey = this.companyData.id || "ceshi"; //单位id
let resType = isVideo ? ResType.Video : ResType.Texture
let key = `${(new Date()).getMonth() + 1}-${(new Date()).getDate()}-${(new Date()).getHours()}`
let url = DataManager.getResPath_mark(institutionKey, resType, key) //url
ServeManager.instance.openFileSelect(file, url, (name: string, path: string) => { //上传
if (!isVideo) { //img
this.beforePlanNode.texture = ObjectsService.getFullPath(path + name)
console.log("上传图片保存数据", this.beforePlanNode);
this.initViewer()
} else { //video
this.beforePlanNode.video = ObjectsService.getFullPath(path + name)

Loading…
Cancel
Save