Browse Source

[修改]修改支队派发任务

非煤矿山灾害智能感知和预警系统
邵佳豪 3 years ago
parent
commit
4aeadea38e
  1. 5
      src/app/home/task/da-oneself-plan/da-oneself-plan.component.ts
  2. 14
      src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts
  3. 18
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.html
  4. 11
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts
  5. 8
      src/app/home/task/station-weekly-plan/task-details/task-details.component.html
  6. 3
      src/app/home/task/zhi-indicators/edit-or/edit-or.component.html
  7. 12
      src/app/home/task/zhi-indicators/edit-or/edit-or.component.ts
  8. 10
      src/app/home/task/zhi-indicators/zhi-indicators.component.html
  9. 34
      src/app/home/task/zhi-indicators/zhi-indicators.component.ts

5
src/app/home/task/da-oneself-plan/da-oneself-plan.component.ts

@ -90,13 +90,15 @@ export class DaOneselfPlanComponent implements OnInit {
item.data = [] item.data = []
item.passed = 0 item.passed = 0
item.inspected = 0 item.inspected = 0
item.percentage = 0
}); });
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
let params = { let params = {
Month: selectedTime, Month: selectedTime,
OrganizationId: this.OrganizationId, OrganizationId: this.OrganizationId,
PageNumber: 1, PageNumber: 1,
PageSize: 9999 PageSize: 9999,
approvalStatuses: ['待处理', '通过', '驳回', '待检查', '已检查']
} }
return await new Promise<void>((resolve, reject) => { return await new Promise<void>((resolve, reject) => {
this.http.get('/api/PlanTasks', { this.http.get('/api/PlanTasks', {
@ -233,6 +235,7 @@ export class DaOneselfPlanComponent implements OnInit {
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
modal.afterClose.subscribe(result => { modal.afterClose.subscribe(result => {
this.getTasks()
this.getTaskListOfStation(item) this.getTaskListOfStation(item)
}); });
} }

14
src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts

@ -17,8 +17,19 @@ export class PlanAdjustmentComponent implements OnInit {
spin1 = false spin1 = false
spin2 = false spin2 = false
userId userId
organizationName
isSupervisor
OrganizationId
ngOnInit(): void { ngOnInit(): void {
this.userId = JSON.parse(sessionStorage.getItem('userData')).id this.userId = JSON.parse(sessionStorage.getItem('userData')).id
this.organizationName = JSON.parse(sessionStorage.getItem('userData')).organizationName
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
let roles = JSON.parse(sessionStorage.getItem('userData')).roles
let isSupervisor = roles.find(item => {
return item.name.indexOf('检查') != -1
})
isSupervisor ? this.isSupervisor = true : this.isSupervisor = false
this.getTaskListOfStation(this.data, '未接任务') this.getTaskListOfStation(this.data, '未接任务')
} }
push(i, item, e) { push(i, item, e) {
@ -129,7 +140,8 @@ export class PlanAdjustmentComponent implements OnInit {
} else { } else {
params = { params = {
Month: this.time, Month: this.time,
SupervisorId: this.userId, SupervisorId: this.isSupervisor ? this.userId : null,
AssitantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
PageNumber: this.PageNumber, PageNumber: this.PageNumber,
approvalStatuses: statuses, approvalStatuses: statuses,
PageSize: this.PageSize PageSize: this.PageSize

18
src/app/home/task/station-weekly-plan/station-weekly-plan.component.html

@ -96,18 +96,20 @@
<p class="itemtwocontentitemp1"> <p class="itemtwocontentitemp1">
<span class="itemtwocontentitemp1name">{{i.company.companyName}}</span> <span class="itemtwocontentitemp1name">{{i.company.companyName}}</span>
<span class="marginr5"> <span class="marginr5">
<span class="green" *ngIf="isExpand" (click)="accept(i,item)">接受</span> <span class="green" *ngIf="isExpand && i.approvalStatus!='已检查'"
<span class="red" *ngIf="isExpand" (click)="reject(i,item)">拒绝</span> (click)="accept(i,item)">接受</span>
<span class="green" *ngIf="isExpand && i.approvalStatus == '通过'">已通过</span> <span class="red" *ngIf="isExpand && i.approvalStatus!='已检查'"
<span class="red" *ngIf="isExpand && i.approvalStatus == '驳回'">已驳回</span> (click)="reject(i,item)">拒绝</span>
<span *ngIf="isExpand">{{i.approvalStatus}}</span>
</span> </span>
</p> </p>
<p>{{i.company.organization.name}}</p> <p>{{i.company.organization.name}}</p>
<p class="marginr5"> <p class="marginr5">
<span class=" green" *ngIf="!isExpand" (click)="accept(i,item)">接受</span> <span class=" green" *ngIf="!isExpand && i.approvalStatus!='已检查'"
<span class="red" *ngIf="!isExpand" (click)="reject(i,item)">拒绝</span> (click)="accept(i,item)">接受</span>
<span class="green" *ngIf="!isExpand && i.approvalStatus == '通过'">已通过</span> <span class="red" *ngIf="!isExpand && i.approvalStatus!='已检查'"
<span class="red" *ngIf="!isExpand && i.approvalStatus == '驳回'">已驳回</span> (click)="reject(i,item)">拒绝</span>
<span *ngIf="!isExpand">{{i.approvalStatus}}</span>
</p> </p>
</div> </div>
</div> </div>

11
src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts

@ -178,8 +178,11 @@ export class StationWeeklyPlanComponent implements OnInit {
PageNumber = 1 PageNumber = 1
PageSize = 9999 PageSize = 9999
async getTaskList() { async getTaskList() {
this.cardData.forEach(item => { this.cardData.forEach(element => {
item.data = [] element.data = []
element.percentage = 0
element.passed = 0
element.inspected = 0
}) })
this.isLoading = true this.isLoading = true
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
@ -188,7 +191,8 @@ export class StationWeeklyPlanComponent implements OnInit {
SupervisorId: this.isSupervisor ? this.userId : null, SupervisorId: this.isSupervisor ? this.userId : null,
AssitantOrganizationId: this.isSupervisor ? null : this.OrganizationId, AssitantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
PageNumber: this.PageNumber, PageNumber: this.PageNumber,
PageSize: this.PageSize PageSize: this.PageSize,
approvalStatuses: ['待处理', '通过', '驳回', '待检查', '已检查']
} }
return await new Promise<void>((resolve, reject) => { return await new Promise<void>((resolve, reject) => {
this.http.get('/api/PlanTasks', { this.http.get('/api/PlanTasks', {
@ -603,6 +607,7 @@ export class StationWeeklyPlanComponent implements OnInit {
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
modal.afterClose.subscribe(result => { modal.afterClose.subscribe(result => {
this.getTaskList()
this.getTaskListPass(this.stationData[0]) this.getTaskListPass(this.stationData[0])
}); });
} }

8
src/app/home/task/station-weekly-plan/task-details/task-details.component.html

@ -18,11 +18,9 @@
</p> </p>
</div> </div>
<div class="state"> <div class="state">
<span class="green" (click)="accept(item)">接受</span> <span class="green" (click)="accept(item)" *ngIf="item.approvalStatus!='已检查'">接受</span>
<span class="red" (click)="reject(item)">拒绝</span> <span class="red" (click)="reject(item)" *ngIf="item.approvalStatus!='已检查'">拒绝</span>
<span *ngIf="item.approvalStatus == '待处理'">待处理</span> <span>{{item.approvalStatus}}</span>
<span class="green" *ngIf="item.approvalStatus == '通过'">已通过</span>
<span class="red" *ngIf="item.approvalStatus == '驳回'">已驳回</span>
</div> </div>
</div> </div>
</div> </div>

3
src/app/home/task/zhi-indicators/edit-or/edit-or.component.html

@ -3,13 +3,12 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="协助机构">协助机构</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="协助机构">协助机构</nz-form-label>
<nz-form-control> <nz-form-control>
<nz-tree-select [nzShowSearch]='true' [nzDropdownClassName]="'maxHeightTreeSelect'" <nz-tree-select #nzTreeComponent [nzShowSearch]='true' [nzDropdownClassName]="'maxHeightTreeSelect'"
formControlName="organization" [nzNodes]="newTree" nzPlaceHolder="请选择协助机构" formControlName="organization" [nzNodes]="newTree" nzPlaceHolder="请选择协助机构"
[nzExpandedIcon]="multiExpandedIconTpl" nzCheckable [nzCheckStrictly]="true"> [nzExpandedIcon]="multiExpandedIconTpl" nzCheckable [nzCheckStrictly]="true">
</nz-tree-select> </nz-tree-select>
<ng-template #multiExpandedIconTpl let-node let-origin="origin"> <ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate"> <ng-container *ngIf="node.children.length == 0; else elseTemplate">
</ng-container> </ng-container>
<ng-template #elseTemplate> <ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'" <i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"

12
src/app/home/task/zhi-indicators/edit-or/edit-or.component.ts

@ -1,10 +1,11 @@
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal'; import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { TreeService } from 'src/app/service/tree.service'; import { TreeService } from 'src/app/service/tree.service';
import { Observable, of } from 'rxjs'; import { Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators'; import { catchError, map } from 'rxjs/operators';
import { NzTreeComponent } from 'ng-zorro-antd/tree';
@Component({ @Component({
selector: 'app-edit-or', selector: 'app-edit-or',
@ -12,10 +13,11 @@ import { catchError, map } from 'rxjs/operators';
styleUrls: ['./edit-or.component.scss'] styleUrls: ['./edit-or.component.scss']
}) })
export class EditOrComponent implements OnInit { export class EditOrComponent implements OnInit {
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
@Input() selectedData?: any; @Input() selectedData?: any;
@Input() organizationList?: any; @Input() organizationList?: any;
@Input() users?: any; @Input() users?: any;
@Input() supervisorList?: any;
validateForm!: FormGroup; validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
@ -26,11 +28,7 @@ export class EditOrComponent implements OnInit {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
organization: [this.selectedData] organization: [this.selectedData]
}); });
let arr = [...this.supervisorList, ...this.organizationList]
console.log(111, this.users)
console.log(222, this.organizationList)
let arr = [...this.users, ...this.organizationList]
console.log(333, arr)
this.newTree = this.toTree.toTree(arr) this.newTree = this.toTree.toTree(arr)
} }

10
src/app/home/task/zhi-indicators/zhi-indicators.component.html

@ -120,7 +120,7 @@
<thead> <thead>
<tr> <tr>
<th nzWidth="25%">单位名称</th> <th nzWidth="25%">单位名称</th>
<th nzWidth="40%">配合机构</th> <th nzWidth="40%">配合机构/人员</th>
<th nzWidth="25%">说明</th> <th nzWidth="25%">说明</th>
<th nzWidth="10%">操作</th> <th nzWidth="10%">操作</th>
</tr> </tr>
@ -134,6 +134,9 @@
<span *ngFor="let i of item.supervisors"> <span *ngFor="let i of item.supervisors">
/{{i.name}} /{{i.name}}
</span> </span>
<span *ngFor="let i of item.assitantOrganizations">
/{{i.name}}
</span>
</span> </span>
<span class="blue" (click)="editOr(complaint,item)" <span class="blue" (click)="editOr(complaint,item)"
[ngClass]="{'forbid': item.approvalStatus == '通过'}">修改机构</span> [ngClass]="{'forbid': item.approvalStatus == '通过'}">修改机构</span>
@ -268,7 +271,7 @@
<thead> <thead>
<tr> <tr>
<th nzWidth="25%">单位名称</th> <th nzWidth="25%">单位名称</th>
<th nzWidth="40%">配合机构</th> <th nzWidth="40%">配合机构/人员</th>
<th nzWidth="25%">说明</th> <th nzWidth="25%">说明</th>
<th nzWidth="10%">操作</th> <th nzWidth="10%">操作</th>
</tr> </tr>
@ -282,6 +285,9 @@
<span *ngFor="let i of item.supervisors"> <span *ngFor="let i of item.supervisors">
/{{i.name}} /{{i.name}}
</span> </span>
<span *ngFor="let i of item.assitantOrganizations">
/{{i.name}}
</span>
</span> </span>
<span class="blue" (click)="editOr(permission,item)" <span class="blue" (click)="editOr(permission,item)"
[ngClass]="{'forbid': item.approvalStatus == '通过'}">修改机构</span> [ngClass]="{'forbid': item.approvalStatus == '通过'}">修改机构</span>

34
src/app/home/task/zhi-indicators/zhi-indicators.component.ts

@ -298,6 +298,8 @@ export class ZhiIndicatorsComponent implements OnInit {
element.title = element.name element.title = element.name
element.selectable = false element.selectable = false
element.disableCheckbox = true element.disableCheckbox = true
element.datatype = '机构'
element.level == 'squadron' ? element.disableCheckbox = false : null
}); });
this.allOrList = JSON.parse(JSON.stringify(data.items)) this.allOrList = JSON.parse(JSON.stringify(data.items))
resolve(data) resolve(data)
@ -329,6 +331,8 @@ export class ZhiIndicatorsComponent implements OnInit {
}) })
}) })
} }
editOr(incomingData, item) { editOr(incomingData, item) {
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '修改协助机构', nzTitle: '修改协助机构',
@ -337,15 +341,23 @@ export class ZhiIndicatorsComponent implements OnInit {
nzWidth: 660, nzWidth: 660,
nzMaskClosable: false, nzMaskClosable: false,
nzComponentParams: { nzComponentParams: {
selectedData: item.supervisorIds, selectedData: [...item.supervisorIds, ...item.assitantOrganizationIds],
organizationList: JSON.parse(JSON.stringify(this.allOrList)), organizationList: JSON.parse(JSON.stringify(this.allOrList)),
users: JSON.parse(JSON.stringify(this.users)), // users: JSON.parse(JSON.stringify(this.users)),
supervisorList: [...JSON.parse(JSON.stringify(this.assitantsupervisorList)), ...JSON.parse(JSON.stringify(this.mainsupervisorList))]
}, },
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
console.log(instance.nzTreeComponent.getCheckedNodeList())
let supervisorIds = []
let assitantOrganizationIds = []
instance.nzTreeComponent.getCheckedNodeList().forEach(item => {
item.origin.datatype == '机构' ? assitantOrganizationIds.push(item.key) : supervisorIds.push(item.key)
})
let body = { let body = {
supervisorIds: instance.validateForm.value.organization, supervisorIds: supervisorIds,
assitantOrganizationIds: assitantOrganizationIds
} }
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({ this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
next: async (data: any) => { next: async (data: any) => {
@ -370,6 +382,8 @@ export class ZhiIndicatorsComponent implements OnInit {
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
} }
orcheckbox(data, $event, node) { orcheckbox(data, $event, node) {
if ($event) { if ($event) {
data.search2Value.push(node.origin.id) data.search2Value.push(node.origin.id)
@ -428,7 +442,9 @@ export class ZhiIndicatorsComponent implements OnInit {
}) })
}); });
this.getUsers() // this.getUsers()
Promise.all([this.getCompanies(), this.getAllOrganization()]) Promise.all([this.getCompanies(), this.getAllOrganization()])
.then((results) => { .then((results) => {
let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))] let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
@ -596,7 +612,7 @@ export class ZhiIndicatorsComponent implements OnInit {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
console.log('毁灭了') // console.log('毁灭了')
// this.doubleRandom.isPopover = false // this.doubleRandom.isPopover = false
} }
@ -650,6 +666,14 @@ export class ZhiIndicatorsComponent implements OnInit {
params: params params: params
}).subscribe((data: any) => { }).subscribe((data: any) => {
console.log('检查员列表', data) 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') { if (type == 'main') {
this.mainsupervisorList = data this.mainsupervisorList = data
} else { } else {

Loading…
Cancel
Save