Browse Source

[修改]修改保存节点接口

master
邵佳豪 4 years ago
parent
commit
a231641bdf
  1. 4
      src/app/examiner/create-test-score/addPlanTwo.html
  2. 2
      src/app/examiner/create-test-score/create-test-score.component.html
  3. 132
      src/app/examiner/create-test-score/create-test-score.component.ts
  4. 7
      src/app/examiner/create-test-score/finishDialog.html
  5. 6
      src/app/ui/collection-tools/collection-tools.component.ts
  6. 4
      src/app/ui/collection-tools/examinationQuestions.html
  7. 14
      src/app/ui/collection-tools/examinationQuestions.ts
  8. 24
      src/app/ui/collection-tools/save.ts
  9. 8
      src/assets/css/ngZorroTree.css
  10. 6
      src/styles.scss

4
src/app/examiner/create-test-score/addPlanTwo.html

@ -3,7 +3,7 @@
<div class="title">
添加预案
</div>
<div *ngIf="dataSource.length != 0" class="tablebox">
<div *ngIf="dataSource && dataSource.length != 0" class="tablebox">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!-- Checkbox Column -->
@ -47,7 +47,7 @@
</table>
</div>
<div *ngIf="dataSource.length == 0">
<div *ngIf="dataSource && dataSource.length == 0">
该单位暂无审核通过的二维预案
</div>
</div>

2
src/app/examiner/create-test-score/create-test-score.component.html

@ -36,7 +36,7 @@
</div>
</div>
<div class="maincontantbox">
<div class="basicinfodiv" [hidden]="!(selectedTab == 1)">
<div id="basicinfodiv" class="basicinfodiv" [hidden]="!(selectedTab == 1)">
<div *ngFor="let unit of unitId;let key = index">
<div [hidden]="!(key == selectedUnitIndex)">
<!-- 选择的单位名称 -->

132
src/app/examiner/create-test-score/create-test-score.component.ts

@ -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();
}

7
src/app/examiner/create-test-score/finishDialog.html

@ -6,7 +6,7 @@
* @LastEditors: sueRimn
* @LastEditTime: 2020-12-14 14:08:52
-->
<div class="box">
<!-- <div class="box">
<div class="diaone">
<div style="margin-bottom: 5px;"><label>请填写试卷名称:</label></div>
<div><input placeholder="请填写" [(ngModel)]="examName"></div>
@ -14,8 +14,7 @@
<div class="diatwo">
<div class="starttime">
<div style="margin-bottom: 5px;"><label>请选择开始时间:</label></div>
<!-- <div><nz-range-picker class="datepicker" nzFormat="yyyy-MM-dd HH:mm" [nzShowTime]="{ nzHideDisabledOptions: true, nzDefaultOpenValue: timeDefaultValue }" [nzDisabledTime]="disabledDateTime" [(ngModel)]="date" (ngModelChange)="onChange($event)"></nz-range-picker>
</div> -->
<div><input type="datetime-local" name="start_time" value="" [(ngModel)]="startTime" /></div>
</div>
<div class="endtime">
@ -29,4 +28,4 @@
<button mat-button (click)="onNoClick()" style="background-color: #07CDCF;margin-left: 200px;color: #fff;">确定</button>
<button mat-button type="button" (click)="close()" style=" background-color: #FF8678;margin-left: 25px;color: #fff;">取消</button>
</div>
</div>
</div> -->

6
src/app/ui/collection-tools/collection-tools.component.ts

@ -1687,7 +1687,8 @@ export class CollectionToolsComponent implements OnInit {
let api
this.examType == 1? api='/api/DisposalNodes' : api='/api/ExamDisposalNodes'
this.selectDisposalNode = ''
let params = {disasterId: this.allFirePlan[0].id || ''}
let params
this.examType == 1? params = {disasterId: this.allFirePlan[0].id || ''} : params = {examDisasterId: this.allFirePlan[0].id || ''}
this.http.get(api,{params:params}).subscribe(data=>{ //处置节点
this.canvasData.allDisposalNode = data
this.handleHybridTree()
@ -1729,7 +1730,8 @@ export class CollectionToolsComponent implements OnInit {
let api
this.examType == 1? api='/api/DisposalNodes' : api='/api/ExamDisposalNodes'
this.defaultExpandedKeys = []
let params = {disasterId: this.allFirePlan[0].id || ''}
let params
this.examType == 1? params = {disasterId: this.allFirePlan[0].id || ''} : params = {examDisasterId: this.allFirePlan[0].id || ''}
this.http.get(api,{params:params}).subscribe(nodeData=>{ //处置节点
this.canvasData.allDisposalNode = nodeData
let oldTreeData = this.nzTreeComponent.getExpandedNodeList()

4
src/app/ui/collection-tools/examinationQuestions.html

@ -1,6 +1,6 @@
<div style="min-width: 240px;" id="nodeTree">
<div style="min-width: 240px;" >
<div style="text-align: center;font-weight: 550;">消防设施考题设定</div>
<div style="max-height: 300px;overflow-y: auto; margin: 25px 0;">
<div id="nodeTree" style="max-height: 300px;overflow-y: auto; margin: 25px 0;">
<!-- 消防列表树 -->
<nz-tree
#nzTreeComponent

14
src/app/ui/collection-tools/examinationQuestions.ts

@ -26,7 +26,6 @@ export class examinationQuestions {
ngOnInit(): void {
this.renderData = this.data.treeData
if(JSON.parse(sessionStorage.getItem('tree型数据')) && JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]){
// console.log(123,JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id])
this.defaultCheckedKeys = JSON.parse(sessionStorage.getItem('tree型数据'))[this.data.buildFloorData.floorData.id]
}
this.data.treeData.forEach(element => {
@ -86,11 +85,20 @@ export class examinationQuestions {
isChecked? checkList.push(element) : null
}
//存储真实素材数据
let basicAssetsId = []
if(checkList && checkList.length != 0){
checkList.forEach(item => {
basicAssetsId.push(item.TemplateId)
})
}
basicAssetsId = Array.from(new Set(basicAssetsId))
console.log(123,this.data.buildFloorData)
let obj = {
name:this.data.buildFloorData.buildingData.name + '-' + this.data.buildFloorData.floorData.name,
key:this.data.buildFloorData.floorData.id,
children:checkList
buildingId:this.data.buildFloorData.buildingData.id,
children:checkList,
basicAssetsId:basicAssetsId
}
let data = JSON.parse(sessionStorage.getItem("试卷id"))

24
src/app/ui/collection-tools/save.ts

@ -119,8 +119,8 @@ export class saveOneDialog {
imageNames: null,
imageUrls: null,
parentId: this.nodeItem ? this.nodeItem.id : null,
disasterId: this.data.disasterId,
planComponentId: sessionStorage.getItem('planId') || '',
examDisasterId: this.data.disasterId,
ExamPlanComponentId: sessionStorage.getItem('planId') || '',
companyId: this.data.siteOrbuilding == -1 ? sessionStorage.getItem('companyId') : null,
sitePlanId: this.data.siteOrbuilding==-1 ? this.selectedSiteData.id : null,
buildingId: this.selectedBuildingData.id || null,
@ -180,8 +180,8 @@ export class saveOneDialog {
id: "",
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null,
version: this.canvasData.selectPanelPoint.Version || "2.0",
disposalNodeId: data.id,
planComponentId: sessionStorage.getItem("planId"),
ExamDisposalNodeId: data.id,
ExamPlanComponentId: sessionStorage.getItem("planId"),
}
this.http.post(`/api/ExamDisposalNodeData`,objData).subscribe(data => {
const config = new MatSnackBarConfig();
@ -226,12 +226,12 @@ export class saveOneDialog {
}
}
dispositionNodeData = {
id: "",
id: null,
name: value.name,
level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0,
order: order,
description: "",
notes: "",
description: null,
notes: null,
weather: null,
airTemperature: 0,
windDirection: 0,
@ -239,8 +239,8 @@ export class saveOneDialog {
imageNames: null,
imageUrls: null,
parentId: this.nodeItem ? this.nodeItem.id : null,
disasterId: this.data.disasterId,
planComponentId: sessionStorage.getItem('planId') || '',
examDisasterId: this.data.disasterId,
ExamPlanComponentId: sessionStorage.getItem('planId') || '',
companyId: null,
sitePlanId: null,
buildingId: null,
@ -273,11 +273,11 @@ export class saveOneDialog {
// let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint))
// postdata.Data = JSON.stringify(postdata.Data)
let objData = {
id: "",
id: null,
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null,
version: this.canvasData.selectPanelPoint.Version || "2.0",
disposalNodeId: data.id,
planComponentId: sessionStorage.getItem("planId"),
ExamDisposalNodeId: data.id,
ExamPlanComponentId: sessionStorage.getItem("planId"),
}
this.http.post(`/api/ExamDisposalNodeData`,objData).subscribe(data => {

8
src/assets/css/ngZorroTree.css

@ -344,12 +344,8 @@
text-align: center;
cursor: pointer
}
#createtestscore,#nodeTree .ant-tree .ant-tree-switcher {
line-height: 22px;
}
#uploadfiretree .ant-tree .ant-tree-switcher {
line-height: 20px;
}
#disposalNodeTree .ant-tree-checkbox {
margin-top: 10px;
}

6
src/styles.scss

@ -117,3 +117,9 @@ table td.mat-footer-cell:last-of-type{
}
}
#nodeTree,#basicinfodiv,#uploadfiretree{
.ant-tree .ant-tree-switcher {
line-height: 22px;
}
}

Loading…
Cancel
Save