|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
ViewChild,
|
|
|
|
ViewContainerRef,
|
|
|
|
NgZone,
|
|
|
|
} from '@angular/core';
|
|
|
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
|
|
import { TreeService } from 'src/app/service/tree.service';
|
|
|
|
import { fromEvent, Subject } from 'rxjs';
|
|
|
|
import { debounceTime, elementAt } from 'rxjs/operators'; // 引入debounceTime、Subject
|
|
|
|
import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
|
import { EditOrComponent } from './edit-or/edit-or.component';
|
|
|
|
import { AllotPersonComponent } from '../da-subordinate-audit/allot-person/allot-person.component';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-zhi-indicators',
|
|
|
|
templateUrl: './zhi-indicators.component.html',
|
|
|
|
styleUrls: ['./zhi-indicators.component.scss'],
|
|
|
|
})
|
|
|
|
export class ZhiIndicatorsComponent implements OnInit {
|
|
|
|
validateForm!: FormGroup;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private ngZone: NgZone,
|
|
|
|
private fb: FormBuilder,
|
|
|
|
private http: HttpClient,
|
|
|
|
private toTree: TreeService,
|
|
|
|
private message: NzMessageService,
|
|
|
|
private modal: NzModalService,
|
|
|
|
private viewContainerRef: ViewContainerRef
|
|
|
|
) {}
|
|
|
|
private valueChange = new Subject<string>();
|
|
|
|
private targetCount = new Subject<string>();
|
|
|
|
|
|
|
|
saveItem() {}
|
|
|
|
months = [
|
|
|
|
{ id: 1, name: '1月', isable: true },
|
|
|
|
{ id: 2, name: '2月', isable: true },
|
|
|
|
{ id: 3, name: '3月', isable: true },
|
|
|
|
{ id: 4, name: '4月', isable: true },
|
|
|
|
{ id: 5, name: '5月', isable: true },
|
|
|
|
{ id: 6, name: '6月', isable: true },
|
|
|
|
{ id: 7, name: '7月', isable: true },
|
|
|
|
{ id: 8, name: '8月', isable: true },
|
|
|
|
{ id: 9, name: '9月', isable: true },
|
|
|
|
{ id: 10, name: '10月', isable: true },
|
|
|
|
{ id: 11, name: '11月', isable: true },
|
|
|
|
{ id: 12, name: '12月', isable: true },
|
|
|
|
];
|
|
|
|
selectedMonth;
|
|
|
|
selectedYear = 2024;
|
|
|
|
selectedTime;
|
|
|
|
selectMonth(item) {
|
|
|
|
console.log('选择月份');
|
|
|
|
this.selectedMonth = item.id;
|
|
|
|
this.initializeData();
|
|
|
|
this.getTaskList('投诉举报');
|
|
|
|
this.getTaskList('行政许可');
|
|
|
|
this.getTaskTarget('双随机');
|
|
|
|
this.getTaskTarget('熟悉演练');
|
|
|
|
}
|
|
|
|
selectYear(e) {
|
|
|
|
console.log('选择年份');
|
|
|
|
this.selectedYear = e;
|
|
|
|
this.initializeData();
|
|
|
|
this.getTaskList('投诉举报');
|
|
|
|
this.getTaskList('行政许可');
|
|
|
|
this.getTaskTarget('双随机');
|
|
|
|
this.getTaskTarget('熟悉演练');
|
|
|
|
}
|
|
|
|
initializeData() {
|
|
|
|
this.complaint.isExpand = true;
|
|
|
|
this.complaint.isPopover = false;
|
|
|
|
this.complaint.isLoading = false;
|
|
|
|
this.complaint.search1 = '';
|
|
|
|
this.complaint.search1Value = [];
|
|
|
|
this.complaint.search2 = '';
|
|
|
|
this.complaint.search2Value = [];
|
|
|
|
this.complaint.selectedMenu = 1;
|
|
|
|
this.complaint.data = [];
|
|
|
|
|
|
|
|
this.permission.isExpand = true;
|
|
|
|
this.permission.isPopover = false;
|
|
|
|
this.permission.isLoading = false;
|
|
|
|
this.permission.search1 = '';
|
|
|
|
this.permission.search1Value = [];
|
|
|
|
this.permission.search2 = '';
|
|
|
|
this.permission.search2Value = [];
|
|
|
|
this.permission.selectedMenu = 1;
|
|
|
|
this.permission.data = [];
|
|
|
|
|
|
|
|
this.doubleRandom.isExpand = true;
|
|
|
|
this.doubleRandom.isPopover = false;
|
|
|
|
this.doubleRandom.isLoading = false;
|
|
|
|
this.doubleRandom.search1 = '';
|
|
|
|
this.doubleRandom.search1Value = [];
|
|
|
|
this.doubleRandom.search2 = '';
|
|
|
|
this.doubleRandom.search2Value = [];
|
|
|
|
this.doubleRandom.selectedMenu = 1;
|
|
|
|
this.doubleRandom.data = [];
|
|
|
|
|
|
|
|
this.rehearsal.isExpand = true;
|
|
|
|
this.rehearsal.isPopover = false;
|
|
|
|
this.rehearsal.isLoading = false;
|
|
|
|
this.rehearsal.search1 = '';
|
|
|
|
this.rehearsal.search1Value = [];
|
|
|
|
this.rehearsal.search2 = '';
|
|
|
|
this.rehearsal.search2Value = [];
|
|
|
|
this.rehearsal.selectedMenu = 1;
|
|
|
|
this.rehearsal.data = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
//投诉举报
|
|
|
|
complaint = {
|
|
|
|
name: '投诉举报',
|
|
|
|
allocated: 0,
|
|
|
|
isExpand: true, //卡片展开
|
|
|
|
isPopover: false, //选择单位气泡卡片
|
|
|
|
isLoading: false,
|
|
|
|
search1: '', //选择单位气泡卡片---单位选择列表
|
|
|
|
search1Value: [],
|
|
|
|
search2: '', //选择单位气泡卡片---组织选择列表
|
|
|
|
search2Value: [],
|
|
|
|
searchAll: [],
|
|
|
|
selectedMenu: 1, //选择单位气泡卡片
|
|
|
|
data: [], //表格数据
|
|
|
|
nodes: [],
|
|
|
|
nodes2: [], //查询后展示的tree
|
|
|
|
isnodes: true,
|
|
|
|
unitList: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
//行政许可
|
|
|
|
permission = {
|
|
|
|
name: '行政许可',
|
|
|
|
allocated: 0,
|
|
|
|
isExpand: true, //卡片展开
|
|
|
|
isPopover: false, //选择单位气泡卡片
|
|
|
|
isLoading: false,
|
|
|
|
search1: '', //选择单位气泡卡片---单位选择列表
|
|
|
|
search1Value: [],
|
|
|
|
search2: '', //选择单位气泡卡片---组织选择列表
|
|
|
|
search2Value: [],
|
|
|
|
searchAll: [],
|
|
|
|
selectedMenu: 1, //选择单位气泡卡片
|
|
|
|
data: [], //表格数据
|
|
|
|
nodes: [],
|
|
|
|
nodes2: [], //查询后展示的tree
|
|
|
|
isnodes: true,
|
|
|
|
unitList: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
// 双随机
|
|
|
|
doubleRandom = {
|
|
|
|
name: '双随机',
|
|
|
|
allocated: 0,
|
|
|
|
allPlanTasks: 0,
|
|
|
|
isExpand: true, //卡片展开
|
|
|
|
isPopover: false, //选择单位气泡卡片
|
|
|
|
isLoading: false,
|
|
|
|
search1: '', //选择单位气泡卡片---单位选择列表
|
|
|
|
search1Value: [],
|
|
|
|
search2: '', //选择单位气泡卡片---组织选择列表
|
|
|
|
search2Value: [],
|
|
|
|
searchAll: [],
|
|
|
|
selectedMenu: 1, //选择单位气泡卡片
|
|
|
|
data: [], //表格数据
|
|
|
|
nodes: [],
|
|
|
|
nodes2: [], //查询后展示的tree
|
|
|
|
isnodes: true,
|
|
|
|
unitList: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
// 熟悉演练
|
|
|
|
rehearsal = {
|
|
|
|
name: '熟悉演练',
|
|
|
|
allocated: 0,
|
|
|
|
allPlanTasks: 0,
|
|
|
|
isExpand: true, //卡片展开
|
|
|
|
isPopover: false, //选择单位气泡卡片
|
|
|
|
isLoading: false,
|
|
|
|
search1: '', //选择单位气泡卡片---单位选择列表
|
|
|
|
search1Value: [],
|
|
|
|
search2: '', //选择单位气泡卡片---组织选择列表
|
|
|
|
search2Value: [],
|
|
|
|
searchAll: [],
|
|
|
|
selectedMenu: 1, //选择单位气泡卡片
|
|
|
|
data: [], //表格数据
|
|
|
|
nodes: [],
|
|
|
|
nodes2: [], //查询后展示的tree
|
|
|
|
isnodes: true,
|
|
|
|
unitList: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
log(data) {
|
|
|
|
let arr = [];
|
|
|
|
data.unitList.forEach((item) => {
|
|
|
|
item.checked ? arr.push(item.id) : null;
|
|
|
|
});
|
|
|
|
data.search1Value = arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
isPopover(data) {
|
|
|
|
console.log(data);
|
|
|
|
data.isPopover = !data.isPopover;
|
|
|
|
data.unitList.forEach((element) => {
|
|
|
|
element.checked = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// 弹出 tab
|
|
|
|
popoverMenuSelect(data, type) {
|
|
|
|
data.selectedMenu = type;
|
|
|
|
}
|
|
|
|
expand(data) {
|
|
|
|
data.isExpand = !data.isExpand;
|
|
|
|
}
|
|
|
|
|
|
|
|
//搜索框提交
|
|
|
|
submitForm(data): void {
|
|
|
|
data.unitList = [];
|
|
|
|
this.PageNumber = 1;
|
|
|
|
this.getCompanies(data);
|
|
|
|
}
|
|
|
|
totalCount: number;
|
|
|
|
unitList = [];
|
|
|
|
PageNumber = 1;
|
|
|
|
async getCompanies(incomingData?: any) {
|
|
|
|
let params = {
|
|
|
|
CompanyName: incomingData ? incomingData.search1 : '',
|
|
|
|
PageNumber: this.PageNumber,
|
|
|
|
PageSize: 50,
|
|
|
|
};
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
|
|
this.http
|
|
|
|
.get('/api/Companies', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
this.moreDataLoading = false;
|
|
|
|
this.totalCount = data.totalCount;
|
|
|
|
data.items.forEach((element) => {
|
|
|
|
element.label = element.companyName;
|
|
|
|
element.value = element.id;
|
|
|
|
element.parentId = element.organizationId;
|
|
|
|
element.key = element.id;
|
|
|
|
element.title = element.companyName;
|
|
|
|
element.level = 4;
|
|
|
|
});
|
|
|
|
this.unitList = data.items;
|
|
|
|
|
|
|
|
// if (incomingData && incomingData.name == '投诉举报') {
|
|
|
|
// this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// } else if (incomingData && incomingData.name == '行政许可') {
|
|
|
|
// this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// } else if (incomingData && incomingData.name == '双随机') {
|
|
|
|
// this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// } else if (incomingData && incomingData.name == '熟悉演练') {
|
|
|
|
// this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// } else {
|
|
|
|
// this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
|
|
|
|
// }
|
|
|
|
|
|
|
|
this.complaint.unitList = this.complaint.unitList.concat(
|
|
|
|
JSON.parse(JSON.stringify(data.items))
|
|
|
|
);
|
|
|
|
this.complaint.unitList = [...this.complaint.unitList];
|
|
|
|
this.permission.unitList = this.permission.unitList.concat(
|
|
|
|
JSON.parse(JSON.stringify(data.items))
|
|
|
|
);
|
|
|
|
this.permission.unitList = [...this.permission.unitList];
|
|
|
|
this.doubleRandom.unitList = this.doubleRandom.unitList.concat(
|
|
|
|
JSON.parse(JSON.stringify(data.items))
|
|
|
|
);
|
|
|
|
this.doubleRandom.unitList = [...this.doubleRandom.unitList];
|
|
|
|
this.rehearsal.unitList = this.rehearsal.unitList.concat(
|
|
|
|
JSON.parse(JSON.stringify(data.items))
|
|
|
|
);
|
|
|
|
this.rehearsal.unitList = [...this.rehearsal.unitList];
|
|
|
|
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
moreDataLoading = false;
|
|
|
|
|
|
|
|
moreData() {
|
|
|
|
this.moreDataLoading = true;
|
|
|
|
this.PageNumber += 1;
|
|
|
|
this.getCompanies();
|
|
|
|
}
|
|
|
|
|
|
|
|
allOrList: any;
|
|
|
|
nodes;
|
|
|
|
async getAllOrganization() {
|
|
|
|
let params = {
|
|
|
|
ContainsChildren: 'true',
|
|
|
|
PageNumber: 1,
|
|
|
|
PageSize: 9999,
|
|
|
|
code: '0000',
|
|
|
|
};
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
|
|
this.http
|
|
|
|
.get('/api/Organizations', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
data.items.forEach((element) => {
|
|
|
|
element.key = element.id;
|
|
|
|
element.title = element.name;
|
|
|
|
element.selectable = false;
|
|
|
|
element.disableCheckbox = true;
|
|
|
|
element.datatype = '机构';
|
|
|
|
element.level == 'squadron'
|
|
|
|
? (element.disableCheckbox = false)
|
|
|
|
: null;
|
|
|
|
});
|
|
|
|
|
|
|
|
this.allOrList = JSON.parse(JSON.stringify(data.items));
|
|
|
|
this.nodes = [
|
|
|
|
...this.toTree.toTree(JSON.parse(JSON.stringify(data.items))),
|
|
|
|
];
|
|
|
|
this.complaint.nodes = JSON.parse(JSON.stringify(this.nodes));
|
|
|
|
this.permission.nodes = JSON.parse(JSON.stringify(this.nodes));
|
|
|
|
this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes));
|
|
|
|
this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes));
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//获得除了检查员的其他用户
|
|
|
|
users;
|
|
|
|
async getUsers() {
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
|
|
let params = {
|
|
|
|
OrganizationId: this.OrganizationId,
|
|
|
|
OrganizationLevel: 'squadron',
|
|
|
|
ContainsChildren: true,
|
|
|
|
PageNumber: 1,
|
|
|
|
PageSize: 9999,
|
|
|
|
};
|
|
|
|
this.http
|
|
|
|
.get('/api/Users', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
console.log('用户列表', data.items);
|
|
|
|
data.items.forEach((element) => {
|
|
|
|
element.key = element.id;
|
|
|
|
element.title = element.name;
|
|
|
|
element.parentId = element.organizationId;
|
|
|
|
});
|
|
|
|
this.users = data.items;
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
editOr(incomingData, item) {
|
|
|
|
const modal = this.modal.create({
|
|
|
|
nzTitle: '修改协助机构',
|
|
|
|
nzContent: EditOrComponent,
|
|
|
|
nzViewContainerRef: this.viewContainerRef,
|
|
|
|
nzWidth: 660,
|
|
|
|
nzMaskClosable: false,
|
|
|
|
nzComponentParams: {
|
|
|
|
selectedData: [...item.supervisorIds, ...item.assistantOrganizationIds],
|
|
|
|
organizationList: JSON.parse(JSON.stringify(this.allOrList)),
|
|
|
|
// users: JSON.parse(JSON.stringify(this.users)),
|
|
|
|
supervisorList: [
|
|
|
|
...JSON.parse(JSON.stringify(this.assitantsupervisorList)),
|
|
|
|
...JSON.parse(JSON.stringify(this.mainsupervisorList)),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
nzOnOk: async () => {
|
|
|
|
if (instance.validateForm.valid) {
|
|
|
|
await new Promise((resolve, reject) => {
|
|
|
|
console.log(instance.nzTreeComponent.getCheckedNodeList());
|
|
|
|
let supervisorIds = [];
|
|
|
|
let assistantOrganizationIds = [];
|
|
|
|
instance.nzTreeComponent.getCheckedNodeList().forEach((item) => {
|
|
|
|
item.origin.datatype == '机构'
|
|
|
|
? assistantOrganizationIds.push(item.key)
|
|
|
|
: supervisorIds.push(item.key);
|
|
|
|
});
|
|
|
|
let body = {
|
|
|
|
supervisorIds: supervisorIds,
|
|
|
|
assistantOrganizationIds: assistantOrganizationIds,
|
|
|
|
};
|
|
|
|
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
|
|
|
|
next: async (data: any) => {
|
|
|
|
this.message.create('success', '修改成功');
|
|
|
|
incomingData.name == '投诉举报'
|
|
|
|
? this.getTaskList('投诉举报')
|
|
|
|
: null;
|
|
|
|
incomingData.name == '行政许可'
|
|
|
|
? this.getTaskList('行政许可')
|
|
|
|
: null;
|
|
|
|
resolve(data);
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '修改失败');
|
|
|
|
reject(err);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.message.create('warning', '请填写完整!');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const instance = modal.getContentComponent();
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
|
|
|
|
modal.afterClose.subscribe((result) =>
|
|
|
|
console.log('[afterClose] The result is:', result)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
orcheckbox(data, $event, node) {
|
|
|
|
if ($event) {
|
|
|
|
data.search2Value.push(node.origin.id);
|
|
|
|
} else {
|
|
|
|
for (let index = 0; index < data.search2Value.length; index++) {
|
|
|
|
const element = data.search2Value[index];
|
|
|
|
if (element == node.origin.id) {
|
|
|
|
data.search2Value.splice(index, 1);
|
|
|
|
index--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(data.search2Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
OrganizationId;
|
|
|
|
|
|
|
|
iszhanxun = false;
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.OrganizationId = JSON.parse(
|
|
|
|
sessionStorage.getItem('userData')
|
|
|
|
).organizationId;
|
|
|
|
this.selectedMonth = new Date().getMonth() + 1;
|
|
|
|
//说明保存防抖
|
|
|
|
this.valueChange.pipe(debounceTime(1000)).subscribe((item: any) => {
|
|
|
|
let body = {
|
|
|
|
description: item.description,
|
|
|
|
};
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
|
|
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
|
|
|
|
next: async (data: any) => {
|
|
|
|
this.message.create('success', '实时保存成功');
|
|
|
|
resolve(data);
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '保存失败');
|
|
|
|
reject(err);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
//任务额保存防抖
|
|
|
|
this.targetCount.pipe(debounceTime(1000)).subscribe((item: any) => {
|
|
|
|
// console.log(item)
|
|
|
|
let body = {
|
|
|
|
targetCount: item.targetCount,
|
|
|
|
};
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
|
|
this.http.patch(`/api/TaskTargets/${item.id}`, body).subscribe({
|
|
|
|
next: async (data: any) => {
|
|
|
|
this.message.create('success', '修改任务额成功');
|
|
|
|
resolve(data);
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '修改任务额失败');
|
|
|
|
reject(err);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// this.getUsers()
|
|
|
|
this.getCompanies();
|
|
|
|
this.getAllOrganization();
|
|
|
|
// Promise.all([this.getCompanies(), this.getAllOrganization()])
|
|
|
|
// .then((results) => {
|
|
|
|
// let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
|
|
|
|
// this.nodes = [...this.toTree.toTree(arr)]
|
|
|
|
// this.complaint.nodes = JSON.parse(JSON.stringify(this.nodes))
|
|
|
|
// this.permission.nodes = JSON.parse(JSON.stringify(this.nodes))
|
|
|
|
// this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes))
|
|
|
|
// this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes))
|
|
|
|
// });
|
|
|
|
|
|
|
|
this.getTaskList('投诉举报');
|
|
|
|
this.getTaskList('行政许可');
|
|
|
|
|
|
|
|
this.getTaskTarget('双随机');
|
|
|
|
this.getTaskTarget('熟悉演练');
|
|
|
|
//获得主协调查人员
|
|
|
|
this.getSupervisor('main');
|
|
|
|
this.getSupervisor('assisted');
|
|
|
|
|
|
|
|
let roles = JSON.parse(sessionStorage.getItem('userData')).roles;
|
|
|
|
let iszhanxun = roles.find((item) => {
|
|
|
|
return item.name.indexOf('战训') != -1;
|
|
|
|
});
|
|
|
|
if (iszhanxun) {
|
|
|
|
this.iszhanxun = true;
|
|
|
|
}
|
|
|
|
console.log('iszhanxun', iszhanxun);
|
|
|
|
}
|
|
|
|
//投诉举报/行政许可 选择单位 确认按钮
|
|
|
|
selectedUnit(data, type) {
|
|
|
|
let arr = [...data.search1Value, ...data.search2Value];
|
|
|
|
let arrSet = [...new Set(arr)];
|
|
|
|
data.isLoading = true;
|
|
|
|
let selectedMonth =
|
|
|
|
this.selectedMonth < 10 ? '0' + this.selectedMonth : this.selectedMonth;
|
|
|
|
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01';
|
|
|
|
this.http
|
|
|
|
.post(`/api/PlanTasks/Many`, null, {
|
|
|
|
params: {
|
|
|
|
month: selectedTime,
|
|
|
|
companyIds: arrSet,
|
|
|
|
taskType: type,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.subscribe({
|
|
|
|
next: (item: Array<Object>) => {
|
|
|
|
data.isLoading = false;
|
|
|
|
data.isPopover = false;
|
|
|
|
this.message.create(
|
|
|
|
'success',
|
|
|
|
'共创建' +
|
|
|
|
arrSet.length +
|
|
|
|
'条任务' +
|
|
|
|
',成功创建' +
|
|
|
|
item.length +
|
|
|
|
'条,剩余' +
|
|
|
|
(arrSet.length - item.length) +
|
|
|
|
'个单位已被创建'
|
|
|
|
);
|
|
|
|
type == '投诉举报' ? this.getTaskList('投诉举报', data) : null;
|
|
|
|
type == '行政许可' ? this.getTaskList('行政许可', data) : null;
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
data.isLoading = false;
|
|
|
|
this.message.create('warning', '创建失败');
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//双随机/熟悉演练 选择单位 确认按钮
|
|
|
|
selectedUnit2(data, type) {
|
|
|
|
let selectedMonth =
|
|
|
|
this.selectedMonth < 10 ? '0' + this.selectedMonth : this.selectedMonth;
|
|
|
|
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01';
|
|
|
|
let arr = [...data.search1Value, ...data.search2Value];
|
|
|
|
let body = [...new Set(arr)];
|
|
|
|
data.isLoading = true;
|
|
|
|
this.http
|
|
|
|
.post(`/api/TaskTargets/${selectedTime}`, body, {
|
|
|
|
params: {
|
|
|
|
taskType: type,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.subscribe({
|
|
|
|
next: (item: Array<Object>) => {
|
|
|
|
data.isLoading = false;
|
|
|
|
data.isPopover = false;
|
|
|
|
this.message.create(
|
|
|
|
'success',
|
|
|
|
'共创建' +
|
|
|
|
body.length +
|
|
|
|
'条任务' +
|
|
|
|
',成功创建' +
|
|
|
|
item.length +
|
|
|
|
'条,剩余' +
|
|
|
|
(body.length - item.length) +
|
|
|
|
'个单位已被创建'
|
|
|
|
);
|
|
|
|
type == '双随机' ? this.getTaskTarget('双随机', data) : null;
|
|
|
|
type == '熟悉演练' ? this.getTaskTarget('熟悉演练', data) : null;
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
data.isLoading = false;
|
|
|
|
this.message.create('warning', '创建失败');
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
async getTaskTarget(TaskType, carddata?: any) {
|
|
|
|
TaskType == '双随机'
|
|
|
|
? (this.doubleRandom.isLoading = true)
|
|
|
|
: (this.rehearsal.isLoading = true);
|
|
|
|
let selectedTime =
|
|
|
|
this.selectedYear + '-' + this.selectedMonth + '-' + '01';
|
|
|
|
let params = {
|
|
|
|
taskType: TaskType,
|
|
|
|
};
|
|
|
|
return await new Promise<void>((resolve, reject) => {
|
|
|
|
this.http
|
|
|
|
.get(`/api/TaskTargets/${selectedTime}`, {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
//这里写需要立即渲染的代码
|
|
|
|
TaskType == '双随机'
|
|
|
|
? (this.doubleRandom.isLoading = false)
|
|
|
|
: (this.rehearsal.isLoading = false);
|
|
|
|
console.log(TaskType + '任务指标列表', data);
|
|
|
|
TaskType == '双随机' ? (this.doubleRandom.allocated = 0) : null;
|
|
|
|
TaskType == '熟悉演练' ? (this.rehearsal.allocated = 0) : null;
|
|
|
|
TaskType == '双随机' ? (this.doubleRandom.allPlanTasks = 0) : null;
|
|
|
|
TaskType == '熟悉演练' ? (this.rehearsal.allPlanTasks = 0) : null;
|
|
|
|
|
|
|
|
TaskType == '双随机' ? (this.doubleRandom.data = data) : null;
|
|
|
|
TaskType == '熟悉演练' ? (this.rehearsal.data = data) : null;
|
|
|
|
|
|
|
|
data.forEach((element) => {
|
|
|
|
if (element.planTasks) {
|
|
|
|
if (TaskType == '双随机') {
|
|
|
|
this.doubleRandom.allPlanTasks += element.planTasks.length;
|
|
|
|
}
|
|
|
|
if (TaskType == '熟悉演练') {
|
|
|
|
this.rehearsal.allPlanTasks += element.planTasks.length;
|
|
|
|
}
|
|
|
|
element.planTasks.forEach((item) => {
|
|
|
|
if (item.approvalStatus == '通过') {
|
|
|
|
TaskType == '双随机'
|
|
|
|
? (this.doubleRandom.allocated += 1)
|
|
|
|
: null;
|
|
|
|
TaskType == '熟悉演练'
|
|
|
|
? (this.rehearsal.allocated += 1)
|
|
|
|
: null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async getTaskList(TaskType, carddata?: any) {
|
|
|
|
TaskType == '投诉举报'
|
|
|
|
? (this.complaint.isLoading = true)
|
|
|
|
: (this.permission.isLoading = true);
|
|
|
|
// carddata ? carddata.isLoading = true : null
|
|
|
|
let selectedTime =
|
|
|
|
this.selectedYear + '-' + this.selectedMonth + '-' + '01';
|
|
|
|
let params = {
|
|
|
|
Month: selectedTime,
|
|
|
|
OrganizationId: this.OrganizationId,
|
|
|
|
TaskType: TaskType,
|
|
|
|
PageNumber: 1,
|
|
|
|
PageSize: 99999,
|
|
|
|
};
|
|
|
|
return await new Promise<void>((resolve, reject) => {
|
|
|
|
this.http
|
|
|
|
.get('/api/PlanTasks', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
//这里写需要立即渲染的代码
|
|
|
|
console.log(TaskType + '任务列表', data.items);
|
|
|
|
TaskType == '投诉举报'
|
|
|
|
? (this.complaint.isLoading = false)
|
|
|
|
: (this.permission.isLoading = false);
|
|
|
|
|
|
|
|
TaskType == '投诉举报' ? (this.complaint.allocated = 0) : null;
|
|
|
|
TaskType == '行政许可' ? (this.permission.allocated = 0) : null;
|
|
|
|
TaskType == '投诉举报' ? (this.complaint.data = data.items) : null;
|
|
|
|
TaskType == '行政许可' ? (this.permission.data = data.items) : null;
|
|
|
|
|
|
|
|
data.items.forEach((item) => {
|
|
|
|
if (item.approvalStatus == '通过') {
|
|
|
|
TaskType == '投诉举报' ? (this.complaint.allocated += 1) : null;
|
|
|
|
TaskType == '行政许可'
|
|
|
|
? (this.permission.allocated += 1)
|
|
|
|
: null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//修改任务描述
|
|
|
|
taskDescChange(incomingData, item) {
|
|
|
|
this.valueChange.next(item);
|
|
|
|
}
|
|
|
|
//修改任务额
|
|
|
|
targetCountChange(incomingData, item, e) {
|
|
|
|
this.targetCount.next(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
// console.log('毁灭了')
|
|
|
|
// this.doubleRandom.isPopover = false
|
|
|
|
}
|
|
|
|
onExpandChange(e: NzFormatEmitEvent): void {
|
|
|
|
const node = e.node;
|
|
|
|
if (
|
|
|
|
node &&
|
|
|
|
node.getChildren().length === 0 &&
|
|
|
|
node.isExpanded &&
|
|
|
|
node.origin.level == 'squadron'
|
|
|
|
) {
|
|
|
|
this.loadNode(node.origin.id).then((data) => {
|
|
|
|
node.addChildren(data);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
node.isLoading = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
loadNode(id): Promise<NzTreeNodeOptions[]> {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
let params = {
|
|
|
|
OrganizationId: id,
|
|
|
|
PageNumber: 1,
|
|
|
|
PageSize: 9999,
|
|
|
|
};
|
|
|
|
this.http
|
|
|
|
.get('/api/Companies', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
console.log(data.items);
|
|
|
|
data.items.forEach((element) => {
|
|
|
|
element.key = element.id;
|
|
|
|
element.title = element.companyName;
|
|
|
|
element.level = 4;
|
|
|
|
element.isLeaf = true;
|
|
|
|
});
|
|
|
|
resolve(data.items);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async getCompaniesByName(incomingData) {
|
|
|
|
// incomingData.search2Value
|
|
|
|
console.log(incomingData.search2Value);
|
|
|
|
if (incomingData.search2) {
|
|
|
|
incomingData.isnodes = false;
|
|
|
|
let params = {
|
|
|
|
CompanyName: incomingData.search2,
|
|
|
|
PageNumber: this.PageNumber,
|
|
|
|
PageSize: 9999,
|
|
|
|
};
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
|
|
this.http
|
|
|
|
.get('/api/Companies', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
this.moreDataLoading = false;
|
|
|
|
this.totalCount = data.totalCount;
|
|
|
|
data.items.forEach((element) => {
|
|
|
|
element.label = element.companyName;
|
|
|
|
element.value = element.id;
|
|
|
|
element.parentId = element.organizationId;
|
|
|
|
element.key = element.id;
|
|
|
|
element.title = element.companyName;
|
|
|
|
element.level = 4;
|
|
|
|
element.isLeaf = true;
|
|
|
|
incomingData.search2Value.forEach((item) => {
|
|
|
|
item == element.id ? (element.isChecked = true) : null;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (data.items.length == 0) {
|
|
|
|
this.message.create('warning', '没有查询到任何单位');
|
|
|
|
incomingData.isnodes = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let allOrList = JSON.parse(JSON.stringify(this.allOrList));
|
|
|
|
allOrList.forEach((element) => {
|
|
|
|
element.expanded = true;
|
|
|
|
});
|
|
|
|
let arr = [...allOrList, ...data.items];
|
|
|
|
incomingData.nodes2 = [...this.toTree.toTree(arr)];
|
|
|
|
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
incomingData.isnodes = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assitantsupervisorList;
|
|
|
|
mainsupervisorList;
|
|
|
|
getSupervisor(type) {
|
|
|
|
let params = {
|
|
|
|
inspectorType: type,
|
|
|
|
};
|
|
|
|
this.http
|
|
|
|
.get('/api/Users/Inspectors', {
|
|
|
|
params: params,
|
|
|
|
})
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
console.log('检查员列表', data);
|
|
|
|
data.forEach((element) => {
|
|
|
|
element.parentId = element.organizationId;
|
|
|
|
element.key = element.id;
|
|
|
|
element.title = element.name;
|
|
|
|
element.selectable = false;
|
|
|
|
element.disableCheckbox = false;
|
|
|
|
element.datatype = '人员';
|
|
|
|
});
|
|
|
|
if (type == 'main') {
|
|
|
|
this.mainsupervisorList = data;
|
|
|
|
} else {
|
|
|
|
this.assitantsupervisorList = data;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
allot(item, type) {
|
|
|
|
console.log(item);
|
|
|
|
if (
|
|
|
|
this.mainsupervisorList.length == 0 ||
|
|
|
|
this.assitantsupervisorList.length == 0
|
|
|
|
) {
|
|
|
|
this.message.create('warning', '请从用户管理添加检查人员');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const modal = this.modal.create({
|
|
|
|
nzTitle: '分配监督检查员',
|
|
|
|
nzContent: AllotPersonComponent,
|
|
|
|
nzViewContainerRef: this.viewContainerRef,
|
|
|
|
nzWidth: 485,
|
|
|
|
nzMaskClosable: false,
|
|
|
|
nzComponentParams: {
|
|
|
|
mainsupervisorList: this.mainsupervisorList,
|
|
|
|
assitantsupervisorList: this.assitantsupervisorList,
|
|
|
|
},
|
|
|
|
nzOnOk: async () => {
|
|
|
|
if (instance.validateForm.valid) {
|
|
|
|
await new Promise((resolve, reject) => {
|
|
|
|
let body = {
|
|
|
|
supervisorIds: [
|
|
|
|
instance.validateForm.value.main,
|
|
|
|
instance.validateForm.value.assitant,
|
|
|
|
],
|
|
|
|
};
|
|
|
|
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
|
|
|
|
next: async (data) => {
|
|
|
|
this.message.create('success', '分配成功');
|
|
|
|
this.getTaskTarget(type);
|
|
|
|
resolve(data);
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '分配失败');
|
|
|
|
reject(err);
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.message.create('warning', '请填写完整!');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const instance = modal.getContentComponent();
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
|
|
|
|
modal.afterClose.subscribe((result) =>
|
|
|
|
console.log('[afterClose] The result is:', result)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
distribute(item, type) {
|
|
|
|
this.modal.confirm({
|
|
|
|
nzTitle: `确定要派发该任务吗?`,
|
|
|
|
nzOkText: '确定',
|
|
|
|
nzOkType: 'default',
|
|
|
|
nzOnOk: () => {
|
|
|
|
item.isLoading = true;
|
|
|
|
this.http
|
|
|
|
.post(`/api/PlanTasks/Approval/${item.id}`, null, {
|
|
|
|
params: {
|
|
|
|
approvalStatus: '待检查',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.subscribe({
|
|
|
|
next: (data) => {
|
|
|
|
this.message.create('success', '已派发');
|
|
|
|
item.approvalStatus = '待检查';
|
|
|
|
item.isLoading = false;
|
|
|
|
item.passed += 1;
|
|
|
|
type == '投诉举报' ? (this.complaint.allocated += 1) : null;
|
|
|
|
type == '行政许可' ? (this.permission.allocated += 1) : null;
|
|
|
|
type == '双随机' ? (this.doubleRandom.allocated += 1) : null;
|
|
|
|
type == '熟悉演练' ? (this.rehearsal.allocated += 1) : null;
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '派发失败');
|
|
|
|
item.isLoading = false;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
nzCancelText: '取消',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//删除任务
|
|
|
|
deleteTask(item, incomingData) {
|
|
|
|
console.log(item);
|
|
|
|
console.log(incomingData);
|
|
|
|
this.modal.confirm({
|
|
|
|
nzTitle: `确定要删除该任务吗?`,
|
|
|
|
nzOkText: '确定',
|
|
|
|
nzOkType: 'primary',
|
|
|
|
nzOnOk: () => {
|
|
|
|
this.http.delete(`/api/PlanTasks/${item.id}`).subscribe((data) => {
|
|
|
|
let originaldata;
|
|
|
|
if (item.taskType == '投诉举报' || item.taskType == '行政许可') {
|
|
|
|
this.getTaskList(item.taskType);
|
|
|
|
}
|
|
|
|
if (item.taskType == '双随机' || item.taskType == '熟悉演练') {
|
|
|
|
this.getTaskTarget(item.taskType);
|
|
|
|
}
|
|
|
|
this.message.create('success', '删除成功!');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
nzCancelText: '取消',
|
|
|
|
nzOnCancel: () => {},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|