邵佳豪 2 years ago
parent
commit
e520bcc7f4
  1. 2
      src/app/pages/records/records-nav/records-nav.component.html
  2. 23
      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=""> <img src="../../../assets/images/logosm.png" alt="">
<div class="content"> <div class="content">
<div class="contentitem"> <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> [ngClass]="{'selectedMenu': selectedMenu == item}">{{item}}</span>
</div> </div>
</div> </div>

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

@ -13,10 +13,29 @@ export class RecordsNavComponent implements OnInit {
isEcharts = true isEcharts = true
menuList = ['预警类型统计', '卸油统计', '证照预警统计'] menuList = ['预警类型统计', '卸油统计', '证照预警统计']
userMenu = []
menu=[]
selectedMenu selectedMenu
ngOnInit(): void { 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.selectedMenu = this.menuList[0]
this.routerChange() this.routerChange()

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

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

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

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

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

@ -41,24 +41,30 @@ export class MenuComponent implements OnInit {
allOrList: any allOrList: any
getAllOrganization() { getAllOrganization() {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
let params = { let params = {
OrganizationUnitId: OrganizationUnitId, OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true" IsContainsChildren: "true"
} }
this.http.get('/api/services/app/Organization/GetAll', { this.http.get('/api/services/app/Menu/GetAll', {
params: params params: params
}).subscribe((data: any) => { }).subscribe((data: any) => {
this.totalCount = data.result.totalCount this.totalCount = data.result.totalCount
data.result.items.forEach(element => { data.result.items.forEach(element => {
element.key = element.id element.key = element.id
element.title = element.displayName element.title = element.name
element.selectable = false element.selectable = false
}); });
this.allOrList = data.result.items this.allOrList = data.result.items
this.nodes = [...this.toTree.toTree(data.result.items)] this.nodes = [...this.toTree.toTree(data.result.items)]
this.defaultExpandedKeys = [this.nodes[0].id] this.defaultExpandedKeys = [this.nodes[0].id]
this.defaultExpandedKeys = [...this.defaultExpandedKeys] this.defaultExpandedKeys = [...this.defaultExpandedKeys]
// console.log(...this.nodes,444);
// console.log(this.defaultExpandedKeys,45);
}) })
} }
@ -68,7 +74,7 @@ export class MenuComponent implements OnInit {
defaultExpandedKeys = []; defaultExpandedKeys = [];
nodes: any[] = [] 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) { addOr(node?: any) {
console.log(node) console.log(node)
@ -85,10 +91,10 @@ export class MenuComponent implements OnInit {
let body = { let body = {
parentId: node ? Number(node.key) : null, parentId: node ? Number(node.key) : null,
// code: instance.validateForm.value.code, // code: instance.validateForm.value.code,
displayName: instance.validateForm.value.name, name: instance.validateForm.value.name,
isGasStation: instance.validateForm.value.isGasStation // 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) resolve(data)
this.message.create('success', '创建成功!'); this.message.create('success', '创建成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
@ -112,7 +118,7 @@ export class MenuComponent implements OnInit {
} }
editOr(node) { editOr(node) {
// console.log(node) console.log(node)
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '编辑组织机构', nzTitle: '编辑组织机构',
nzContent: EditmenuComponent, nzContent: EditmenuComponent,
@ -129,10 +135,10 @@ export class MenuComponent implements OnInit {
id: node.origin.id, id: node.origin.id,
parentId: node.origin.parentId, parentId: node.origin.parentId,
// code: instance.validateForm.value.code, // code: instance.validateForm.value.code,
displayName: instance.validateForm.value.name, name: instance.validateForm.value.name,
isGasStation: instance.validateForm.value.isGasStation // 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) resolve(data)
this.message.create('success', '编辑成功!'); this.message.create('success', '编辑成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
@ -164,7 +170,7 @@ export class MenuComponent implements OnInit {
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: () => { nzOnOk: () => {
this.http.delete('/api/services/app/Organization/Delete', { this.http.delete('/api/services/app/Menu/Delete', {
params: { params: {
Id: item.origin.id Id: item.origin.id
} }

Loading…
Cancel
Save