|
|
|
@ -5,8 +5,8 @@ import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-
|
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal'; |
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
// import { AddorComponent } from './addor/addor.component';
|
|
|
|
|
// import { EditorComponent } from './editor/editor.component';
|
|
|
|
|
import { AddmenuComponent } from './addmenu/addmenu.component'; |
|
|
|
|
import { EditmenuComponent } from './editmenu/editmenu.component'; |
|
|
|
|
|
|
|
|
|
import { NzFormatBeforeDropEvent } from 'ng-zorro-antd/tree'; |
|
|
|
|
import { Observable, of } from 'rxjs'; |
|
|
|
@ -70,90 +70,90 @@ export class MenuComponent implements OnInit {
|
|
|
|
|
nodes: any[] = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// addOr(node?: any) {
|
|
|
|
|
// console.log(node)
|
|
|
|
|
// const modal = this.modal.create({
|
|
|
|
|
// nzTitle: node ? '新增组织机构' : '新增一级组织机构',
|
|
|
|
|
// nzContent: AddorComponent,
|
|
|
|
|
// nzViewContainerRef: this.viewContainerRef,
|
|
|
|
|
// nzWidth: 288,
|
|
|
|
|
// nzComponentParams: {},
|
|
|
|
|
// nzOnOk: async () => {
|
|
|
|
|
// console.log('hhhhhhh', instance.validateForm)
|
|
|
|
|
// if (instance.validateForm.valid) {
|
|
|
|
|
// await new Promise(resolve => {
|
|
|
|
|
// let body = {
|
|
|
|
|
// parentId: node ? Number(node.key) : null,
|
|
|
|
|
// // code: instance.validateForm.value.code,
|
|
|
|
|
// displayName: instance.validateForm.value.name,
|
|
|
|
|
// isGasStation: instance.validateForm.value.isGasStation
|
|
|
|
|
// }
|
|
|
|
|
// this.http.post('/api/services/app/Organization/Create', body).subscribe(data => {
|
|
|
|
|
// resolve(data)
|
|
|
|
|
// this.message.create('success', '创建成功!');
|
|
|
|
|
// this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
|
|
|
|
|
// this.defaultExpandedKeys.push(item.key)
|
|
|
|
|
// })
|
|
|
|
|
// this.getAllOrganization()
|
|
|
|
|
// return true
|
|
|
|
|
// }, err => {
|
|
|
|
|
// resolve(err)
|
|
|
|
|
// this.message.create('warning', '创建失败');
|
|
|
|
|
// return false
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
// this.message.create('warning', '请填写完整!');
|
|
|
|
|
// return false
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// const instance = modal.getContentComponent();
|
|
|
|
|
addOr(node?: any) { |
|
|
|
|
console.log(node) |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzTitle: node ? '新增组织机构' : '新增一级组织机构', |
|
|
|
|
nzContent: AddmenuComponent, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 288, |
|
|
|
|
nzComponentParams: {}, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
console.log('hhhhhhh', instance.validateForm) |
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
await new Promise(resolve => { |
|
|
|
|
let body = { |
|
|
|
|
parentId: node ? Number(node.key) : null, |
|
|
|
|
// code: instance.validateForm.value.code,
|
|
|
|
|
displayName: instance.validateForm.value.name, |
|
|
|
|
isGasStation: instance.validateForm.value.isGasStation |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/Organization/Create', body).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.message.create('success', '创建成功!'); |
|
|
|
|
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { |
|
|
|
|
this.defaultExpandedKeys.push(item.key) |
|
|
|
|
}) |
|
|
|
|
this.getAllOrganization() |
|
|
|
|
return true |
|
|
|
|
}, err => { |
|
|
|
|
resolve(err) |
|
|
|
|
this.message.create('warning', '创建失败'); |
|
|
|
|
return false |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// editOr(node) {
|
|
|
|
|
// // console.log(node)
|
|
|
|
|
// const modal = this.modal.create({
|
|
|
|
|
// nzTitle: '编辑组织机构',
|
|
|
|
|
// nzContent: EditorComponent,
|
|
|
|
|
// nzViewContainerRef: this.viewContainerRef,
|
|
|
|
|
// nzWidth: 288,
|
|
|
|
|
// nzComponentParams: {
|
|
|
|
|
// data: node.origin,
|
|
|
|
|
// },
|
|
|
|
|
// nzOnOk: async () => {
|
|
|
|
|
// console.log('hhhhhhh', instance.validateForm)
|
|
|
|
|
// if (instance.validateForm.valid) {
|
|
|
|
|
// await new Promise(resolve => {
|
|
|
|
|
// let body = {
|
|
|
|
|
// id: node.origin.id,
|
|
|
|
|
// parentId: node.origin.parentId,
|
|
|
|
|
// // code: instance.validateForm.value.code,
|
|
|
|
|
// displayName: instance.validateForm.value.name,
|
|
|
|
|
// isGasStation: instance.validateForm.value.isGasStation
|
|
|
|
|
// }
|
|
|
|
|
// this.http.put('/api/services/app/Organization/Update', body).subscribe(data => {
|
|
|
|
|
// resolve(data)
|
|
|
|
|
// this.message.create('success', '编辑成功!');
|
|
|
|
|
// this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
|
|
|
|
|
// this.defaultExpandedKeys.push(item.key)
|
|
|
|
|
// })
|
|
|
|
|
// this.getAllOrganization()
|
|
|
|
|
// return true
|
|
|
|
|
// }, err => {
|
|
|
|
|
// resolve(err)
|
|
|
|
|
// this.message.create('warning', '编辑失败');
|
|
|
|
|
// return false
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
// this.message.create('warning', '请填写完整!');
|
|
|
|
|
// return false
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// const instance = modal.getContentComponent();
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
editOr(node) { |
|
|
|
|
// console.log(node)
|
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzTitle: '编辑组织机构', |
|
|
|
|
nzContent: EditmenuComponent, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 288, |
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: node.origin, |
|
|
|
|
}, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
console.log('hhhhhhh', instance.validateForm) |
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
await new Promise(resolve => { |
|
|
|
|
let body = { |
|
|
|
|
id: node.origin.id, |
|
|
|
|
parentId: node.origin.parentId, |
|
|
|
|
// code: instance.validateForm.value.code,
|
|
|
|
|
displayName: instance.validateForm.value.name, |
|
|
|
|
isGasStation: instance.validateForm.value.isGasStation |
|
|
|
|
} |
|
|
|
|
this.http.put('/api/services/app/Organization/Update', body).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.message.create('success', '编辑成功!'); |
|
|
|
|
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { |
|
|
|
|
this.defaultExpandedKeys.push(item.key) |
|
|
|
|
}) |
|
|
|
|
this.getAllOrganization() |
|
|
|
|
return true |
|
|
|
|
}, err => { |
|
|
|
|
resolve(err) |
|
|
|
|
this.message.create('warning', '编辑失败'); |
|
|
|
|
return false |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
} |
|
|
|
|
deleteOr(item) { |
|
|
|
|
console.log(item) |
|
|
|
|
if (item.origin.children && item.origin.children.length != 0) { |
|
|
|
|