|
|
|
@ -60,7 +60,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
clickUnitName(key){ |
|
|
|
|
this.selectedUnitIndex = key |
|
|
|
|
} |
|
|
|
|
unitId:any = JSON.parse(sessionStorage.getItem('checkedWork'))
|
|
|
|
|
unitId:any = JSON.parse(sessionStorage.getItem(sessionStorage.getItem('paper')))
|
|
|
|
|
|
|
|
|
|
//获取单位基本信息
|
|
|
|
|
async getUnitData(){ |
|
|
|
@ -1080,11 +1080,19 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
paperDataInfo[key].functionalDivisionScore = item.funDivScore |
|
|
|
|
paperDataInfo[key].facilityData = item.fireFacNodes ? JSON.stringify(item.fireFacNodes) : '[]' |
|
|
|
|
paperDataInfo[key].facilityScore = item.fireFacScore |
|
|
|
|
paperDataInfo[key].planList = item.planList |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// console.log(123456,paperDataInfo)
|
|
|
|
|
//判断是否存在总分填写后没有勾选 或者勾选了没有填写总分的情况
|
|
|
|
|
paperDataInfo.forEach(element => { |
|
|
|
|
element.planList.forEach(item => { |
|
|
|
|
if(!item.score || item.score == 0){ |
|
|
|
|
element.isPlanScore = false |
|
|
|
|
}else{ |
|
|
|
|
element.isPlanScore = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//判断存在总分填写后没有勾选题目
|
|
|
|
|
if( (element.basicInfoScore != 0 && JSON.parse(element.basicInfoData).length == 0) || |
|
|
|
|
(element.adjoinScore != 0 && JSON.parse(element.adjoinData).length == 0) || |
|
|
|
@ -1109,14 +1117,26 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('存在勾选过题目,但未填写总分的分组','确定',config); |
|
|
|
|
return
|
|
|
|
|
}else
|
|
|
|
|
//存在预案没有填写总分
|
|
|
|
|
if(!element.isPlanScore){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('存在预案未填写总分的分组','确定',config); |
|
|
|
|
return
|
|
|
|
|
}else{ |
|
|
|
|
const dialogRef = this.dialog.open(FinishDialog, { |
|
|
|
|
width: '650px', |
|
|
|
|
data: paperDataInfo |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(result => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if(window.confirm('你确定要创建该试卷吗?')){ |
|
|
|
|
console.log(555,this.unitId) |
|
|
|
|
|
|
|
|
|
console.log(666,paperDataInfo) |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1275,103 +1295,21 @@ export class FinishDialog{
|
|
|
|
|
|
|
|
|
|
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<AddPlanTwoDialog>,@Inject(MAT_DIALOG_DATA) public data: any) {} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getProfiles() |
|
|
|
|
} |
|
|
|
|
//获取登录账号的个人资料
|
|
|
|
|
Profiles:any
|
|
|
|
|
getProfiles(){ |
|
|
|
|
this.http.get('/api/ExamAccounts/Profiles').subscribe(data => { |
|
|
|
|
console.log(data) |
|
|
|
|
this.Profiles = data |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startTime:string//考试开始时间
|
|
|
|
|
endTime:string//考试结束时间
|
|
|
|
|
examName:string//考试名称
|
|
|
|
|
|
|
|
|
|
//弹窗确定点击事件
|
|
|
|
|
onNoClick(): void { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
if(this.startTime!=undefined&&this.endTime!=undefined&&this.examName!=undefined){ |
|
|
|
|
if(this.startTime>this.endTime){ |
|
|
|
|
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]); |
|
|
|
|
//得到两个日期之间的差值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 n=min2-min1; |
|
|
|
|
//将日期和时间两个部分计算出来的差值相加,即得到两个时间相减后的分钟数
|
|
|
|
|
var minutes=m+n; |
|
|
|
|
|
|
|
|
|
console.log(this.startTime,this.endTime) |
|
|
|
|
let params = { |
|
|
|
|
id: null, |
|
|
|
|
title: this.examName, |
|
|
|
|
duration: minutes, |
|
|
|
|
modifiedTime: new Date(), |
|
|
|
|
deleted: false, |
|
|
|
|
startTime: this.startTime, |
|
|
|
|
endTime: this.endTime, |
|
|
|
|
organizationId: this.Profiles.organizationId, |
|
|
|
|
creatorId: this.Profiles.id, |
|
|
|
|
paperDataInfo: this.data |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/Papers',params).subscribe(data => { |
|
|
|
|
this.snackBar.open('创建成功','确定',config); |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
sessionStorage.removeItem("checkedWork") |
|
|
|
|
this.router.navigate(['/home/createexam-index']) //跳转试卷列表页面
|
|
|
|
|
},err => { |
|
|
|
|
this.snackBar.open(err,'确定',config); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
if(this.startTime==undefined) |
|
|
|
|
this.snackBar.open('请输入开始时间','确定',config); |
|
|
|
|
else if(this.endTime==undefined) |
|
|
|
|
this.snackBar.open('请输入结束时间','确定',config); |
|
|
|
|
else if(this.examName==undefined) |
|
|
|
|
this.snackBar.open('请输入试卷名称','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(window.confirm('你确定要创建该试卷吗?')){ |
|
|
|
|
alert("确定"); |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
alert("取消"); |
|
|
|
|
|
|
|
|
|
//ngzerro组件
|
|
|
|
|
timeDefaultValue = setHours(new Date(), 0); |
|
|
|
|
disabledDateTime: DisabledTimeFn = () => { |
|
|
|
|
var second=[] |
|
|
|
|
for(var i=1;i<60;i++){ |
|
|
|
|
second.push(i) |
|
|
|
|
} |
|
|
|
|
return { |
|
|
|
|
nzDisabledHours: () => [], |
|
|
|
|
nzDisabledMinutes: () => [], |
|
|
|
|
nzDisabledSeconds: () => second |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onChange(result: Date[]): void { |
|
|
|
|
console.log('onChange: ', result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getWeek(result: Date[]): void { |
|
|
|
|
console.log('week: ', result.map(getISOWeek)); |
|
|
|
|
} |
|
|
|
|
close(){ |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|