Browse Source

[修改]申请任务双随机增加检查人员

非煤矿山灾害智能感知和预警系统
邵佳豪 2 years ago
parent
commit
df41203cdb
  1. 6
      src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html
  2. 3
      src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts
  3. 17
      src/app/home/task/station-task-apply/apply/apply.component.html
  4. 15
      src/app/home/task/station-task-apply/apply/apply.component.scss
  5. 22
      src/app/home/task/station-task-apply/apply/apply.component.ts
  6. 21
      src/app/home/task/station-task-apply/station-task-apply.component.html
  7. 58
      src/app/home/task/station-task-apply/station-task-apply.component.ts
  8. 2
      src/theme.less

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

@ -3,7 +3,8 @@
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查员(主)">检查员(主)</nz-form-label>
<nz-form-control>
<nz-select nzMode="multiple" formControlName="main" nzPlaceHolder="请选择消防监督检查员(主)">
<nz-select nzShowSearch [nzDropdownClassName]="'maxHeightTreeSelect'" formControlName="main"
nzPlaceHolder="请选择消防监督检查员(主)">
<nz-option *ngFor="let item of mainsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
@ -12,7 +13,8 @@
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查员(协)">检查员(协)</nz-form-label>
<nz-form-control>
<nz-select nzMode="multiple" formControlName="assitant" nzPlaceHolder="请选择消防监督检查员(协)">
<nz-select nzShowSearch [nzDropdownClassName]="'maxHeightTreeSelect'" formControlName="assitant"
nzPlaceHolder="请选择消防监督检查员(协)">
<nz-option *ngFor="let item of assitantsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>

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

@ -21,7 +21,8 @@ export class AllotPersonComponent implements OnInit {
assitant: [null, [Validators.required]]
});
// console.log(this.mainsupervisorList)
// console.log(this.assitantsupervisorList)
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });

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

@ -3,7 +3,7 @@
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="账号">任务名称</nz-form-label>
<nz-form-control>
<nz-radio-group formControlName="taskname">
<nz-radio-group formControlName="taskname" [(ngModel)]="taskType">
<label nz-radio [nzValue]="item" *ngFor="let item of title">{{item}}</label>
</nz-radio-group>
</nz-form-control>
@ -122,5 +122,20 @@
</ng-template>
</nz-form-control>
</nz-form-item>
<nz-form-item class="itembox" *ngIf="taskType == '双随机'">
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查人员">检查人员</nz-form-label>
<nz-form-control>
<img class="img1" src="../../../../../assets/images/icon/main.png" alt="">
<nz-select nzPlaceHolder="请选择主查" class="select" formControlName="main">
<nz-option *ngFor="let item of mainsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
<img class="img2" src="../../../../../assets/images/icon/assist.png" alt="">
<nz-select nzPlaceHolder="请选择协查" class="select" formControlName="assist">
<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>

15
src/app/home/task/station-task-apply/apply/apply.component.scss

@ -26,6 +26,7 @@
border: 1px solid #d9d9d9;
box-sizing: border-box;
padding: 10px;
nz-form-item {
margin: 12px 0;
}
@ -76,3 +77,17 @@
}
}
}
.itembox {
.img1 {
margin-right: 8px;
}
.img2 {
margin: 0 8px;
}
.select{
width: 44.6%;
}
}

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

@ -17,16 +17,23 @@ export class ApplyComponent implements OnInit {
@Input() supervisorList?: any;
@Input() organizationList?: any;
@Input() users?: any;
@Input() mainsupervisorList?: any;
@Input() assitantsupervisorList?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private message: NzMessageService) { }
taskType
newTree
ngOnInit(): void {
console.log('mainsupervisorList', this.mainsupervisorList)
console.log('assitantsupervisorList', this.assitantsupervisorList)
this.validateForm = this.fb.group({
taskname: [null, [Validators.required]],
organization: [null, [Validators.required]]
organization: [null, [Validators.required]],
main: [null],
assist: [null]
});
this.newTree = this.nodes
@ -35,7 +42,6 @@ export class ApplyComponent implements OnInit {
.then((results) => {
let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
let nodes = [...this.toTree.toTree(arr)]
console.log('6666',nodes)
this.unitPopover.nodes = JSON.parse(JSON.stringify(nodes))
});
}
@ -63,9 +69,9 @@ export class ApplyComponent implements OnInit {
element.disableCheckbox = true
});
this.allOrList = JSON.parse(JSON.stringify(data.items))
console.log(111,this.allOrList)
console.log(111, this.allOrList)
this.allOrList.forEach(element => {
if(element.id == JSON.parse(sessionStorage.getItem('userData')).organizationId){
if (element.id == JSON.parse(sessionStorage.getItem('userData')).organizationId) {
element.parentId = null
}
});
@ -147,12 +153,7 @@ export class ApplyComponent implements OnInit {
}
isPopover(data, e?: any) {
e ? e.stopPropagation() : null
console.log(data)
data.isPopover = !data.isPopover
// data.unitList.forEach(element => {
// element.checked = false
// });
}
// 弹出 tab
popoverMenuSelect(data, type) {
@ -183,7 +184,6 @@ export class ApplyComponent implements OnInit {
}
}
}
console.log(data.search2Value)
}
}

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

@ -121,13 +121,14 @@
<span *ngFor="let i of item.assitantOrganizations">
{{i.name}}
</span>
<span *ngFor="let i of item.supervisors;let key = index">
<img *ngIf="key == 0" src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="key == 1" src="../../../../assets/images/icon/assist.png" alt="">
{{i.name}}
</span>
</ng-container>
<ng-template #elseTemplate2>
<span *ngFor="let i of item.supervisors">
<img *ngIf="i.posts && i.posts[0] == '主查人员'"
src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="i.posts && i.posts[0] == '协查人员'"
src="../../../../assets/images/icon/assist.png" alt="">
{{i.name}}
</span>
</ng-template>
@ -137,21 +138,21 @@
<span style="margin-right: 6px;" *ngFor="let i of item.assitantOrganizations">
{{i.name}}
</span>
<span style="margin-right: 6px;" *ngFor="let i of item.supervisors;let key = index">
<img *ngIf="key == 0" src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="key == 1" src="../../../../assets/images/icon/assist.png" alt="">
{{i.name}}
</span>
</ng-container>
<ng-template #elseTemplate3>
<span style="margin-right: 6px;" *ngFor="let i of item.supervisors">
<img *ngIf="i.posts && i.posts[0] == '主查人员'"
src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="i.posts && i.posts[0] == '协查人员'"
src="../../../../assets/images/icon/assist.png" alt="">
{{i.name}}
</span>
</ng-template>
</ng-template>
<span>
{{isSupervisor ? '协助机构' : '协助人员'}}
{{isSupervisor ? '协助机构/人员' : '协助人员'}}
</span>
</div>
<div class="flexcol">

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

@ -70,7 +70,7 @@ export class StationTaskApplyComponent implements OnInit {
CompanyName: this.searchForm.unitname,
AssitantOrganizationId: this.searchForm.or,
CreatorId: this.isSupervisor ? this.userId : null,//如果是检查员需要传CreatorId只针对这个账户 如果是救援站就不需要
CreationTypes:['申领任务'],
CreationTypes: ['申领任务'],
OrganizationId: this.OrganizationId,
PageNumber: this.PageNumber,
PageSize: this.PageSize
@ -139,10 +139,9 @@ export class StationTaskApplyComponent implements OnInit {
//获得所有检查员
supervisorList = []
mainsupervisorList = []
assitantsupervisorList = []
async getSupervisor() {
var p = new Promise<void>((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Users/Inspectors').subscribe((data: any) => {
console.log('检查员列表', data)
data.forEach(element => {
@ -154,7 +153,23 @@ export class StationTaskApplyComponent implements OnInit {
resolve(data)
})
})
return p
}
mainsupervisorList = []
assitantsupervisorList = []
getSupervisortype(type) {
let params = {
inspectorType: type
}
this.http.get('/api/Users/Inspectors', {
params: params
}).subscribe((data: any) => {
if (type == 'main') {
this.mainsupervisorList = data
} else {
this.assitantsupervisorList = data
}
})
}
//获得除了检查员的其他用户
@ -210,6 +225,10 @@ export class StationTaskApplyComponent implements OnInit {
setTimeout(() => {
this.rollStart()
}, 0);
//获得主协调查人员
this.getSupervisortype('main')
this.getSupervisortype('assisted')
}
messageList = [1, 1, 1, 1, 1]
@ -268,22 +287,45 @@ export class StationTaskApplyComponent implements OnInit {
supervisorList: JSON.parse(JSON.stringify(this.supervisorList)),
organizationList: JSON.parse(JSON.stringify(this.organizationList)),
users: JSON.parse(JSON.stringify(this.users)),
nodes: JSON.parse(JSON.stringify(this.nodes))
nodes: JSON.parse(JSON.stringify(this.nodes)),
mainsupervisorList: JSON.parse(JSON.stringify(this.mainsupervisorList)),
assitantsupervisorList: JSON.parse(JSON.stringify(this.assitantsupervisorList))
},
nzOnOk: async () => {
console.log(instance.validateForm.value)
if (instance.validateForm.valid && instance.selectedUnitData.id) {
if (instance.taskType == '双随机') {
if (!instance.validateForm.value.main || !instance.validateForm.value.assist) {
this.message.create('warning', '请填写检查人员!');
return false
}
}
await new Promise((resolve, reject) => {
let selectedMonth = this.selectedMonth < 10 ? "0" + this.selectedMonth : this.selectedMonth;
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01'
let supervisorIds
let assitantOrganizationIds
if (this.isSupervisor) {
if (instance.taskType == '双随机') {
supervisorIds = [instance.validateForm.value.main, instance.validateForm.value.assist]
} else {
supervisorIds = []
}
assitantOrganizationIds = instance.validateForm.value.organization
} else {
supervisorIds = instance.validateForm.value.organization
assitantOrganizationIds = []
}
let body = {
month: selectedTime,
taskName: instance.validateForm.value.taskname,
taskType: instance.validateForm.value.taskname,
companyId: instance.selectedUnitData.id,
organizationId: this.OrganizationId,
supervisorIds: this.isSupervisor ? [] : instance.validateForm.value.organization,
assitantOrganizationIds: this.isSupervisor ? instance.validateForm.value.organization : [],
supervisorIds: supervisorIds,
assitantOrganizationIds: assitantOrganizationIds,
creationType: '申领任务',
approvalStatus: '待处理'
}

2
src/theme.less

@ -90,4 +90,4 @@
label{
margin-bottom: 6px;
}
}
}

Loading…
Cancel
Save