邵佳豪 2 years ago
parent
commit
e520bcc7f4
  1. 2
      src/app/pages/records/records-nav/records-nav.component.html
  2. 21
      src/app/pages/records/records-nav/records-nav.component.ts
  3. 4
      src/app/system-management/menu/addmenu/addmenu.component.html
  4. 4
      src/app/system-management/menu/editmenu/editmenu.component.html
  5. 28
      src/app/system-management/menu/menu.component.ts

2
src/app/pages/records/records-nav/records-nav.component.html

@ -4,7 +4,7 @@
<img src="../../../assets/images/logosm.png" alt="">
<div class="content">
<div class="contentitem">
<span (click)="selectMenu(item)" *ngFor="let item of menuList"
<span (click)="selectMenu(item)" *ngFor="let item of menu"
[ngClass]="{'selectedMenu': selectedMenu == item}">{{item}}</span>
</div>
</div>

21
src/app/pages/records/records-nav/records-nav.component.ts

@ -13,10 +13,29 @@ export class RecordsNavComponent implements OnInit {
isEcharts = true
menuList = ['预警类型统计', '卸油统计', '证照预警统计']
userMenu = []
menu=[]
selectedMenu
ngOnInit(): void {
let a= sessionStorage.getItem('userdata')
this.userMenu=JSON.parse(a).menus
console.log( this.userMenu);
if (this.userMenu.length==0) {
this.menu=this.menuList
}else{
for (let index = 0; index < this.menuList.length; index++) {
for (let k = 0; k < this.userMenu.length; k++) {
if (this.userMenu[k]==this.menuList[index]) {
this.menu.push(this.userMenu[k])
console.log( this.menu);
}
}
}
}
this.selectedMenu = this.menuList[0]
this.routerChange()

4
src/app/system-management/menu/addmenu/addmenu.component.html

@ -14,10 +14,10 @@
</nz-input-group>
</nz-form-control>
</nz-form-item> -->
<nz-form-item>
<!-- <nz-form-item>
<nz-form-control>
<label nz-checkbox formControlName="isGasStation">是否为加油站</label>
</nz-form-control>
</nz-form-item>
</nz-form-item> -->
</form>
</div>

4
src/app/system-management/menu/editmenu/editmenu.component.html

@ -14,11 +14,11 @@
</nz-input-group>
</nz-form-control>
</nz-form-item> -->
<nz-form-item>
<!-- <nz-form-item>
<nz-form-control>
<label [(ngModel)]="datacopy.isGasStation" nz-checkbox formControlName="isGasStation">是否为加油站</label>
</nz-form-control>
</nz-form-item>
</nz-form-item> -->
</form>
</div>

28
src/app/system-management/menu/menu.component.ts

@ -41,24 +41,30 @@ export class MenuComponent implements OnInit {
allOrList: any
getAllOrganization() {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true"
}
this.http.get('/api/services/app/Organization/GetAll', {
this.http.get('/api/services/app/Menu/GetAll', {
params: params
}).subscribe((data: any) => {
this.totalCount = data.result.totalCount
data.result.items.forEach(element => {
element.key = element.id
element.title = element.displayName
element.title = element.name
element.selectable = false
});
this.allOrList = data.result.items
this.nodes = [...this.toTree.toTree(data.result.items)]
this.defaultExpandedKeys = [this.nodes[0].id]
this.defaultExpandedKeys = [...this.defaultExpandedKeys]
// console.log(...this.nodes,444);
// console.log(this.defaultExpandedKeys,45);
})
}
@ -68,7 +74,7 @@ export class MenuComponent implements OnInit {
defaultExpandedKeys = [];
nodes: any[] = []
datas:any[]=[{id:0,title:"首页",children:[]},{id:1,title:"数字油站",children:[]},{id:2,title:"今日预警",children:[]},{id:3,title:"预警记录",children:[{title:'预警类型统计',isGasStation:true},{title:'卸油统计',isGasStation:true},{title:'证照预警统计',isGasStation:true}]},{id:4,title:"证照管理",children:[{title:'经营类证照',isGasStation:true},{title:'资产类证照',isGasStation:true},{title:'待办',isGasStation:true},{title:'审批记录',isGasStation:true}]}]
addOr(node?: any) {
console.log(node)
@ -85,10 +91,10 @@ export class MenuComponent implements OnInit {
let body = {
parentId: node ? Number(node.key) : null,
// code: instance.validateForm.value.code,
displayName: instance.validateForm.value.name,
isGasStation: instance.validateForm.value.isGasStation
name: instance.validateForm.value.name,
// isGasStation: instance.validateForm.value.isGasStation
}
this.http.post('/api/services/app/Organization/Create', body).subscribe(data => {
this.http.post('/api/services/app/Menu/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
@ -112,7 +118,7 @@ export class MenuComponent implements OnInit {
}
editOr(node) {
// console.log(node)
console.log(node)
const modal = this.modal.create({
nzTitle: '编辑组织机构',
nzContent: EditmenuComponent,
@ -129,10 +135,10 @@ export class MenuComponent implements OnInit {
id: node.origin.id,
parentId: node.origin.parentId,
// code: instance.validateForm.value.code,
displayName: instance.validateForm.value.name,
isGasStation: instance.validateForm.value.isGasStation
name: instance.validateForm.value.name,
// isGasStation: instance.validateForm.value.isGasStation
}
this.http.put('/api/services/app/Organization/Update', body).subscribe(data => {
this.http.put('/api/services/app/Menu/Update', body).subscribe(data => {
resolve(data)
this.message.create('success', '编辑成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
@ -164,7 +170,7 @@ export class MenuComponent implements OnInit {
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
this.http.delete('/api/services/app/Organization/Delete', {
this.http.delete('/api/services/app/Menu/Delete', {
params: {
Id: item.origin.id
}

Loading…
Cancel
Save