import { Component, OnInit, TemplateRef, ViewChild, ViewContainerRef, } from "@angular/core"; import { FormBuilder, FormGroup } from "@angular/forms"; import { NzFormatEmitEvent } from "ng-zorro-antd/tree"; import { NzModalService } from "ng-zorro-antd/modal"; import { NzMessageService } from "ng-zorro-antd/message"; import { HttpClient } from "@angular/common/http"; import { TreeService } from "src/app/service/tree.service"; import { NzNotificationService } from "ng-zorro-antd/notification"; // import { BindingComponent } from "./binding/binding.component"; @Component({ selector: "app-or-binding", templateUrl: "./or-binding.component.html", styleUrls: ["./or-binding.component.scss"], }) export class OrBindingComponent implements OnInit { validateForm!: FormGroup; constructor( private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private viewContainerRef: ViewContainerRef ) {} ngOnInit(): void { this.validateForm = this.fb.group({ search: [null], }); this.getAllUsers(); // this.getAllOrganization(); } listConfig = { loading: false, usersLIst: [], totalCount: 0, IsContainsChildren: true, searchValue: "", OrganizationUnitId: "", IsBindingLocal: true, }; getAllUsers() { this.listConfig.loading = true; let params = { Keyword: this.validateForm.value.search ? this.validateForm.value.search : "", SkipCount: String(this.SkipCount), MaxResultCount: String(this.MaxResultCount), // OrganizationUnitId: this.OrganizationUnitId, IsBindingLocal: this.listConfig.IsBindingLocal, // IsActive:true, // IsContainsChildren: String(this.listConfig.IsContainsChildren), }; this.http .get(this.getAllUrl, { params: params, }) .subscribe((data: any) => { console.log("中台用户列表", data); this.listConfig.usersLIst = data.result.items; this.listConfig.totalCount = data.result.totalCount; this.listConfig.loading = false; }); } SkipCount: number = 0; //0 16 32 48 MaxResultCount: number = 16; pageChange($event) { this.SkipCount = ($event - 1) * this.MaxResultCount; this.getAllUsers(); } getAllUrl = "/api/services/app/User/GetSinochemUsers"; //搜索框提交 submitForm(): void { for (const i in this.validateForm.controls) { this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].updateValueAndValidity(); } this.getAllUsers(); } binding(data) { // const modal = this.modal.create({ // nzTitle: "绑定本地用户", // nzContent: BindingComponent, // nzViewContainerRef: this.viewContainerRef, // nzWidth: 1500, // nzFooter: null, // nzMaskClosable: false, // nzComponentParams: { // data: JSON.parse(JSON.stringify(data)), // }, // }); // const instance = modal.getContentComponent(); // modal.afterClose.subscribe((result) => this.getAllUsers()); } }