Browse Source

[新增]新增预案页面上传按钮功能

master
邵佳豪 4 years ago
parent
commit
454d07d4b4
  1. 10
      src/app/examiner/create-test-score/create-test-score.component.ts
  2. 56
      src/app/ui/collection-tools/examinationQuestions.ts

10
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}`)
})
}
}

56
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<any>,
@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',

Loading…
Cancel
Save