From 454d07d4b41a5e5c62e532bb22a7904aad6bad5c Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Mon, 21 Dec 2020 13:55:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=96=B0=E5=A2=9E=E9=A2=84?= =?UTF-8?q?=E6=A1=88=E9=A1=B5=E9=9D=A2=E4=B8=8A=E4=BC=A0=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../create-test-score.component.ts | 10 ++-- .../collection-tools/examinationQuestions.ts | 56 ++++++++++++++++--- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/src/app/examiner/create-test-score/create-test-score.component.ts b/src/app/examiner/create-test-score/create-test-score.component.ts index 19d4368..49fe135 100644 --- a/src/app/examiner/create-test-score/create-test-score.component.ts +++ b/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(sessionStorage.getItem('paper'))) + unitId:any = JSON.parse(sessionStorage.getItem(sessionStorage.getItem('paperId'))) //获取单位基本信息 async getUnitData(){ @@ -1085,13 +1085,13 @@ export class CreateTestScoreComponent implements OnInit { //判断是否存在总分填写后没有勾选 或者勾选了没有填写总分的情况 paperDataInfo.forEach(element => { - element.planList.forEach(item => { + element.planList ? element.planList.forEach(item => { if(!item.score || item.score == 0){ element.isPlanScore = false }else{ element.isPlanScore = true } - }) + }) : null //判断存在总分填写后没有勾选题目 if( (element.basicInfoScore != 0 && JSON.parse(element.basicInfoData).length == 0) || @@ -1240,7 +1240,7 @@ export class AddPlanTwoDialog { sessionStorage.setItem('planId',this.selectedRadioData.id) sessionStorage.setItem('buildingTypeId',this.data.companyData.companyData.buildingTypes[0].id) sessionStorage.setItem('companyId',this.data.companyData.companyData.id) - window.open('/canvasTool?openType=1') + window.open(`/canvasTool?openType=1&planName=${this.selectedRadioData.name}`) }else{ if(this.dataSource.length == 0){ this.dialogRef.close(); @@ -1274,7 +1274,7 @@ export class AddPlanTwoDialog { sessionStorage.setItem("companyId",this.data.companyData.companyData.id) sessionStorage.setItem("buildingTypeId",this.data.companyData.companyData.buildingTypes[0].id) sessionStorage.setItem("editable","1") - window.open('/canvasTool?openType=2') + window.open(`/canvasTool?openType=2&planName=${this.customPlanName}`) }) } } diff --git a/src/app/ui/collection-tools/examinationQuestions.ts b/src/app/ui/collection-tools/examinationQuestions.ts index 1de21b6..9743466 100644 --- a/src/app/ui/collection-tools/examinationQuestions.ts +++ b/src/app/ui/collection-tools/examinationQuestions.ts @@ -6,6 +6,7 @@ import {CanvasShareDataService,DisposalNodeData} from '../../canvas-share-data.s import { FlatTreeControl } from '@angular/cdk/tree'; import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; import { NzFormatBeforeDropEvent, NzFormatEmitEvent,NzTreeComponent } from 'ng-zorro-antd/tree'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'dialog-examination-questions', @@ -101,7 +102,7 @@ export class examinationQuestions { basicAssetsId:basicAssetsId } - let data = JSON.parse(sessionStorage.getItem("试卷id")) + let data = JSON.parse(sessionStorage.getItem("消防设施"+sessionStorage.getItem('paperId'))) if(data && data.length != 0){ console.log(1) @@ -121,13 +122,13 @@ export class examinationQuestions { }else{ data.push(obj) } - sessionStorage.setItem("试卷id",JSON.stringify(data)) + sessionStorage.setItem("消防设施"+sessionStorage.getItem('paperId'),JSON.stringify(data)) }else{ console.log(2) data = [] data[0] = obj - sessionStorage.setItem("试卷id",JSON.stringify(data)) + sessionStorage.setItem("消防设施"+sessionStorage.getItem('paperId'),JSON.stringify(data)) } @@ -135,11 +136,13 @@ export class examinationQuestions { config.verticalPosition = 'top'; config.duration = 3000 this.snackBar.open('当层消防设施考题设置完成','确定',config); - // this.dialogRef.close() + this.dialogRef.close() } } + +//上传按钮 @Component({ selector: 'dialog-upload-questions', templateUrl: './uploadQuestions.html', @@ -148,20 +151,29 @@ export class examinationQuestions { export class uploadQuestions { constructor(private http:HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data) {} + @Inject(MAT_DIALOG_DATA) public data,private route:ActivatedRoute) {} defaultCheckedKeys = []; //指定选中复选框的树节点 key值 defaultExpandedKeys = []; //展开指定的树节点 key值 defaultSelectedKeys = []; //指定选中的树节点 key值 renderData:any ngOnInit(): void { - let data = JSON.parse(sessionStorage.getItem("试卷id")) - data.forEach(item => { + let data = JSON.parse(sessionStorage.getItem("消防设施"+sessionStorage.getItem('paperId'))) + data ? data.forEach(item => { item.children.forEach(i => { i.isLeaf = true }) - }) + }) :null this.renderData = data + this.getProfiles() + } + //获取登录账号的个人资料 + Profiles:any + getProfiles(){ + this.http.get('/api/ExamAccounts/Profiles').subscribe(data => { + console.log(data) + this.Profiles = data + }) } nzEvent($event){ console.log($event) @@ -169,10 +181,38 @@ export class uploadQuestions { //上传 submit () { console.log(this.data.question) + let body:any = { + id: null, + paperId: sessionStorage.getItem('paperId'), + planComponentId: sessionStorage.getItem('planId'), + examPlanType: this.route.snapshot.queryParams.openType == 1 ? 0 : 1, + creatorId: this.Profiles.id, + modifiedTime: new Date(), + isPublic: true, + title: this.route.snapshot.queryParams.planName, + mainPoint: this.data.question.keynote, + score: null, + examFacilityAssetsData: sessionStorage.getItem('消防设施' + sessionStorage.getItem('paperId')) ? sessionStorage.getItem('消防设施' + sessionStorage.getItem('paperId')) : null, + examDisposalNodesData: sessionStorage.getItem('examNodeList') ? sessionStorage.getItem('examNodeList') : null + } + let params:any = { + paperId:sessionStorage.getItem('paperId'), + examPlanType:this.route.snapshot.queryParams.openType == 1 ? 0 : 1 + } + this.http.post("/api/PaperPlans",body,{params:params}).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('设置完成','确定',config); + }) + } } + + +//保存考的节点 @Component({ selector: 'dialog-disposal-nodes', templateUrl: './uploadDisposalNodes.html',