|
|
|
@ -9,7 +9,9 @@ import { DisabledTimeFn, DisabledTimePartial } from 'ng-zorro-antd/date-picker';
|
|
|
|
|
import getISOWeek from 'date-fns/getISOWeek'; |
|
|
|
|
import setHours from 'date-fns/setHours'; |
|
|
|
|
import { NzFormatEmitEvent, NzTreeComponent } from 'ng-zorro-antd/tree'; |
|
|
|
|
import { Router } from '@angular/router'; |
|
|
|
|
import { ActivatedRoute, Router } from '@angular/router'; |
|
|
|
|
import { async } from '@angular/core/testing'; |
|
|
|
|
import { functions } from 'firebase'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-create-test-score', |
|
|
|
|
templateUrl: './create-test-score.component.html', |
|
|
|
@ -17,7 +19,7 @@ import { Router } from '@angular/router';
|
|
|
|
|
}) |
|
|
|
|
export class CreateTestScoreComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
constructor(private router:Router,public dialog: MatDialog,private http: HttpClient,public snackBar: MatSnackBar) { } |
|
|
|
|
constructor(private router:Router,public dialog: MatDialog,private http: HttpClient,public snackBar: MatSnackBar,private route:ActivatedRoute) { } |
|
|
|
|
selectedTab:number = 1 //选中的选项卡
|
|
|
|
|
selectTab(index){ |
|
|
|
|
setTimeout(() => { |
|
|
|
@ -26,41 +28,91 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
for (let y = 0, length = this.unitId.length; y < length; y++){ |
|
|
|
|
let element = this.unitId[y] |
|
|
|
|
element.score = 0 |
|
|
|
|
element.basicInfoScore = 0 |
|
|
|
|
element.basicInfoItemScore = 0 |
|
|
|
|
element.basicInfoNodes = [] |
|
|
|
|
element.aroundScore = 0 |
|
|
|
|
element.aroundItemScore = 0 |
|
|
|
|
element.aroundNodes = [] |
|
|
|
|
element.keySiteScore = 0 |
|
|
|
|
element.keySiteItemScore = 0 |
|
|
|
|
element.keySiteNodes = [] |
|
|
|
|
element.funDivScore = 0 |
|
|
|
|
element.funDivItemScore = 0 |
|
|
|
|
element.funDivNodes = [] |
|
|
|
|
element.fireFacScore = 0 |
|
|
|
|
element.fireFacItemScore = 0 |
|
|
|
|
element.fireFacNodes = [] |
|
|
|
|
} |
|
|
|
|
this.getUnitData().then(()=>{ |
|
|
|
|
this.getAround().then(()=>{ |
|
|
|
|
this.getKeySite().then(()=>{ |
|
|
|
|
this.getFunDiv().then(()=>{ |
|
|
|
|
this.getFireFac() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.route.snapshot.queryParams.pattern && this.route.snapshot.queryParams.pattern == 'edit'){ |
|
|
|
|
this.getSoloPaper() |
|
|
|
|
}else{ |
|
|
|
|
this.unitId = JSON.parse(sessionStorage.getItem(sessionStorage.getItem('paperId')))
|
|
|
|
|
for (let y = 0, length = this.unitId.length; y < length; y++){ |
|
|
|
|
let element = this.unitId[y] |
|
|
|
|
element.score = 0 |
|
|
|
|
element.basicInfoScore = 0 |
|
|
|
|
element.basicInfoItemScore = 0 |
|
|
|
|
element.basicInfoNodes = [] |
|
|
|
|
element.aroundScore = 0 |
|
|
|
|
element.aroundItemScore = 0 |
|
|
|
|
element.aroundNodes = [] |
|
|
|
|
element.keySiteScore = 0 |
|
|
|
|
element.keySiteItemScore = 0 |
|
|
|
|
element.keySiteNodes = [] |
|
|
|
|
element.funDivScore = 0 |
|
|
|
|
element.funDivItemScore = 0 |
|
|
|
|
element.funDivNodes = [] |
|
|
|
|
element.fireFacScore = 0 |
|
|
|
|
element.fireFacItemScore = 0 |
|
|
|
|
element.fireFacNodes = [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.getUnitData().then(()=>{ |
|
|
|
|
this.getAround().then(()=>{ |
|
|
|
|
this.getKeySite().then(()=>{ |
|
|
|
|
this.getFunDiv().then(()=>{ |
|
|
|
|
this.getFireFac() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.getPaperPlans().then(()=>{ |
|
|
|
|
this.planItemScore() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得指定试卷信息。
|
|
|
|
|
getSoloPaper(){ |
|
|
|
|
this.http.get(`/api/Papers/${sessionStorage.getItem('paperId')}`).subscribe((data:any) => { |
|
|
|
|
data.paperDataInfo.forEach(item => { |
|
|
|
|
this.unitId.push(JSON.parse(item.originalData)) |
|
|
|
|
}) |
|
|
|
|
console.log('试卷信息',this.unitId) |
|
|
|
|
this.planItemScore() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取所有考试设定
|
|
|
|
|
async getPaperPlans(){ |
|
|
|
|
|
|
|
|
|
for (let y = 0, length = this.unitId.length; y < length; y++){ |
|
|
|
|
let element = this.unitId[y] |
|
|
|
|
await new Promise((resolve,reject)=>{ |
|
|
|
|
this.http.get('/api/PaperPlans',{params:{ |
|
|
|
|
paperId : sessionStorage.getItem('paperId'), |
|
|
|
|
companyId : element.id |
|
|
|
|
}}).subscribe(data => { |
|
|
|
|
console.log('当前试卷的预案列表',data) |
|
|
|
|
element.planList = data |
|
|
|
|
resolve(1) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前选中的单位
|
|
|
|
|
selectedUnitIndex = 0 |
|
|
|
|
clickUnitName(key){ |
|
|
|
|
this.selectedUnitIndex = key |
|
|
|
|
} |
|
|
|
|
unitId:any = JSON.parse(sessionStorage.getItem(sessionStorage.getItem('paperId')))
|
|
|
|
|
unitId:any = [] |
|
|
|
|
|
|
|
|
|
//获取单位基本信息
|
|
|
|
|
async getUnitData(){ |
|
|
|
@ -314,14 +366,14 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
let result1 = await new Promise((resolve, reject) => { |
|
|
|
|
this.http.get('/api/CompanyImportantLocations',{params:id}).subscribe((data:any)=>{ |
|
|
|
|
//如果存在单位毗邻
|
|
|
|
|
//如果存在单位重点部位
|
|
|
|
|
let newData = [] |
|
|
|
|
data.forEach(item => { |
|
|
|
|
item.isLeaf = true |
|
|
|
|
item.key = item.id |
|
|
|
|
item.name ? newData.push(item) : null |
|
|
|
|
}) |
|
|
|
|
if(data.length != 0){ |
|
|
|
|
if(newData.length != 0){ |
|
|
|
|
this.unitId[y].keySiteNodes.push({ |
|
|
|
|
name: '单位重点部位', |
|
|
|
|
key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5), |
|
|
|
@ -347,7 +399,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(element) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取当前单位所有建筑重点部位
|
|
|
|
@ -592,7 +644,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//tree的选择事件
|
|
|
|
|
nzEvent(event: NzFormatEmitEvent,key): void { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(event.node.origin.type == '基本信息' || (event.node.parentNode && event.node.parentNode.origin.type == '基本信息')){ |
|
|
|
|
|
|
|
|
|
let selectedNum = [] |
|
|
|
@ -696,6 +748,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(type == '重点部位'){ |
|
|
|
|
console.log('重点部位') |
|
|
|
|
let selectedNum = 0 |
|
|
|
|
this.unitId[key].keySiteNodes.forEach(item => { |
|
|
|
|
item.children.forEach(i => { |
|
|
|
@ -721,7 +774,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
this.unitId[key].funDivItemScore = 0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(type == '消防设施'){ |
|
|
|
|
if(type == '数据核验'){ |
|
|
|
|
let selectedNum = 0 |
|
|
|
|
this.unitId[key].fireFacNodes.forEach(item => { |
|
|
|
|
item.children.forEach(i => { |
|
|
|
@ -762,9 +815,8 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//每条预案分数增加在试卷分数
|
|
|
|
|
planItemScore(item){ |
|
|
|
|
planItemScore(){ |
|
|
|
|
//计算整个试卷的总分
|
|
|
|
|
console.log(item) |
|
|
|
|
let examScore = 0 |
|
|
|
|
this.unitId.forEach(element => { |
|
|
|
|
examScore += element.score |
|
|
|
@ -792,18 +844,87 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//删除每条预案试卷
|
|
|
|
|
deletePlan(item){ |
|
|
|
|
this.unitId[this.selectedUnitIndex].planList.forEach((element,key)=>{ |
|
|
|
|
if(item == element){ |
|
|
|
|
this.unitId[this.selectedUnitIndex].planList.splice(key,1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除成功','确定',config); |
|
|
|
|
if(window.confirm('你确定要删除该预案设定吗?')){ |
|
|
|
|
this.http.delete(`/api/PaperPlans/${item.id}`).subscribe(data => { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除成功','确定',config); |
|
|
|
|
this.unitId[this.selectedUnitIndex].planList.forEach((element,key)=>{ |
|
|
|
|
if(item == element){ |
|
|
|
|
this.unitId[this.selectedUnitIndex].planList.splice(key,1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.planItemScore() |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(item) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//保存
|
|
|
|
|
save(){ |
|
|
|
|
this.unitId.forEach(item => { |
|
|
|
|
//建筑的基本信息选中key集合
|
|
|
|
|
item.basicInfoNodesKey = [] |
|
|
|
|
item.basicInfoNodes.forEach((i,key) => { |
|
|
|
|
if(i.checked){ |
|
|
|
|
item.basicInfoNodesKey.push(i.key) |
|
|
|
|
}else{ |
|
|
|
|
i.children.forEach(ele => { |
|
|
|
|
ele.checked ? item.basicInfoNodesKey.push(ele.key) : null |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
//四周毗邻选中key集合
|
|
|
|
|
item.aroundNodesKey = [] |
|
|
|
|
item.aroundNodes.forEach((i,key) => { |
|
|
|
|
if(i.checked){ |
|
|
|
|
item.aroundNodesKey.push(i.key) |
|
|
|
|
}else{ |
|
|
|
|
i.children.forEach(ele => { |
|
|
|
|
ele.checked ? item.aroundNodesKey.push(ele.key) : null |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
//重点部位选中key集合
|
|
|
|
|
item.keySiteNodesKey = [] |
|
|
|
|
item.keySiteNodes.forEach((i,key) => { |
|
|
|
|
if(i.checked){ |
|
|
|
|
item.keySiteNodesKey.push(i.key) |
|
|
|
|
}else{ |
|
|
|
|
i.children.forEach(ele => { |
|
|
|
|
ele.checked ? item.keySiteNodesKey.push(ele.key) : null |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
//功能分区选中key集合
|
|
|
|
|
item.funDivNodesKey = [] |
|
|
|
|
item.funDivNodes.forEach((i,key) => { |
|
|
|
|
if(i.checked){ |
|
|
|
|
item.funDivNodesKey.push(i.key) |
|
|
|
|
}else{ |
|
|
|
|
i.children.forEach(ele => { |
|
|
|
|
ele.checked ? item.funDivNodesKey.push(ele.key) : null |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
//数据核验选中key集合
|
|
|
|
|
item.fireFacNodesKey = [] |
|
|
|
|
item.fireFacNodes.forEach((i,key) => { |
|
|
|
|
if(i.checked){ |
|
|
|
|
item.fireFacNodesKey.push(i.key) |
|
|
|
|
}else{ |
|
|
|
|
i.children.forEach(ele => { |
|
|
|
|
ele.checked ? item.fireFacNodesKey.push(ele.key) : null |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
let copyDatas = JSON.parse(JSON.stringify(this.unitId)) |
|
|
|
|
//循环每个建筑处理数据筛选出选中数据
|
|
|
|
|
copyDatas.forEach(item => { |
|
|
|
@ -900,7 +1021,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
i.children = newChildren |
|
|
|
|
delete i.selected |
|
|
|
|
}) |
|
|
|
|
console.log(111,item) |
|
|
|
|
// console.log(111,item)
|
|
|
|
|
//建筑的重点部位模块处理
|
|
|
|
|
item.keySiteNodes ? item.keySiteNodes.forEach((i,key) => { |
|
|
|
|
i.selected ? i.selected = null : null |
|
|
|
@ -1068,7 +1189,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
copyDatas.forEach((item,key) =>{ |
|
|
|
|
paperDataInfo[key] = {} |
|
|
|
|
paperDataInfo[key].id = null |
|
|
|
|
paperDataInfo[key].paperId = null |
|
|
|
|
paperDataInfo[key].paperId = sessionStorage.getItem('paperId') |
|
|
|
|
paperDataInfo[key].companyId = item.id |
|
|
|
|
paperDataInfo[key].basicInfoData = item.basicInfoNodes ? JSON.stringify(item.basicInfoNodes) : '[]' |
|
|
|
|
paperDataInfo[key].basicInfoScore = item.basicInfoScore |
|
|
|
@ -1079,12 +1200,13 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
paperDataInfo[key].functionalDivisionData = item.funDivNodes ? JSON.stringify(item.funDivNodes) : '[]' |
|
|
|
|
paperDataInfo[key].functionalDivisionScore = item.funDivScore |
|
|
|
|
paperDataInfo[key].facilityData = item.fireFacNodes ? JSON.stringify(item.fireFacNodes) : '[]' |
|
|
|
|
paperDataInfo[key].facilityScore = item.fireFacScore |
|
|
|
|
paperDataInfo[key].planList = item.planList |
|
|
|
|
paperDataInfo[key].facilityScore = item.fireFacScore, |
|
|
|
|
paperDataInfo[key].originalData = JSON.stringify(this.unitId[key]) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//判断是否存在总分填写后没有勾选 或者勾选了没有填写总分的情况
|
|
|
|
|
paperDataInfo.forEach(element => { |
|
|
|
|
for (let index = 0; index < paperDataInfo.length; index++) { |
|
|
|
|
const element = paperDataInfo[index]; |
|
|
|
|
element.planList ? element.planList.forEach(item => { |
|
|
|
|
if(!item.score || item.score == 0){ |
|
|
|
|
element.isPlanScore = false |
|
|
|
@ -1119,29 +1241,61 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
return
|
|
|
|
|
}else
|
|
|
|
|
//存在预案没有填写总分
|
|
|
|
|
if(!element.isPlanScore){ |
|
|
|
|
if(element.isPlanScore == false){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('存在预案未填写总分的分组','确定',config); |
|
|
|
|
return
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
if(window.confirm('你确定要创建该试卷吗?')){ |
|
|
|
|
console.log(555,this.unitId) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(666,paperDataInfo) |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
//设置paperPlan的分数
|
|
|
|
|
console.log(123,this.unitId) |
|
|
|
|
|
|
|
|
|
console.log(456,paperDataInfo) |
|
|
|
|
let _this = this |
|
|
|
|
async function setPlansScore(){
|
|
|
|
|
for (let index = 0; index < _this.unitId.length; index++) { |
|
|
|
|
const element = _this.unitId[index]; |
|
|
|
|
for (let i = 0; i < element.planList.length; i++) { |
|
|
|
|
await new Promise((resolve, reject) => { |
|
|
|
|
const item = element.planList[i]; |
|
|
|
|
_this.http.put(`/api/PaperPlans/ModifyScore/${item.id}`,'',{params:{ |
|
|
|
|
score : item.score |
|
|
|
|
}}).subscribe(((data) => { |
|
|
|
|
resolve(i) |
|
|
|
|
console.log('修改分数成功'+i,item.score) |
|
|
|
|
})) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setPlansScore().then(()=>{ |
|
|
|
|
console.log('修改分数成功2222') |
|
|
|
|
|
|
|
|
|
let body = {
|
|
|
|
|
id:sessionStorage.getItem('paperId'), |
|
|
|
|
paperDataInfo:paperDataInfo |
|
|
|
|
} |
|
|
|
|
this.http.put(`/api/Papers/UpdatePaperData/${sessionStorage.getItem('paperId')}`,body).subscribe(data => { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('创建试卷成功','确定',config); |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//上一步
|
|
|
|
|
goBack(){ |
|
|
|
@ -1211,7 +1365,7 @@ export class AddPlanTwoDialog {
|
|
|
|
|
} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.get2DPlan() |
|
|
|
|
console.log(this.data) |
|
|
|
|
console.log(1,this.data.companyData.companyData.id) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取当前公司的二维预案
|
|
|
|
@ -1235,12 +1389,37 @@ export class AddPlanTwoDialog {
|
|
|
|
|
confirm(){ |
|
|
|
|
if(this.planType){//如果选择的是已存在预案
|
|
|
|
|
if(this.selectedRadioData){ |
|
|
|
|
this.dialogRef.close(this.selectedRadioData); |
|
|
|
|
sessionStorage.setItem('companyName',this.data.companyData.companyData.name) |
|
|
|
|
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&planName=${this.selectedRadioData.name}`) |
|
|
|
|
console.log(this.selectedRadioData) |
|
|
|
|
let paperPlansBody = { |
|
|
|
|
id: null, |
|
|
|
|
paperId: sessionStorage.getItem('paperId'), |
|
|
|
|
planComponentId: this.selectedRadioData.id, |
|
|
|
|
examPlanType: 0, |
|
|
|
|
creatorId: JSON.parse(sessionStorage.getItem('creatorData')).id, |
|
|
|
|
modifiedTime: new Date(), |
|
|
|
|
isPublic: this.selectedRadioData.openRange == "未公开" ? false : true, |
|
|
|
|
title: this.selectedRadioData.name, |
|
|
|
|
mainPoint: null, |
|
|
|
|
score: 0, |
|
|
|
|
examFacilityAssetsData: null, |
|
|
|
|
examDisposalNodesData: null, |
|
|
|
|
companyId:this.data.companyData.companyData.id, |
|
|
|
|
creatorName:this.selectedRadioData.creatorName, |
|
|
|
|
planLevel:Number(this.selectedRadioData.planLevel)
|
|
|
|
|
} |
|
|
|
|
let paperPlansParams:any = { |
|
|
|
|
paperId:sessionStorage.getItem('paperId'), |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/PaperPlans',paperPlansBody,{params:paperPlansParams}).subscribe((data2:any) => { |
|
|
|
|
this.dialogRef.close(data2); |
|
|
|
|
sessionStorage.setItem('companyName',this.data.companyData.companyData.name) |
|
|
|
|
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&planName=${this.selectedRadioData.name}&paperplanId=${data2.id}`) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
if(this.dataSource.length == 0){ |
|
|
|
|
this.dialogRef.close(); |
|
|
|
@ -1255,6 +1434,12 @@ export class AddPlanTwoDialog {
|
|
|
|
|
}else{//如果选择的是自定义预案
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let level = sessionStorage.getItem('level') |
|
|
|
|
let body = { |
|
|
|
|
id: null, |
|
|
|
@ -1268,13 +1453,37 @@ export class AddPlanTwoDialog {
|
|
|
|
|
this.http.post("/api/ExamPlanComponents2D",body,{params:{ |
|
|
|
|
companyId : this.data.companyData.companyData.id |
|
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
|
// console.log("创建成功")
|
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
sessionStorage.setItem("planId",data.id); |
|
|
|
|
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&planName=${this.customPlanName}`) |
|
|
|
|
console.log("创建自定义二维成功") |
|
|
|
|
|
|
|
|
|
let paperPlansBody = { |
|
|
|
|
id: null, |
|
|
|
|
paperId: sessionStorage.getItem('paperId'), |
|
|
|
|
planComponentId: data.id, |
|
|
|
|
examPlanType: 1, |
|
|
|
|
creatorId: JSON.parse(sessionStorage.getItem('creatorData')).id, |
|
|
|
|
modifiedTime: new Date(), |
|
|
|
|
isPublic: true, |
|
|
|
|
title: this.customPlanName, |
|
|
|
|
mainPoint: null, |
|
|
|
|
score: 0, |
|
|
|
|
examFacilityAssetsData: null, |
|
|
|
|
examDisposalNodesData: null, |
|
|
|
|
companyId:this.data.companyData.companyData.id, |
|
|
|
|
creatorName:sessionStorage.getItem('realName'), |
|
|
|
|
planLevel:Number(sessionStorage.getItem('level')) |
|
|
|
|
} |
|
|
|
|
let paperPlansParams:any = { |
|
|
|
|
paperId:sessionStorage.getItem('paperId') |
|
|
|
|
} |
|
|
|
|
console.log(this) |
|
|
|
|
this.http.post('/api/PaperPlans',paperPlansBody,{params:paperPlansParams}).subscribe((data2:any) => { |
|
|
|
|
this.dialogRef.close(data2); |
|
|
|
|
sessionStorage.setItem("planId",data.id); |
|
|
|
|
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&planName=${this.customPlanName}&paperplanId=${data2.id}`) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|