Browse Source

菜单管理

beijing
陈鹏飞 3 years ago
parent
commit
df0350f4fd
  1. 4
      src/app/system-management/menu/addmenu/addmenu.component.html
  2. 4
      src/app/system-management/menu/editmenu/editmenu.component.html
  3. 2
      src/app/system-management/menu/menu.component.html
  4. 25
      src/app/system-management/menu/menu.component.ts

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>

2
src/app/system-management/menu/menu.component.html

@ -27,7 +27,7 @@
<span>组织机构</span>
<span>操作</span>
</div>
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="datas"
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes"
[nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" [nzTreeTemplate]="nzTreeTemplate" nzDraggable
nzBlockNode (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop" [nzExpandedIcon]="multiExpandedIconTpl">
</nz-tree>

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

@ -47,21 +47,22 @@ export class MenuComponent implements OnInit {
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);
// console.log(...this.nodes,444);
// console.log(this.defaultExpandedKeys,45);
})
@ -90,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) => {
@ -117,7 +118,7 @@ export class MenuComponent implements OnInit {
}
editOr(node) {
// console.log(node)
console.log(node)
const modal = this.modal.create({
nzTitle: '编辑组织机构',
nzContent: EditmenuComponent,
@ -134,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) => {
@ -169,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