|
|
|
|
/*
|
|
|
|
|
* @Descripttion:
|
|
|
|
|
* @version:
|
|
|
|
|
* @Author: sueRimn
|
|
|
|
|
* @Date: 2021-06-16 13:56:54
|
|
|
|
|
* @LastEditors: sueRimn
|
|
|
|
|
* @LastEditTime: 2021-09-06 17:02:53
|
|
|
|
|
*/
|
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
|
import { Component, Inject, OnInit, Renderer2, ViewChild, Input } from '@angular/core';
|
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
|
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
|
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
|
|
|
import { FormControl } from '@angular/forms';
|
|
|
|
|
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
|
|
|
|
|
import { PageEvent } from '@angular/material/paginator';
|
|
|
|
|
import { TreeService } from '../../http-interceptors/tree.service'
|
|
|
|
|
import Viewer from 'viewerjs';
|
|
|
|
|
import { async } from 'rxjs/internal/scheduler/async';
|
|
|
|
|
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
|
|
|
declare var $: any
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-create-plan-online-five',
|
|
|
|
|
templateUrl: './create-plan-online-five.component.html',
|
|
|
|
|
styleUrls: ['./create-plan-online-five.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private route: ActivatedRoute, public snackBar: MatSnackBar, public dialog: MatDialog, private tree: TreeService) { }
|
|
|
|
|
|
|
|
|
|
private _transformer = (node, level: number) => { //初始化tree
|
|
|
|
|
return {
|
|
|
|
|
expandable: !!node.children && node.children.length > 0,
|
|
|
|
|
name: node.name,
|
|
|
|
|
level: level,
|
|
|
|
|
id: node.id,
|
|
|
|
|
parentId: node.parentId,
|
|
|
|
|
children: node.children
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable);
|
|
|
|
|
treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
|
|
|
|
|
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
|
|
|
|
|
myControl = new FormControl();
|
|
|
|
|
hasChild = (_: number, node: any) => node.expandable;
|
|
|
|
|
//分页
|
|
|
|
|
@ViewChild(MatPaginator, { static: true })
|
|
|
|
|
pageEvent: PageEvent;
|
|
|
|
|
paginator: MatPaginator;
|
|
|
|
|
length: any; //共多少条数据
|
|
|
|
|
pageSize: any; //每页条数
|
|
|
|
|
pageSizeOptions: number[] = [6] //设置每页条数
|
|
|
|
|
PageNumber: any; //第几页
|
|
|
|
|
|
|
|
|
|
planLevel: string//预案级别
|
|
|
|
|
blockyl = true
|
|
|
|
|
zaixianDr=false
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
this.planLevel = this.route.snapshot.queryParams.planCategory
|
|
|
|
|
if (this.route.snapshot.queryParams.pattern == 'false') {
|
|
|
|
|
this.pattern = 'look'
|
|
|
|
|
this.blockyl = false
|
|
|
|
|
this.clickTitleItem('单位概况')
|
|
|
|
|
} else {
|
|
|
|
|
this.pattern = 'edit'
|
|
|
|
|
}
|
|
|
|
|
this.getUnitData()
|
|
|
|
|
this.getOrganizations()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
zdysearch = ''
|
|
|
|
|
organizationName: any //当前单位组织机构名称
|
|
|
|
|
treedata: any //组织机构树型数据
|
|
|
|
|
newArr: any = []
|
|
|
|
|
newallorganizations: any //用于存储在原始数据基础上的每个机构增加children字段
|
|
|
|
|
pcMore//pc更多
|
|
|
|
|
pcput = false//pc收起
|
|
|
|
|
pcfind//pc查询
|
|
|
|
|
padjt = false
|
|
|
|
|
|
|
|
|
|
//辖区中队div是否显示
|
|
|
|
|
isorganizationbox: boolean = false
|
|
|
|
|
js: any //所选组织机构
|
|
|
|
|
jsId: any //所选组织机构的id
|
|
|
|
|
jscheck: boolean //所选组织机构勾选框
|
|
|
|
|
//点击辖区中队树,将选择的辖区中队添加到变量
|
|
|
|
|
add(node) {
|
|
|
|
|
this.isorganizationbox = false
|
|
|
|
|
this.js = node.name
|
|
|
|
|
this.jsId = node.id
|
|
|
|
|
}
|
|
|
|
|
//关闭辖区中队隐藏框
|
|
|
|
|
closeorganizationbox() {
|
|
|
|
|
this.isorganizationbox = false
|
|
|
|
|
}
|
|
|
|
|
//打开辖区中队隐藏框
|
|
|
|
|
openorganizationbox() {
|
|
|
|
|
this.isorganizationbox = true
|
|
|
|
|
}
|
|
|
|
|
//关闭出现的组织机构div
|
|
|
|
|
closediv() {
|
|
|
|
|
this.isorganizationbox = false
|
|
|
|
|
}
|
|
|
|
|
//得到当前单位所在组织机构的tree型数据
|
|
|
|
|
allorganizations: any //所有组织机构
|
|
|
|
|
getpresentOrganization() {
|
|
|
|
|
this.newallorganizations = this.allorganizations
|
|
|
|
|
this.newallorganizations.forEach(item => {
|
|
|
|
|
item.children = []
|
|
|
|
|
this.newallorganizations.forEach(element => {
|
|
|
|
|
if (element.parentId == item.id) {
|
|
|
|
|
item.children.push(element)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
/* this.http.get("/api/Account/Profiles").subscribe(
|
|
|
|
|
(data: any) => {
|
|
|
|
|
this.organizationName = data.organizationName
|
|
|
|
|
if (this.organizationName) {
|
|
|
|
|
this.newallorganizations.forEach(item => {
|
|
|
|
|
if (item.name == this.organizationName) {
|
|
|
|
|
this.dataSource.data = [item]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.dataSource.data = this.tree.toTree(this.treedata);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
) */
|
|
|
|
|
this.dataSource.data = this.tree.toTree(this.treedata);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//获得所有组织机构
|
|
|
|
|
getOrganizations() {
|
|
|
|
|
this.http.get('/api/Organizations').subscribe(
|
|
|
|
|
(data: any) => {
|
|
|
|
|
this.allorganizations = data
|
|
|
|
|
this.treedata = this.tree.toTree(data);
|
|
|
|
|
this.getpresentOrganization();
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
//清空查询条件数据
|
|
|
|
|
clearSearch() {
|
|
|
|
|
this.zdysearch = ''
|
|
|
|
|
this.js = ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获得单位信息
|
|
|
|
|
unitData: any
|
|
|
|
|
getUnitData() {
|
|
|
|
|
let paramsdata: any = {
|
|
|
|
|
Name: this.route.snapshot.queryParams.unitName || '',
|
|
|
|
|
}
|
|
|
|
|
this.http.get("/api/Companies", { params: paramsdata }).subscribe((data: any) => {
|
|
|
|
|
data.items.forEach(element => {
|
|
|
|
|
if (element.id == this.route.snapshot.queryParams.companyId) {
|
|
|
|
|
this.unitData = element
|
|
|
|
|
if((this.unitData.buildingTypes[0].name=='高层建筑'||this.unitData.buildingTypes[0].name=='居民小区'||this.unitData.buildingTypes[0].name=='厂房'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='商市场'||this.unitData.buildingTypes[0].name=='医院'||this.unitData.buildingTypes[0].name=='学校'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='宾馆'||this.unitData.buildingTypes[0].name=='娱乐场所'||this.unitData.buildingTypes[0].name=='餐饮业'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='影剧院'||this.unitData.buildingTypes[0].name=='展览建筑'||this.unitData.buildingTypes[0].name=='养老院'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='会议中心')&&this.planLevel=='5'){
|
|
|
|
|
this.zaixianDr=true
|
|
|
|
|
}
|
|
|
|
|
//console.log('单位列表信息', this.unitData)
|
|
|
|
|
this.getTemplateData()
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获得四周毗邻信息
|
|
|
|
|
getArrayIndex(arr, groupName) {
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (arr[i].groupName === groupName) {
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pilinData = []
|
|
|
|
|
async getpili() {
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
let result = await new Promise((resolve) => {
|
|
|
|
|
this.planTemplateData[index].building.forEach(element => {
|
|
|
|
|
let id = { buildingId: element.buildingId }
|
|
|
|
|
this.http.get('/api/BuildingAdjoins', { params: id }).subscribe(data => {
|
|
|
|
|
this.pilinData.push(data)
|
|
|
|
|
resolve(data)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
//this.pilinData.push(result)
|
|
|
|
|
this.pilinData = JSON.parse(JSON.stringify(this.pilinData))
|
|
|
|
|
console.log(this.pilinData)
|
|
|
|
|
this.pilinData.forEach((pvalue, pindex, parr) => {
|
|
|
|
|
parr[pindex].forEach((nval, nindex, narr) => {
|
|
|
|
|
this.planTemplateData[index].building.forEach((value, i, arr) => {
|
|
|
|
|
if (narr[nindex].buildingId == arr[i].buildingId) {
|
|
|
|
|
if (nval.direction == 0) {
|
|
|
|
|
this.planTemplateData[index].building[i].body[2].attinf[0].value = nval.name
|
|
|
|
|
} else if (nval.direction == 1) {
|
|
|
|
|
this.planTemplateData[index].building[i].body[2].attinf[1].value = nval.name
|
|
|
|
|
} else if (nval.direction == 2) {
|
|
|
|
|
this.planTemplateData[index].building[i].body[2].attinf[2].value = nval.name
|
|
|
|
|
} else if (nval.direction == 3) {
|
|
|
|
|
this.planTemplateData[index].building[i].body[2].attinf[3].value = nval.name
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取重点部位
|
|
|
|
|
buData = []
|
|
|
|
|
async getbuwei() {
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
let result = await new Promise((resolve) => {
|
|
|
|
|
this.planTemplateData[index].building.forEach(element => {
|
|
|
|
|
let id = { buildingId: element.buildingId }
|
|
|
|
|
this.http.get('/api/BuildingImportantLocations', { params: id }).subscribe(data => {
|
|
|
|
|
this.buData.push(data)
|
|
|
|
|
resolve(data)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
this.buData = JSON.parse(JSON.stringify(this.buData))
|
|
|
|
|
//console.log(this.buData)
|
|
|
|
|
this.buData.forEach((pvalue, pindex, parr) => {
|
|
|
|
|
if (parr[pindex].length > 0) {
|
|
|
|
|
parr[pindex].forEach((nval, nindex, narr) => {
|
|
|
|
|
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[0].value = nval.name
|
|
|
|
|
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[1].value = nval.nature
|
|
|
|
|
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[2].value = nval.position
|
|
|
|
|
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[3].value = nval.structure
|
|
|
|
|
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[4].value = nval.hazards
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectedItem: string = '封面'
|
|
|
|
|
selectedContent:any
|
|
|
|
|
async clickTitleItem(item) {
|
|
|
|
|
//this.planTemplateData[key].new=true
|
|
|
|
|
|
|
|
|
|
this.selectedContent = item
|
|
|
|
|
this.addNumber = -1
|
|
|
|
|
this.yinruData = {
|
|
|
|
|
items: []
|
|
|
|
|
}
|
|
|
|
|
this.yinJson = {
|
|
|
|
|
//组织指挥
|
|
|
|
|
organizationCommands: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//社会联动
|
|
|
|
|
socialLinkages: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//勤务保障
|
|
|
|
|
serviceSupports: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//辅助决策
|
|
|
|
|
decisionSupports: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
this.js = ''
|
|
|
|
|
this.zdysearch = ''
|
|
|
|
|
this.selectedItem = item.groupName
|
|
|
|
|
if (this.selectedItem == '重点图示') {
|
|
|
|
|
this.getAllBuildings()
|
|
|
|
|
this.getSitePlan()
|
|
|
|
|
this.getRealPicture()
|
|
|
|
|
} else if (this.selectedItem == '单位概况') {
|
|
|
|
|
await this.getAllBuildings()
|
|
|
|
|
await this.getAllBuildingsInfo()
|
|
|
|
|
await this.getpili()
|
|
|
|
|
await this.getbuwei()
|
|
|
|
|
//console.log(this.buildZong)
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
this.planTemplateData[index].building.forEach(element => {
|
|
|
|
|
if(element.body[0].completed){
|
|
|
|
|
element.body[0].attinf[0].value = element.body[0].attinf[0].olddata = this.unitData.usci
|
|
|
|
|
element.body[0].attinf[1].value = element.body[0].attinf[1].olddata = this.unitData.buildingTypes[0].name
|
|
|
|
|
element.body[0].attinf[2].value = element.body[0].attinf[2].olddata = this.unitData.contacts
|
|
|
|
|
element.body[0].attinf[3].value = element.body[0].attinf[3].olddata = this.unitData.phone
|
|
|
|
|
element.body[0].attinf[4].value = element.body[0].attinf[4].olddata = this.unitData.organizationName
|
|
|
|
|
element.body[0].attinf[5].value = element.body[0].attinf[5].olddata = this.unitData.address
|
|
|
|
|
if (element.body[1].attinf != undefined) {
|
|
|
|
|
element.body[1].attinf.forEach(eBuild => {
|
|
|
|
|
this.buildZong.forEach(oldBuild => {
|
|
|
|
|
if (oldBuild.buildingBasicGroups.length > 0) {
|
|
|
|
|
oldBuild.buildingBasicGroups[0].propertyInfos.forEach(infodata => {
|
|
|
|
|
eBuild.olddata = infodata.propertyValue
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
} else if (this.selectedItem == '预案附件') {
|
|
|
|
|
this.getTwoDPlanList()
|
|
|
|
|
}else if(this.selectedItem == '新建'){
|
|
|
|
|
const dialogRef = this.dialog.open(newTitle, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '300px',
|
|
|
|
|
height:'190px',
|
|
|
|
|
disableClose:true,
|
|
|
|
|
data:{type:'新建',planTemplateData:this.planTemplateData}
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
console.log(result)
|
|
|
|
|
if(result!=undefined){
|
|
|
|
|
//delete this.planTemplateData[this.planTemplateData.length-1]
|
|
|
|
|
this.planTemplateData[this.planTemplateData.length-1]={attribute:[],completed: true, groupName: result,new:false,headName:'自定义名称'}
|
|
|
|
|
this.planTemplateData.push({completed: true,groupName: '新建'})
|
|
|
|
|
//delete this.planTemplateData[this.planTemplateData.length-3]
|
|
|
|
|
}
|
|
|
|
|
//JSON.parse(JSON.stringify(this.planTemplateData))
|
|
|
|
|
//console.log(this.planTemplateData)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//自定义模块改名
|
|
|
|
|
upName(index,name){
|
|
|
|
|
const dialogRef = this.dialog.open(newTitle, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '300px',
|
|
|
|
|
height:'190px',
|
|
|
|
|
disableClose:true,
|
|
|
|
|
data:{type:'修改',planName:name,planTemplateData:this.planTemplateData}
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
this.planTemplateData[index].groupName=result
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//自定义模块删除
|
|
|
|
|
delName(index){
|
|
|
|
|
let isTrue = confirm('您确定要删除该项吗')
|
|
|
|
|
if(isTrue){
|
|
|
|
|
this.planTemplateData.splice(index,1)
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
drop(event: CdkDragDrop<string[]>) {
|
|
|
|
|
moveItemInArray(this.planTemplateData, event.previousIndex, event.currentIndex);
|
|
|
|
|
//console.log('拖拽标题', this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取建筑信息
|
|
|
|
|
buildingsData = []
|
|
|
|
|
buildDataName
|
|
|
|
|
buildZong
|
|
|
|
|
//获得所有建筑信息
|
|
|
|
|
async getAllBuildingsInfo() {
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
const result = await new Promise((resolve) => {
|
|
|
|
|
this.http.get("/api/Buildings", {
|
|
|
|
|
params: {
|
|
|
|
|
companyId: this.unitId
|
|
|
|
|
}
|
|
|
|
|
}).subscribe(async (data: any) => {
|
|
|
|
|
this.buildDataName = data
|
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
this.http.get("/api/BuildingBasicInfos", { // 循环请求当前单位建筑每一个建筑的信息保存到数组中
|
|
|
|
|
params: {
|
|
|
|
|
companyId: this.unitId,
|
|
|
|
|
buildingId: data[i].id,
|
|
|
|
|
buildingType: data[i].buildingTypes[0].id
|
|
|
|
|
}
|
|
|
|
|
}).subscribe((buildingsData: any) => {
|
|
|
|
|
//console.log(buildingsData)
|
|
|
|
|
this.buildingsData.push(buildingsData[0])
|
|
|
|
|
resolve(this.buildingsData)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//console.log(this.buildingsData)
|
|
|
|
|
if (this.planTemplateData[index].building == undefined) {
|
|
|
|
|
this.planTemplateData[index].building = []
|
|
|
|
|
if (this.planTemplateData[index].attribute[1].attinf != undefined) {
|
|
|
|
|
this.planTemplateData[index].attribute[1].attinf.forEach(pData => {
|
|
|
|
|
this.buildingsData.forEach((bDara, bi, bArr) => {
|
|
|
|
|
if (bDara.buildingBasicGroups.length > 0) {
|
|
|
|
|
bDara.buildingBasicGroups[0].propertyInfos.forEach(bInfo => {
|
|
|
|
|
pData.propertyValue = pData.olddata = bInfo.propertyValue
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < this.buildDataName.length; i++) {
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
this.planTemplateData[index].building.push({ name: this.buildDataName[i].name, buildingId: this.buildDataName[i].id, body: JSON.parse(JSON.stringify(this.planTemplateData[index].attribute)), completed: true })
|
|
|
|
|
} else {
|
|
|
|
|
this.planTemplateData[index].building.push({ name: this.buildDataName[i].name, buildingId: this.buildDataName[i].id, body: JSON.parse(JSON.stringify(this.planTemplateData[index].attribute)), completed: false })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
for (var a = 0; a < this.planTemplateData[index].building.length; a++) {
|
|
|
|
|
if (a > 0) {
|
|
|
|
|
this.planTemplateData[index].building[a].body[0].completed = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.buildZong = result
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取当前单位的二维预案
|
|
|
|
|
TwoDPlanList: any
|
|
|
|
|
getTwoDPlanList() {
|
|
|
|
|
let paramsData = {
|
|
|
|
|
companyId: this.route.snapshot.queryParams.companyId,
|
|
|
|
|
pageSize: "999"
|
|
|
|
|
}
|
|
|
|
|
this.http.get("/api/PlanComponents", { params: paramsData }).subscribe((data: any) => {
|
|
|
|
|
this.TwoDPlanList = data.items.filter((item) => {
|
|
|
|
|
return item.planType == 1
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取实景图
|
|
|
|
|
allRealPicture
|
|
|
|
|
getRealPicture() {
|
|
|
|
|
let companyId = this.unitId
|
|
|
|
|
this.http.get('/api/RealityImageGroups', {
|
|
|
|
|
params: {
|
|
|
|
|
companyId: this.route.snapshot.queryParams.companyId
|
|
|
|
|
}
|
|
|
|
|
}).subscribe((data: any) => {
|
|
|
|
|
this.allRealPicture = data
|
|
|
|
|
this.getAllRealPicture().then(() => {
|
|
|
|
|
// console.log('实景图', this.allRealPicture)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
async getAllRealPicture() {
|
|
|
|
|
for (let index = 0; index < this.allRealPicture.length; index++) {
|
|
|
|
|
const element = this.allRealPicture[index];
|
|
|
|
|
let data = {
|
|
|
|
|
groupId: element.id,
|
|
|
|
|
pageSize: '999',
|
|
|
|
|
}
|
|
|
|
|
await new Promise((resolve, reject) => {
|
|
|
|
|
this.http.get('/api/RealityImages', { params: data }).subscribe((data: any) => {
|
|
|
|
|
element.realityImages = data.items
|
|
|
|
|
element.realityImages.forEach(item => { //每张图片设置选中状态为false
|
|
|
|
|
item.newImageUrl = `/api/Objects/PlanPlatform/${item.imageUrl}?x-oss-process=image/resize,m_fill,h_100,w_100` //处理图片URL地址
|
|
|
|
|
item.nameStart = item.name.substring(0, item.name.lastIndexOf(".")); //图片名称前缀
|
|
|
|
|
item.nameEnd = item.name.substring(item.name.lastIndexOf("."), item.name.length); //图片名称后缀
|
|
|
|
|
resolve(data)
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
planTemplateData: any
|
|
|
|
|
//获得模板信息
|
|
|
|
|
getTemplateData() {
|
|
|
|
|
this.http.get(`/api/PlanComponents/${this.route.snapshot.queryParams.planId}/WebText`).subscribe((data: any) => {
|
|
|
|
|
//console.log('预案内容', data)
|
|
|
|
|
this.planTemplateData = JSON.parse(data.webTextData).filter(item =>
|
|
|
|
|
item.completed == true
|
|
|
|
|
)
|
|
|
|
|
//console.log(this.planTemplateData)
|
|
|
|
|
if (this.planTemplateData[0].groupName != '封面') {
|
|
|
|
|
let obj = {
|
|
|
|
|
completed: true,
|
|
|
|
|
groupName: "封面",
|
|
|
|
|
attribute: {
|
|
|
|
|
planNumber: '',
|
|
|
|
|
planName: this.route.snapshot.queryParams.planName,
|
|
|
|
|
objName: this.unitData.name,
|
|
|
|
|
unitNature: this.unitData.buildingTypes[0].name,
|
|
|
|
|
planLevel: '',
|
|
|
|
|
disasterType: '火灾',
|
|
|
|
|
fireproofingLevel: '',
|
|
|
|
|
fireproofingAdminister: this.unitData.organizationName,
|
|
|
|
|
putOutFireAdminister: '',
|
|
|
|
|
producer: {
|
|
|
|
|
name: '',
|
|
|
|
|
duty: ''
|
|
|
|
|
},
|
|
|
|
|
verifier: {
|
|
|
|
|
name: '',
|
|
|
|
|
duty: ''
|
|
|
|
|
},
|
|
|
|
|
auditTime: ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData.unshift(obj)
|
|
|
|
|
}
|
|
|
|
|
else if (this.planTemplateData[0].groupName == '封面') {
|
|
|
|
|
this.planTemplateData[0].attribute.objName = this.unitData.name
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData.forEach(element => {
|
|
|
|
|
if (element.groupName == '重点图示') {
|
|
|
|
|
if (!element.attribute) {
|
|
|
|
|
element.attribute = [{ name: '', imgArr: [] }]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.groupName == '交通水源') {
|
|
|
|
|
if (!element.attribute) {
|
|
|
|
|
element.attribute = [{ name: '', imgArr: [] }]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.groupName == '预案附件') {
|
|
|
|
|
if (!element.attribute) {
|
|
|
|
|
element.attribute = [{ name: '', imgArr: [] }]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.groupName == '处置要点') {
|
|
|
|
|
if (!element.attribute) {
|
|
|
|
|
element.attribute = [{ name: '', content: '' }]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.groupName == '特别警示') {
|
|
|
|
|
if (!element.attribute) {
|
|
|
|
|
element.attribute = [{ name: '特别警示', content: '' }]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(element.groupName=='三位概况'){
|
|
|
|
|
this.clickTitleItem('单位概况')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if(this.planLevel=='4'){
|
|
|
|
|
this.planTemplateData.push({completed: true,groupName: '新建'})
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData.forEach(element => {
|
|
|
|
|
if(element.attribute!=undefined){
|
|
|
|
|
/* element.attribute.forEach((item,index,value) => {
|
|
|
|
|
if(value[index].level!=undefined&&value[index].level==1){
|
|
|
|
|
value[index].lieNumber=value[index].tableth.length
|
|
|
|
|
}
|
|
|
|
|
}); */
|
|
|
|
|
for(let i=0;i<element.attribute.length;i++){
|
|
|
|
|
if(element.attribute[i].level!=undefined&&element.attribute[i].level==1){
|
|
|
|
|
element.attribute[i].lieNumber=element.attribute[i].tableth.length
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//引入数据json
|
|
|
|
|
yinJson = {
|
|
|
|
|
//组织指挥
|
|
|
|
|
organizationCommands: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//社会联动
|
|
|
|
|
socialLinkages: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//勤务保障
|
|
|
|
|
serviceSupports: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//辅助决策
|
|
|
|
|
decisionSupports: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
async yinRu(type) {
|
|
|
|
|
if (type == 0) {
|
|
|
|
|
this.yinJson = {
|
|
|
|
|
//组织指挥
|
|
|
|
|
organizationCommands: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//社会联动
|
|
|
|
|
socialLinkages: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//勤务保障
|
|
|
|
|
serviceSupports: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//辅助决策
|
|
|
|
|
decisionSupports: {
|
|
|
|
|
tableCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
tables: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
inputCount: {
|
|
|
|
|
totalCount: 0,
|
|
|
|
|
inputs: [
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
textAreaCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
},
|
|
|
|
|
treeCount: {
|
|
|
|
|
totalCount: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
var orgtableCount = 0
|
|
|
|
|
var orginputCount = 0
|
|
|
|
|
var orgtextAreaCount = 0
|
|
|
|
|
var orgtreeCount = 0
|
|
|
|
|
this.planTemplateData.forEach((value, index, array) => {
|
|
|
|
|
if (value.groupName == '组织指挥') {
|
|
|
|
|
value.attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
orgtableCount++
|
|
|
|
|
this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length })
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
orginputCount++
|
|
|
|
|
this.yinJson.organizationCommands.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
orgtextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
orgtreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.yinJson.organizationCommands.tableCount.totalCount = orgtableCount
|
|
|
|
|
this.yinJson.organizationCommands.inputCount.totalCount = orginputCount
|
|
|
|
|
this.yinJson.organizationCommands.textAreaCount.totalCount = orgtextAreaCount
|
|
|
|
|
this.yinJson.organizationCommands.treeCount.totalCount = orgtreeCount
|
|
|
|
|
var shetableCount = 0
|
|
|
|
|
var sheinputCount = 0
|
|
|
|
|
var shetextAreaCount = 0
|
|
|
|
|
var shetreeCount = 0
|
|
|
|
|
if (value.groupName == '社会联动') {
|
|
|
|
|
value.attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
shetableCount++
|
|
|
|
|
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
sheinputCount++
|
|
|
|
|
this.yinJson.socialLinkages.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
shetextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
shetreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.yinJson.socialLinkages.tableCount.totalCount = shetableCount
|
|
|
|
|
this.yinJson.socialLinkages.inputCount.totalCount = sheinputCount
|
|
|
|
|
this.yinJson.socialLinkages.textAreaCount.totalCount = shetextAreaCount
|
|
|
|
|
this.yinJson.socialLinkages.treeCount.totalCount = shetreeCount
|
|
|
|
|
var qintableCount = 0
|
|
|
|
|
var qininputCount = 0
|
|
|
|
|
var qintextAreaCount = 0
|
|
|
|
|
var qintreeCount = 0
|
|
|
|
|
if (value.groupName == '勤务保障') {
|
|
|
|
|
value.attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
qintableCount++
|
|
|
|
|
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
qininputCount++
|
|
|
|
|
this.yinJson.serviceSupports.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
qintextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
qintreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.yinJson.serviceSupports.tableCount.totalCount = qintableCount
|
|
|
|
|
this.yinJson.serviceSupports.inputCount.totalCount = qininputCount
|
|
|
|
|
this.yinJson.serviceSupports.textAreaCount.totalCount = qintextAreaCount
|
|
|
|
|
this.yinJson.serviceSupports.treeCount.totalCount = qintreeCount
|
|
|
|
|
var futableCount = 0
|
|
|
|
|
var fuinputCount = 0
|
|
|
|
|
var futextAreaCount = 0
|
|
|
|
|
var futreeCount = 0
|
|
|
|
|
if (value.groupName == '辅助决策') {
|
|
|
|
|
value.attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
futableCount++
|
|
|
|
|
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
fuinputCount++
|
|
|
|
|
this.yinJson.decisionSupports.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
futextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
futreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.yinJson.decisionSupports.tableCount.totalCount = futableCount
|
|
|
|
|
this.yinJson.decisionSupports.inputCount.totalCount = fuinputCount
|
|
|
|
|
this.yinJson.decisionSupports.textAreaCount.totalCount = futextAreaCount
|
|
|
|
|
this.yinJson.decisionSupports.treeCount.totalCount = futreeCount
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (type == 5) {
|
|
|
|
|
var orgtableCount = 0
|
|
|
|
|
var orginputCount = 0
|
|
|
|
|
var orgtextAreaCount = 0
|
|
|
|
|
var orgtreeCount = 0
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'组织指挥')
|
|
|
|
|
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
orgtableCount++
|
|
|
|
|
this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length })
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
orginputCount++
|
|
|
|
|
this.yinJson.organizationCommands.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
orgtextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
orgtreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.yinJson.organizationCommands.tableCount.totalCount = orgtableCount
|
|
|
|
|
this.yinJson.organizationCommands.inputCount.totalCount = orginputCount
|
|
|
|
|
this.yinJson.organizationCommands.textAreaCount.totalCount = orgtextAreaCount
|
|
|
|
|
this.yinJson.organizationCommands.treeCount.totalCount = orgtreeCount
|
|
|
|
|
this.yinJson.decisionSupports = null
|
|
|
|
|
this.yinJson.serviceSupports = null
|
|
|
|
|
this.yinJson.socialLinkages = null
|
|
|
|
|
} if (type == 7) {
|
|
|
|
|
var orgtableCount = 0
|
|
|
|
|
var orginputCount = 0
|
|
|
|
|
var orgtextAreaCount = 0
|
|
|
|
|
var orgtreeCount = 0
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'社会联动')
|
|
|
|
|
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
orgtableCount++
|
|
|
|
|
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
orginputCount++
|
|
|
|
|
this.yinJson.socialLinkages.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
orgtextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
orgtreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.yinJson.socialLinkages.tableCount.totalCount = orgtableCount
|
|
|
|
|
this.yinJson.socialLinkages.inputCount.totalCount = orginputCount
|
|
|
|
|
this.yinJson.socialLinkages.textAreaCount.totalCount = orgtextAreaCount
|
|
|
|
|
this.yinJson.socialLinkages.treeCount.totalCount = orgtreeCount
|
|
|
|
|
this.yinJson.serviceSupports = null
|
|
|
|
|
this.yinJson.organizationCommands = null
|
|
|
|
|
this.yinJson.decisionSupports = null
|
|
|
|
|
} if (type == 8) {
|
|
|
|
|
var orgtableCount = 0
|
|
|
|
|
var orginputCount = 0
|
|
|
|
|
var orgtextAreaCount = 0
|
|
|
|
|
var orgtreeCount = 0
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'勤务保障')
|
|
|
|
|
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
orgtableCount++
|
|
|
|
|
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
orginputCount++
|
|
|
|
|
this.yinJson.serviceSupports.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
orgtextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
orgtreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.yinJson.serviceSupports.tableCount.totalCount = orgtableCount
|
|
|
|
|
this.yinJson.serviceSupports.inputCount.totalCount = orginputCount
|
|
|
|
|
this.yinJson.serviceSupports.textAreaCount.totalCount = orgtextAreaCount
|
|
|
|
|
this.yinJson.serviceSupports.treeCount.totalCount = orgtreeCount
|
|
|
|
|
this.yinJson.decisionSupports = null
|
|
|
|
|
this.yinJson.organizationCommands = null
|
|
|
|
|
this.yinJson.socialLinkages = null
|
|
|
|
|
} if (type == 10) {
|
|
|
|
|
var orgtableCount = 0
|
|
|
|
|
var orginputCount = 0
|
|
|
|
|
var orgtextAreaCount = 0
|
|
|
|
|
var orgtreeCount = 0
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'处置要点')
|
|
|
|
|
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
|
|
|
|
|
if (orgArr[orgi].level == '1') {
|
|
|
|
|
orgtableCount++
|
|
|
|
|
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
|
|
|
|
|
} else if (orgArr[orgi].level == '2') {
|
|
|
|
|
orginputCount++
|
|
|
|
|
this.yinJson.decisionSupports.inputCount.inputs.push({ colCount: orgArr[orgi].lieNumber, rowCount: orgArr[orgi].hNumber })
|
|
|
|
|
} else if (orgArr[orgi].level == '3') {
|
|
|
|
|
orgtextAreaCount++
|
|
|
|
|
} else if (orgArr[orgi].level == '4') {
|
|
|
|
|
orgtreeCount++
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.yinJson.decisionSupports.tableCount.totalCount = orgtableCount
|
|
|
|
|
this.yinJson.decisionSupports.inputCount.totalCount = orginputCount
|
|
|
|
|
this.yinJson.decisionSupports.textAreaCount.totalCount = orgtextAreaCount
|
|
|
|
|
this.yinJson.decisionSupports.treeCount.totalCount = orgtreeCount
|
|
|
|
|
this.yinJson.organizationCommands = null
|
|
|
|
|
this.yinJson.serviceSupports = null
|
|
|
|
|
this.yinJson.socialLinkages = null
|
|
|
|
|
}
|
|
|
|
|
// console.log(this.yinJson)
|
|
|
|
|
}
|
|
|
|
|
//查询能引入的预案
|
|
|
|
|
yinruData = {
|
|
|
|
|
items: []
|
|
|
|
|
}
|
|
|
|
|
searchYuan() {
|
|
|
|
|
this.yinRu(this.selectedItem == '组织指挥' ? 5 : this.selectedItem == '社会联动' ? 7 : this.selectedItem == '勤务保障' ? 8 : 10)
|
|
|
|
|
//console.log(JSON.stringify(this.yinJson))
|
|
|
|
|
var urlbm = encodeURI(JSON.stringify(this.yinJson))
|
|
|
|
|
let paramsdata: any = {
|
|
|
|
|
planCategory: this.planLevel,
|
|
|
|
|
buildingTypeId: this.route.snapshot.queryParams.unitTypeId,
|
|
|
|
|
OrganizationId: this.searchType == '0' ? '' : this.jsId,
|
|
|
|
|
CustomKeyword: this.searchType == '0' ? this.zdysearch : '',
|
|
|
|
|
webTextStatistics: urlbm,
|
|
|
|
|
PageNumber: this.PageNumber || '1',
|
|
|
|
|
PageSize: this.pageSizeOptions[0],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.http.get("/api/PlanComponents/WebText", { params: paramsdata }).subscribe((data: any) => {
|
|
|
|
|
this.yinruData = null
|
|
|
|
|
this.yinruData = data
|
|
|
|
|
if (this.yinruData.items.length == 0) {
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
this.snackBar.open('暂无数据', '确定', config);
|
|
|
|
|
}
|
|
|
|
|
//console.log(this.yinruData)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//可引入预案点击事件
|
|
|
|
|
clickYinru(clicki) {
|
|
|
|
|
const dialogRef = this.dialog.open(yinYong, {
|
|
|
|
|
width: '750px',
|
|
|
|
|
height: '700px',
|
|
|
|
|
//disableClose: true
|
|
|
|
|
data: { selectedItem: this.selectedItem, yinruData: this.yinruData.items[clicki].webTextData }
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
// console.log(result)
|
|
|
|
|
if (result != undefined) {
|
|
|
|
|
this.planTemplateData.forEach(element => {
|
|
|
|
|
if (element.groupName == this.selectedItem) {
|
|
|
|
|
element.attribute = result
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//分页事件
|
|
|
|
|
changePage(e) {
|
|
|
|
|
this.PageNumber = e.pageIndex + 1
|
|
|
|
|
this.searchYuan()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重点图示增加分组
|
|
|
|
|
addkeyImgItem(item) {
|
|
|
|
|
item.attribute.push({ name: '', imgArr: [] })
|
|
|
|
|
}
|
|
|
|
|
//处置要点增加分组
|
|
|
|
|
addDisposalPointItem(item) {
|
|
|
|
|
item.attribute.push({ name: '', content: '' })
|
|
|
|
|
}
|
|
|
|
|
//通过左侧查看实景图
|
|
|
|
|
gallery
|
|
|
|
|
lookkeyImgItemLeft(key1, key2, i) {
|
|
|
|
|
let dom = document.getElementById(`viewerjs`)
|
|
|
|
|
let pObjs = dom.childNodes;
|
|
|
|
|
let node = document.createElement("img")
|
|
|
|
|
node.style.display = "none";
|
|
|
|
|
node.src = '/api/Objects/PlanPlatform/' + i.imageUrl;
|
|
|
|
|
node.id = 'img'
|
|
|
|
|
dom.appendChild(node)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
let viewer = new Viewer(document.getElementById(`viewerjs`), {
|
|
|
|
|
hidden: () => {
|
|
|
|
|
dom.removeChild(pObjs[0]);
|
|
|
|
|
viewer.destroy();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
node.click();
|
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//通过左侧实景图增加分组
|
|
|
|
|
addkeyImgItemLeft(item, i) {
|
|
|
|
|
this.planTemplateData.forEach(element => {
|
|
|
|
|
if (element.groupName == '重点图示') {
|
|
|
|
|
element.attribute.push({ name: item.name + '-' + i.name, imgArr: ['/api/Objects/PlanPlatform/' + i.imageUrl] })
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//重点图示,处置要点删除指定分组
|
|
|
|
|
deleteItem(item, key) {
|
|
|
|
|
let isDelete = window.confirm('确定要删除该分组吗?分组下内容将一同被删除!')
|
|
|
|
|
if (isDelete) {
|
|
|
|
|
item.attribute.splice(key, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//重点图示删除指定分组里面的图片
|
|
|
|
|
deleteImgItem(imgArr, imgkey) {
|
|
|
|
|
let isDelete = window.confirm('确定要删除该图片吗?')
|
|
|
|
|
if (isDelete) {
|
|
|
|
|
imgArr.splice(imgkey, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重点图示上传图片
|
|
|
|
|
filechange(e, i) {
|
|
|
|
|
console.log(i)
|
|
|
|
|
let file = e.target.files[0] || null //获取上传的文件
|
|
|
|
|
let fileSize = file.size || null //上传文件的总大小
|
|
|
|
|
let maxSize = 5 * 1024 * 1024 //5MB一个分片
|
|
|
|
|
let tenSize = 100 * 1024 * 1024 //100MB限制
|
|
|
|
|
if (file && fileSize <= maxSize) { //上传文件<=5MB时
|
|
|
|
|
let upload = this.uploadFile(this.route.snapshot.queryParams.companyId, this.route.snapshot.queryParams.planId, file)
|
|
|
|
|
upload.then((res: any) => {
|
|
|
|
|
if (i.tableth != undefined) {
|
|
|
|
|
i.tableth.json.push('/api/Objects/PlanPlatform/' + res.objectName)
|
|
|
|
|
} else {
|
|
|
|
|
i.imgArr.push('/api/Objects/PlanPlatform/' + res.objectName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
} else { //上传文件>5MB时
|
|
|
|
|
let upload = this.sectionUpload(this.route.snapshot.queryParams.companyId, this.route.snapshot.queryParams.planId, file)
|
|
|
|
|
upload.then(res => {
|
|
|
|
|
if (i.tableth != undefined) {
|
|
|
|
|
i.tableth.json.push('/api/Objects/PlanPlatform/' + res)
|
|
|
|
|
} else {
|
|
|
|
|
i.imgArr.push('/api/Objects/PlanPlatform/' + res)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
//单位相关数据
|
|
|
|
|
unitId: any = this.route.snapshot.queryParams.companyId
|
|
|
|
|
//获得所有的建筑物
|
|
|
|
|
allBuildings: any
|
|
|
|
|
async getAllBuildings() {
|
|
|
|
|
let result = await new Promise((resolve, reject) => {
|
|
|
|
|
this.http.get("/api/Buildings", {
|
|
|
|
|
params: {
|
|
|
|
|
companyId: this.unitId
|
|
|
|
|
}
|
|
|
|
|
}).subscribe((data: any) => {
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
let params = { buildingId: item.id }
|
|
|
|
|
item.plandata = []
|
|
|
|
|
this.http.get('/api/BuildingAreas', { params }).subscribe(data => {
|
|
|
|
|
item.plandata = data
|
|
|
|
|
resolve(data)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.allBuildings = data
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//获取总平面图
|
|
|
|
|
sitePlanItems: any
|
|
|
|
|
getSitePlan() {
|
|
|
|
|
let params = { companyId: this.unitId }
|
|
|
|
|
this.http.get('/api/SitePlans', { params: params }).subscribe(data => {
|
|
|
|
|
this.sitePlanItems = data
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//打开采集工具
|
|
|
|
|
openPlan(item, index, type?: string) {
|
|
|
|
|
sessionStorage.setItem("gisplan", 'look')
|
|
|
|
|
sessionStorage.setItem("companyId", this.unitId)
|
|
|
|
|
// console.log(item)
|
|
|
|
|
if (type == '预案') {
|
|
|
|
|
sessionStorage.setItem("planId", item.id)
|
|
|
|
|
sessionStorage.setItem("companyId", this.route.snapshot.queryParams.companyId)
|
|
|
|
|
sessionStorage.setItem("buildingTypeId", this.route.snapshot.queryParams.unitTypeId)
|
|
|
|
|
sessionStorage.setItem("editable", "0")
|
|
|
|
|
sessionStorage.setItem("planName", item.name)
|
|
|
|
|
sessionStorage.setItem("orName", item.name)
|
|
|
|
|
sessionStorage.setItem("orId", item.name)
|
|
|
|
|
}
|
|
|
|
|
let data = { select: item, key: index, allBuildings: this.allBuildings, type: type }
|
|
|
|
|
let width = Math.round(document.body.clientWidth * 0.8) + 'px'
|
|
|
|
|
let height = Math.round(document.body.clientHeight * 0.9) + 'px'
|
|
|
|
|
// console.log('宽度',width)
|
|
|
|
|
let dialogRef = this.dialog.open(OpenPlanToolDialog, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
id: 'openPlanToolDialog',
|
|
|
|
|
data,
|
|
|
|
|
width: width,
|
|
|
|
|
height: height
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe((data) => { });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//正常上传
|
|
|
|
|
async uploadFile(companyId: string, planId: string, file) {
|
|
|
|
|
let formData = new FormData()
|
|
|
|
|
formData.append("file", file)
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
this.http.post(`/api/Objects/PlanPlatform/${companyId}/${planId}`, formData).subscribe((data: any) => {
|
|
|
|
|
resolve(data)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//input key值,一个字符焦点消失问题
|
|
|
|
|
trackByFn(index) {
|
|
|
|
|
return index
|
|
|
|
|
}
|
|
|
|
|
//四种类型增加一行
|
|
|
|
|
addNumber = -1
|
|
|
|
|
addTd(key, i) {
|
|
|
|
|
this.addNumber++
|
|
|
|
|
if (this.planTemplateData[key].attribute[i].tableth == undefined||this.planTemplateData[key].attribute[i].tableth.length==0) {
|
|
|
|
|
//this.planTemplateData[key].attribute[i].tabletr = []
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
this.snackBar.open('请先编辑列!', '确定', config);
|
|
|
|
|
}else{
|
|
|
|
|
if(this.planTemplateData[key].attribute[i].tabletr == undefined){
|
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr = []
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr.push({ tabletd: [] })
|
|
|
|
|
for(var j = 0; j < this.planTemplateData[key].attribute[i].tableth.length; j++) {
|
|
|
|
|
if (this.planTemplateData[key].attribute[i].tabletr != undefined) {
|
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr[this.planTemplateData[key].attribute[i].tabletr.length - 1].tabletd.push('')
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr[this.addNumber].tabletd.push('')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
//四种类型删除一行
|
|
|
|
|
delTd(key, i,tri?:number,uniti?:number,elei?:number) {
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
let isTrue = confirm('您确定要删除该条信息吗')
|
|
|
|
|
if(isTrue){
|
|
|
|
|
if(tri==undefined){
|
|
|
|
|
this.planTemplateData[key].attribute.splice(i,1)
|
|
|
|
|
}else{
|
|
|
|
|
if(uniti==undefined&&elei==undefined){
|
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr.splice(tri,1)
|
|
|
|
|
}else{
|
|
|
|
|
this.planTemplateData[key].building[i].body[tri].attinf[uniti].tabletr.splice(elei,1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//修改多行文本,表格行列数量
|
|
|
|
|
updataHl(...num:number[]){
|
|
|
|
|
const dialogRef = this.dialog.open(updataHl, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '340px',
|
|
|
|
|
height:'350px',
|
|
|
|
|
disableClose:true,
|
|
|
|
|
data:JSON.parse(JSON.stringify(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]))
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
if(result!=undefined){
|
|
|
|
|
|
|
|
|
|
//外层四种类型编辑行跟列
|
|
|
|
|
if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).level==1){
|
|
|
|
|
//表格类型编辑列数
|
|
|
|
|
if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tabletr==undefined){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tabletr = []
|
|
|
|
|
}
|
|
|
|
|
if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.length<result.lieNumber){
|
|
|
|
|
//表格类型新增列数
|
|
|
|
|
for(let i=(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.length;i<result.lieNumber;i++){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.push('')
|
|
|
|
|
if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tabletr!=undefined){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tabletr.forEach(element => {
|
|
|
|
|
element.tabletd.push('')
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//表格类型减少列数
|
|
|
|
|
for(let i=(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.length;i>result.lieNumber;i--){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.splice(i-1,1)
|
|
|
|
|
if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tabletr!=undefined){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tabletr.forEach((element) => {
|
|
|
|
|
element.tabletd.splice(element.tabletd.length-1,1)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).level==2){
|
|
|
|
|
//多行文本编辑行列
|
|
|
|
|
if((num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.length<result.hNumber){
|
|
|
|
|
for(let i=(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.length;i<result.hNumber;i++){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.push([{body: '', head: ''}])
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(let i=(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.length;i>result.hNumber;i--){
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.splice(i-1,1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(num.length<3? this.planTemplateData[num[0]].attribute[num[1]]:this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]]).tableth.forEach((element,index,value) => {
|
|
|
|
|
if(value[index].length<result.lieNumber){
|
|
|
|
|
for(let a=value[index].length;a<result.lieNumber;a++){
|
|
|
|
|
value[index].push({body: '', head: ''})
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(let a=value[index].length;a>result.lieNumber;a--){
|
|
|
|
|
value[index].splice(index-1,1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//新建内容向上排序
|
|
|
|
|
upPai(zi,attributei){
|
|
|
|
|
var temp
|
|
|
|
|
if(attributei!=0){
|
|
|
|
|
for (let index = attributei-1; index >=0; index--) {
|
|
|
|
|
temp=this.planTemplateData[zi].attribute[index]
|
|
|
|
|
this.planTemplateData[zi].attribute[index]=this.planTemplateData[zi].attribute[attributei]
|
|
|
|
|
this.planTemplateData[zi].attribute[attributei]=temp
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//新建内容向下排序
|
|
|
|
|
downPai(zi,attributei){
|
|
|
|
|
var temp
|
|
|
|
|
if (attributei!=this.planTemplateData[zi].attribute.length-1) {
|
|
|
|
|
for (let index = attributei+1; index < this.planTemplateData[zi].attribute.length; index++) {
|
|
|
|
|
temp=this.planTemplateData[zi].attribute[index]
|
|
|
|
|
this.planTemplateData[zi].attribute[index]=this.planTemplateData[zi].attribute[attributei]
|
|
|
|
|
this.planTemplateData[zi].attribute[attributei]=temp
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//单位概况左侧建筑点击事件
|
|
|
|
|
buildingName
|
|
|
|
|
clicki = 0
|
|
|
|
|
group
|
|
|
|
|
clickBuilding(item, i) {
|
|
|
|
|
this.buildingName = item.name
|
|
|
|
|
this.clicki = i
|
|
|
|
|
// console.log(item, this.clicki)
|
|
|
|
|
}
|
|
|
|
|
//单位概况增加一行
|
|
|
|
|
unitadd(surveyName, attacki, i,fileNum?:number) {
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
this.addNumber++
|
|
|
|
|
this.planTemplateData[index].building[attacki].body.forEach((value,bodyi,arr)=>{
|
|
|
|
|
if(surveyName==arr[bodyi].surveyName){
|
|
|
|
|
console.log(bodyi)
|
|
|
|
|
if(arr[bodyi].zdy==undefined){
|
|
|
|
|
if (surveyName == '进攻通道') {
|
|
|
|
|
if (this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr == undefined) {
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr = []
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr.push({ tabletd: [] })
|
|
|
|
|
for (var j = 0; j < this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tableth.length; j++) {
|
|
|
|
|
if (this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr != undefined) {
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr[this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.length - 1].tabletd.push('')
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr[this.addNumber].tabletd.push('')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
else if (surveyName == '功能分区') {
|
|
|
|
|
// console.log(attacki)
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ name: '', value: '' })
|
|
|
|
|
} else if (surveyName == '重点部位') {
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ heafName: '', body: [{ name: '重点部位名称', value: '' }, { name: '重点部位所在位置', value: '' }, { name: '建筑结构', value: '' }, { name: '使用性质', value: '' }, { name: '主要危险性', value: '' }] })
|
|
|
|
|
}
|
|
|
|
|
else if(surveyName == '单位基本信息'||surveyName == '建筑信息'){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ propertyName: '', value: '',completed:true,zdy:true })
|
|
|
|
|
} else if(surveyName == '四周毗邻'){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ name: '', value: '',completed:true,zdy:false })
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ name: '', value: '',completed:true,zdy:true })
|
|
|
|
|
}else if(surveyName == '消防设施'){
|
|
|
|
|
if(fileNum==0){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].facilityItems.push({ name: '', value: '',completed:true,zdy:true})
|
|
|
|
|
}else{
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.push({ propertyName: '', value: '',completed:true,zdy:true,facilityItems:[] })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.addAttribute(surveyName,attacki,i,1,surveyName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
//单位概况自定义表格新增一行
|
|
|
|
|
unitNewadd(...num:number[]){
|
|
|
|
|
console.log(num)
|
|
|
|
|
if (this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tableth == undefined||this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tableth.length==0) {
|
|
|
|
|
//this.planTemplateData[key].attribute[i].tabletr = []
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
this.snackBar.open('请先编辑列!', '确定', config);
|
|
|
|
|
}else{
|
|
|
|
|
if(this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr == undefined){
|
|
|
|
|
this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr = []
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr.push({ tabletd: [] })
|
|
|
|
|
for(var j = 0; j < this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tableth.length; j++) {
|
|
|
|
|
if (this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr != undefined) {
|
|
|
|
|
this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr[this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr.length - 1].tabletd.push('')
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].tabletr[this.addNumber].tabletd.push('')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//this.planTemplateData[num[0]].building[num[1]].body[num[2]].attinf[num[3]].push()
|
|
|
|
|
}
|
|
|
|
|
//单位概况删除一行
|
|
|
|
|
unitDel(surveyName, attacki, i,fileNum?:number) {
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
let isTrue = confirm('您确定要删除该条信息吗')
|
|
|
|
|
this.planTemplateData[index].building[attacki].body.forEach((value,bodyi,arr) => {
|
|
|
|
|
if(surveyName==arr[bodyi].surveyName){
|
|
|
|
|
if (surveyName == '进攻通道') {
|
|
|
|
|
if (isTrue) {
|
|
|
|
|
if (this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr != undefined) {
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr.splice(this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.length - 1, 1)
|
|
|
|
|
this.addNumber--
|
|
|
|
|
if (this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].tabletr.length == 0) {
|
|
|
|
|
this.addNumber = -1
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.snackBar.open('请先增加一行!', '确定', config);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (surveyName == '功能分区'||surveyName=='重点部位'||surveyName=='单位基本信息'||surveyName=='建筑信息'||surveyName=='消防设施') {
|
|
|
|
|
if (isTrue) {
|
|
|
|
|
if(surveyName=='消防设施'&&fileNum!=undefined){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf[i].facilityItems.splice(fileNum,1)
|
|
|
|
|
}else{
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.splice(i, 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else if(surveyName == '四周毗邻'){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.splice(i, 1)
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bodyi].attinf.splice(i-1, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//分段上传
|
|
|
|
|
sectionUpload(companyId: string, planId: string, file) {
|
|
|
|
|
let data = { filename: file.name }
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
this.http.post(`/api/NewMultipartUpload/PlanPlatform/${companyId}/${planId}`, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传
|
|
|
|
|
let objectName = data.objectName
|
|
|
|
|
let uploadId = data.uploadId
|
|
|
|
|
let PartNumberETag = []; //每次返回需要保存的信息
|
|
|
|
|
//分块 处理
|
|
|
|
|
let fileSize = file.size || null //上传文件的总大小
|
|
|
|
|
let shardSize = 5 * 1024 * 1024 //5MB一个分片
|
|
|
|
|
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < allSlice; i++) { //循环分段上传
|
|
|
|
|
let start = i * shardSize //切割文件开始位置
|
|
|
|
|
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
|
|
|
|
|
let formData = new FormData()
|
|
|
|
|
formData.append("file", file.slice(start, end))
|
|
|
|
|
|
|
|
|
|
//同步写法实现异步调用
|
|
|
|
|
let result = await new Promise((resolve, reject) => {
|
|
|
|
|
// await 需要后面返回一个 promise 对象
|
|
|
|
|
this.http.post(`/api/MultipartUpload/PlanPlatform/${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => {
|
|
|
|
|
let msg = { "partNumber": data.partNumber || null, "eTag": data.eTag || null }
|
|
|
|
|
resolve(msg) // 调用 promise 内置方法处理成功
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
PartNumberETag.push(result)
|
|
|
|
|
|
|
|
|
|
if (PartNumberETag.length === allSlice) { //分块上传完成
|
|
|
|
|
let data = PartNumberETag
|
|
|
|
|
let paramsData = { uploadId: uploadId }
|
|
|
|
|
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${objectName}`, data, { params: paramsData }).subscribe(data => {
|
|
|
|
|
resolve(objectName)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}//for循环
|
|
|
|
|
|
|
|
|
|
//分块 处理
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//预览
|
|
|
|
|
pattern: string = 'edit'
|
|
|
|
|
preview() {
|
|
|
|
|
this.pattern = 'look'
|
|
|
|
|
this.clickTitleItem('单位概况')
|
|
|
|
|
}
|
|
|
|
|
quitPreview() {
|
|
|
|
|
this.pattern = 'edit'
|
|
|
|
|
}
|
|
|
|
|
//提交
|
|
|
|
|
async submit() {
|
|
|
|
|
await this.yinRu(0)
|
|
|
|
|
//console.log('提交信息', this.planTemplateData)
|
|
|
|
|
let body = {
|
|
|
|
|
webTextData: JSON.stringify(this.planTemplateData),
|
|
|
|
|
webTextStatistics: this.yinJson
|
|
|
|
|
}
|
|
|
|
|
this.http.put(`/api/PlanComponents/${this.route.snapshot.queryParams.planId}`, body).subscribe(data => {
|
|
|
|
|
// console.log('提交成功',data)
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
this.snackBar.open('提交成功', '确定', config);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//返回顶部
|
|
|
|
|
goBack() {
|
|
|
|
|
document.querySelector('#mainbox').scrollIntoView(true)
|
|
|
|
|
}
|
|
|
|
|
//生成word
|
|
|
|
|
generatingDoc() {
|
|
|
|
|
/* changeImgToDataurl()
|
|
|
|
|
function changeImgToDataurl() {
|
|
|
|
|
let charImg = document.getElementsByTagName("img");
|
|
|
|
|
console.log(charImg)
|
|
|
|
|
let imgURLs = "";
|
|
|
|
|
for (let i = 0; i < charImg.length; i++) {
|
|
|
|
|
let imgURL = charImg[i].currentSrc;
|
|
|
|
|
getBase64(imgURL, charImg[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function getBase64(url, charImg) {
|
|
|
|
|
let Img = new Image();
|
|
|
|
|
Img.crossOrigin = "Anonymous";//跨域必须使用,且后台也得设置允许跨域
|
|
|
|
|
let dataURL = '';
|
|
|
|
|
Img.src = url;
|
|
|
|
|
Img.onload = function () { //要先确保图片完整获取到,这是个异步事件
|
|
|
|
|
let canvas = document.createElement("canvas"), //创建canvas元素
|
|
|
|
|
width = Img.width, //确保canvas的尺寸和图片一样
|
|
|
|
|
height = Img.height;
|
|
|
|
|
canvas.width = width;
|
|
|
|
|
canvas.height = height;
|
|
|
|
|
canvas.getContext("2d").drawImage(Img, 0, 0, width, height); //将图片绘制到canvas中
|
|
|
|
|
dataURL = canvas.toDataURL('image/jpg'); //转换图片为dataURL
|
|
|
|
|
condataurl ? condataurl(dataURL, charImg) : null; //调用回调函数
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function condataurl(dataURL, charImg) {
|
|
|
|
|
charImg.src = dataURL;
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
$(".mainbox").wordExport('word文档');
|
|
|
|
|
}
|
|
|
|
|
//原数据点击
|
|
|
|
|
oldData = false
|
|
|
|
|
clickoldData() {
|
|
|
|
|
this.oldData = !this.oldData
|
|
|
|
|
}
|
|
|
|
|
//新增功能(社会联动等引用)
|
|
|
|
|
searchType = '0'
|
|
|
|
|
//打开自定义新增具体内容
|
|
|
|
|
tuTrue=false
|
|
|
|
|
addAttribute(groupName,attacki?:any, bi?:any,fileNum?:any,surveyName?:string){
|
|
|
|
|
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
|
|
|
|
|
const dialogRef = this.dialog.open(disaster, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '340px',
|
|
|
|
|
height:'450px',
|
|
|
|
|
disableClose:true,
|
|
|
|
|
data:this.planTemplateData
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
if(result!=undefined){
|
|
|
|
|
if(surveyName==undefined){
|
|
|
|
|
this.planTemplateData.forEach((value,index,array)=>{
|
|
|
|
|
if(array[index].groupName==groupName){
|
|
|
|
|
if(array[index].attribute==undefined){
|
|
|
|
|
array[index].attribute=[]
|
|
|
|
|
array[index].attribute.push(result)
|
|
|
|
|
}else{
|
|
|
|
|
array[index].attribute.push(result)
|
|
|
|
|
}
|
|
|
|
|
if(result.level==2){
|
|
|
|
|
for(let i=0;i<result.hNumber;i++){
|
|
|
|
|
array[index].attribute[array[index].attribute.length-1].tableth.push([{head:'',body:''}])
|
|
|
|
|
for(var j=0;j<result.lieNumber-1;j++){
|
|
|
|
|
array[index].attribute[array[index].attribute.length-1].tableth[i].push({head:'',body:''})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bi].attinf.push(result)
|
|
|
|
|
if(result.level==2){
|
|
|
|
|
for(var i=0;i<result.hNumber;i++){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bi].attinf[this.planTemplateData[index].building[attacki].body[bi].attinf.length-1].tableth.push([{head:'',body:''}])
|
|
|
|
|
for(var j=0;j<result.lieNumber-1;j++){
|
|
|
|
|
this.planTemplateData[index].building[attacki].body[bi].attinf[this.planTemplateData[index].building[attacki].body[bi].attinf.length-1].tableth[i].push({head:'',body:''})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(result.level=='4'){
|
|
|
|
|
this.tuTrue=true
|
|
|
|
|
this.getAllBuildings()
|
|
|
|
|
this.getSitePlan()
|
|
|
|
|
this.getRealPicture()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//自定义内容删除一条数据
|
|
|
|
|
delDisaster(name,i){
|
|
|
|
|
let isTrue = confirm('您确定要删除该条信息吗')
|
|
|
|
|
if(isTrue){
|
|
|
|
|
this.planTemplateData.forEach((value,index,array)=>{
|
|
|
|
|
if (array[index].groupName==name) {
|
|
|
|
|
this.planTemplateData[index].attribute.splice(i,1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//自定义添加表格数据
|
|
|
|
|
attackAdd(name,i,level){
|
|
|
|
|
//console.log(name,i)
|
|
|
|
|
this.planTemplateData.forEach((value,index,array)=>{
|
|
|
|
|
if (array[index].groupName==name) {
|
|
|
|
|
if(level==1){
|
|
|
|
|
this.planTemplateData[index].attribute[i].tableth.push('')
|
|
|
|
|
}else if(level==2){
|
|
|
|
|
this.planTemplateData[index].attribute[i].tableth.push({head:'',body:''})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//console.log(this.newleftTabledata)
|
|
|
|
|
}
|
|
|
|
|
//自定义模块删除一张图片
|
|
|
|
|
delImg(key,attributei,imgkey){
|
|
|
|
|
let isDelete = window.confirm('确定要删除该分组吗?分组下内容将一同被删除!')
|
|
|
|
|
if (isDelete) {
|
|
|
|
|
this.planTemplateData[key].attribute[attributei].tableth.json.splice(imgkey,1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//鼠标移入图片显示
|
|
|
|
|
showTu(key){
|
|
|
|
|
this.planTemplateData[key].new=true
|
|
|
|
|
}
|
|
|
|
|
//上传
|
|
|
|
|
upload() {
|
|
|
|
|
let isTrue = confirm('上传新文件后可能会覆盖原有数据,您确定要继续上传吗')
|
|
|
|
|
if(isTrue){
|
|
|
|
|
document.getElementById('up').click()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//在线文档上传接口
|
|
|
|
|
fileData
|
|
|
|
|
iftrue=false
|
|
|
|
|
fileSc(e){
|
|
|
|
|
this.iftrue=true
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
let formData = new FormData()
|
|
|
|
|
formData.append("file", e.target.files[0])
|
|
|
|
|
let type=this.unitData.buildingTypes[0].name=='高层建筑'?1:this.unitData.buildingTypes[0].name=='居民小区'?2:this.unitData.buildingTypes[0].name=='厂房'?3
|
|
|
|
|
:(this.unitData.buildingTypes[0].name=='商市场'||this.unitData.buildingTypes[0].name=='医院'||this.unitData.buildingTypes[0].name=='学校'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='宾馆'||this.unitData.buildingTypes[0].name=='娱乐场所'||this.unitData.buildingTypes[0].name=='餐饮业'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='影剧院'||this.unitData.buildingTypes[0].name=='展览建筑'||this.unitData.buildingTypes[0].name=='养老院'
|
|
|
|
|
||this.unitData.buildingTypes[0].name=='会议中心')?4:5
|
|
|
|
|
let fileData={
|
|
|
|
|
type:this.unitData.buildingTypes[0].name=='高层建筑'?1:2,
|
|
|
|
|
file:formData
|
|
|
|
|
}
|
|
|
|
|
this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=${type}`,formData).subscribe((data:any)=>{
|
|
|
|
|
console.log(data)
|
|
|
|
|
if(data==null){
|
|
|
|
|
this.snackBar.open('解析失败,请确定好格式再重新上传!', '确定', config);
|
|
|
|
|
}else{
|
|
|
|
|
this.fileData=JSON.parse(JSON.stringify(data))
|
|
|
|
|
this.fileData.forEach((value,index,array) => {
|
|
|
|
|
if(value.groupName=='交通水源'||value.groupName=='重点图示'){
|
|
|
|
|
value.attribute.forEach(element => {
|
|
|
|
|
element.imgArr[0]=element.imgArr[0].slice(25,element.imgArr[0].length)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.planTemplateData.forEach((pvalue,pindex,parr) => {
|
|
|
|
|
if(parr[1].building==undefined){
|
|
|
|
|
if(array[index].groupName==parr[pindex].groupName){
|
|
|
|
|
parr[pindex].attribute=array[index].attribute
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(array[index].groupName==parr[pindex].groupName&&pindex!=1){
|
|
|
|
|
parr[pindex].attribute=array[index].attribute
|
|
|
|
|
}else if(array[index].groupName==parr[pindex].groupName&&pindex==1){
|
|
|
|
|
parr[pindex].building[0].body=array[index].attribute
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
//console.log(this.fileData)
|
|
|
|
|
this.snackBar.open('解析成功!', '确定', config);
|
|
|
|
|
}
|
|
|
|
|
this.iftrue=false
|
|
|
|
|
e.target.value=''
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//消防设施新增一条数据
|
|
|
|
|
zdyXf(groupName){
|
|
|
|
|
const dialogRef = this.dialog.open(disaster, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '340px',
|
|
|
|
|
height:'450px',
|
|
|
|
|
disableClose:true,
|
|
|
|
|
data:this.planTemplateData
|
|
|
|
|
});
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
console.log(result)
|
|
|
|
|
if(result!=undefined){
|
|
|
|
|
this.planTemplateData.forEach((value,index,array)=>{
|
|
|
|
|
if(array[index].groupName==groupName){
|
|
|
|
|
if(array[index].attribute==undefined){
|
|
|
|
|
array[index].attribute=[]
|
|
|
|
|
array[index].attribute.push(result)
|
|
|
|
|
}else{
|
|
|
|
|
array[index].attribute.push(result)
|
|
|
|
|
}
|
|
|
|
|
if(result.level==2){
|
|
|
|
|
for(var i=0;i<result.hNumber;i++){
|
|
|
|
|
array[index].attribute[array[index].attribute.length-1].tableth.push([{head:'',body:''}])
|
|
|
|
|
for(var j=0;j<result.lieNumber-1;j++){
|
|
|
|
|
array[index].attribute[array[index].attribute.length-1].tableth[i].push({head:'',body:''})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if(result.level=='4'){
|
|
|
|
|
this.tuTrue=true
|
|
|
|
|
this.getAllBuildings()
|
|
|
|
|
this.getSitePlan()
|
|
|
|
|
this.getRealPicture()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(this.planTemplateData)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查看预案
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'lookPlan-dialog',
|
|
|
|
|
templateUrl: './openPlanTool.html',
|
|
|
|
|
styleUrls: ['./openPlanTool.scss']
|
|
|
|
|
})
|
|
|
|
|
export class OpenPlanToolDialog {
|
|
|
|
|
|
|
|
|
|
constructor(public http: HttpClient, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<OpenPlanToolDialog>,
|
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data, private render2: Renderer2, public dialog: MatDialog, private route: ActivatedRoute) { }
|
|
|
|
|
|
|
|
|
|
@ViewChild('plan') plan: any //子组件
|
|
|
|
|
|
|
|
|
|
type: any//打开的类型 是平面图还是水源
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.type = this.data.type
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngAfterViewInit(): void {
|
|
|
|
|
if (this.type != '水源' && this.type != '预案') {
|
|
|
|
|
this.noticePlan()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通知 子组件 传递参数
|
|
|
|
|
noticePlan() {
|
|
|
|
|
this.plan.isEditPattern = false
|
|
|
|
|
let parameter = { //查询 节点 对应 建筑/楼层 index,id
|
|
|
|
|
buildingIndex: this.data.key, //总平面图/建筑 index
|
|
|
|
|
storeyId: this.data.select.id
|
|
|
|
|
}
|
|
|
|
|
this.http.get("/api/Buildings", { params: { companyId: this.route.snapshot.queryParams.companyId } }).subscribe((data: any) => {
|
|
|
|
|
this.plan.allBuildings = data
|
|
|
|
|
this.plan.isGis = this.data.select.isGis
|
|
|
|
|
this.plan.seekPanelPoint(parameter)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//关闭弹窗
|
|
|
|
|
closeDiv() {
|
|
|
|
|
this.dialogRef.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//查看引用
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'yinYong',
|
|
|
|
|
templateUrl: './yinyong.html',
|
|
|
|
|
styleUrls: ['./create-plan-online-five.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class yinYong {
|
|
|
|
|
constructor(public http: HttpClient, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<yinYong>,
|
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data, public dialog: MatDialog) { }
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.selectedItem = this.data.selectedItem
|
|
|
|
|
this.planTemplateData = JSON.parse(this.data.yinruData)
|
|
|
|
|
this.yinData()
|
|
|
|
|
// console.log(this.planTemplateData)
|
|
|
|
|
}
|
|
|
|
|
selectedItem//传来的组织指挥或者。。。
|
|
|
|
|
planTemplateData//传来的数据
|
|
|
|
|
selectData
|
|
|
|
|
xuanze: boolean
|
|
|
|
|
//imgUrl
|
|
|
|
|
//看看查的是哪个标题下的内容
|
|
|
|
|
yinData() {
|
|
|
|
|
this.planTemplateData.forEach((pvale, pi, parr) => {
|
|
|
|
|
if (pvale.groupName == this.selectedItem) {
|
|
|
|
|
this.selectData = pvale.attribute
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
trackByFn(index) {
|
|
|
|
|
return index
|
|
|
|
|
}
|
|
|
|
|
//关闭弹窗
|
|
|
|
|
closeDiv() {
|
|
|
|
|
let isTrue = confirm('您确定要引用该条预案吗')
|
|
|
|
|
if (isTrue) {
|
|
|
|
|
this.xuanze = true
|
|
|
|
|
this.dialogRef.close(this.selectData)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.xuanze = false
|
|
|
|
|
this.dialogRef.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新建模板
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'newTitle',
|
|
|
|
|
templateUrl: './newTitle.html',
|
|
|
|
|
styleUrls: ['./create-plan-online-five.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class newTitle{
|
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<newTitle>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
|
|
|
|
|
ngOnInit(){
|
|
|
|
|
console.log(this.data)
|
|
|
|
|
if(this.data.planName!=undefined){
|
|
|
|
|
this.planname=this.data.planName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
planname//预案名称
|
|
|
|
|
//取消按钮
|
|
|
|
|
close(){
|
|
|
|
|
this.dialogRef.close();
|
|
|
|
|
}
|
|
|
|
|
//确定按钮
|
|
|
|
|
planName(){
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
if(this.planname==''||this.planname==undefined){
|
|
|
|
|
this.snackBar.open('请输入名称', '确定', config);
|
|
|
|
|
}else{
|
|
|
|
|
this.data.planTemplateData.forEach(element => {
|
|
|
|
|
if(element.groupName==this.planname){
|
|
|
|
|
this.snackBar.open('您输入的名称重复', '确定', config);
|
|
|
|
|
this.planname=undefined
|
|
|
|
|
this.dialogRef.close();
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.dialogRef.close(this.planname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//新建模块新增具体内容
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'disaster',
|
|
|
|
|
templateUrl: './Disaster.html',
|
|
|
|
|
styleUrls: ['./addKeyname.scss']
|
|
|
|
|
})
|
|
|
|
|
export class disaster{
|
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<disaster>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
|
|
|
|
|
ngOnInit(): void{
|
|
|
|
|
//console.log(this.data)
|
|
|
|
|
}
|
|
|
|
|
level//类型
|
|
|
|
|
headName//表头名称
|
|
|
|
|
lieNumber//列数
|
|
|
|
|
hNumber//行数
|
|
|
|
|
//取消按钮
|
|
|
|
|
close(){
|
|
|
|
|
this.dialogRef.close();
|
|
|
|
|
}
|
|
|
|
|
//确定按钮
|
|
|
|
|
newdisaster(){
|
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
|
config.duration = 3000
|
|
|
|
|
if(this.level==undefined||this.level==''){
|
|
|
|
|
this.snackBar.open('请选择类型!','确定',config);
|
|
|
|
|
}else if(this.headName==undefined||this.headName==''){
|
|
|
|
|
this.snackBar.open('请输入表头名称!','确定',config);
|
|
|
|
|
}else{
|
|
|
|
|
let tree={
|
|
|
|
|
json:[],
|
|
|
|
|
name: ''
|
|
|
|
|
}
|
|
|
|
|
let attrubute={
|
|
|
|
|
headName:this.headName,
|
|
|
|
|
level:this.level,
|
|
|
|
|
tableth:this.level==1||this.level==2?[]:this.level==3?'':tree,
|
|
|
|
|
lieNumber:this.lieNumber,
|
|
|
|
|
hNumber:this.hNumber,
|
|
|
|
|
imgArr: [],
|
|
|
|
|
zdy:true
|
|
|
|
|
}
|
|
|
|
|
this.dialogRef.close(attrubute);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//修改表格,都行文本行列
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'updataHl',
|
|
|
|
|
templateUrl: './updatal.html',
|
|
|
|
|
styleUrls: ['./addKeyname.scss']
|
|
|
|
|
})
|
|
|
|
|
export class updataHl{
|
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<updataHl>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
|
|
|
|
|
ngOnInit(): void{
|
|
|
|
|
JSON.parse(JSON.stringify(this.data))
|
|
|
|
|
this.level=Number(this.data.level)
|
|
|
|
|
console.log(this.data)
|
|
|
|
|
}
|
|
|
|
|
level//类型
|
|
|
|
|
headName=this.data.headName//表头名称
|
|
|
|
|
lieNumber=this.data.zdy!=undefined?0:this.data.lieNumber//最小列数
|
|
|
|
|
hNumber=this.data.zdy!=undefined?0:this.data.hNumber//行数
|
|
|
|
|
//取消按钮
|
|
|
|
|
close(){
|
|
|
|
|
this.dialogRef.close();
|
|
|
|
|
}
|
|
|
|
|
//确定按钮
|
|
|
|
|
newdisaster(){
|
|
|
|
|
console.log(this.data)
|
|
|
|
|
let result={
|
|
|
|
|
lieNumber:this.level==2? this.data.tableth[0].length:this.data.tableth.length,
|
|
|
|
|
hNumber:this.data.tableth.length
|
|
|
|
|
}
|
|
|
|
|
this.dialogRef.close(result);
|
|
|
|
|
}
|
|
|
|
|
}
|