|
|
|
@ -4,14 +4,21 @@
|
|
|
|
|
* @Author: sueRimn |
|
|
|
|
* @Date: 2021-06-16 13:56:54 |
|
|
|
|
* @LastEditors: sueRimn |
|
|
|
|
* @LastEditTime: 2021-07-30 14:56:55 |
|
|
|
|
* @LastEditTime: 2021-08-05 16:24:21 |
|
|
|
|
*/ |
|
|
|
|
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'; |
|
|
|
|
declare var $: any |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-create-plan-online-five', |
|
|
|
@ -20,8 +27,31 @@ declare var $: any
|
|
|
|
|
}) |
|
|
|
|
export class CreatePlanOnlineFiveComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private route: ActivatedRoute, public snackBar: MatSnackBar, public dialog: MatDialog) { } |
|
|
|
|
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[] = [10] //设置每页条数
|
|
|
|
|
PageNumber: any; //第几页
|
|
|
|
|
|
|
|
|
|
planLevel: string//预案级别
|
|
|
|
|
blockyl=true |
|
|
|
@ -34,29 +64,82 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
this.pattern='edit' |
|
|
|
|
} |
|
|
|
|
this.getUnitData() |
|
|
|
|
this.getOrganizations(); |
|
|
|
|
//this.getAllBuildings()
|
|
|
|
|
this.tree = { |
|
|
|
|
json: this.treedate, |
|
|
|
|
config: this.treeConfig |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
//树形结构数据
|
|
|
|
|
treedate = [ |
|
|
|
|
{ |
|
|
|
|
"guid": "bc4c7a02-5379-4046-92be-12c67af4295a", |
|
|
|
|
"displayName": "Elentrix", |
|
|
|
|
"children": [ |
|
|
|
|
/* "85d412c2-ebc1-4d56-96c9-7da433ac9bb2", |
|
|
|
|
"28aac445-83b1-464d-9695-a4157dab6eac" */ |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
] |
|
|
|
|
tree |
|
|
|
|
treeConfig = { |
|
|
|
|
nodeWidth: 90, |
|
|
|
|
nodeHeight: 60 |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
//获得所有组织机构
|
|
|
|
|
getOrganizations() { |
|
|
|
|
this.http.get('/api/Organizations').subscribe( |
|
|
|
|
(data: any) => { |
|
|
|
|
this.allorganizations = data |
|
|
|
|
this.treedata = this.tree.toTree(data); |
|
|
|
|
this.getpresentOrganization(); |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获得单位信息
|
|
|
|
|
unitData: any |
|
|
|
@ -68,7 +151,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
if (element.id == this.route.snapshot.queryParams.companyId) { |
|
|
|
|
this.unitData = element |
|
|
|
|
// console.log('单位列表信息', this.unitData)
|
|
|
|
|
console.log('单位列表信息', this.unitData) |
|
|
|
|
this.getTemplateData() |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -76,7 +159,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
selectedItem: string = '封面' |
|
|
|
|
clickTitleItem(item) { |
|
|
|
|
async clickTitleItem(item) { |
|
|
|
|
this.addNumber = -1 |
|
|
|
|
this.selectedItem = item.groupName |
|
|
|
|
if (this.selectedItem == '重点图示') { |
|
|
|
@ -84,7 +167,15 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
this.getSitePlan() |
|
|
|
|
this.getRealPicture() |
|
|
|
|
} else if (this.selectedItem == '单位概况') { |
|
|
|
|
this.getAllBuildings() |
|
|
|
|
await this.getAllBuildings() |
|
|
|
|
this.planTemplateData[1].building.forEach(element => { |
|
|
|
|
element.body[0].attinf[0].olddata = this.unitData.usci |
|
|
|
|
element.body[0].attinf[1].olddata = this.unitData.buildingTypes[0].name |
|
|
|
|
element.body[0].attinf[2].olddata = this.unitData.contacts |
|
|
|
|
element.body[0].attinf[3].olddata = this.unitData.phone |
|
|
|
|
element.body[0].attinf[4].olddata = this.unitData.organizationName |
|
|
|
|
element.body[0].attinf[5].olddata = this.unitData.address |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.planTemplateData[1].attribute[0].attinf[0].value=this.planTemplateData[1].attribute[0].attinf[0].olddata = this.unitData.usci |
|
|
|
|
this.planTemplateData[1].attribute[0].attinf[1].value=this.planTemplateData[1].attribute[0].attinf[1].olddata = this.unitData.buildingTypes[0].name |
|
|
|
@ -161,11 +252,11 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
//获得模板信息
|
|
|
|
|
getTemplateData() { |
|
|
|
|
this.http.get(`/api/PlanComponents/${this.route.snapshot.queryParams.planId}/WebText`).subscribe((data: any) => { |
|
|
|
|
// console.log('预案内容', data)
|
|
|
|
|
console.log('预案内容', data) |
|
|
|
|
this.planTemplateData = JSON.parse(data.webTextData).filter(item => |
|
|
|
|
item.completed == true |
|
|
|
|
) |
|
|
|
|
// console.log(this.planTemplateData)
|
|
|
|
|
//console.log(this.planTemplateData)
|
|
|
|
|
if (this.planTemplateData[0].groupName != '封面') { |
|
|
|
|
let obj = { |
|
|
|
|
completed: true, |
|
|
|
@ -193,6 +284,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
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) { |
|
|
|
@ -309,38 +403,42 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
unitId: any = this.route.snapshot.queryParams.companyId |
|
|
|
|
//获得所有的建筑物
|
|
|
|
|
allBuildings: any |
|
|
|
|
getAllBuildings() { |
|
|
|
|
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 |
|
|
|
|
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 |
|
|
|
|
if (this.planTemplateData[1].building == undefined) { |
|
|
|
|
this.planTemplateData[1].building = [] |
|
|
|
|
for (var i = 0; i < this.allBuildings.length; i++) { |
|
|
|
|
if (i == 0) { |
|
|
|
|
this.planTemplateData[1].building.push({ name: this.allBuildings[i].name, body: this.planTemplateData[1].attribute, completed: true }) |
|
|
|
|
} else { |
|
|
|
|
this.planTemplateData[1].building.push({ name: this.allBuildings[i].name, body: this.planTemplateData[1].attribute, completed: false }) |
|
|
|
|
this.allBuildings = data |
|
|
|
|
if (this.planTemplateData[1].building == undefined) { |
|
|
|
|
this.planTemplateData[1].building = [] |
|
|
|
|
for (var i = 0; i < this.allBuildings.length; i++) { |
|
|
|
|
if (i == 0) { |
|
|
|
|
this.planTemplateData[1].building.push({ name: this.allBuildings[i].name, body: this.planTemplateData[1].attribute, completed: true }) |
|
|
|
|
} else { |
|
|
|
|
this.planTemplateData[1].building.push({ name: this.allBuildings[i].name, body: this.planTemplateData[1].attribute, completed: false }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(this.planTemplateData) |
|
|
|
|
//this.buildingName=this.planTemplateData[1].building[0].name
|
|
|
|
|
this.group = this.planTemplateData[1].building |
|
|
|
|
//delete this.planTemplateData[0].attribute
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//console.log(this.planTemplateData)
|
|
|
|
|
//this.buildingName=this.planTemplateData[1].building[0].name
|
|
|
|
|
this.group = this.planTemplateData[1].building |
|
|
|
|
//delete this.planTemplateData[0].attribute
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//获取总平面图
|
|
|
|
|
sitePlanItems: any |
|
|
|
@ -599,7 +697,10 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
oldData=false |
|
|
|
|
clickoldData(){ |
|
|
|
|
this.oldData=!this.oldData |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//新增功能(社会联动等引用)
|
|
|
|
|
searchType='0' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|