|
|
|
@ -1,5 +1,13 @@
|
|
|
|
|
import { HttpClient } from "@angular/common/http"; |
|
|
|
|
import { Component, OnInit, AfterViewInit, ViewChild } from "@angular/core"; |
|
|
|
|
import { |
|
|
|
|
Component, |
|
|
|
|
OnInit, |
|
|
|
|
AfterViewInit, |
|
|
|
|
ViewChild, |
|
|
|
|
Inject, |
|
|
|
|
} from "@angular/core"; |
|
|
|
|
import { MatSnackBar } from "@angular/material/snack-bar"; |
|
|
|
|
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog"; |
|
|
|
|
import { |
|
|
|
|
NzFormatEmitEvent, |
|
|
|
|
NzTreeComponent, |
|
|
|
@ -12,7 +20,12 @@ import {
|
|
|
|
|
styleUrls: ["./open-or.component.scss"], |
|
|
|
|
}) |
|
|
|
|
export class OpenOrComponent implements OnInit { |
|
|
|
|
constructor(private http: HttpClient) {} |
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
public snackBar: MatSnackBar, |
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data: any, |
|
|
|
|
public dialogRef: MatDialogRef<OpenOrComponent> |
|
|
|
|
) {} |
|
|
|
|
@ViewChild("nzTreeComponent", { static: false }) |
|
|
|
|
nzTreeComponent!: NzTreeComponent; |
|
|
|
|
defaultCheckedKeys = []; |
|
|
|
@ -77,8 +90,12 @@ export class OpenOrComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
return node; |
|
|
|
|
} |
|
|
|
|
if (this.data.plan.publicOrganizationIds.length === 0) { |
|
|
|
|
this.defaultCheckedKeys = [...lookForAllId([item])]; |
|
|
|
|
} else { |
|
|
|
|
this.defaultCheckedKeys = this.data.plan.publicOrganizationIds; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.defaultCheckedKeys = [...lookForAllId([item])]; |
|
|
|
|
this.nodes = [...[item]]; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -86,7 +103,24 @@ export class OpenOrComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
save() { |
|
|
|
|
console.log(this.nzTreeComponent); |
|
|
|
|
console.log(this.nzTreeComponent.getCheckedNodeList()); |
|
|
|
|
let ids = |
|
|
|
|
this.nzTreeComponent.getCheckedNodeList().map((item) => { |
|
|
|
|
return item.key; |
|
|
|
|
}) || []; |
|
|
|
|
if (ids.length === 0) { |
|
|
|
|
this.snackBar.open("至少选择一个队站公开", "确定", { |
|
|
|
|
verticalPosition: "top", |
|
|
|
|
duration: 3000, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
this.http |
|
|
|
|
.put(`/api/PlanAudits/${this.data.plan.id}/Public`, ids) |
|
|
|
|
.subscribe((data) => { |
|
|
|
|
this.snackBar.open("预案已公开", "确定", { |
|
|
|
|
verticalPosition: "top", |
|
|
|
|
duration: 3000, |
|
|
|
|
}); |
|
|
|
|
this.dialogRef.close("公开成功"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|