diff --git a/src/app/home/basic-info/add-unit/add-unit.component.html b/src/app/home/basic-info/add-unit/add-unit.component.html index 72e4c2b..ca53762 100644 --- a/src/app/home/basic-info/add-unit/add-unit.component.html +++ b/src/app/home/basic-info/add-unit/add-unit.component.html @@ -37,8 +37,8 @@ 所属救援站 - - + + @@ -46,8 +46,8 @@ 所属大队 - - + + @@ -55,17 +55,16 @@ 使用性质 - - - - + + + 建筑类型 - - + + diff --git a/src/app/home/basic-info/add-unit/add-unit.component.ts b/src/app/home/basic-info/add-unit/add-unit.component.ts index 0589415..066dd4a 100644 --- a/src/app/home/basic-info/add-unit/add-unit.component.ts +++ b/src/app/home/basic-info/add-unit/add-unit.component.ts @@ -14,6 +14,9 @@ export class AddUnitComponent implements OnInit { @Input() title?: string; @Input() subtitle?: string; validateForm!: FormGroup; + zhidui=[] + dadui=[] + jiuyuanzhan=[] constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } ngOnInit(): void { @@ -22,13 +25,13 @@ export class AddUnitComponent implements OnInit { name: [null], iphone: [null], addr: [null], - role: [[]], - role2: [[]], - role3: [[]], - role4: [[]], + role: [null], + role2: [null], + nature: [null], + role4: [null], phonenum: [null] }); - + this.getAllOrganization() } destroyModal(): void { this.modal.destroy({ data: 'this the result data' }); @@ -36,6 +39,7 @@ export class AddUnitComponent implements OnInit { listOfData: any[] = []; listOfData2: any[] = []; + //获取角色列表 getAllRoles() { let params = { @@ -65,23 +69,29 @@ export class AddUnitComponent implements OnInit { } //获取所有组织机构 nodes: any = [] - getAllOrganization() { - let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id + getAllOrganization(){ let params = { - OrganizationUnitId: OrganizationUnitId, - IsContainsChildren: "true" + // OrganizationUnitId: OrganizationUnitId, + // IsContainsChildren: "true" + ContainsChildren: true, + pageSize: 9999 } - this.http.get('/api/services/app/Organization/GetAll', { + this.http.get('/api/Organizations', { params: params }).subscribe((data: any) => { - data.result.items.forEach(element => { - if (element.id == OrganizationUnitId) { - element.parentId = null + console.log(data); + for (let index = 0; index < data.items.length; index++) { + if(data.items[index].level==1){ + this.zhidui.push(data.items[index]) + }else if(data.items[index].level==2){ + this.dadui.push(data.items[index]) + }else{ + this.jiuyuanzhan.push(data.items[index]) } - element.key = element.id - element.title = element.displayName - }); - this.nodes = [...this.toTree.toTree(data.result.items)] + + } + console.log(this.dadui); + }) } } diff --git a/src/app/home/basic-info/unit/unit.component.html b/src/app/home/basic-info/unit/unit.component.html index c56375d..2d32b70 100644 --- a/src/app/home/basic-info/unit/unit.component.html +++ b/src/app/home/basic-info/unit/unit.component.html @@ -68,18 +68,18 @@ - {{ data.name }} + {{ data.companyName }}
-
- {{data.integrity}}%
+ {{integrity}}%
{{ data.organization }} {{ data.level }} - {{ data.nature }} - {{ data.time }} + {{ data.useNature }} + {{ data.creationTime }} {{ data.addr }} {{ data.state }} diff --git a/src/app/home/basic-info/unit/unit.component.ts b/src/app/home/basic-info/unit/unit.component.ts index 9e76949..5a4a2d5 100644 --- a/src/app/home/basic-info/unit/unit.component.ts +++ b/src/app/home/basic-info/unit/unit.component.ts @@ -8,42 +8,22 @@ 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'; -interface Person { - id: string; - name: string; - integrity: number; - organization: string; - level: string; - nature:string; - time:string; - addr:string; - state:string -} + @Component({ selector: 'app-unit', templateUrl: './unit.component.html', styleUrls: ['./unit.component.scss'] }) export class UnitComponent implements OnInit { - checked=true - listOfData: Person[] = [ - { - id: '1', - name: 'John Brown', - integrity: 20, - organization: 'New York No. 1 Lake Park', - level:'重点单位', - nature:'会议中心', - time:'time', - addr:'单位地址', - state:'' - } - - ]; + checked = true + + listOfData: any = []; + integrity = 0 validateForm!: FormGroup; - - + constructor(private router: Router, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } + + datas = "" ngOnInit(): void { this.validateForm = this.fb.group({ level: [null], @@ -51,25 +31,35 @@ export class UnitComponent implements OnInit { event: [null], area: [null], disposalState: [null], - + }); - - this.http.get('/api/Companies').subscribe((data: any) => { - console.log(data); - }) + this.getCompanies() } - constructor(private router: Router,private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } searchValue = ''; next() { this.router.navigate(['/basicInfo/unit/details']); } + getCompanies() { + this.http.get('/api/Companies').subscribe((data: any) => { + console.log(data); + + this.listOfData = data.items + this.listOfData = [...this.listOfData] + console.log(this.listOfData); + for (let index = 0; index < this.listOfData.length; index++) { + this.listOfData[index].creationTime=this.listOfData[index].creationTime.substring(0,10) + + } + }) + } + ngOnDestroy(): void { console.log('删除了6666666666666') // CustomReuseStrategy.deleteRouteSnapshot('/basicInfo/unit'); } addOr(node?: any) { - console.log(node) + const modal = this.modal.create({ nzTitle: "新增单位", nzContent: AddUnitComponent, @@ -86,26 +76,27 @@ export class UnitComponent implements OnInit { companyName: instance.validateForm.value.unit, directorName: instance.validateForm.value.name, directorPhone: instance.validateForm.value.iphone, - address:instance.validateForm.value.addr, - organizationId:instance.validateForm.value.role.id || 0, - relatedOrganizationId:instance.validateForm.value.role2.id || 0, - buildingTypeId:instance.validateForm.value.role3.id || 0, - useNature:instance.validateForm.value.role4.id || 0, + address: instance.validateForm.value.addr, + organizationId: instance.validateForm.value.role || null, + relatedOrganizationId: instance.validateForm.value.role2 || null, + buildingTypeId: instance.validateForm.value.role4 || null, + useNature: instance.validateForm.value.nature, + data: null } this.http.post('/api/Companies', body).subscribe({ next: (data: any) => { - console.log(data,80808) - + console.log(data, 80808) + }, error: (err) => { - + console.log(err) } } - + ) }) - + } else { this.message.create('warning', '请填写完整!'); return false diff --git a/src/app/home/system-management/or/editor/editor.component.html b/src/app/home/system-management/or/editor/editor.component.html index 2351467..bb5e042 100644 --- a/src/app/home/system-management/or/editor/editor.component.html +++ b/src/app/home/system-management/or/editor/editor.component.html @@ -15,10 +15,10 @@
--> - + \ No newline at end of file diff --git a/src/app/home/system-management/or/or.component.ts b/src/app/home/system-management/or/or.component.ts index e5d4c7a..3d9302d 100644 --- a/src/app/home/system-management/or/or.component.ts +++ b/src/app/home/system-management/or/or.component.ts @@ -81,7 +81,8 @@ export class OrComponent implements OnInit { addOr(node?: any) { - console.log(node) + console.log(node); + const modal = this.modal.create({ nzTitle: node ? '新增组织机构' : '新增一级组织机构', nzContent: AddorComponent, @@ -93,8 +94,7 @@ export class OrComponent implements OnInit { await new Promise(resolve => { let body = { name: instance.validateForm.value.name, - parentId: node ? Number(node.key) : null, - isGasStation: instance.validateForm.value.isGasStation + parentId: node ? node.key : null } this.http.post('/api/Organizations', body).subscribe(data => { resolve(data) @@ -120,7 +120,7 @@ export class OrComponent implements OnInit { } editOr(node) { - // console.log(node) + console.log(node) const modal = this.modal.create({ nzTitle: '编辑组织机构', nzContent: EditorComponent, @@ -134,10 +134,9 @@ export class OrComponent implements OnInit { await new Promise(resolve => { let body = { name: instance.validateForm.value.name, - isGasStation: instance.validateForm.value.isGasStation, parentId: node.origin.parentId } - this.http.put(`/api/Organizations/${node.origin.id}`, body).subscribe(data => { + this.http.patch(`/api/Organizations/${node.origin.id}`, body).subscribe(data => { resolve(data) this.message.create('success', '编辑成功!'); this.nzTreeComponent.getExpandedNodeList().forEach((item) => { @@ -194,7 +193,7 @@ export class OrComponent implements OnInit { if (this.pos == 0) {//目标节点内部 parentId = event.node.key } else { - if (event.node.level == 0) { + if (event.node.level == 1) { parentId = null } else { parentId = event.node.origin.parentId @@ -302,7 +301,7 @@ export class OrComponent implements OnInit { pos//放置位置 beforeDrop = (arg: NzFormatBeforeDropEvent) => { console.log('arg', arg) - if (arg.node.level === 0) {//如果为数据节点则不允许拖到一级节点 + if (arg.node.level === 1) {//如果为数据节点则不允许拖到一级节点 this.message.create('warning', '不允许拖拽到一级节点'); this.isDrag = false return of(false);