|
|
|
@ -1,203 +1,236 @@
|
|
|
|
|
/* |
|
|
|
|
* @Descripttion:
|
|
|
|
|
* @version:
|
|
|
|
|
* @Descripttion: |
|
|
|
|
* @version: |
|
|
|
|
* @Author: sueRimn |
|
|
|
|
* @Date: 2020-12-11 09:06:03 |
|
|
|
|
* @LastEditors: sueRimn |
|
|
|
|
* @LastEditTime: 2021-02-25 11:44:34 |
|
|
|
|
*/ |
|
|
|
|
import { Component, OnInit, ViewChild, Inject, Input, ViewContainerRef } from '@angular/core'; |
|
|
|
|
import { HttpClient } from '@angular/common/http' |
|
|
|
|
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatPaginator } from '@angular/material/paginator'; |
|
|
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
|
|
import { PageEvent } from '@angular/material/paginator'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
import { FormControl } from '@angular/forms'; |
|
|
|
|
import { Router, ActivatedRoute } from '@angular/router'; |
|
|
|
|
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; |
|
|
|
|
import { FlatTreeControl } from '@angular/cdk/tree'; |
|
|
|
|
import { TreeService } from '../../http-interceptors/tree.service' |
|
|
|
|
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree' |
|
|
|
|
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; |
|
|
|
|
import { |
|
|
|
|
Component, |
|
|
|
|
OnInit, |
|
|
|
|
ViewChild, |
|
|
|
|
Inject, |
|
|
|
|
Input, |
|
|
|
|
ViewContainerRef, |
|
|
|
|
} from "@angular/core"; |
|
|
|
|
import { HttpClient } from "@angular/common/http"; |
|
|
|
|
import { |
|
|
|
|
MatDialogRef, |
|
|
|
|
MatDialog, |
|
|
|
|
MAT_DIALOG_DATA, |
|
|
|
|
} from "@angular/material/dialog"; |
|
|
|
|
import { MatPaginator } from "@angular/material/paginator"; |
|
|
|
|
import { MatTableDataSource } from "@angular/material/table"; |
|
|
|
|
import { PageEvent } from "@angular/material/paginator"; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar"; |
|
|
|
|
import { FormControl } from "@angular/forms"; |
|
|
|
|
import { Router, ActivatedRoute } from "@angular/router"; |
|
|
|
|
import { |
|
|
|
|
MatTreeFlatDataSource, |
|
|
|
|
MatTreeFlattener, |
|
|
|
|
} from "@angular/material/tree"; |
|
|
|
|
import { FlatTreeControl } from "@angular/cdk/tree"; |
|
|
|
|
import { TreeService } from "../../http-interceptors/tree.service"; |
|
|
|
|
import { |
|
|
|
|
NzFormatEmitEvent, |
|
|
|
|
NzTreeComponent, |
|
|
|
|
NzTreeNodeOptions, |
|
|
|
|
} from "ng-zorro-antd/tree"; |
|
|
|
|
import { NzModalRef, NzModalService } from "ng-zorro-antd/modal"; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-examiner-index', |
|
|
|
|
templateUrl: './examiner-index.component.html', |
|
|
|
|
styleUrls: ['./examiner-index.component.scss'] |
|
|
|
|
selector: "app-examiner-index", |
|
|
|
|
templateUrl: "./examiner-index.component.html", |
|
|
|
|
styleUrls: ["./examiner-index.component.scss"], |
|
|
|
|
}) |
|
|
|
|
export class ExaminerIndexComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
constructor(private router: Router, private activatedRoute: ActivatedRoute, public http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private tree: TreeService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private router: Router, |
|
|
|
|
private activatedRoute: ActivatedRoute, |
|
|
|
|
public http: HttpClient, |
|
|
|
|
public dialog: MatDialog, |
|
|
|
|
public snackBar: MatSnackBar, |
|
|
|
|
private tree: TreeService, |
|
|
|
|
private modal: NzModalService, |
|
|
|
|
private viewContainerRef: ViewContainerRef |
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
this.getUnittype(); |
|
|
|
|
this.getAlltabledate(); |
|
|
|
|
this.getProfiles() |
|
|
|
|
this.getProfiles(); |
|
|
|
|
} |
|
|
|
|
//获取登录账号的个人资料
|
|
|
|
|
Profiles: any |
|
|
|
|
Profiles: any; |
|
|
|
|
getProfiles() { |
|
|
|
|
this.http.get('/api/ExamAccounts/Profiles').subscribe((data: any) => { |
|
|
|
|
this.Profiles = data |
|
|
|
|
sessionStorage.setItem('creatorData', JSON.stringify(data)) |
|
|
|
|
this.http.get("/api/ExamAccounts/Profiles").subscribe((data: any) => { |
|
|
|
|
this.Profiles = data; |
|
|
|
|
sessionStorage.setItem("creatorData", JSON.stringify(data)); |
|
|
|
|
this.getOrganizations(); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
displayedColumns: string[] = ['name', 'startTime', 'endTime', 'examzhong', 'scc']; |
|
|
|
|
tabledataSource: any |
|
|
|
|
accound |
|
|
|
|
helpName//消防救援对名称
|
|
|
|
|
optionId |
|
|
|
|
@ViewChild('son') son; |
|
|
|
|
displayedColumns: string[] = [ |
|
|
|
|
"name", |
|
|
|
|
"startTime", |
|
|
|
|
"endTime", |
|
|
|
|
"examzhong", |
|
|
|
|
"scc", |
|
|
|
|
]; |
|
|
|
|
tabledataSource: any; |
|
|
|
|
accound; |
|
|
|
|
helpName; //消防救援对名称
|
|
|
|
|
optionId; |
|
|
|
|
@ViewChild("son") son; |
|
|
|
|
//分页
|
|
|
|
|
@ViewChild(MatPaginator, { static: true }) |
|
|
|
|
pageEvent: PageEvent; |
|
|
|
|
paginator: MatPaginator; |
|
|
|
|
length: any; //共多少条数据
|
|
|
|
|
pageSize: any; //每页条数
|
|
|
|
|
pageSizeOptions: number[] = [10] //设置每页条数
|
|
|
|
|
PageNumber: any //第几页
|
|
|
|
|
startTime: [] |
|
|
|
|
endTime: [] |
|
|
|
|
allorganizations: any |
|
|
|
|
allunittype: any //获取所有的单位类型
|
|
|
|
|
jscheck: any //辖区中队包含下级
|
|
|
|
|
|
|
|
|
|
pageSizeOptions: number[] = [10]; //设置每页条数
|
|
|
|
|
PageNumber: any; //第几页
|
|
|
|
|
startTime: []; |
|
|
|
|
endTime: []; |
|
|
|
|
allorganizations: any; |
|
|
|
|
allunittype: any; //获取所有的单位类型
|
|
|
|
|
jscheck: any; //辖区中队包含下级
|
|
|
|
|
|
|
|
|
|
//获得所有组织机构
|
|
|
|
|
getOrganizations() { |
|
|
|
|
this.http.get('/api/Organizations').subscribe( |
|
|
|
|
(data: any) => { |
|
|
|
|
this.allorganizations = data |
|
|
|
|
console.log('组织机构列表', this.allorganizations) |
|
|
|
|
this.treedata = this.tree.toTree(data); |
|
|
|
|
this.getpresentOrganization(); |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
this.http.get("/api/Organizations").subscribe((data: any) => { |
|
|
|
|
this.allorganizations = data; |
|
|
|
|
console.log("组织机构列表", this.allorganizations); |
|
|
|
|
this.treedata = this.tree.toTree(data); |
|
|
|
|
this.getpresentOrganization(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
organizationName: any //当前单位组织机构名称
|
|
|
|
|
treedata: any //组织机构树型数据
|
|
|
|
|
newallorganizations: any //用于存储在原始数据基础上的每个机构增加children字段
|
|
|
|
|
nodes: any = [] |
|
|
|
|
expandedKeys: any = []//默认展开tree节点
|
|
|
|
|
organizationName: any; //当前单位组织机构名称
|
|
|
|
|
treedata: any; //组织机构树型数据
|
|
|
|
|
newallorganizations: any; //用于存储在原始数据基础上的每个机构增加children字段
|
|
|
|
|
nodes: any = []; |
|
|
|
|
expandedKeys: any = []; //默认展开tree节点
|
|
|
|
|
//得到当前单位所在组织机构的tree型数据
|
|
|
|
|
getpresentOrganization() { |
|
|
|
|
this.newallorganizations = this.allorganizations |
|
|
|
|
this.newallorganizations.forEach(item => { |
|
|
|
|
item.children = [] |
|
|
|
|
this.newallorganizations.forEach(element => { |
|
|
|
|
this.newallorganizations = this.allorganizations; |
|
|
|
|
this.newallorganizations.forEach((item) => { |
|
|
|
|
item.children = []; |
|
|
|
|
this.newallorganizations.forEach((element) => { |
|
|
|
|
if (element.parentId == item.id) { |
|
|
|
|
item.children.push(element) |
|
|
|
|
item.children.push(element); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
this.organizationName = this.Profiles.organizationName |
|
|
|
|
this.organizationName = this.Profiles.organizationName; |
|
|
|
|
if (this.organizationName) { |
|
|
|
|
this.newallorganizations.forEach(item => { |
|
|
|
|
this.newallorganizations.forEach((item) => { |
|
|
|
|
if (item.name == this.organizationName) { |
|
|
|
|
this.expandedKeys = [item.key] |
|
|
|
|
this.nodes = [item] |
|
|
|
|
this.nodes = [item]; |
|
|
|
|
this.expandedKeys = [item.key]; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.expandedKeys = this.nodes[0].key |
|
|
|
|
this.nodes = this.tree.toTree(this.treedata); |
|
|
|
|
this.expandedKeys = this.nodes[0].key; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//编辑试卷
|
|
|
|
|
editPaper(item) { |
|
|
|
|
console.log(item) |
|
|
|
|
console.log(item); |
|
|
|
|
if (item.status == 2) { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('考试结束,不能编辑', '确定', config); |
|
|
|
|
config.verticalPosition = "top"; |
|
|
|
|
config.duration = 3000; |
|
|
|
|
this.snackBar.open("考试结束,不能编辑", "确定", config); |
|
|
|
|
} else if (item.status == 1) { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('开考中,不能编辑', '确定', config); |
|
|
|
|
} |
|
|
|
|
else if (item.status == -1) {//未发布
|
|
|
|
|
sessionStorage.setItem("paperId", item.id) |
|
|
|
|
this.router.navigate(['/home/createexam-index/examiner-new-one']) //跳转试卷列表页面
|
|
|
|
|
config.verticalPosition = "top"; |
|
|
|
|
config.duration = 3000; |
|
|
|
|
this.snackBar.open("开考中,不能编辑", "确定", config); |
|
|
|
|
} else if (item.status == -1) { |
|
|
|
|
//未发布
|
|
|
|
|
sessionStorage.setItem("paperId", item.id); |
|
|
|
|
this.router.navigate(["/home/createexam-index/examiner-new-one"]); //跳转试卷列表页面
|
|
|
|
|
} else { |
|
|
|
|
sessionStorage.setItem("paperId", item.id) |
|
|
|
|
this.router.navigateByUrl(`/examiner/create-test-score?pattern=edit&status=${item.status}`) |
|
|
|
|
sessionStorage.setItem("paperId", item.id); |
|
|
|
|
this.router.navigateByUrl( |
|
|
|
|
`/examiner/create-test-score?pattern=edit&status=${item.status}` |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
lookPaper(item) { |
|
|
|
|
sessionStorage.setItem("paperId", item.id) |
|
|
|
|
console.log(item) |
|
|
|
|
this.router.navigateByUrl(`/examiner/create-test-score?pattern=look&status=${item.status}`) |
|
|
|
|
sessionStorage.setItem("paperId", item.id); |
|
|
|
|
console.log(item); |
|
|
|
|
this.router.navigateByUrl( |
|
|
|
|
`/examiner/create-test-score?pattern=look&status=${item.status}` |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获得所有单位类型
|
|
|
|
|
getUnittype() { |
|
|
|
|
this.http.get('/api/BuildingTypes/Simple').subscribe( |
|
|
|
|
data => { |
|
|
|
|
this.allunittype = data |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
this.http.get("/api/BuildingTypes/Simple").subscribe((data) => { |
|
|
|
|
this.allunittype = data; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得查询支队信息
|
|
|
|
|
help() { |
|
|
|
|
let paramsdata: any = { |
|
|
|
|
PageNumber: this.PageNumber || '1', |
|
|
|
|
PageNumber: this.PageNumber || "1", |
|
|
|
|
PageSize: this.pageSizeOptions[0], |
|
|
|
|
Sort: null, |
|
|
|
|
SortType: null, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
//console.log(paramsdata)
|
|
|
|
|
this.http.get("/api/Papers", { params: paramsdata }).subscribe((data: any) => { |
|
|
|
|
this.tabledataSource = data |
|
|
|
|
console.log(this.tabledataSource) |
|
|
|
|
}) |
|
|
|
|
this.http |
|
|
|
|
.get("/api/Papers", { params: paramsdata }) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
this.tabledataSource = data; |
|
|
|
|
console.log(this.tabledataSource); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//分页事件
|
|
|
|
|
chagePage(e) { |
|
|
|
|
this.PageNumber = e.pageIndex + 1 |
|
|
|
|
this.getAlltabledate() |
|
|
|
|
this.PageNumber = e.pageIndex + 1; |
|
|
|
|
this.getAlltabledate(); |
|
|
|
|
} |
|
|
|
|
//获取表格信息
|
|
|
|
|
getAlltabledate() { |
|
|
|
|
let paramsdata: any = { |
|
|
|
|
PageNumber: this.PageNumber || '1', |
|
|
|
|
PageNumber: this.PageNumber || "1", |
|
|
|
|
PageSize: this.pageSizeOptions[0], |
|
|
|
|
OrganizationId: this.js || '', |
|
|
|
|
HasChildren: this.jscheck || '', |
|
|
|
|
OrganizationId: this.js || "", |
|
|
|
|
HasChildren: this.jscheck || "", |
|
|
|
|
Sort: null, |
|
|
|
|
SortType: null, |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/Papers", { params: paramsdata }).subscribe((data: any) => { |
|
|
|
|
this.tabledataSource = data.items |
|
|
|
|
this.length = data.totalCount |
|
|
|
|
}) |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get("/api/Papers", { params: paramsdata }) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
this.tabledataSource = data.items; |
|
|
|
|
this.length = data.totalCount; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//获取消防救援对信息
|
|
|
|
|
getHelp() { |
|
|
|
|
let paramsdata: any = { |
|
|
|
|
Name: '', |
|
|
|
|
IdentityCard: '', |
|
|
|
|
Phone: '', |
|
|
|
|
RealName: '', |
|
|
|
|
OrganizationId: '', |
|
|
|
|
PageNumber: '', |
|
|
|
|
PageSize: '', |
|
|
|
|
Sort: '', |
|
|
|
|
RoleType: '1', |
|
|
|
|
SortType: '' |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/ExamUsers", { params: paramsdata }).subscribe((data: any) => { |
|
|
|
|
this.helpName = data.items |
|
|
|
|
}) |
|
|
|
|
Name: "", |
|
|
|
|
IdentityCard: "", |
|
|
|
|
Phone: "", |
|
|
|
|
RealName: "", |
|
|
|
|
OrganizationId: "", |
|
|
|
|
PageNumber: "", |
|
|
|
|
PageSize: "", |
|
|
|
|
Sort: "", |
|
|
|
|
RoleType: "1", |
|
|
|
|
SortType: "", |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get("/api/ExamUsers", { params: paramsdata }) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
this.helpName = data.items; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取optionid
|
|
|
|
@ -209,52 +242,46 @@ export class ExaminerIndexComponent implements OnInit {
|
|
|
|
|
//查询按钮
|
|
|
|
|
findClick() { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
console.log(this.js) |
|
|
|
|
config.verticalPosition = "top"; |
|
|
|
|
config.duration = 3000; |
|
|
|
|
console.log(this.js); |
|
|
|
|
let paramsdata: any = { |
|
|
|
|
PageNumber: this.PageNumber || '1', |
|
|
|
|
PageNumber: this.PageNumber || "1", |
|
|
|
|
PageSize: this.pageSizeOptions[0], |
|
|
|
|
OrganizationId: this.js || '', |
|
|
|
|
HasChildren: this.jscheck || '', |
|
|
|
|
OrganizationId: this.js || "", |
|
|
|
|
HasChildren: this.jscheck || "", |
|
|
|
|
Sort: null, |
|
|
|
|
SortType: null, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
if (!this.js) { |
|
|
|
|
this.snackBar.open('请选择消防救援队', '确定', config); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
this.PageNumber = 1 |
|
|
|
|
this.pageEvent.pageIndex = 0 |
|
|
|
|
this.getAlltabledate() |
|
|
|
|
this.snackBar.open("请选择消防救援队", "确定", config); |
|
|
|
|
} else { |
|
|
|
|
this.PageNumber = 1; |
|
|
|
|
this.pageEvent.pageIndex = 0; |
|
|
|
|
this.getAlltabledate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//重置按钮
|
|
|
|
|
Reset() { |
|
|
|
|
this.js = '' |
|
|
|
|
this.jscheck = '' |
|
|
|
|
this.getAlltabledate() |
|
|
|
|
this.js = ""; |
|
|
|
|
this.jscheck = ""; |
|
|
|
|
this.getAlltabledate(); |
|
|
|
|
} |
|
|
|
|
//删除一套考题
|
|
|
|
|
deleteExam(examid) { |
|
|
|
|
let isTrue = confirm('您确定要删除吗') |
|
|
|
|
let isTrue = confirm("您确定要删除吗"); |
|
|
|
|
if (isTrue) { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
config.verticalPosition = "top"; |
|
|
|
|
config.duration = 3000; |
|
|
|
|
this.http.delete(`/api/Papers/${examid}`).subscribe((data: any) => { |
|
|
|
|
this.snackBar.open('删除试卷成功', '确定', config); |
|
|
|
|
this.getAlltabledate() |
|
|
|
|
}) |
|
|
|
|
this.snackBar.open("删除试卷成功", "确定", config); |
|
|
|
|
this.getAlltabledate(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//新增考题跳转
|
|
|
|
|
newExamination() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const dialogRef = this.dialog.open(FinishDia, {
|
|
|
|
|
// width: '685px',
|
|
|
|
|
// data: {
|
|
|
|
@ -263,9 +290,8 @@ export class ExaminerIndexComponent implements OnInit {
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const modal: any = this.modal.create({ |
|
|
|
|
nzTitle: '新增考题', |
|
|
|
|
nzTitle: "新增考题", |
|
|
|
|
nzContent: FinishDia, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 688, |
|
|
|
@ -274,79 +300,86 @@ export class ExaminerIndexComponent implements OnInit {
|
|
|
|
|
Profiles: this.Profiles, |
|
|
|
|
treedata: this.treedata, |
|
|
|
|
}, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
nzOnOk: async () => {}, |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); |
|
|
|
|
modal.afterOpen.subscribe(() => console.log("[afterOpen] emitted!")); |
|
|
|
|
// Return a result when closed
|
|
|
|
|
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
js: any //辖区中队输入框
|
|
|
|
|
zIndex() { |
|
|
|
|
|
|
|
|
|
modal.afterClose.subscribe((result) => |
|
|
|
|
console.log("[afterClose] The result is:", result) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
js: any; //辖区中队输入框
|
|
|
|
|
zIndex() {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//创建试题弹窗
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'finish-dialog', |
|
|
|
|
templateUrl: 'finishDia.html', |
|
|
|
|
styleUrls: ['finishDia.scss'] |
|
|
|
|
selector: "finish-dialog", |
|
|
|
|
templateUrl: "finishDia.html", |
|
|
|
|
styleUrls: ["finishDia.scss"], |
|
|
|
|
}) |
|
|
|
|
export class FinishDia { |
|
|
|
|
// @ViewChild('nzTreSelect', { static: false }) nzTreSelect!: NzTreeComponent;
|
|
|
|
|
constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private modal: NzModalRef) { } |
|
|
|
|
constructor( |
|
|
|
|
private router: Router, |
|
|
|
|
private http: HttpClient, |
|
|
|
|
public dialog: MatDialog, |
|
|
|
|
public snackBar: MatSnackBar, |
|
|
|
|
private modal: NzModalRef |
|
|
|
|
) {} |
|
|
|
|
//获取登录账号的个人资料
|
|
|
|
|
Profiles: any |
|
|
|
|
treedata: any |
|
|
|
|
selectedOr |
|
|
|
|
nodes = [] |
|
|
|
|
expandedKeys = [] |
|
|
|
|
Profiles: any; |
|
|
|
|
treedata: any; |
|
|
|
|
selectedOr; |
|
|
|
|
nodes = []; |
|
|
|
|
expandedKeys = []; |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.Profiles = this.Profiles |
|
|
|
|
this.nodes = [...this.treedata] |
|
|
|
|
this.expandedKeys = [this.treedata[0].key] |
|
|
|
|
this.Profiles = this.Profiles; |
|
|
|
|
this.nodes = [...this.treedata]; |
|
|
|
|
this.expandedKeys = [this.treedata[0].key]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onChange($event: string[]): void { |
|
|
|
|
console.log($event); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
startTime: string//考试开始时间
|
|
|
|
|
endTime: string//考试结束时间
|
|
|
|
|
examName: string//考试名称
|
|
|
|
|
indexid: string//创建考试的id
|
|
|
|
|
tabledate |
|
|
|
|
startTime: string; //考试开始时间
|
|
|
|
|
endTime: string; //考试结束时间
|
|
|
|
|
examName: string; //考试名称
|
|
|
|
|
indexid: string; //创建考试的id
|
|
|
|
|
tabledate; |
|
|
|
|
|
|
|
|
|
//弹窗确定点击事件
|
|
|
|
|
onNoClick(): void { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
if (this.startTime != undefined && this.endTime != undefined && this.examName != undefined && this.selectedOr != undefined) { |
|
|
|
|
|
|
|
|
|
config.verticalPosition = "top"; |
|
|
|
|
config.duration = 3000; |
|
|
|
|
if ( |
|
|
|
|
this.startTime != undefined && |
|
|
|
|
this.endTime != undefined && |
|
|
|
|
this.examName != undefined && |
|
|
|
|
this.selectedOr != undefined |
|
|
|
|
) { |
|
|
|
|
if (this.startTime > this.endTime) { |
|
|
|
|
this.snackBar.open('开始时间不能大于结束时间', '确定', config); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
this.snackBar.open("开始时间不能大于结束时间", "确定", config); |
|
|
|
|
} else { |
|
|
|
|
//截取字符串,得到日期部分"2009-12-02",用split把字符串分隔成数组
|
|
|
|
|
var begin1 = this.startTime.substr(0, 10).split("-"); |
|
|
|
|
var end1 = this.endTime.substr(0, 10).split("-"); |
|
|
|
|
//将拆分的数组重新组合,并实例成化新的日期对象
|
|
|
|
|
var date1 = new Date(begin1[1] + - + begin1[2] + - + begin1[0]); |
|
|
|
|
var date2 = new Date(end1[1] + - + end1[2] + - + end1[0]); |
|
|
|
|
var date1 = new Date(begin1[1] + -+begin1[2] + -+begin1[0]); |
|
|
|
|
var date2 = new Date(end1[1] + -+end1[2] + -+end1[0]); |
|
|
|
|
//得到两个日期之间的差值m,以分钟为单位
|
|
|
|
|
var m = Number(Math.abs(Number(date2) - Number(date1)) / 1000 / 60); |
|
|
|
|
//小时数和分钟数相加得到总的分钟数
|
|
|
|
|
var min1 = parseInt(this.startTime.substr(11, 2)) * 60 + parseInt(this.startTime.substr(14, 2)); |
|
|
|
|
var min2 = parseInt(this.endTime.substr(11, 2)) * 60 + parseInt(this.endTime.substr(14, 2)); |
|
|
|
|
var min1 = |
|
|
|
|
parseInt(this.startTime.substr(11, 2)) * 60 + |
|
|
|
|
parseInt(this.startTime.substr(14, 2)); |
|
|
|
|
var min2 = |
|
|
|
|
parseInt(this.endTime.substr(11, 2)) * 60 + |
|
|
|
|
parseInt(this.endTime.substr(14, 2)); |
|
|
|
|
//两个分钟数相减得到时间部分的差值,以分钟为单位
|
|
|
|
|
var n = min2 - min1; |
|
|
|
|
//将日期和时间两个部分计算出来的差值相加,即得到两个时间相减后的分钟数
|
|
|
|
@ -362,40 +395,37 @@ export class FinishDia {
|
|
|
|
|
organizationId: this.Profiles.organizationId, |
|
|
|
|
creatorId: this.Profiles.id, |
|
|
|
|
paperDataInfo: null, |
|
|
|
|
organizationIds: this.selectedOr |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(this.selectedOr) |
|
|
|
|
this.http.post('/api/Papers', body).subscribe(data => { |
|
|
|
|
this.snackBar.open('创建成功', '确定', config); |
|
|
|
|
this.modal.triggerOk() |
|
|
|
|
this.tabledate = data |
|
|
|
|
console.log(this.tabledate) |
|
|
|
|
sessionStorage.setItem("paperId", this.tabledate.id) |
|
|
|
|
this.router.navigate(['/home/createexam-index/examiner-new-one']) //跳转试卷列表页面
|
|
|
|
|
}, err => { |
|
|
|
|
this.snackBar.open(err, '确定', config); |
|
|
|
|
}) |
|
|
|
|
organizationIds: this.selectedOr, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
console.log(this.selectedOr); |
|
|
|
|
this.http.post("/api/Papers", body).subscribe( |
|
|
|
|
(data) => { |
|
|
|
|
this.snackBar.open("创建成功", "确定", config); |
|
|
|
|
this.modal.triggerOk(); |
|
|
|
|
this.tabledate = data; |
|
|
|
|
console.log(this.tabledate); |
|
|
|
|
sessionStorage.setItem("paperId", this.tabledate.id); |
|
|
|
|
this.router.navigate(["/home/createexam-index/examiner-new-one"]); //跳转试卷列表页面
|
|
|
|
|
}, |
|
|
|
|
(err) => { |
|
|
|
|
this.snackBar.open(err, "确定", config); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
if (this.startTime == undefined) |
|
|
|
|
this.snackBar.open('请输入开始时间', '确定', config); |
|
|
|
|
this.snackBar.open("请输入开始时间", "确定", config); |
|
|
|
|
else if (this.endTime == undefined) |
|
|
|
|
this.snackBar.open('请输入结束时间', '确定', config); |
|
|
|
|
this.snackBar.open("请输入结束时间", "确定", config); |
|
|
|
|
else if (this.examName == undefined) |
|
|
|
|
this.snackBar.open('请输入试卷名称', '确定', config); |
|
|
|
|
this.snackBar.open("请输入试卷名称", "确定", config); |
|
|
|
|
else if (this.selectedOr == undefined) |
|
|
|
|
this.snackBar.open('请选择考核队站', '确定', config); |
|
|
|
|
this.snackBar.open("请选择考核队站", "确定", config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close() { |
|
|
|
|
// this.dialogRef.close();
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|