You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
4.2 KiB
138 lines
4.2 KiB
import { HttpClient } from '@angular/common/http'; |
|
import { Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core'; |
|
import { FormBuilder, FormGroup } from '@angular/forms'; |
|
import { NzModalService } from 'ng-zorro-antd/modal'; |
|
import { TreeService } from 'src/app/service/tree.service'; |
|
import { LookTaskComponent } from './look-task/look-task.component'; |
|
@Component({ |
|
selector: 'app-zhi-audit', |
|
templateUrl: './zhi-audit.component.html', |
|
styleUrls: ['./zhi-audit.component.scss'] |
|
}) |
|
export class ZhiAuditComponent implements OnInit { |
|
|
|
validateForm!: FormGroup; |
|
|
|
constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } |
|
|
|
months = [ |
|
{ name: '1月', isable: true }, |
|
{ name: '2月', isable: true }, |
|
{ name: '3月', isable: true }, |
|
{ name: '4月', isable: true }, |
|
{ name: '5月', isable: true }, |
|
{ name: '6月', isable: true }, |
|
{ name: '7月', isable: true }, |
|
{ name: '8月', isable: true }, |
|
{ name: '9月', isable: true }, |
|
{ name: '10月', isable: true }, |
|
{ name: '11月', isable: true }, |
|
{ name: '12月', isable: true } |
|
] |
|
selectedMonth |
|
selectMonth(item) { |
|
this.selectedMonth = item.name |
|
} |
|
|
|
|
|
// 双随机 |
|
doubleRandom = { |
|
isExpand: true,//卡片展开 |
|
isPopover: false,//选择单位气泡卡片 |
|
search1: '',//选择单位气泡卡片---单位选择列表 |
|
search1Value: [], |
|
search2: '',//选择单位气泡卡片---组织选择列表 |
|
search2Value: [], |
|
selectedMenu: 1,//选择单位气泡卡片 |
|
data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],//表格数据 |
|
nodes: [] |
|
} |
|
|
|
// 熟悉演练 |
|
rehearsal = { |
|
isExpand: false,//卡片展开 |
|
isPopover: false,//选择单位气泡卡片 |
|
search1: '',//选择单位气泡卡片---单位选择列表 |
|
search1Value: [], |
|
search2: '',//选择单位气泡卡片---组织选择列表 |
|
search2Value: [], |
|
selectedMenu: 1,//选择单位气泡卡片 |
|
data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],//表格数据 |
|
nodes: [] |
|
} |
|
isPopover(data) { |
|
data.isPopover = !data.isPopover |
|
} |
|
//搜索框提交 |
|
submitForm(value): void { |
|
// console.log(value) |
|
} |
|
// 弹出 tab |
|
popoverMenuSelect(data, type) { |
|
data.selectedMenu = type |
|
} |
|
expand(data) { |
|
data.isExpand = !data.isExpand |
|
} |
|
|
|
ngOnInit(): void { |
|
this.getAllOrganization() |
|
} |
|
|
|
nzExpandAll = false; |
|
totalCount: string |
|
|
|
allOrList: any |
|
nodes |
|
getAllOrganization() { |
|
let params = { |
|
ContainsChildren: "true", |
|
PageNumber: 1, |
|
PageSize: 9999 |
|
} |
|
this.http.get('/api/Organizations', { |
|
params: params |
|
}).subscribe((data: any) => { |
|
this.totalCount = data.totalCount |
|
data.items.forEach(element => { |
|
element.key = element.id |
|
element.title = element.name |
|
element.selectable = false |
|
}); |
|
this.allOrList = data.items |
|
this.nodes = [...this.toTree.toTree(data.items)] |
|
|
|
this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes)) |
|
this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes)) |
|
}) |
|
} |
|
orcheckbox(data, $event, node) { |
|
if ($event) { |
|
data.search2Value.push(node.origin.name) |
|
} else { |
|
for (let index = 0; index < data.search2Value.length; index++) { |
|
const element = data.search2Value[index]; |
|
if (element == node.origin.name) { |
|
data.search2Value.splice(index, 1) |
|
} |
|
} |
|
} |
|
console.log(data.search2Value) |
|
} |
|
|
|
lookTask() { |
|
const modal = this.modal.create({ |
|
nzTitle: '任务详情', |
|
nzContent: LookTaskComponent, |
|
nzViewContainerRef: this.viewContainerRef, |
|
nzFooter: null, |
|
nzWidth:800, |
|
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000)) |
|
}); |
|
const instance = modal.getContentComponent(); |
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); |
|
// Return a result when closed |
|
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); |
|
|
|
} |
|
}
|
|
|