Browse Source

[新增]大队下级任务审核

非煤矿山灾害智能感知和预警系统
邵佳豪 2 years ago
parent
commit
f4151e746a
  1. 148
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html
  2. 54
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.scss
  3. 225
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts
  4. 23
      src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html
  5. 24
      src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts
  6. 70
      src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html
  7. 15
      src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.scss
  8. 195
      src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.ts
  9. 20
      src/app/home/task/station-task-apply/station-task-apply.component.html
  10. 2
      src/app/home/task/station-task-apply/station-task-apply.component.ts
  11. 16
      src/app/http-interceptors/base-interceptor.ts
  12. 2
      src/app/service/cache-token.service.ts
  13. 14
      src/styles.scss

148
src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html

@ -1,12 +1,12 @@
<!-- <p>月度任务总览</p> -->
<div class="box">
<div class="timebox">
<nz-select ngModel="2022">
<nz-option nzValue="2021" nzLabel="2021年"></nz-option>
<nz-option nzValue="2022" nzLabel="2022年"></nz-option>
<nz-select [(ngModel)]="selectedYear" (ngModelChange)="selectYear($event)">
<nz-option [nzValue]="2021" nzLabel="2021年"></nz-option>
<nz-option [nzValue]="2022" nzLabel="2022年"></nz-option>
</nz-select>
<div *ngFor="let item of months" class="monthbtn" (click)="selectMonth(item)"
[ngClass]="{'selectedMonth': item.name == selectedMonth}">
[ngClass]="{'selectedMonth': item.id == selectedMonth}">
{{item.name}}
</div>
</div>
@ -76,108 +76,54 @@
<i nz-icon [nzType]="istaskauditExpanded ? 'down' : 'up'" nzTheme="outline"></i>
</span>
</div>
<!-- 熟悉演练任务 -->
<div class="shuxibox" *ngIf="istaskauditExpanded">
<div class="header">
<span>熟悉演练任务</span>
<span (click)="expand(shuxiTaskData)" class="expand blue">
{{shuxiTaskData.isExpand ? '收起' :'展开'}}
<i nz-icon [nzType]="shuxiTaskData.isExpand ? 'down' : 'up'" nzTheme="outline"></i>
</span>
</div>
<div class="content" *ngIf="shuxiTaskData.isExpand">
<div class="card redcard">
<div class="unitname">
<img src="../../../../assets/images/icon/unit.png" alt="">
<span>上海雅特酒店管理有限公司济南泺文路分公司</span>
</div>
<div class="info">
<span>
<img src="../../../../assets/images/icon/main.png" alt="">
未分配
</span>
<span>
<img src="../../../../assets/images/icon/assist.png" alt="">
未分配
</span>
<span class="blue">分配</span>
<span>|</span>
<span>申请人: 历下区A消防救援站</span>
<span class="blue">修改</span>
</div>
<div class="btn">
<button nz-button style="background: #42B983;color: white;">同意</button>
<button nz-button style="background: #FF0000;color: white;margin-left: 20px;">驳回</button>
</div>
<img class="auditimg" src="../../../../assets/images/icon/reject.png" alt="">
<!-- <img class="auditimg" src="../../../../assets/images/icon/agree.png" alt=""> -->
<!-- 任务 -->
<div *ngIf="istaskauditExpanded">
<div class="taskauditbox" *ngFor="let item of taskData">
<div class="header">
<span>{{item.name}}</span>
<span (click)="expand(item)" class="expand blue">
{{item.isExpand ? '收起' :'展开'}}
<i nz-icon [nzType]="item.isExpand ? 'down' : 'up'" nzTheme="outline"></i>
</span>
</div>
<div class="card greencard">
<div class="unitname">
<img src="../../../../assets/images/icon/unit.png" alt="">
<span>上海雅特酒店管理有限公司济南泺文路分公司</span>
</div>
<div class="info">
<span>
<img src="../../../../assets/images/icon/main.png" alt="">
未分配
</span>
<span>
<img src="../../../../assets/images/icon/assist.png" alt="">
未分配
</span>
<span class="blue">分配</span>
<span>|</span>
<span>申请人: 历下区A消防救援站</span>
<span class="blue">修改</span>
</div>
<div class="btn">
<button nz-button style="background: #42B983;color: white;">同意</button>
<button nz-button style="background: #FF0000;color: white;margin-left: 20px;">驳回</button>
<div class="content" *ngIf="item.isExpand">
<div *ngFor="let i of item.list" class="card greencard"
[ngClass]="{'redcard': i.approvalStatus == 'reject'}">
<div class="unitname">
<img src="../../../../assets/images/icon/unit.png" alt="">
<span>{{i.company.companyName}}</span>
</div>
<div class="info">
<span>
<img src="../../../../assets/images/icon/main.png" alt="">
{{i.mainSupervisor ? i.mainSupervisor.name : '未分配'}}
</span>
<span>
<img src="../../../../assets/images/icon/assist.png" alt="">
{{i.assitantSupervisor ? i.assitantSupervisor.name : '未分配'}}
</span>
<span class="blue" (click)="allot(i)">分配</span>
<span>|</span>
<span>申请人: {{i.assitantOrganization.name}}</span>
<!-- <span class="blue">修改</span> -->
</div>
<div class="btn">
<button [ngClass]="{'forbidbtn': i.approvalStatus}" [disabled]="i.approvalStatus"
nz-button (click)="agree(i)">同意</button>
<button [ngClass]="{'forbidbtn': i.approvalStatus}" [disabled]="i.approvalStatus"
nz-button (click)="reject(i)">驳回</button>
</div>
<img *ngIf="i.approvalStatus == 'reject'" class="auditimg"
src="../../../../assets/images/icon/reject.png" alt="">
<img *ngIf="i.approvalStatus == 'approved'" class="auditimg"
src="../../../../assets/images/icon/agree.png" alt="">
</div>
<img class="auditimg" src="../../../../assets/images/icon/reject.png" alt="">
<!-- <img class="auditimg" src="../../../../assets/images/icon/agree.png" alt=""> -->
</div>
</div>
</div>
<!-- 联络指导任务 -->
<div class="zhidaobox" *ngIf="istaskauditExpanded">
<div class="header">
<span>联络指导任务</span>
<span (click)="expand(zhidaoTaskData)" class="expand blue">
{{zhidaoTaskData.isExpand ? '收起' :'展开'}}
<i nz-icon [nzType]="zhidaoTaskData.isExpand ? 'down' : 'up'" nzTheme="outline"></i>
</span>
</div>
<div class="content" *ngIf="zhidaoTaskData.isExpand">
<!-- <div class="card redcard">
<div class="unitname">
<img src="../../../../assets/images/icon/unit.png" alt="">
<span>上海雅特酒店管理有限公司济南泺文路分公司</span>
</div>
<div class="info">
<span>
<img src="../../../../assets/images/icon/main.png" alt="">
未分配
</span>
<span>
<img src="../../../../assets/images/icon/assist.png" alt="">
未分配
</span>
<span class="blue">分配</span>
<span>|</span>
<span>申请人: 历下区A消防救援站</span>
<span class="blue">修改</span>
</div>
<div class="btn">
<button nz-button style="background: #42B983;color: white;">同意</button>
<button nz-button style="background: #FF0000;color: white;margin-left: 20px;">驳回</button>
</div>
<img class="auditimg" src="../../../../assets/images/icon/reject.png" alt="">
<img class="auditimg" src="../../../../assets/images/icon/agree.png" alt="">
</div> -->
</div>
</div>
</div>
<!-- 本级部署 -->

54
src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.scss

@ -227,8 +227,7 @@
margin-bottom: 15px;
}
.shuxibox,
.zhidaobox {
.taskauditbox {
width: 100%;
background: #FFFFFF;
@ -290,6 +289,17 @@
.btn {
flex: 1;
button:nth-child(1) {
background: #42B983;
color: white;
}
button:nth-child(2) {
background: #FF0000;
color: white;
margin-left: 20px;
}
}
.auditimg {
@ -311,7 +321,7 @@
}
}
.zhidaobox {
.taskauditbox:nth-child(2) {
margin-bottom: 0px;
}
@ -348,28 +358,34 @@
flex-direction: column;
justify-content: space-around;
color: #fff;
.title{
.title {
text-align: left;
}
.details{
.details {
display: flex;
justify-content: space-between;
align-items: center;
.detailsname{
display: flex;
align-items: center;
.detailsname {
display: flex;
align-items: center;
}
.progresssquare{
width: 60%;
display: flex;
color: #fff;
align-items: center;
span:nth-child(1){
margin-right: 16px;
}
span:last-child{
margin-left: 16px;
}
.progresssquare {
width: 60%;
display: flex;
color: #fff;
align-items: center;
span:nth-child(1) {
margin-right: 16px;
}
span:last-child {
margin-left: 16px;
}
}
}
}

225
src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, ViewContainerRef } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';
import { AllotPersonComponent } from '../da-subordinate-audit/allot-person/allot-person.component';
@Component({
selector: 'app-da-monthly-task-overview',
@ -7,28 +11,45 @@ import { Component, OnInit } from '@angular/core';
})
export class DaMonthlyTaskOverviewComponent implements OnInit {
constructor() { }
constructor(private http: HttpClient, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { }
OrganizationId
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
this.selectedMonth = new Date().getMonth() + 1
this.getTaskList()
//获得主协调查人员
this.getSupervisor('main')
this.getSupervisor('assisted')
}
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
selectedYear = 2022
selectedTime
selectMonth(item) {
this.selectedMonth = item.name
this.selectedMonth = item.id
this.getTaskList()
}
selectYear(e) {
this.selectedYear = e
console.log('年', e)
this.getTaskList()
}
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 }
]
istaskauditExpanded = true
@ -48,6 +69,176 @@ export class DaMonthlyTaskOverviewComponent implements OnInit {
zhidaoTaskData = {
isExpand: true
}
PageNumber = 1
PageSize = 9999
taskData = [
{ id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [], isExpand: true },
{ id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [], isExpand: true }
]
isloading = false
getTaskList() {
this.isloading = true
this.taskData = [
{ id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [], isExpand: true },
{ id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [], isExpand: true }
]
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
console.log('查询时间', selectedTime)
let params = {
Month: selectedTime,
OrganizationId: this.OrganizationId,
PageNumber: this.PageNumber,
PageSize: this.PageSize
}
this.http.get('/api/PlanTasks', {
params: params
}).subscribe((data: any) => {
let arr1 = []
let arr2 = []
data.items.forEach(element => {
if (element.taskName == '熟悉演练') {
arr1.push(element)
}
if (element.taskName == '联络指导') {
arr2.push(element)
}
});
arr1.forEach(item => {
if (!!item.approvalStatus) {
this.taskData[0].finished += 1
}
});
arr2.forEach(item => {
if (!!item.approvalStatus) {
this.taskData[1].finished += 1
}
});
this.taskData[0].totalCount = arr1.length
this.taskData[0].list = [...arr1]
this.taskData[1].totalCount = arr2.length
this.taskData[1].list = [...arr2]
this.isloading = false
})
}
assitantsupervisorList
mainsupervisorList
getSupervisor(type) {
let params = {
inspectorType: type
}
this.http.get('/api/Users/Inspectors', {
params: params
}).subscribe((data: any) => {
console.log('检查员列表', data)
if (type == 'main') {
this.mainsupervisorList = data
} else {
this.assitantsupervisorList = data
}
})
}
allot(item) {
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 = {
mainSupervisorId: instance.validateForm.value.main,
assitantSupervisorId: instance.validateForm.value.assitant
}
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
next: async (data) => {
this.message.create('success', '分配成功');
resolve(data)
this.getTaskList()
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));
}
agree(item) {
this.modal.confirm({
nzTitle: `确定要同意该申请吗?`,
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: () => {
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, {
params: {
approvalStatus: 'approved'
}
}).subscribe({
next: (data) => {
this.message.create('success', '审核成功');
this.getTaskList()
},
error: (err) => {
this.message.create('warning', '审核失败');
}
})
},
nzCancelText: '取消'
});
}
reject(item) {
this.modal.confirm({
nzTitle: `确定要驳回该申请吗?`,
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: () => {
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, {
params: {
approvalStatus: 'reject'
}
}).subscribe({
next: (data) => {
this.message.create('success', '审核成功');
this.getTaskList()
},
error: (err) => {
this.message.create('warning', '审核失败');
}
})
},
nzCancelText: '取消'
});
}
expand(data) {
data.isExpand = !data.isExpand
}

23
src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html

@ -1 +1,22 @@
<p>allot-person works!</p>
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查员(主)">检查员(主)</nz-form-label>
<nz-form-control>
<nz-select formControlName="main" nzPlaceHolder="请选择消防监督检查员(主)">
<nz-option *ngFor="let item of mainsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查员(协)">检查员(协)</nz-form-label>
<nz-form-control>
<nz-select formControlName="assitant" nzPlaceHolder="请选择消防监督检查员(协)">
<nz-option *ngFor="let item of assitantsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

24
src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts

@ -1,5 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { TreeService } from 'src/app/service/tree.service';
@Component({
selector: 'app-allot-person',
templateUrl: './allot-person.component.html',
@ -7,9 +10,24 @@ import { Component, OnInit } from '@angular/core';
})
export class AllotPersonComponent implements OnInit {
constructor() { }
@Input() mainsupervisorList?: any;
@Input() assitantsupervisorList?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
main: [null, [Validators.required]],
assitant: [null, [Validators.required]]
});
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
listOfData: any[] = [];
}

70
src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html

@ -1,19 +1,22 @@
<!-- <p>下级任务申请</p> -->
<div class="box">
<div class="timebox">
<nz-select ngModel="2022">
<nz-option nzValue="2021" nzLabel="2021年"></nz-option>
<nz-option nzValue="2022" nzLabel="2022年"></nz-option>
<nz-select [(ngModel)]="selectedYear" (ngModelChange)="selectYear($event)">
<nz-option [nzValue]="2021" nzLabel="2021年"></nz-option>
<nz-option [nzValue]="2022" nzLabel="2022年"></nz-option>
</nz-select>
<div *ngFor="let item of months" class="monthbtn" (click)="selectMonth(item)"
[ngClass]="{'selectedMonth': item.name == selectedMonth}">
[ngClass]="{'selectedMonth': item.id == selectedMonth}">
{{item.name}}
</div>
</div>
<div class="content">
<div class="spin" *ngIf="isloading">
<nz-spin nzSimple></nz-spin>
</div>
<div class="tabheader">
<div *ngFor="let item of data" class="tabtitle" [ngClass]="{'selectedTab': selectedTab == item.id}"
(click)="selectTab(item.id)">
(click)="selectTab(item)">
<div [ngClass]="{'blue': selectedTab == item.id}">
<span>{{item.name}}</span>
<span style="margin: 0 8px;"></span>
@ -21,40 +24,9 @@
</div>
</div>
</div>
<div class="tabbody" *ngIf="selectedTab == 0">
<div class="card greencard" [ngClass]="{'redcard': item.approvalStatus == 1}"
*ngFor="let item of data[0].list">
<div class="unitname">
<img src="../../../../assets/images/icon/unit.png" alt="">
<span>{{item.company.companyName}}</span>
</div>
<div class="info">
<span>
<img src="../../../../assets/images/icon/main.png" alt="">
未分配
</span>
<span>
<img src="../../../../assets/images/icon/assist.png" alt="">
未分配
</span>
<span class="blue">分配</span>
<span>|</span>
<span>申请人: {{item.assitantOrganization.name}}</span>
<!-- <span class="blue">修改</span> -->
</div>
<div class="btn">
<button nz-button style="background: #42B983;color: white;">同意</button>
<button nz-button style="background: #FF0000;color: white;margin-left: 20px;">驳回</button>
</div>
<img *ngIf="item.approvalStatus == 1" class="auditimg" src="../../../../assets/images/icon/reject.png"
alt="">
<img *ngIf="item.approvalStatus == 0" class="auditimg" src="../../../../assets/images/icon/agree.png"
alt="">
</div>
</div>
<div class="tabbody" *ngIf="selectedTab == 1">
<div class="card greencard" [ngClass]="{'redcard': item.approvalStatus == 1}"
*ngFor="let item of data[1].list">
<div class="tabbody">
<div class="card greencard" [ngClass]="{'redcard': item.approvalStatus == 'reject'}"
*ngFor="let item of atPresentData.list">
<div class="unitname">
<img src="../../../../assets/images/icon/unit.png" alt="">
<span>{{item.company.companyName}}</span>
@ -62,25 +34,27 @@
<div class="info">
<span>
<img src="../../../../assets/images/icon/main.png" alt="">
未分配
{{item.mainSupervisor ? item.mainSupervisor.name : '未分配'}}
</span>
<span>
<img src="../../../../assets/images/icon/assist.png" alt="">
未分配
{{item.assitantSupervisor ? item.assitantSupervisor.name : '未分配'}}
</span>
<span class="blue">分配</span>
<span class="blue" (click)="allot(item)">分配</span>
<span>|</span>
<span>申请人: {{item.assitantOrganization.name}}</span>
<!-- <span class="blue">修改</span> -->
</div>
<div class="btn">
<button nz-button style="background: #42B983;color: white;">同意</button>
<button nz-button style="background: #FF0000;color: white;margin-left: 20px;">驳回</button>
<button [ngClass]="{'forbidbtn': item.approvalStatus}" [disabled]="item.approvalStatus" nz-button
(click)="agree(item)">同意</button>
<button [ngClass]="{'forbidbtn': item.approvalStatus}" [disabled]="item.approvalStatus" nz-button
(click)="reject(item)">驳回</button>
</div>
<img *ngIf="item.approvalStatus == 1" class="auditimg" src="../../../../assets/images/icon/reject.png"
alt="">
<img *ngIf="item.approvalStatus == 0" class="auditimg" src="../../../../assets/images/icon/agree.png"
alt="">
<img *ngIf="item.approvalStatus == 'reject'" class="auditimg"
src="../../../../assets/images/icon/reject.png" alt="">
<img *ngIf="item.approvalStatus == 'approved'" class="auditimg"
src="../../../../assets/images/icon/agree.png" alt="">
</div>
</div>
</div>

15
src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.scss

@ -53,6 +53,9 @@
text-align: left;
display: flex;
flex-direction: column;
position: relative;
.tabheader {
width: 100%;
@ -101,6 +104,7 @@
box-sizing: border-box;
padding: 0 20px;
position: relative;
div {
display: flex;
align-items: center;
@ -124,6 +128,17 @@
.btn {
flex: 1;
button:nth-child(1) {
background: #42B983;
color: white;
}
button:nth-child(2) {
background: #FF0000;
color: white;
margin-left: 20px;
}
}
.auditimg {

195
src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.ts

@ -1,5 +1,8 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewContainerRef } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';
import { AllotPersonComponent } from './allot-person/allot-person.component';
@Component({
selector: 'app-da-subordinate-audit',
@ -8,42 +11,58 @@ import { Component, OnInit } from '@angular/core';
})
export class DaSubordinateAuditComponent implements OnInit {
constructor(private http: HttpClient) { }
constructor(private http: HttpClient, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { }
OrganizationId
selectedTab = 0
atPresentData = { id: 0, name: '', finished: 0, totalCount: 0, list: [] }
selectTab(item) {
this.selectedTab = item
this.selectedTab = item.id
this.atPresentData = item
}
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
let month = new Date().getMonth() + 1
this.selectedMonth = month + '月'
this.selectedMonth = new Date().getMonth() + 1
this.getTaskList(0)
//获得主协调查人员
this.getSupervisor('main')
this.getSupervisor('assisted')
this.getTaskList()
}
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 }
{ 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 = 2022
selectedTime
selectMonth(item) {
this.selectedMonth = item.name
}
this.selectedMonth = item.id
this.getTaskList(this.selectedTab)
}
selectYear(e) {
this.selectedYear = e
console.log('年', e)
this.getTaskList(this.selectedTab)
}
nzLoading = false
PageNumber = 1
PageSize = 9999
@ -52,11 +71,17 @@ export class DaSubordinateAuditComponent implements OnInit {
{ id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [] }
]
getTaskList() {
this.nzLoading = true
isloading = false
getTaskList(index) {
this.isloading = true
this.data = [
{ id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [] },
{ id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [] }
]
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
console.log('查询时间', selectedTime)
let params = {
Month: selectedTime,
OrganizationId: this.OrganizationId,
PageNumber: this.PageNumber,
PageSize: this.PageSize
@ -64,8 +89,6 @@ export class DaSubordinateAuditComponent implements OnInit {
this.http.get('/api/PlanTasks', {
params: params
}).subscribe((data: any) => {
this.nzLoading = false
let arr1 = []
let arr2 = []
data.items.forEach(element => {
@ -91,8 +114,126 @@ export class DaSubordinateAuditComponent implements OnInit {
this.data[1].totalCount = arr2.length
this.data[1].list = [...arr2]
this.atPresentData = this.data[index]
console.log(this.atPresentData)
this.isloading = false
})
}
assitantsupervisorList
mainsupervisorList
getSupervisor(type) {
let params = {
inspectorType: type
}
this.http.get('/api/Users/Inspectors', {
params: params
}).subscribe((data: any) => {
console.log('检查员列表', data)
if (type == 'main') {
this.mainsupervisorList = data
} else {
this.assitantsupervisorList = data
}
})
}
allot(item) {
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 = {
mainSupervisorId: instance.validateForm.value.main,
assitantSupervisorId: instance.validateForm.value.assitant
}
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
next: async (data) => {
this.message.create('success', '分配成功');
resolve(data)
this.getTaskList(this.selectedTab)
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));
}
agree(item) {
this.modal.confirm({
nzTitle: `确定要同意该申请吗?`,
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: () => {
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, {
params: {
approvalStatus: 'approved'
}
}).subscribe({
next: (data) => {
this.message.create('success', '审核成功');
this.getTaskList(this.selectedTab)
},
error: (err) => {
this.message.create('warning', '审核失败');
}
})
},
nzCancelText: '取消'
});
}
reject(item) {
this.modal.confirm({
nzTitle: `确定要驳回该申请吗?`,
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: () => {
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, {
params: {
approvalStatus: 'reject'
}
}).subscribe({
next: (data) => {
this.message.create('success', '审核成功');
this.getTaskList(this.selectedTab)
},
error: (err) => {
this.message.create('warning', '审核失败');
}
})
},
nzCancelText: '取消'
});
}
}

20
src/app/home/task/station-task-apply/station-task-apply.component.html

@ -53,8 +53,9 @@
<th [width]="'20%'">单位名称</th>
<!-- <th>单位级别</th> -->
<th>协助机构</th>
<th>结果</th>
<th>时间</th>
<th>申请结果</th>
<th>检查结果</th>
<th [width]="'8%'">操作</th>
</tr>
</thead>
@ -73,10 +74,23 @@
{{item.assitantOrganization.name}}
</td>
<td>
/
{{item.creationTime | date:"yyyy-MM-dd hh:mm:ss"}}
</td>
<td>
{{item.creationTime | date:"yyyy-MM-dd hh:mm:ss"}}
<ng-container *ngIf="item.approvalStatus; else elseTemplate">
<ng-container *ngIf="item.approvalStatus == 'reject'; else elseTemplate2">
<span class="green">审核驳回</span>
</ng-container>
<ng-template #elseTemplate2>
<span class="red">审核通过</span>
</ng-template>
</ng-container>
<ng-template #elseTemplate>
未审核
</ng-template>
</td>
<td>
/
</td>
<td class="operation">
<a class="blue" (click)="look(item)">查看</a>

2
src/app/home/task/station-task-apply/station-task-apply.component.ts

@ -122,7 +122,7 @@ export class StationTaskApplyComponent implements OnInit {
await new Promise((resolve, reject) => {
let body = {
organizationId: this.OrganizationId,
taskName: "熟悉演练",
taskName: "联络指导",
companyId: instance.validateForm.value.unitname,
assitantOrganizationId: instance.validateForm.value.organization,
}

16
src/app/http-interceptors/base-interceptor.ts

@ -56,32 +56,24 @@ export class BaseInterceptor implements HttpInterceptor {
this.token.delete()
sessionStorage.clear()
localStorage.removeItem("isautologin")
this.message.create('error', `用户认证信息过期,请重新登录!`);
this.message.create('error', `认证失败!`);
this.router.navigate(['/login'])
return
}
if (error.status === 403) {
this.message.create('error', `对不起,您无此权限!`);
return
}
if (error.status === 400) {
this.message.create('error', error.error);
return
}
if (error.status === 503) {
this.message.create('error', error.error.detail);
this.message.create('error', `无权限!`);
return
}
if (error.error instanceof ErrorEvent) {
// 发生客户端或网络错误。相应处理。
console.error('An error occurred:', error.error.message);
console.error('An error occurred:', error.message);
} else {
// 服务端返回http状态码
// 服务端返回错误信息
console.error(
`状态码${error.status}, ` +
`错误内容:${error.error}`);
this.message.create('error', error.error);
this.message.create('error', error.error.title);
}
// 返回带有面向用户的错误信息
return throwError(() => {

2
src/app/service/cache-token.service.ts

@ -24,7 +24,7 @@ export class CacheTokenService {
sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken", data.refreshToken);
})
}, 10 * 60 * 1000)
}, 60 * 1000)
console.log('启动定时刷新token')
}

14
src/styles.scss

@ -134,6 +134,11 @@ app-root {
pointer-events: none
}
.forbidbtn {
background: gray !important;
pointer-events: none
}
.box {
width: 100%;
height: 100%;
@ -207,3 +212,12 @@ app-root {
.panelheadernamered {
background-color: #FF404D;
}
.spin {
background: rgb(134, 131, 131, 0.2);
position: absolute;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
Loading…
Cancel
Save