|
|
|
@ -5,21 +5,12 @@ import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http';
|
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { FormControl } from '@angular/forms'; |
|
|
|
|
import { MatSnackBar ,MatSnackBarConfig} from '@angular/material/snack-bar'; |
|
|
|
|
import format from 'date-fns/format'; |
|
|
|
|
import { TreeService } from '../../http-interceptors/tree.service' |
|
|
|
|
import { FileUploader, FileItem } from 'ng2-file-upload' |
|
|
|
|
// import { House } from '../../interface'
|
|
|
|
|
import { AddHouseInfo } from './addhouseinfo.component' |
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser' |
|
|
|
|
import { Injectable } from "@angular/core" |
|
|
|
|
import { filter } from 'rxjs/operators'; |
|
|
|
|
import { async } from '@angular/core/testing'; |
|
|
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
|
|
import { isNgTemplate } from '@angular/compiler'; |
|
|
|
|
import * as _ from 'lodash'; |
|
|
|
|
// import Swiper from 'swiper';
|
|
|
|
|
import { LookMaster } from './lookmaster.component' |
|
|
|
|
import { Router,ActivatedRoute } from '@angular/router' |
|
|
|
|
import { ActivatedRoute } from '@angular/router' |
|
|
|
|
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; |
|
|
|
|
declare var AMap: any; |
|
|
|
|
|
|
|
|
@ -48,16 +39,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uploader:FileUploader = new FileUploader({ //初始化上传事件 ng2-upload
|
|
|
|
|
url: `/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,
|
|
|
|
|
method: "POST",
|
|
|
|
|
itemAlias: "uploadedfile", |
|
|
|
|
autoUpload: false, |
|
|
|
|
removeAfterUpload:true //上传之后是否在队列中移除,如果不移除就会出现无法上传第二次的情况
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private _transformer = (node, level: number) => { //初始化tree
|
|
|
|
@ -79,22 +60,22 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
isorganizationbox = false//控制辖区中队框的显示隐藏
|
|
|
|
|
selectedorganization: any//所选的辖区中队
|
|
|
|
|
selectedorganizationid:any //所选的辖区中队的id
|
|
|
|
|
|
|
|
|
|
highhouse = false//控制高层表单的显示
|
|
|
|
|
houses: any = [] //存储当前单位的建筑信息
|
|
|
|
|
|
|
|
|
|
defaultbuildingTypes :any //存储当前建筑的默认类型的id
|
|
|
|
|
buildingTypesname:any//存储当前建筑的默认类型name
|
|
|
|
|
buildingCustomData:any //存储当前建筑的自定义信息
|
|
|
|
|
allunittype: any //所有单位类型
|
|
|
|
|
allorganizing:any = [] //所有组织机构
|
|
|
|
|
constructor(private elementRef: ElementRef,public renderer2: Renderer2,private tabbarService: TabbarAndScoreService,private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private elementRef: ElementRef,public renderer2: Renderer2,private tabbarService: TabbarAndScoreService,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unitId : any //当前单位id
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getallunittype() |
|
|
|
|
this.getorganization() |
|
|
|
|
// this.getunitinfo()
|
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
this.getallunittype()//获得所有单位类型
|
|
|
|
|
this.getorganization()//获得所有组织机构 + 获得当前单位的基本信息
|
|
|
|
|
this.getunitallbuilding()//获得当前单位所有建筑
|
|
|
|
|
this.unitId = this.route.snapshot.queryParams.id |
|
|
|
|
sessionStorage.setItem("companyId",this.route.snapshot.queryParams.id); |
|
|
|
|
} |
|
|
|
@ -107,7 +88,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
isGisTopBoxTwo:boolean = false//点击位置按钮
|
|
|
|
|
oldPositionMarker:any //旧位置marker实例
|
|
|
|
|
newPositionMarker:any //新位置marker实例
|
|
|
|
|
|
|
|
|
|
newPositionMarkerContent:any =
|
|
|
|
|
'<div class="custom-content-marker">' + |
|
|
|
|
' <img src="/assets/images/newposition.png">' + |
|
|
|
@ -179,13 +159,9 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.map.setCity('上海市'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
markerPosition2 |
|
|
|
|
//点击位置按钮
|
|
|
|
|
setPosition(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.isGisTopBox = false |
|
|
|
|
this.isGisTopBoxTwo = true |
|
|
|
|
if(this.isMapLabel){//如果已经标注单位坐标
|
|
|
|
@ -304,12 +280,14 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得所有单位类型
|
|
|
|
|
allunittype: any //所有单位类型
|
|
|
|
|
getallunittype() { |
|
|
|
|
this.http.get("/api/BuildingTypes/Simple").subscribe(data => { |
|
|
|
|
this.allunittype = data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//获得所有组织机构
|
|
|
|
|
allorganizing:any = [] //所有组织机构
|
|
|
|
|
getorganization() { |
|
|
|
|
this.http.get('/api/Organizations').subscribe( |
|
|
|
|
(data: any) => { |
|
|
|
@ -323,15 +301,12 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}else{//未标注
|
|
|
|
|
_this.isMapLabel = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.labelGis() |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
//获得当前单位的基本信息
|
|
|
|
|
CompanyId
|
|
|
|
|
async getunitinfo(){ |
|
|
|
|
let result = await new Promise((resolve, reject) => { |
|
|
|
|
this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ |
|
|
|
@ -367,8 +342,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
this.selectedorganization = str.substr(1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.unitinfo = data |
|
|
|
|
resolve(this.unitinfo) |
|
|
|
|
this.selectedorganizationid = data.organizationId |
|
|
|
@ -383,6 +357,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//石油化工 装置信息 勾选框
|
|
|
|
|
checkboxchange(item,e){ |
|
|
|
|
if(item.buildingBasicGroups){ |
|
|
|
@ -395,13 +370,13 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unitallbuilding:any = []//用于存储当前单位所有的建筑
|
|
|
|
|
buildinginfoId:any = []//用于存储当前单位所有具体建筑的id
|
|
|
|
|
presentbuildinfoId:any // 用于存储当前单位第一个建筑的id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bigfor:any//循环(储罐信息+罐区信息)大组
|
|
|
|
|
npdata:any = [] |
|
|
|
|
newnpdata:any //用于存储石油化工 储罐信息/罐区情况的 datasource
|
|
|
|
|
|
|
|
|
|
basicCategoryId:any //当前单位所有建筑中位于第一个的建筑id
|
|
|
|
|
|
|
|
|
|
deviceinfodata:any=[];//用于存储石油化工装置信息的数组
|
|
|
|
|
zhuangzhiinfodatasource:any = [] //用于存储石油化工装置信息表格的数据来源
|
|
|
|
|
newzhuangzhiinfodatasource:any= []//存储石油化工装置信息表格的 datasource形式
|
|
|
|
@ -575,7 +550,11 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
item.buildingCustomData.customProperties.pop() |
|
|
|
|
} |
|
|
|
|
//得到建筑信息数据并进行处理
|
|
|
|
|
allBuildings:any |
|
|
|
|
allBuildings:any //当前单位所有的建筑
|
|
|
|
|
houses: any = [] //存储当前单位的建筑信息
|
|
|
|
|
basicCategoryId:any //当前单位所有建筑中位于第一个的建筑类型id
|
|
|
|
|
presentbuildinfoId:any //用于存储当前单位第一个建筑的具体id
|
|
|
|
|
buildinginfoId:any = []//用于存储当前单位所有具体建筑的id
|
|
|
|
|
getunitallbuilding(){ |
|
|
|
|
this.houses = [] |
|
|
|
|
this.unitId = this.route.snapshot.queryParams.id |
|
|
|
@ -584,9 +563,9 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
companyId:this.unitId |
|
|
|
|
} |
|
|
|
|
}).subscribe(async (data:any)=>{ // 获得当前单位所有的建筑
|
|
|
|
|
console.log('所有建筑',data) |
|
|
|
|
this.allBuildings = data |
|
|
|
|
// console.log(data)
|
|
|
|
|
if(data.length != 0){ |
|
|
|
|
if(data.length != 0){//如果存在建筑
|
|
|
|
|
this.basicCategoryId = data[0].buildingTypes[0].id |
|
|
|
|
this.presentbuildinfoId = data[0].id // 用于存储当前单位第一个建筑的id
|
|
|
|
|
for (let i = 0, length = data.length; i < length; i++) {//循环所有建筑
|
|
|
|
@ -601,17 +580,19 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
buildingType:n.buildingTypes[0].id |
|
|
|
|
} |
|
|
|
|
}).subscribe((data)=>{ |
|
|
|
|
//获得当前建筑自定义信息并且添加到item自定义属性上
|
|
|
|
|
//获得当前建筑自定义信息并且添加到建筑属性对象中
|
|
|
|
|
let _data = data |
|
|
|
|
console.log('当前建筑信息'+index,data) |
|
|
|
|
this.http.get("/api/BuildingCustomData",{params:{ |
|
|
|
|
buildingId:n.id |
|
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
|
console.log('当前建筑自定义信息'+index,data) |
|
|
|
|
_data[0].buildingCustomData = data |
|
|
|
|
if(data && data.customProperties.length != 0){ |
|
|
|
|
_data[0].isCustomData = true |
|
|
|
|
}else{ |
|
|
|
|
_data[0].isCustomData = false |
|
|
|
|
_data[0].buildingCustomData ={ |
|
|
|
|
_data[0].buildingCustomData = { |
|
|
|
|
id: "", |
|
|
|
|
customProperties: [ |
|
|
|
|
{ |
|
|
|
@ -623,7 +604,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
//为每个建筑添加自定义属性
|
|
|
|
|
//为每个建筑添加建筑名称等自定义属性 用于显示使用
|
|
|
|
|
data[0].buildingtypeId = n.buildingTypes[0].id |
|
|
|
|
data[0].name = n.name |
|
|
|
|
data[0].username = n.name |
|
|
|
@ -714,7 +695,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.houses.push(result) // 并且把他添加到 tab 总体数组中
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// console.log(666,this.houses)
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -1052,7 +1032,8 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
hasChild = (_: number, node: any) => node.expandable; |
|
|
|
|
|
|
|
|
|
imgsrc = "../../../assets/images/upload.jpg" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
|
|
|
|
|
imgsrc = "" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
|
|
|
|
|
noImgSrc = '../../../assets/images/upload.jpg' |
|
|
|
|
// imgsrc = ""
|
|
|
|
|
imgUrl = ""//返回来的图片地址后缀
|
|
|
|
|
file: any; //上传的文件
|
|
|
|
@ -1102,7 +1083,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
let shardSize = 5 * 1024 * 1024 //5MB一个分片
|
|
|
|
|
|
|
|
|
|
if (file && fileSize <= shardSize) { //上传文件<=5MB时
|
|
|
|
|
// this.upload()
|
|
|
|
|
let formData = new FormData() |
|
|
|
|
formData.append("file",file) |
|
|
|
|
this.http.post(`/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ |
|
|
|
@ -1124,38 +1104,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//小于5MB不需要分块上传
|
|
|
|
|
upload(){ |
|
|
|
|
this.uploader.queue[0].upload();//开始上传
|
|
|
|
|
this.uploader.queue[0].onSuccess = (response, status, headers) => {
|
|
|
|
|
// 上传文件成功
|
|
|
|
|
if (status == 201) { |
|
|
|
|
// 上传文件后获取服务器返回的数据
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('上传成功','确定',config); |
|
|
|
|
this.isspinner = false |
|
|
|
|
let tempRes = JSON.parse(response); |
|
|
|
|
this.imgUrl = tempRes.objectName
|
|
|
|
|
this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` |
|
|
|
|
}else {
|
|
|
|
|
// 上传文件后获取服务器返回的数据错误
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
this.uploader.queue[0].onError = (response, status, headers) => {
|
|
|
|
|
if (status == 401) { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('上传失败','确定',config); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//开始分块上传
|
|
|
|
|
async subsectionUploading () { |
|
|
|
@ -1194,7 +1142,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.imgsrc = `/api/Objects/PlanPlatform/${this.objectName}?x-oss-process=image/resize,m_fill,h_170,w_299` |
|
|
|
|
this.isspinner = false |
|
|
|
|
this.PartNumberETag = [] |
|
|
|
|
this.uploader.clearQueue(); //清空input控件文件
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//删除具体建筑
|
|
|
|
|