+
+ 建筑名称:
+
+
+
+ *
+
+
+ 建筑类型:
+
+
+ {{n.name}}
+
+
+ *
+
+
+
-
-
-
-
-
- 建筑名称:
-
-
-
- *
-
-
- 建筑类型:
-
-
- {{n.name}}
-
-
- *
-
-
{{item.buildingBasicGroups[0].name}}
-
+
+
\ No newline at end of file
diff --git a/src/app/ui/basicinfo-look/basicinfo.component.ts b/src/app/ui/basicinfo-look/basicinfo.component.ts
index 5a2aa2a..26a4993 100644
--- a/src/app/ui/basicinfo-look/basicinfo.component.ts
+++ b/src/app/ui/basicinfo-look/basicinfo.component.ts
@@ -1,214 +1,236 @@
-import { Component, OnInit, Inject ,ViewChild} from '@angular/core';
-import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
-import { FlatTreeControl } from '@angular/cdk/tree';
-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 { Component, OnInit, Inject, ViewChild } from "@angular/core";
+import {
+ MatTreeFlatDataSource,
+ MatTreeFlattener,
+} from "@angular/material/tree";
+import { FlatTreeControl } from "@angular/cdk/tree";
+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 { 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 { 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 { LookMaster2 } from './lookmaster.component'
-import { Router,ActivatedRoute } from '@angular/router'
-import {CacheTokenService} from '../../http-interceptors/cache-token.service'
+import { LookMaster2 } from "./lookmaster.component";
+import { Router, ActivatedRoute } from "@angular/router";
+import { CacheTokenService } from "../../http-interceptors/cache-token.service";
@Component({
- selector: 'app-basicinfo-look',
- templateUrl: './basicinfo.component.html',
- styleUrls: ['./basicinfo.component.scss']
+ selector: "app-basicinfo-look",
+ templateUrl: "./basicinfo.component.html",
+ styleUrls: ["./basicinfo.component.scss"],
})
export class BasicinfoLookComponent implements OnInit {
- unitinfo:any={
- id: '',
- name: '', //单位信息名字
- usci: '', //单位信用代码
- contacts: '', //联系人
- phone: '', //联系电话
- address: '', //单位地址
- imageUrl: '', //图片地址
- location: '', //单位地理位置
- modifiedTime: '', //信息修改时间
- organizationId: '', //所属组织机构
- organizationName: '', //组织机构名称
+ unitinfo: any = {
+ id: "",
+ name: "", //单位信息名字
+ usci: "", //单位信用代码
+ contacts: "", //联系人
+ phone: "", //联系电话
+ address: "", //单位地址
+ imageUrl: "", //图片地址
+ location: "", //单位地理位置
+ modifiedTime: "", //信息修改时间
+ organizationId: "", //所属组织机构
+ organizationName: "", //组织机构名称
buildingTypes: [
{
- id:'',
- name:''
- }
- ]
- }
-
- uploader:FileUploader = new FileUploader({ //初始化上传事件 ng2-upload
- url: `/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,
- method: "POST",
+ id: "",
+ name: "",
+ },
+ ],
+ };
+
+ uploader: FileUploader = new FileUploader({
+ //初始化上传事件 ng2-upload
+ url: `/api/Objects/PlanPlatform/${sessionStorage.getItem("companyId")}`,
+ method: "POST",
itemAlias: "uploadedfile",
autoUpload: false,
- removeAfterUpload:true //上传之后是否在队列中移除,如果不移除就会出现无法上传第二次的情况
+ removeAfterUpload: true, //上传之后是否在队列中移除,如果不移除就会出现无法上传第二次的情况
});
-
-
-
- private _transformer = (node, level: number) => { //初始化tree
+ 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
+ children: node.children,
};
- }
- treeControl = new FlatTreeControl
(node => node.level, node => node.expandable);
- treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
+ };
+ treeControl = new FlatTreeControl(
+ (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();
- 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 router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar,public isLogin:CacheTokenService) { }
+ myControl = new FormControl();
+ 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 router: Router,
+ private route: ActivatedRoute,
+ private http: HttpClient,
+ private tree: TreeService,
+ private sanitizer: DomSanitizer,
+ public dialog: MatDialog,
+ public snackBar: MatSnackBar,
+ public isLogin: CacheTokenService
+ ) {}
- unitId = sessionStorage.getItem('companyId') //当前单位id
+ unitId = sessionStorage.getItem("companyId"); //当前单位id
ngOnInit(): void {
- let token = sessionStorage.getItem('token')
+ let token = sessionStorage.getItem("token");
if (token) {
- this.unitId = sessionStorage.getItem('companyId');
- this.getallunittype()
- this.getorganization()
- this.getunitallbuilding()
+ this.unitId = sessionStorage.getItem("companyId");
+ this.getallunittype();
+ this.getorganization();
+ this.getunitallbuilding();
} else {
- this.isLogin.login().then(res=>{
- this.unitId = sessionStorage.getItem('companyId');
- this.getallunittype()
- this.getorganization()
- this.getunitallbuilding()
- })
+ this.isLogin.login().then((res) => {
+ this.unitId = sessionStorage.getItem("companyId");
+ this.getallunittype();
+ this.getorganization();
+ this.getunitallbuilding();
+ });
}
-
}
//获得所有单位类型
getallunittype() {
- this.http.get("/api/BuildingTypes/Simple").subscribe(data => {
- this.allunittype = data
- })
+ this.http.get("/api/BuildingTypes/Simple").subscribe((data) => {
+ this.allunittype = data;
+ });
}
//获得所有组织机构
getorganization() {
- this.http.get('/api/Organizations').subscribe(
- (data: any) => {
- this.allorganizing = data;
- this.dataSource.data = this.tree.toTree(data);
- this.getunitinfo();
- }
- )
+ this.http.get("/api/Organizations").subscribe((data: any) => {
+ this.allorganizing = data;
+ this.dataSource.data = this.tree.toTree(data);
+ this.getunitinfo();
+ });
}
//获得当前单位的基本信息
- getunitinfo(){
- this.http.get(`/api/Companies/${sessionStorage.getItem('companyId')}`).subscribe((data:any)=>{
-
- // if(data.buildingTypes.length){
- // sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id)
- // }else{
- // sessionStorage.setItem('buildingTypeId',"")
- // }
- let node
- this.allorganizing.forEach(item => {
- if(item.id == data.organizationId){
- node = item
- }
- });
- if(node){
- if(!node.parentId){
- this.selectedorganization = node.name
- }else{
- let namearr = [node.name]
- let targetId = node.parentId; // 临时变量
- for(let i = 0; i < node.level ; i++){
- this.allorganizing.forEach(item => {
- if(item.id == targetId ){
- namearr.push(item.name)
- targetId = item.parentId; // 临时变量更新没有副作用
- }
+ getunitinfo() {
+ this.http
+ .get(`/api/Companies/${sessionStorage.getItem("companyId")}`)
+ .subscribe((data: any) => {
+ // if(data.buildingTypes.length){
+ // sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id)
+ // }else{
+ // sessionStorage.setItem('buildingTypeId',"")
+ // }
+ let node;
+ this.allorganizing.forEach((item) => {
+ if (item.id == data.organizationId) {
+ node = item;
+ }
+ });
+ if (node) {
+ if (!node.parentId) {
+ this.selectedorganization = node.name;
+ } else {
+ let namearr = [node.name];
+ let targetId = node.parentId; // 临时变量
+ for (let i = 0; i < node.level; i++) {
+ this.allorganizing.forEach((item) => {
+ if (item.id == targetId) {
+ namearr.push(item.name);
+ targetId = item.parentId; // 临时变量更新没有副作用
+ }
+ });
+ }
+ namearr.reverse();
+ let str = "";
+ namearr.forEach((item) => {
+ str += "/" + item;
});
+ this.selectedorganization = str.substr(1);
}
- namearr.reverse()
- let str = ''
- namearr.forEach(item=>{
- str += '/' + item
- })
- this.selectedorganization = str.substr(1)
}
- }
-
- this.unitinfo = data
- this.selectedorganizationid = data.organizationId
- if(data.imageUrl){
- this.imgsrc = data.imageUrl
- }
- if(data.buildingTypes[0]){
- this.defaultbuildingTypes = data.buildingTypes[0].id
- this.buildingTypesname = data.buildingTypes[0].name
- }
- })
+
+ this.unitinfo = data;
+ this.selectedorganizationid = data.organizationId;
+ if (data.imageUrl) {
+ console.log('图片地址', data.imageUrl)
+ this.imgsrc = data.imageUrl;
+ }
+ if (data.buildingTypes[0]) {
+ this.defaultbuildingTypes = data.buildingTypes[0].id;
+ this.buildingTypesname = data.buildingTypes[0].name;
+ }
+ });
}
- unitallbuilding:any = []//用于存储当前单位所有的建筑
- buildinginfoId:any = []//用于存储当前单位所有具体建筑的id
- presentbuildinfoId:any // 用于存储当前单位第一个建筑的id
- bigfor:any//循环(储罐信息+罐区信息)大组
- npdata:any = []
- newnpdata:any //用于存储石油化工 储罐信息/罐区情况的 datasource
+ 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形式
- devicedataSourcebox:any = [] //存储多个石油化工建筑的不同装置信息表格datasource
+ basicCategoryId: any; //当前单位所有建筑中位于第一个的建筑id
+ deviceinfodata: any = []; //用于存储石油化工装置信息的数组
+ zhuangzhiinfodatasource: any = []; //用于存储石油化工装置信息表格的数据来源
+ newzhuangzhiinfodatasource: any = []; //存储石油化工装置信息表格的 datasource形式
+ devicedataSourcebox: any = []; //存储多个石油化工建筑的不同装置信息表格datasource
-
//数据格式化函数 将原始数据映射转化为表格需要的datasource
formatHandle(list) {
const result = [{}]; // tag 是从1开始,因此预置索引为0的项
list.forEach((item) => {
const { tag, propertyName, propertyValue } = item;
- if (result[tag] === undefined) { // 初始化对象
- result[tag] = {};
+ if (result[tag] === undefined) {
+ // 初始化对象
+ result[tag] = {};
}
- const fieldMap = { // 字段映射,实现自动映射
- '罐区': 'tank',
- '储罐编号': 'tankid',
- '储存介质': 'tankmedium',
- '储罐类型': 'tanktype',
- '容量': 'tankcapacity',
- '直径': 'tankdiameter',
- '高度': 'tankheight',
- '顶盖形式': 'tanktectum',
- '浮盘材质': 'tanktexture',
- '浮盘类型': 'platetype',
- '泡沫产生器型号': 'foamgeneratorid',
- '泡沫产生器形式': 'foamgeneratortype',
- '是否设置氮封惰化保护装置': 'isprotect',
- '防护堤高度': 'fendinggroyneheight',
- '半固定泡沫灭火接口数量': 'portnum',
- '其它设施': 'else'
+ const fieldMap = {
+ // 字段映射,实现自动映射
+ 罐区: "tank",
+ 储罐编号: "tankid",
+ 储存介质: "tankmedium",
+ 储罐类型: "tanktype",
+ 容量: "tankcapacity",
+ 直径: "tankdiameter",
+ 高度: "tankheight",
+ 顶盖形式: "tanktectum",
+ 浮盘材质: "tanktexture",
+ 浮盘类型: "platetype",
+ 泡沫产生器型号: "foamgeneratorid",
+ 泡沫产生器形式: "foamgeneratortype",
+ 是否设置氮封惰化保护装置: "isprotect",
+ 防护堤高度: "fendinggroyneheight",
+ 半固定泡沫灭火接口数量: "portnum",
+ 其它设施: "else",
};
result[tag][fieldMap[propertyName]] = propertyValue;
});
@@ -217,57 +239,58 @@ export class BasicinfoLookComponent implements OnInit {
}
//将模板信息加工成附带自定义属性的信息
- getunithouse(data,n,x){ //data是原始模板在此基础上加工 n是当前建筑名称和建筑id、 x是当前循环的item信息
- data[0].buildingtypeId = n.id
- data[0].name = x.name
- data[0].username =x.name
- data[0].buildtype = n.name
- data[0].tongyong = true
- data[0].index = x.index
- if(data[0].buildtype == "石油化工类"){
- data[0].tongyong = false
- data[0].isshiyou = true
- this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息的初始数据,需要转换成datasource形式
- var map = []
- this.deviceinfodata.forEach((item,index) => {
- if(item.tag == ""){
- item.tag = "1"
+ getunithouse(data, n, x) {
+ //data是原始模板在此基础上加工 n是当前建筑名称和建筑id、 x是当前循环的item信息
+ data[0].buildingtypeId = n.id;
+ data[0].name = x.name;
+ data[0].username = x.name;
+ data[0].buildtype = n.name;
+ data[0].tongyong = true;
+ data[0].index = x.index;
+ if (data[0].buildtype == "石油化工类") {
+ data[0].tongyong = false;
+ data[0].isshiyou = true;
+ this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos; //存储装置信息的初始数据,需要转换成datasource形式
+ var map = [];
+ this.deviceinfodata.forEach((item, index) => {
+ if (item.tag == "") {
+ item.tag = "1";
}
- if(!(item.tag in map)){
- map[item.tag] = []
+ if (!(item.tag in map)) {
+ map[item.tag] = [];
}
- map[item.tag].push(item)
+ map[item.tag].push(item);
});
- let zhuangzhiinfodatasource = []
- map.forEach((item,index)=>{
- zhuangzhiinfodatasource[index] = {}
- item.forEach(i => {
+ let zhuangzhiinfodatasource = [];
+ map.forEach((item, index) => {
+ zhuangzhiinfodatasource[index] = {};
+ item.forEach((i) => {
if (i.propertyName == "装置区名称") {
- zhuangzhiinfodatasource[index].name = i.propertyValue
+ zhuangzhiinfodatasource[index].name = i.propertyValue;
}
if (i.propertyName == "工艺流程") {
- zhuangzhiinfodatasource[index].flow = i.propertyValue
+ zhuangzhiinfodatasource[index].flow = i.propertyValue;
}
if (i.propertyName == "火灾危险性") {
- zhuangzhiinfodatasource[index].danger = i.propertyValue
+ zhuangzhiinfodatasource[index].danger = i.propertyValue;
}
if (i.propertyName == "灭火注意事项") {
- zhuangzhiinfodatasource[index].payattentionto = i.propertyValue
+ zhuangzhiinfodatasource[index].payattentionto = i.propertyValue;
}
});
- })
- this.newzhuangzhiinfodatasource =[] //数据去空
- zhuangzhiinfodatasource.forEach(item=>{
- if(item !== "" && item != undefined){
- this.newzhuangzhiinfodatasource.push(item)
+ });
+ this.newzhuangzhiinfodatasource = []; //数据去空
+ zhuangzhiinfodatasource.forEach((item) => {
+ if (item !== "" && item != undefined) {
+ this.newzhuangzhiinfodatasource.push(item);
}
- })
- this.devicedataSourcebox[data[0].buildingId] = new MatTableDataSource(this.newzhuangzhiinfodatasource)
- data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource
+ });
+ this.devicedataSourcebox[data[0].buildingId] =
+ new MatTableDataSource(this.newzhuangzhiinfodatasource);
+ data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource;
-
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
- let noemptybigfordata = data[0].buildingBasicGroups
+ let noemptybigfordata = data[0].buildingBasicGroups;
// if(noemptybigfordata.length > 4){
// noemptybigfordata.forEach((item,index) => {
// if(!item.submitted && item.name !="装置信息"){
@@ -275,695 +298,758 @@ export class BasicinfoLookComponent implements OnInit {
// }
// })
// }
- let bigtankgroups = noemptybigfordata.slice(2)
+ let bigtankgroups = noemptybigfordata.slice(2);
// console.log("bigtankgroups",bigtankgroups)
let proportion = 2; //按照比例切割
let num = 0;
- let bigfor =[];
- for(let i=0;i{
- item[1].propertyInfos.forEach(item => {
- if(item.tag == ""){
- item.tag = 1
+
+ bigfor.forEach((item) => {
+ item[1].propertyInfos.forEach((item) => {
+ if (item.tag == "") {
+ item.tag = 1;
}
});
- item[1].propertyInfos = this.formatHandle(item[1].propertyInfos)
-
- })
- data[0].bigfor = bigfor
+ item[1].propertyInfos = this.formatHandle(item[1].propertyInfos);
+ });
+ data[0].bigfor = bigfor;
}
// if(data[0].buildtype == "地铁类"){
// data[0].tongyong = true
// // data[0].ditie = true
// }
- return data[0]
+ return data[0];
}
//点击建筑自定义信息的checkbox
- isCustomData = false
- checkCustomData(e){
- this.isCustomData = e.checked
+ isCustomData = false;
+ checkCustomData(e) {
+ this.isCustomData = e.checked;
}
//增加自定义信息行数
- addCustomData(item){
+ addCustomData(item) {
item.buildingCustomData.customProperties.push({
- name: "",
- value: ""
- })
+ name: "",
+ value: "",
+ });
}
//删除自定义信息行数
- deleteCustomData(item){
- item.buildingCustomData.customProperties.pop()
+ deleteCustomData(item) {
+ item.buildingCustomData.customProperties.pop();
}
//得到建筑信息数据并进行处理
- allBuildings:any
- getunitallbuilding(){
- this.houses = []
- this.unitId = sessionStorage.getItem('companyId')
- this.http.get("/api/Buildings",{
- params:{
- companyId:this.unitId
- }
- }).subscribe(async (data:any)=>{ // 获得当前单位所有的建筑
- this.allBuildings = data
- // console.log(data)
- 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++) {//循环所有建筑
- const n = data[i];
- const index = i;
- this.buildinginfoId.push(n.id)
- const result = await new Promise((resolve) => {
- this.http.get("/api/BuildingBasicInfos",{ // 循环请求当前单位建筑每一个建筑的信息保存到数组中
- params:{
- companyId :this.unitId,
- buildingId:n.id,
- buildingType:n.buildingTypes[0].id
- }
- }).subscribe((data)=>{
- //获得当前建筑自定义信息并且添加到item自定义属性上
- let _data = data
- this.http.get("/api/BuildingCustomData",{params:{
- buildingId:n.id
- }}).subscribe((data:any)=>{
- _data[0].buildingCustomData = data
- if(data && data.customProperties.length != 0){
- _data[0].isCustomData = true
- }else{
- _data[0].isCustomData = false
- _data[0].buildingCustomData ={
- id: "",
- customProperties: [
- {
- name: "",
- value: ""
+ allBuildings: any;
+ getunitallbuilding() {
+ this.houses = [];
+ this.unitId = sessionStorage.getItem("companyId");
+ this.http
+ .get("/api/Buildings", {
+ params: {
+ companyId: this.unitId,
+ },
+ })
+ .subscribe(async (data: any) => {
+ // 获得当前单位所有的建筑
+ this.allBuildings = data;
+ // console.log(data)
+ 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++) {
+ //循环所有建筑
+ const n = data[i];
+ const index = i;
+ this.buildinginfoId.push(n.id);
+ const result = await new Promise((resolve) => {
+ this.http
+ .get("/api/BuildingBasicInfos", {
+ // 循环请求当前单位建筑每一个建筑的信息保存到数组中
+ params: {
+ companyId: this.unitId,
+ buildingId: n.id,
+ buildingType: n.buildingTypes[0].id,
+ },
+ })
+ .subscribe((data) => {
+ //获得当前建筑自定义信息并且添加到item自定义属性上
+ let _data = data;
+ this.http
+ .get("/api/BuildingCustomData", {
+ params: {
+ buildingId: n.id,
+ },
+ })
+ .subscribe((data: any) => {
+ _data[0].buildingCustomData = data;
+ if (data && data.customProperties.length != 0) {
+ _data[0].isCustomData = true;
+ } else {
+ _data[0].isCustomData = false;
+ _data[0].buildingCustomData = {
+ id: "",
+ customProperties: [
+ {
+ name: "",
+ value: "",
+ },
+ ],
+ buildingId: _data[0].buildingId,
+ };
+ }
+ });
+ //为每个建筑添加自定义属性
+ data[0].buildingtypeId = n.buildingTypes[0].id;
+ data[0].name = n.name;
+ data[0].username = n.name;
+ data[0].buildtype = n.buildingTypes[0].name;
+ data[0].tongyong = true;
+ data[0].index = index;
+
+ if (data[0].buildtype == "石油化工类") {
+ data[0].tongyong = false;
+ data[0].isshiyou = true;
+ let noemptydeviceArr =
+ data[0].buildingBasicGroups[1].propertyInfos;
+ noemptydeviceArr.forEach((item, index) => {
+ if (item.tag == "") {
+ noemptydeviceArr.splice(index, 1);
+ }
+ });
+ this.deviceinfodata = noemptydeviceArr; //存储装置信息的初始数据,需要转换成datasource形式
+ var map = [];
+ this.deviceinfodata.forEach((item, index) => {
+ if (!data[0].buildingBasicGroups[1].submitted) {
+ if (item.tag == "") {
+ item.tag = "1";
}
- ],
- buildingId: _data[0].buildingId
- }
- }
- })
- //为每个建筑添加自定义属性
- data[0].buildingtypeId = n.buildingTypes[0].id
- data[0].name = n.name
- data[0].username = n.name
- data[0].buildtype = n.buildingTypes[0].name
- data[0].tongyong = true
- data[0].index = index
+ }
- if(data[0].buildtype == "石油化工类"){
- data[0].tongyong = false
- data[0].isshiyou = true
- let noemptydeviceArr = data[0].buildingBasicGroups[1].propertyInfos
- noemptydeviceArr.forEach((item,index) => {
- if(item.tag == ""){
- noemptydeviceArr.splice(index,1)
- }
- });
- this.deviceinfodata = noemptydeviceArr //存储装置信息的初始数据,需要转换成datasource形式
- var map = []
- this.deviceinfodata.forEach((item,index) => {
- if(!data[0].buildingBasicGroups[1].submitted){
- if(item.tag == ""){
- item.tag = "1"
- }
- }
+ if (!(item.tag in map)) {
+ map[item.tag] = [];
+ }
+ map[item.tag].push(item);
+ });
+ let zhuangzhiinfodatasource = [];
+ map.forEach((item, index) => {
+ zhuangzhiinfodatasource[index] = {};
+ item.forEach((i) => {
+ if (i.propertyName == "装置区名称") {
+ zhuangzhiinfodatasource[index].name = i.propertyValue;
+ }
+ if (i.propertyName == "工艺流程") {
+ zhuangzhiinfodatasource[index].flow = i.propertyValue;
+ }
+ if (i.propertyName == "火灾危险性") {
+ zhuangzhiinfodatasource[index].danger =
+ i.propertyValue;
+ }
+ if (i.propertyName == "灭火注意事项") {
+ zhuangzhiinfodatasource[index].payattentionto =
+ i.propertyValue;
+ }
+ });
+ });
+ this.newzhuangzhiinfodatasource = []; //数据去空
+ zhuangzhiinfodatasource.forEach((item) => {
+ if (item !== "" && item != undefined) {
+ this.newzhuangzhiinfodatasource.push(item);
+ }
+ });
+ this.devicedataSourcebox[data[0].buildingId] =
+ new MatTableDataSource(
+ this.newzhuangzhiinfodatasource
+ );
+ data[0].newzhuangzhiinfodatasource =
+ this.newzhuangzhiinfodatasource;
- if(!(item.tag in map)){
- map[item.tag] = []
- }
- map[item.tag].push(item)
- });
- let zhuangzhiinfodatasource = []
- map.forEach((item,index)=>{
- zhuangzhiinfodatasource[index] = {}
- item.forEach(i => {
- if (i.propertyName == "装置区名称") {
- zhuangzhiinfodatasource[index].name = i.propertyValue
- }
- if (i.propertyName == "工艺流程") {
- zhuangzhiinfodatasource[index].flow = i.propertyValue
- }
- if (i.propertyName == "火灾危险性") {
- zhuangzhiinfodatasource[index].danger = i.propertyValue
- }
- if (i.propertyName == "灭火注意事项") {
- zhuangzhiinfodatasource[index].payattentionto = i.propertyValue
- }
- });
- })
- this.newzhuangzhiinfodatasource =[] //数据去空
- zhuangzhiinfodatasource.forEach(item=>{
- if(item !== "" && item != undefined){
- this.newzhuangzhiinfodatasource.push(item)
- }
- })
- this.devicedataSourcebox[data[0].buildingId] = new MatTableDataSource(this.newzhuangzhiinfodatasource)
- data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource
-
- //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
- let noemptybigfordata = data[0].buildingBasicGroups
+ //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
+ let noemptybigfordata = data[0].buildingBasicGroups;
- let bigtankgroups = noemptybigfordata.slice(2)
- let proportion = 2; //按照比例切割
- let num = 0;
- let bigfor =[];
- for(let i=0;i{
-
- item[1].propertyInfos = this.formatHandle(item[1].propertyInfos)
-
- })
- data[0].bigfor = bigfor
- }
- resolve(data[0]) //把数据传递出去
- })
- })
- this.houses.push(result) // 并且把他添加到 tab 总体数组中
+ //bigfor决定当前储罐分组有几个
+ bigfor.forEach((item, index) => {
+ item[1].propertyInfos = this.formatHandle(
+ item[1].propertyInfos
+ );
+ });
+ data[0].bigfor = bigfor;
+ }
+ resolve(data[0]); //把数据传递出去
+ });
+ });
+ this.houses.push(result); // 并且把他添加到 tab 总体数组中
+ }
}
- }
- // console.log(666,this.houses)
- })
-
+ // console.log(666,this.houses)
+ });
}
- unitinfotemplate:any //存储选择不同单位类型时的模板信息
- displayedColumns: string[]=['name', 'flow','danger','payattentionto'];
- displayedColumns2: string[]=['tank','tankid', 'tankmedium','tanktype','tankcapacity','tankdiameter', 'tankheight','tanktectum','tanktexture','platetype', 'foamgeneratorid','foamgeneratortype','isprotect','fendinggroyneheight', 'portnum','else'];
- devicedataSource:any; //存储石油化工模板中的装置信息表格
- tankinfodatabox:any = [
- []
- ]
+ unitinfotemplate: any; //存储选择不同单位类型时的模板信息
+ displayedColumns: string[] = ["name", "flow", "danger", "payattentionto"];
+ displayedColumns2: string[] = [
+ "tank",
+ "tankid",
+ "tankmedium",
+ "tanktype",
+ "tankcapacity",
+ "tankdiameter",
+ "tankheight",
+ "tanktectum",
+ "tanktexture",
+ "platetype",
+ "foamgeneratorid",
+ "foamgeneratortype",
+ "isprotect",
+ "fendinggroyneheight",
+ "portnum",
+ "else",
+ ];
+ devicedataSource: any; //存储石油化工模板中的装置信息表格
+ tankinfodatabox: any = [[]];
// dataSourceArr = []
- tankinfodata:any=[];//用于存储石油化工储罐信息的数组
- adddeviceinfo2(e,item){//点击加一行 视图上多一行
+ tankinfodata: any = []; //用于存储石油化工储罐信息的数组
+ adddeviceinfo2(e, item) {
+ //点击加一行 视图上多一行
item.bigfor[e][1].propertyInfos.push({
- tank:"",
- tankid:"",
- tankmedium:"",
- tanktype:"",
- tankcapacity:"",
- tankdiameter:"",
- tankheight:"",
- tanktectum:"",
- tanktexture:"",
- platetype:"",
- foamgeneratorid:"",
- foamgeneratortype:"",
- isprotect:"",
- fendinggroyneheight:"",
- portnum:"",
- else:""
- })
- item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos]
+ tank: "",
+ tankid: "",
+ tankmedium: "",
+ tanktype: "",
+ tankcapacity: "",
+ tankdiameter: "",
+ tankheight: "",
+ tanktectum: "",
+ tanktexture: "",
+ platetype: "",
+ foamgeneratorid: "",
+ foamgeneratortype: "",
+ isprotect: "",
+ fendinggroyneheight: "",
+ portnum: "",
+ else: "",
+ });
+ item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos];
}
- removedeviceinfo3(e,item){//点击减一行
- var isdeleted = confirm("确定要删除末行吗?")
- if(isdeleted){
- if(item.bigfor[e][1].propertyInfos.length > 1){
- item.bigfor[e][1].propertyInfos.pop()
- }else{
+ removedeviceinfo3(e, item) {
+ //点击减一行
+ var isdeleted = confirm("确定要删除末行吗?");
+ if (isdeleted) {
+ if (item.bigfor[e][1].propertyInfos.length > 1) {
+ item.bigfor[e][1].propertyInfos.pop();
+ } else {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('只剩一行,无法删除','确定',config);
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("只剩一行,无法删除", "确定", config);
}
- item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos]
+ item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos];
}
-
}
-
//增加储罐大分组
//在石油化工模板种点击增加储罐信息
//获得模板信息
- templateinfo:any
- gettemplateinfo(typeid){
-
- }
-
- addtankbox(item,bigkey){
- this.http.get("/api/CompanyAccount/BasicInfos",{
- params:{
- companyId : this.unitId,
- buildingType:item.buildingtypeId
- }
- }).subscribe((data:any)=>{
- // console.log(1314,data)
- // console.log(777,data[0])
- item.bigfor.push([
- {
- id: "",
- name: "罐区"+ (item.bigfor.length+ 1),
- type: 0,
- addMode: 2,
- basicGroupId:'',
- basicCategoryId: item.basicCategoryId,
- buildingBasicId: null,
- buildingId: item.buildingId,
- companyId: this.unitinfo.id,
- enabled: true,
- order: item.bigfor.length+2,
- propertyInfos:data[0].buildingBasicGroups[2].propertyInfos
+ templateinfo: any;
+ gettemplateinfo(typeid) {}
+
+ addtankbox(item, bigkey) {
+ this.http
+ .get("/api/CompanyAccount/BasicInfos", {
+ params: {
+ companyId: this.unitId,
+ buildingType: item.buildingtypeId,
},
- {
- addMode: 2,
- basicCategoryId:item.basicCategoryId,
- buildingBasicId:null,
- buildingId: item.buildingId,
- companyId: this.unitinfo.id,
- enabled: true,
- basicGroupId:'',
- id: "",
- name: "罐区" + (item.bigfor.length+ 1) +"/储罐信息",
- order: item.bigfor.length+3,
- propertyInfos: [
- {
- else: "",
- fendinggroyneheight: "",
- foamgeneratorid: "",
- foamgeneratortype: "",
- isprotect: "",
- platetype: "",
- portnum: "",
- tank: "",
- tankcapacity: "",
- tankdiameter: "",
- tankheight: "",
- tankid: "",
- tankmedium: "",
- tanktectum: "",
- tanktexture: "",
- tanktype: ""
- }
- ],
- type: 1
- }
-
- ])
- })
-
+ })
+ .subscribe((data: any) => {
+ // console.log(1314,data)
+ // console.log(777,data[0])
+ item.bigfor.push([
+ {
+ id: "",
+ name: "罐区" + (item.bigfor.length + 1),
+ type: 0,
+ addMode: 2,
+ basicGroupId: "",
+ basicCategoryId: item.basicCategoryId,
+ buildingBasicId: null,
+ buildingId: item.buildingId,
+ companyId: this.unitinfo.id,
+ enabled: true,
+ order: item.bigfor.length + 2,
+ propertyInfos: data[0].buildingBasicGroups[2].propertyInfos,
+ },
+ {
+ addMode: 2,
+ basicCategoryId: item.basicCategoryId,
+ buildingBasicId: null,
+ buildingId: item.buildingId,
+ companyId: this.unitinfo.id,
+ enabled: true,
+ basicGroupId: "",
+ id: "",
+ name: "罐区" + (item.bigfor.length + 1) + "/储罐信息",
+ order: item.bigfor.length + 3,
+ propertyInfos: [
+ {
+ else: "",
+ fendinggroyneheight: "",
+ foamgeneratorid: "",
+ foamgeneratortype: "",
+ isprotect: "",
+ platetype: "",
+ portnum: "",
+ tank: "",
+ tankcapacity: "",
+ tankdiameter: "",
+ tankheight: "",
+ tankid: "",
+ tankmedium: "",
+ tanktectum: "",
+ tanktexture: "",
+ tanktype: "",
+ },
+ ],
+ type: 1,
+ },
+ ]);
+ });
}
//移除储罐大分组
- removetankbox(item,bigkey){
- if(item.bigfor.length > 1){
- var isdeleted = confirm("确定要删除末尾储罐分组吗?")
- if(isdeleted){
- item.bigfor.pop()
- }
- }else{
+ removetankbox(item, bigkey) {
+ if (item.bigfor.length > 1) {
+ var isdeleted = confirm("确定要删除末尾储罐分组吗?");
+ if (isdeleted) {
+ item.bigfor.pop();
+ }
+ } else {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('只剩唯一储罐,无法删除','确定',config);
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("只剩唯一储罐,无法删除", "确定", config);
}
}
//新建建筑时把原始建筑数据放进来进行加工处理成可用数据
- async changebuildingdata(data){
- let n = data
- let yyy
- let result = await new Promise(resolve=>{
- this.http.get("/api/BuildingBasicInfos",{ // 需要请求建筑信息的模板
- params:{
- companyId : this.unitId,
- buildingId:data.id,
- buildingType:data.buildingTypes[0].id
- }
- }).subscribe((data)=>{//此时的data才是模板详细信息
- let _data = data
- this.http.get("/api/BuildingCustomData",{params:{ //-----处理建筑自定义属性部分
- buildingId:n.id
- }}).subscribe(data=>{
- if(data){
- _data[0].isCustomData = true //如果data存在则把自定义属性isCustomData设为true
- _data[0].buildingCustomData = data //把建筑自定义信息赋给buildingCustomData自定义属性
- }else{
- _data[0].isCustomData = false
- _data[0].buildingCustomData ={ //否则设为false,并且把自定义信息属性赋值为空
+ async changebuildingdata(data) {
+ let n = data;
+ let yyy;
+ let result = await new Promise((resolve) => {
+ this.http
+ .get("/api/BuildingBasicInfos", {
+ // 需要请求建筑信息的模板
+ params: {
+ companyId: this.unitId,
+ buildingId: data.id,
+ buildingType: data.buildingTypes[0].id,
+ },
+ })
+ .subscribe((data) => {
+ //此时的data才是模板详细信息
+ let _data = data;
+ this.http
+ .get("/api/BuildingCustomData", {
+ params: {
+ //-----处理建筑自定义属性部分
+ buildingId: n.id,
+ },
+ })
+ .subscribe((data) => {
+ if (data) {
+ _data[0].isCustomData = true; //如果data存在则把自定义属性isCustomData设为true
+ _data[0].buildingCustomData = data; //把建筑自定义信息赋给buildingCustomData自定义属性
+ } else {
+ _data[0].isCustomData = false;
+ _data[0].buildingCustomData = {
+ //否则设为false,并且把自定义信息属性赋值为空
id: "",
customProperties: [
{
name: "",
- value: ""
- }
+ value: "",
+ },
],
- buildingId: _data[0].buildingId
+ buildingId: _data[0].buildingId,
+ };
}
- }
- })
- data[0].buildingtypeId = n.buildingTypes[0].id
- data[0].buildtype = n.buildingTypes[0].name
- data[0].name = n.name
- data[0].username = n.name
- data[0].tongyong = true
- data[0].index = this.houses.length //////////////////
- if(data[0].buildtype == "石油化工类"){
- data[0].tongyong = false
- data[0].isshiyou = true //如果是石油化工则启用石油化工的模板
- this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息表格的初始数据,需要转换成datasource形式
- var map = []
- this.deviceinfodata.forEach((item,index) => {
- if(item.tag == ""){
- item.tag = "1"
+ });
+ data[0].buildingtypeId = n.buildingTypes[0].id;
+ data[0].buildtype = n.buildingTypes[0].name;
+ data[0].name = n.name;
+ data[0].username = n.name;
+ data[0].tongyong = true;
+ data[0].index = this.houses.length; //////////////////
+ if (data[0].buildtype == "石油化工类") {
+ data[0].tongyong = false;
+ data[0].isshiyou = true; //如果是石油化工则启用石油化工的模板
+ this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos; //存储装置信息表格的初始数据,需要转换成datasource形式
+ var map = [];
+ this.deviceinfodata.forEach((item, index) => {
+ if (item.tag == "") {
+ item.tag = "1";
}
- if(!(item.tag in map)){
- map[item.tag] = []
+ if (!(item.tag in map)) {
+ map[item.tag] = [];
}
- map[item.tag].push(item)
+ map[item.tag].push(item);
});
- let zhuangzhiinfodatasource = []
- map.forEach((item,index)=>{
- zhuangzhiinfodatasource[index] = {}
- item.forEach(i => {
+ let zhuangzhiinfodatasource = [];
+ map.forEach((item, index) => {
+ zhuangzhiinfodatasource[index] = {};
+ item.forEach((i) => {
if (i.propertyName == "装置区名称") {
- zhuangzhiinfodatasource[index].name = i.propertyValue
+ zhuangzhiinfodatasource[index].name = i.propertyValue;
}
if (i.propertyName == "工艺流程") {
- zhuangzhiinfodatasource[index].flow = i.propertyValue
+ zhuangzhiinfodatasource[index].flow = i.propertyValue;
}
if (i.propertyName == "火灾危险性") {
- zhuangzhiinfodatasource[index].danger = i.propertyValue
+ zhuangzhiinfodatasource[index].danger = i.propertyValue;
}
if (i.propertyName == "灭火注意事项") {
- zhuangzhiinfodatasource[index].payattentionto = i.propertyValue
+ zhuangzhiinfodatasource[index].payattentionto =
+ i.propertyValue;
}
});
- })
- this.newzhuangzhiinfodatasource =[] //数据去空
- zhuangzhiinfodatasource.forEach(item=>{
- if(item !== "" && item != undefined){
- this.newzhuangzhiinfodatasource.push(item)
+ });
+ this.newzhuangzhiinfodatasource = []; //数据去空
+ zhuangzhiinfodatasource.forEach((item) => {
+ if (item !== "" && item != undefined) {
+ this.newzhuangzhiinfodatasource.push(item);
}
- })
- this.devicedataSourcebox[data[0].buildingId] = new MatTableDataSource(this.newzhuangzhiinfodatasource) //强制渲染表格
- data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource
+ });
+ this.devicedataSourcebox[data[0].buildingId] =
+ new MatTableDataSource(this.newzhuangzhiinfodatasource); //强制渲染表格
+ data[0].newzhuangzhiinfodatasource =
+ this.newzhuangzhiinfodatasource;
-
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
- let bigtankgroups = data[0].buildingBasicGroups.slice(2)
+ let bigtankgroups = data[0].buildingBasicGroups.slice(2);
let proportion = 2; //按照比例切割
let num = 0;
- let bigfor =[];
- for(let i=0;i{
- item[1].propertyInfos.forEach(item => {
- if(item.tag == ""){
- item.tag = 1
+
+ bigfor.forEach((item) => {
+ item[1].propertyInfos.forEach((item) => {
+ if (item.tag == "") {
+ item.tag = 1;
}
});
- item[1].propertyInfos = this.formatHandle(item[1].propertyInfos)
- })
- data[0].bigfor = bigfor
+ item[1].propertyInfos = this.formatHandle(item[1].propertyInfos);
+ });
+ data[0].bigfor = bigfor;
}
- if(data[0].buildtype == "地铁类"){
- data[0].tongyong = true
- // data[0].ditie = true
- }
- yyy = data[0]
- resolve(yyy)
- })
- })
- return result
+ if (data[0].buildtype == "地铁类") {
+ data[0].tongyong = true;
+ // data[0].ditie = true
+ }
+ yyy = data[0];
+ resolve(yyy);
+ });
+ });
+ return result;
}
-
-
//点击不同的tab选项
- selecttab(e) {
- }
+ selecttab(e) {}
- FunData(e){//切割数组
+ FunData(e) {
+ //切割数组
let proportion = 2; //按照比例切割
let num = 0;
- let _data =[];
- for(let i=0;i {
- if(item.id == targetId ){
- namearr.push(item.name)
+ for (let i = 0; i < node.level; i++) {
+ this.allorganizing.forEach((item) => {
+ if (item.id == targetId) {
+ namearr.push(item.name);
targetId = item.parentId; // 临时变量更新没有副作用
}
});
}
- namearr.reverse()
- let str = ''
- namearr.forEach(item=>{
- str += '/' + item
- })
-
- this.selectedorganization = str.substr(1)
+ namearr.reverse();
+ let str = "";
+ namearr.forEach((item) => {
+ str += "/" + item;
+ });
+
+ this.selectedorganization = str.substr(1);
}
-}
+ }
//关闭辖区中队隐藏框
closeorganizationbox() {
- this.isorganizationbox = false
+ this.isorganizationbox = false;
}
//打开辖区中队隐藏框
openorganizationbox() {
- this.isorganizationbox = true
+ this.isorganizationbox = true;
}
hasChild = (_: number, node: any) => node.expandable;
-
+
// imgsrc = "../../../assets/upload.jpg" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
- imgsrc = ""
- imgUrl = ""//返回来的图片地址后缀
+ imgsrc = "";
+ imgUrl = ""; //返回来的图片地址后缀
file: any; //上传的文件
objectName: any; //上传对象名
uploadId: any; //上传分块上传事件编号
- isspinner:boolean=false //控制进度圈的显示隐藏
+ isspinner: boolean = false; //控制进度圈的显示隐藏
PartNumberETag: any = []; //分块上传每次返回需要保存的信息
//change选择文件
filechange(e) {
- this.file = e.target.files[0] || null //上传的文件
+ this.file = e.target.files[0] || null; //上传的文件
var reader = new FileReader();
reader.readAsDataURL(this.file);
- var image:any = new Image();
- reader.onload = function(){
- image.src = reader.result
- }
+ var image: any = new Image();
+ reader.onload = function () {
+ image.src = reader.result;
+ };
setTimeout(() => {
- if(image.width>=4096 || image.height>=5000 ){
+ if (image.width >= 4096 || image.height >= 5000) {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config);
- }else{
- if(this.file){
- this.startUploading()
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请选择分辨率小于4096*5000的图片", "确定", config);
+ } else {
+ if (this.file) {
+ this.startUploading();
}
}
-
}, 500);
- }
+ }
//查看单位大图
- lookmaster(){
- const dialogRef = this.dialog.open(LookMaster2, {//调用open方法打开对话框并且携带参数过去
- width: '1600px',
- height:'900px',
- data: {img:this.imgsrc}
+ lookmaster() {
+ const dialogRef = this.dialog.open(LookMaster2, {
+ //调用open方法打开对话框并且携带参数过去
+ width: "1600px",
+ height: "900px",
+ data: { img: this.imgsrc },
});
- dialogRef.afterClosed().subscribe(
-
- );
+ dialogRef.afterClosed().subscribe();
}
//上传文件
startUploading() {
- this.isspinner = true
- let file = this.file || null //获取上传的文件
- let fileSize = file.size || null //上传文件的总大小
- let shardSize = 5 * 1024 * 1024 //5MB一个分片
+ this.isspinner = true;
+ let file = this.file || null; //获取上传的文件
+ let fileSize = file.size || null; //上传文件的总大小
+ let shardSize = 5 * 1024 * 1024; //5MB一个分片
- if (file && fileSize <= shardSize) { //上传文件<=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)=>{
- this.isspinner = false
- this.imgUrl = data.objectName
- this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299`
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('上传成功','确定',config);
- })
- } else if (file && fileSize >= shardSize) { //上传文件>5MB时,分块上传
+ let formData = new FormData();
+ formData.append("file", file);
+ this.http
+ .post(
+ `/api/Objects/PlanPlatform/${sessionStorage.getItem("companyId")}`,
+ formData
+ )
+ .subscribe((data: any) => {
+ this.isspinner = false;
+ this.imgUrl = data.objectName;
+ this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299`;
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("上传成功", "确定", config);
+ });
+ } else if (file && fileSize >= shardSize) {
+ //上传文件>5MB时,分块上传
- let data = { filename: file.name }
- this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.unitinfo.id}`, {}, { params: data }).subscribe((data: any) => { //初始化分段上传
- this.objectName = data.objectName
- this.uploadId = data.uploadId
- this.subsectionUploading()
- })
+ let data = { filename: file.name };
+ this.http
+ .post(
+ `/api/NewMultipartUpload/PlanPlatform/${this.unitinfo.id}`,
+ {},
+ { params: data }
+ )
+ .subscribe((data: any) => {
+ //初始化分段上传
+ this.objectName = data.objectName;
+ this.uploadId = data.uploadId;
+ this.subsectionUploading();
+ });
}
}
-
-
-
- //小于5MB不需要分块上传
- upload(){
- this.uploader.queue[0].upload();//开始上传
- this.uploader.queue[0].onSuccess = (response, status, headers) => {
- // 上传文件成功
+ //小于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
+ 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.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) => {
+ 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);
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("上传失败", "确定", config);
}
};
}
-
+
//开始分块上传
- async subsectionUploading () {
- let file = this.file || null //获取上传的文件
- let fileSize = file.size || null //上传文件的总大小
- let shardSize = 5 * 1024 * 1024 //5MB一个分片
- let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
+ async subsectionUploading() {
+ let file = this.file || null; //获取上传的文件
+ 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 //切割文件开始位置
+ 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 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/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{
- let msg = {
- "partNumber":data.partNumber || null,
- "eTag": data.eTag || null
- }
- resolve(msg) // 调用 promise 内置方法处理成功
- })
+ // await 需要后面返回一个 promise 对象
+ this.http
+ .post(
+ `/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${
+ this.uploadId
+ }&partNumber=${i + 1}`,
+ formData
+ )
+ .subscribe((data: any) => {
+ let msg = {
+ partNumber: data.partNumber || null,
+ eTag: data.eTag || null,
+ };
+ resolve(msg); // 调用 promise 内置方法处理成功
+ });
});
- this.PartNumberETag.push(result)
+ this.PartNumberETag.push(result);
if (this.PartNumberETag.length === allSlice) {
- this.endUploading()
+ this.endUploading();
}
}
}
//完成分块上传
endUploading() {
- let data = this.PartNumberETag
- let paramsData = { uploadId: this.uploadId }
- this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`, data, { params: paramsData }).subscribe(data => {
- 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控件文件
- })
+ let data = this.PartNumberETag;
+ let paramsData = { uploadId: this.uploadId };
+ this.http
+ .post(
+ `/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,
+ data,
+ { params: paramsData }
+ )
+ .subscribe((data) => {
+ 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控件文件
+ });
}
//删除具体建筑
- deletedbuilding(item){
- var isdeleted = confirm("确定要删除此建筑吗?")
- if(isdeleted){
+ deletedbuilding(item) {
+ var isdeleted = confirm("确定要删除此建筑吗?");
+ if (isdeleted) {
//请求删除接口
- this.http.delete(`/api/Buildings/${item.buildingId}`).subscribe(data=>{
-
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('删除成功','确定',config);
- this.houses.splice(this.houses.findIndex(items=>items==item),1)
- })
+ this.http
+ .delete(`/api/Buildings/${item.buildingId}`)
+ .subscribe((data) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("删除成功", "确定", config);
+ this.houses.splice(
+ this.houses.findIndex((items) => items == item),
+ 1
+ );
+ });
}
}
//提交单位基本信息
- onSubmit(value,invalid,form) {
- if(invalid){
+ onSubmit(value, invalid, form) {
+ if (invalid) {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写必填项','确定',config);
- }else{
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请填写必填项", "确定", config);
+ } else {
// sessionStorage.setItem('buildingTypeId',value.unittype)
- let time =new Date()
+ let time = new Date();
let body = {
id: this.unitinfo.id,
name: this.unitinfo.name,
@@ -974,7 +1060,7 @@ export class BasicinfoLookComponent implements OnInit {
imageUrl: this.imgsrc,
location: {
x: 0,
- y: 0
+ y: 0,
},
modifiedTime: time,
organizationId: this.selectedorganizationid,
@@ -982,1003 +1068,1059 @@ export class BasicinfoLookComponent implements OnInit {
buildingTypes: [
{
id: value.unittype,
- name: this.buildingTypesname
+ name: this.buildingTypesname,
+ },
+ ],
+ };
+ this.http
+ .put(`/api/Companies/${this.unitId}`, body)
+ .subscribe((data: any) => {
+ //修改单位基本信息
+ this.getunitinfo();
+ if (!this.houses.length) {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open(
+ "单位基本信息保存成功,请填写单位建筑模板信息",
+ "确定",
+ config
+ );
+ // alert("单位基本信息保存成功,请填写单位建筑模板信息")
+ let order = 0;
+ let addbody = {
+ //请求创建单位基本信息成功后 直接创建出一个主体建筑模板
+ id: "", //即将要生成具体建筑的id
+ name: "主体建筑",
+ order: order,
+ enabled: true,
+ companyId: this.unitinfo.id,
+ buildingTypes: [
+ {
+ id: value.unittype,
+ name: "",
+ },
+ ],
+ };
+ this.http.post("/api/Buildings", addbody).subscribe((data) => {
+ //首先创建建筑成功了,需要刷出当前建筑类型的模板
+ this.getunitallbuilding();
+ });
+ } else {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("保存成功", "确定", config);
}
- ]
- }
- this.http.put(`/api/Companies/${this.unitId}`,body).subscribe((data:any)=>{ //修改单位基本信息
- this.getunitinfo()
- if(!this.houses.length){
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('单位基本信息保存成功,请填写单位建筑模板信息','确定',config);
- // alert("单位基本信息保存成功,请填写单位建筑模板信息")
- let order = 0
- let addbody = { //请求创建单位基本信息成功后 直接创建出一个主体建筑模板
- id: "",//即将要生成具体建筑的id
- name: "主体建筑",
- order: order,
- enabled: true,
- companyId: this.unitinfo.id,
- buildingTypes: [
- {
- id: value.unittype,
- name: ""
- }
- ]
- }
- this.http.post("/api/Buildings",addbody).subscribe(data=>{//首先创建建筑成功了,需要刷出当前建筑类型的模板
- this.getunitallbuilding()
- })
- }else{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('保存成功','确定',config);
- }
- }),
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写正确信息','确定',config);
- }
+ }),
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请填写正确信息", "确定", config);
+ };
}
-
-
}
- selected:any
+ selected: any;
- isshowrule:boolean = false
- rulevalue:any
- inputchange(e,name,value,item){
+ isshowrule: boolean = false;
+ rulevalue: any;
+ inputchange(e, name, value, item) {
// console.log(e.target.value,name,value,item)
// console.log(item)
- if(name == "≥"){
- if(Number(e.target.value)< Number(value)){
- item.isshowrule = true
- item.rulevalue = `请输入≥${value}的值`
- }else{
- item.isshowrule = false
+ if (name == "≥") {
+ if (Number(e.target.value) < Number(value)) {
+ item.isshowrule = true;
+ item.rulevalue = `请输入≥${value}的值`;
+ } else {
+ item.isshowrule = false;
}
}
- if(name == "≤"){
- if(Number(e.target.value) > Number(value)){
- item.isshowrule = true
- item.rulevalue = `请输入≤${value}的值`
- }else{
- item.isshowrule = false
+ if (name == "≤") {
+ if (Number(e.target.value) > Number(value)) {
+ item.isshowrule = true;
+ item.rulevalue = `请输入≤${value}的值`;
+ } else {
+ item.isshowrule = false;
}
}
- if(name == "Range"){
- let rangenum = value.split(",")
+ if (name == "Range") {
+ let rangenum = value.split(",");
// console.log(rangenum)
- if(Number(e.target.value) < Number(rangenum[0]) || Number(e.target.value) >= Number(rangenum[1])){
- item.isshowrule = true
- item.rulevalue = `请输入位于${Number(rangenum[0])}和${Number(rangenum[1])-1}之间的值`
- }else{
- item.isshowrule = false
+ if (
+ Number(e.target.value) < Number(rangenum[0]) ||
+ Number(e.target.value) >= Number(rangenum[1])
+ ) {
+ item.isshowrule = true;
+ item.rulevalue = `请输入位于${Number(rangenum[0])}和${
+ Number(rangenum[1]) - 1
+ }之间的值`;
+ } else {
+ item.isshowrule = false;
}
}
}
-
+
//切换建筑类型
- templatebuildtype(n ,item,key){
- this.http.get("/api/Buildings",{
- params:{
- companyId:this.unitId
- }
- }).subscribe((data:any)=>{
- this.allBuildings = data
- this.http.put(`/api/Buildings/${item.buildingId}`,{ //修改当前建筑类型
- id: item.buildingId,
- name: item.housename,
- order: this.allBuildings[key].order,
- enabled: true,
- companyId: this.unitinfo.id,
- buildingTypes: [
- {
- id: n.id,
- name: n.name
- }
- ]
- }).subscribe(data=>{
- this.http.get("/api/BuildingBasicInfos",{//请求当前建筑类型的模板信息保存到数组中
- params:{
- companyId :this.unitId,
- buildingId:item.buildingId,
- buildingType:n.id
- }
- }).subscribe(data=>{
- this.getunithouse(data,n,item)
- this.houses[item.index] = data[0]
-
- let _data = data
- this.http.get("/api/BuildingCustomData",{params:{
- buildingId:item.buildingId
- }}).subscribe((data:any)=>{
- _data[0].buildingCustomData = data
- if(data && data.customProperties.length != 0){
- _data[0].isCustomData = true
- }else{
- _data[0].isCustomData = false
- _data[0].buildingCustomData ={
- id: "",
- customProperties: [
- {
- name: "",
- value: ""
- }
- ],
- buildingId: _data[0].buildingId
- }
- }
- })
- })
+ templatebuildtype(n, item, key) {
+ this.http
+ .get("/api/Buildings", {
+ params: {
+ companyId: this.unitId,
+ },
})
- })
-
+ .subscribe((data: any) => {
+ this.allBuildings = data;
+ this.http
+ .put(`/api/Buildings/${item.buildingId}`, {
+ //修改当前建筑类型
+ id: item.buildingId,
+ name: item.housename,
+ order: this.allBuildings[key].order,
+ enabled: true,
+ companyId: this.unitinfo.id,
+ buildingTypes: [
+ {
+ id: n.id,
+ name: n.name,
+ },
+ ],
+ })
+ .subscribe((data) => {
+ this.http
+ .get("/api/BuildingBasicInfos", {
+ //请求当前建筑类型的模板信息保存到数组中
+ params: {
+ companyId: this.unitId,
+ buildingId: item.buildingId,
+ buildingType: n.id,
+ },
+ })
+ .subscribe((data) => {
+ this.getunithouse(data, n, item);
+ this.houses[item.index] = data[0];
+ let _data = data;
+ this.http
+ .get("/api/BuildingCustomData", {
+ params: {
+ buildingId: item.buildingId,
+ },
+ })
+ .subscribe((data: any) => {
+ _data[0].buildingCustomData = data;
+ if (data && data.customProperties.length != 0) {
+ _data[0].isCustomData = true;
+ } else {
+ _data[0].isCustomData = false;
+ _data[0].buildingCustomData = {
+ id: "",
+ customProperties: [
+ {
+ name: "",
+ value: "",
+ },
+ ],
+ buildingId: _data[0].buildingId,
+ };
+ }
+ });
+ });
+ });
+ });
}
- deviceinfo=[] //用于存储石头化工的第一个表格
+ deviceinfo = []; //用于存储石头化工的第一个表格
//提交单位模板信息
- onSubmit2(value,item,key,invalid){
- this.http.get("/api/Buildings",{
- params:{
- companyId:this.unitId
- }
- }).subscribe((data:any)=>{
- this.allBuildings = data
- if(invalid){
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写必填项','确定',config);
- }else{
- this.http.put(`/api/Buildings/${item.buildingId}`,{ //(通用)只修改建筑名称和建筑类型
- id: item.buildingId,
- name: value.housename,
- order: this.allBuildings[key].order,
- enabled: true,
- companyId: this.unitinfo.id,
- buildingTypes: [
- {
- id: item.buildingtypeId,
- name: item.buildtype
- }
- ]
- }).subscribe((data:any)=>{
- this.houses[item.index].username = item.name
+ onSubmit2(value, item, key, invalid) {
+ this.http
+ .get("/api/Buildings", {
+ params: {
+ companyId: this.unitId,
},
- err=>{
- alert("名称和类型保存失败")
- })
-
- if(value.checkbuilding){//如果勾选了自定义信息的checkbox
- var CustomDataval = []
- for (const key in value) {
- if (key.indexOf("CustomData") != -1) {
- CustomDataval.push(value[key])
- }
- }
- let newCustomData = this.FunData(CustomDataval)
- let newCustomDataval = []
- newCustomData.forEach(n=>{
- newCustomDataval.push({
- name:n[0],
- value:n[1]
- })
- })
- let CustomDatabody = {
- id: "",
- customProperties: newCustomDataval,
- buildingId: item.buildingId
- }
- this.http.post("/api/BuildingCustomData",CustomDatabody,{params:{
- buildingId:item.buildingId
- }}).subscribe(data=>{
-
- },
- err=>{
- alert("自定义信息保存失败")
- })
- }else{
- let CustomDatabody = {
- id: "",
- customProperties: [],
- buildingId: item.buildingId
- }
- this.http.post("/api/BuildingCustomData",CustomDatabody,{params:{
- buildingId:item.buildingId
- }}).subscribe(data=>{
-
- },
- err=>{
- alert("自定义信息保存失败")
- })
- }
-
-
- if(item.buildtype != "石油化工类" && item.buildtype != "地铁类"){
- // console.log(this.houses[key])
- // console.log(value)
- this.houses[key].buildingBasicGroups[0].propertyInfos.forEach(item => {
-
- if(item.propertyValue || item.propertyValue == 0){
- // item.propertyValue = "" + value[key]
- item.propertyValue = String(item.propertyValue)
- }
-
- });
- let newObj = _.cloneDeep(this.houses[key]) //把数据深拷贝取出来进行操作
- newObj.buildingBasicGroups[0].buildingId = item.buildingId
- newObj.buildingBasicGroups[0].companyId = this.unitinfo.id
- newObj.buildingBasicGroups[0].submitted = true //把是否提交过变为true
- delete newObj.name
- delete newObj.username
- delete newObj.buildtype
- delete newObj.tongyong
- delete newObj.index
- delete newObj.isCustomData
- delete newObj.buildingCustomData
- newObj.buildingBasicGroups[0].propertyInfos.forEach(item => {
- delete item.isshowrule
- delete item.rulevalue
- });
-
- let body = newObj
- let newbody = []
- newbody.push(body)
- if(newbody[0].buildingBasicGroups.length){
- this.http.post("/api/BuildingBasicInfos",newbody,{
- params:{
- companyId : this.unitId,
- buildingId :newbody[0].buildingId
- }
- }).subscribe((data:any)=>{
- this.houses[key].id = data[0].id
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('建筑信息保存成功','确定',config);
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请检查输入数据是否有误','确定',config);
+ })
+ .subscribe((data: any) => {
+ this.allBuildings = data;
+ if (invalid) {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请填写必填项", "确定", config);
+ } else {
+ this.http
+ .put(`/api/Buildings/${item.buildingId}`, {
+ //(通用)只修改建筑名称和建筑类型
+ id: item.buildingId,
+ name: value.housename,
+ order: this.allBuildings[key].order,
+ enabled: true,
+ companyId: this.unitinfo.id,
+ buildingTypes: [
+ {
+ id: item.buildingtypeId,
+ name: item.buildtype,
+ },
+ ],
})
- }
- }
- if(item.buildtype == "石油化工类"){
- // console.log(888,item)
- let bodyObj = _.cloneDeep(item)
- delete bodyObj.name
- delete bodyObj.username
- delete bodyObj.isshiyou
- delete bodyObj.newzhuangzhiinfodatasource
- delete bodyObj.tongyong
- delete bodyObj.buildtype
- delete bodyObj.buildingtypeId
- delete bodyObj.bigfor
- delete bodyObj.index
- delete bodyObj.isCustomData
- delete bodyObj.buildingCustomData
- // console.log(456,bodyObj)
- bodyObj.buildingBasicGroups[0].propertyInfos.forEach(item => {
- delete item.isshowrule
- delete item.rulevalue
- });
- //修改基本信息
- bodyObj.buildingBasicGroups[0].propertyInfos.forEach(item => {
- for (const key in value) {
- if (item.propertyName == key) {
- if(item.propertyValue || item.propertyValue == 0){
- // item.propertyValue = "" + value[key]
- item.propertyValue = String(value[key])
+ .subscribe(
+ (data: any) => {
+ this.houses[item.index].username = item.name;
+ },
+ (err) => {
+ alert("名称和类型保存失败");
}
-
+ );
+
+ if (value.checkbuilding) {
+ //如果勾选了自定义信息的checkbox
+ var CustomDataval = [];
+ for (const key in value) {
+ if (key.indexOf("CustomData") != -1) {
+ CustomDataval.push(value[key]);
}
}
- });
- bodyObj.buildingBasicGroups[0].submitted = true
- bodyObj.buildingBasicGroups[0].buildingId = item.buildingId
- bodyObj.buildingBasicGroups[0].companyId = this.unitinfo.id
- //石油化工类的 装置信息 就提交这个表单——————————————————————————————this.deviceinfo 记得清空
- // console.log(this.deviceinfodata)
- if(bodyObj.buildingBasicGroups[1].submitted){ //如果用户点击了并填写了装置信息就提交这个表格数据
- this.deviceinfo = []
- item.newzhuangzhiinfodatasource.forEach((element,index) => {
- this.deviceinfo.push({
- propertyName: "装置区名称",
- propertyValue: element.name,
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
+ let newCustomData = this.FunData(CustomDataval);
+ let newCustomDataval = [];
+ newCustomData.forEach((n) => {
+ newCustomDataval.push({
+ name: n[0],
+ value: n[1],
+ });
+ });
+ let CustomDatabody = {
+ id: "",
+ customProperties: newCustomDataval,
+ buildingId: item.buildingId,
+ };
+ this.http
+ .post("/api/BuildingCustomData", CustomDatabody, {
+ params: {
+ buildingId: item.buildingId,
+ },
+ })
+ .subscribe(
+ (data) => {},
+ (err) => {
+ alert("自定义信息保存失败");
+ }
+ );
+ } else {
+ let CustomDatabody = {
+ id: "",
+ customProperties: [],
+ buildingId: item.buildingId,
+ };
+ this.http
+ .post("/api/BuildingCustomData", CustomDatabody, {
+ params: {
+ buildingId: item.buildingId,
+ },
+ })
+ .subscribe(
+ (data) => {},
+ (err) => {
+ alert("自定义信息保存失败");
+ }
+ );
+ }
+
+ if (item.buildtype != "石油化工类" && item.buildtype != "地铁类") {
+ // console.log(this.houses[key])
+ // console.log(value)
+ this.houses[key].buildingBasicGroups[0].propertyInfos.forEach(
+ (item) => {
+ if (item.propertyValue || item.propertyValue == 0) {
+ // item.propertyValue = "" + value[key]
+ item.propertyValue = String(item.propertyValue);
+ }
+ }
+ );
+ let newObj = _.cloneDeep(this.houses[key]); //把数据深拷贝取出来进行操作
+ newObj.buildingBasicGroups[0].buildingId = item.buildingId;
+ newObj.buildingBasicGroups[0].companyId = this.unitinfo.id;
+ newObj.buildingBasicGroups[0].submitted = true; //把是否提交过变为true
+ delete newObj.name;
+ delete newObj.username;
+ delete newObj.buildtype;
+ delete newObj.tongyong;
+ delete newObj.index;
+ delete newObj.isCustomData;
+ delete newObj.buildingCustomData;
+ newObj.buildingBasicGroups[0].propertyInfos.forEach((item) => {
+ delete item.isshowrule;
+ delete item.rulevalue;
+ });
+
+ let body = newObj;
+ let newbody = [];
+ newbody.push(body);
+ if (newbody[0].buildingBasicGroups.length) {
+ this.http
+ .post("/api/BuildingBasicInfos", newbody, {
+ params: {
+ companyId: this.unitId,
+ buildingId: newbody[0].buildingId,
+ },
+ })
+ .subscribe(
+ (data: any) => {
+ this.houses[key].id = data[0].id;
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("建筑信息保存成功", "确定", config);
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open(
+ "请检查输入数据是否有误",
+ "确定",
+ config
+ );
+ }
+ );
+ }
+ }
+ if (item.buildtype == "石油化工类") {
+ // console.log(888,item)
+ let bodyObj = _.cloneDeep(item);
+ delete bodyObj.name;
+ delete bodyObj.username;
+ delete bodyObj.isshiyou;
+ delete bodyObj.newzhuangzhiinfodatasource;
+ delete bodyObj.tongyong;
+ delete bodyObj.buildtype;
+ delete bodyObj.buildingtypeId;
+ delete bodyObj.bigfor;
+ delete bodyObj.index;
+ delete bodyObj.isCustomData;
+ delete bodyObj.buildingCustomData;
+ // console.log(456,bodyObj)
+ bodyObj.buildingBasicGroups[0].propertyInfos.forEach((item) => {
+ delete item.isshowrule;
+ delete item.rulevalue;
+ });
+ //修改基本信息
+ bodyObj.buildingBasicGroups[0].propertyInfos.forEach((item) => {
+ for (const key in value) {
+ if (item.propertyName == key) {
+ if (item.propertyValue || item.propertyValue == 0) {
+ // item.propertyValue = "" + value[key]
+ item.propertyValue = String(value[key]);
+ }
+ }
+ }
+ });
+ bodyObj.buildingBasicGroups[0].submitted = true;
+ bodyObj.buildingBasicGroups[0].buildingId = item.buildingId;
+ bodyObj.buildingBasicGroups[0].companyId = this.unitinfo.id;
+ //石油化工类的 装置信息 就提交这个表单——————————————————————————————this.deviceinfo 记得清空
+ // console.log(this.deviceinfodata)
+ if (bodyObj.buildingBasicGroups[1].submitted) {
+ //如果用户点击了并填写了装置信息就提交这个表格数据
+ this.deviceinfo = [];
+ item.newzhuangzhiinfodatasource.forEach((element, index) => {
+ this.deviceinfo.push(
+ {
+ propertyName: "装置区名称",
+ propertyValue: element.name,
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(index + 1),
+ },
+ {
+ propertyName: "工艺流程",
+ propertyValue: element.flow,
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 1,
+ enabled: true,
+ visible: true,
+ tag: String(index + 1),
+ },
+ {
+ propertyName: "火灾危险性",
+ propertyValue: element.danger,
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 2,
+ enabled: true,
+ visible: true,
+ tag: String(index + 1),
+ },
+ {
+ propertyName: "灭火注意事项",
+ propertyValue: element.payattentionto,
+ propertyType: 1,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 3,
+ enabled: true,
+ visible: true,
+ tag: String(index + 1),
+ }
+ );
+ });
+ } else {
+ //否则就传一个空的
+ this.deviceinfo = [
+ {
+ propertyName: "装置区名称",
+ propertyValue: "",
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
physicalUnit: "",
- order:0,
+ order: 0,
enabled: true,
visible: true,
- tag: String(index + 1)
- },
- {
+ tag: "1",
+ },
+ {
propertyName: "工艺流程",
- propertyValue: element.flow,
+ propertyValue: "",
propertyType: 0,
required: true,
ruleName: "",
ruleValue: "",
physicalUnit: "",
- order:1,
+ order: 0,
enabled: true,
visible: true,
- tag: String(index + 1)
- },
- {
+ tag: "1",
+ },
+ {
propertyName: "火灾危险性",
- propertyValue: element.danger,
+ propertyValue: "",
propertyType: 0,
required: true,
ruleName: "",
ruleValue: "",
physicalUnit: "",
- order:2,
+ order: 0,
enabled: true,
visible: true,
- tag: String(index + 1)
- },
- {
+ tag: "1",
+ },
+ {
propertyName: "灭火注意事项",
- propertyValue: element.payattentionto,
+ propertyValue: "",
propertyType: 1,
required: false,
ruleName: "",
ruleValue: "",
physicalUnit: "",
- order:3,
+ order: 0,
enabled: true,
visible: true,
- tag: String(index + 1)
- })
- });
- }else{//否则就传一个空的
- this.deviceinfo = [
- {
- propertyName: "装置区名称",
- propertyValue: "",
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag: "1"
- },
- {
- propertyName: "工艺流程",
- propertyValue: "",
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag: "1"
- },
- {
- propertyName: "火灾危险性",
- propertyValue: "",
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag: "1"
- },
- {
- propertyName: "灭火注意事项",
- propertyValue: "",
- propertyType: 1,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag: "1"
+ tag: "1",
+ },
+ ];
}
- ]
- }
- bodyObj.buildingBasicGroups[1].propertyInfos = this.deviceinfo
- bodyObj.buildingBasicGroups[1].buildingId = item.buildingId
- bodyObj.buildingBasicGroups[1].companyId = this.unitinfo.id
-
-
- if(bodyObj.buildingBasicGroups[2].submitted){ //如果勾选了储罐信息 则直接提交当前bodyObj
- var map = {}; //用于存储石油化工要提交的储罐信息表单
- for (let key in value) {
- if (key.indexOf('tanker') != -1) {
- const list = key.split('-'); // 2,tanker,1
- const orderKey = list[0]; // 2 or 3
- if (!(orderKey in map)) {
+ bodyObj.buildingBasicGroups[1].propertyInfos = this.deviceinfo;
+ bodyObj.buildingBasicGroups[1].buildingId = item.buildingId;
+ bodyObj.buildingBasicGroups[1].companyId = this.unitinfo.id;
+
+ if (bodyObj.buildingBasicGroups[2].submitted) {
+ //如果勾选了储罐信息 则直接提交当前bodyObj
+ var map = {}; //用于存储石油化工要提交的储罐信息表单
+ for (let key in value) {
+ if (key.indexOf("tanker") != -1) {
+ const list = key.split("-"); // 2,tanker,1
+ const orderKey = list[0]; // 2 or 3
+ if (!(orderKey in map)) {
map[orderKey] = []; // map[2] or map[3] = [];
+ }
+ map[orderKey][list[2]] = value[key]; // map[2][1] = xxxxx
}
- map[orderKey][list[2]] = value[key]; // map[2][1] = xxxxx
}
- }
-
- bodyObj.buildingBasicGroups.splice( 2 , bodyObj.buildingBasicGroups.length)
-
- // console.log(123, item)
-
- let basictankinfobody:any = {}
-
- for(let key in map){//------------------------------------------------------------石油化工 储罐信息
-
-
- basictankinfobody = {
- id: null,
- name: "罐区" + (Number(key)-1),
- type: 0,
- addMode: 2,
- basicGroupId:'',
- submitted:true,
- isOptional:true,
- order: Number(key),
- enabled: true,
- propertyInfos: item.bigfor[Number(key)-2][0].propertyInfos,
- basicCategoryId: item.basicCategoryId,
- buildingBasicId: null,
- buildingId: item.buildingId,//当前建筑id
- companyId: this.unitinfo.id//当前企业id
- }
-
- bodyObj.buildingBasicGroups.push(basictankinfobody)
- }
-
-
- let basictankchildinfobody:any = []//-------------后续储罐信息以及储罐信息/罐区情况都push到这个数组中
- item.bigfor.forEach(item => {
- basictankchildinfobody.push(item[1].propertyInfos)
- });
- var _item = item
- basictankchildinfobody.forEach((item,index) => {
- let tankfieldArr = []
- item.forEach((element,key) => {
- tankfieldArr.push(
+
+ bodyObj.buildingBasicGroups.splice(
+ 2,
+ bodyObj.buildingBasicGroups.length
+ );
+
+ // console.log(123, item)
+
+ let basictankinfobody: any = {};
+
+ for (let key in map) {
+ //------------------------------------------------------------石油化工 储罐信息
+
+ basictankinfobody = {
+ id: null,
+ name: "罐区" + (Number(key) - 1),
+ type: 0,
+ addMode: 2,
+ basicGroupId: "",
+ submitted: true,
+ isOptional: true,
+ order: Number(key),
+ enabled: true,
+ propertyInfos: item.bigfor[Number(key) - 2][0].propertyInfos,
+ basicCategoryId: item.basicCategoryId,
+ buildingBasicId: null,
+ buildingId: item.buildingId, //当前建筑id
+ companyId: this.unitinfo.id, //当前企业id
+ };
+
+ bodyObj.buildingBasicGroups.push(basictankinfobody);
+ }
+
+ let basictankchildinfobody: any = []; //-------------后续储罐信息以及储罐信息/罐区情况都push到这个数组中
+ item.bigfor.forEach((item) => {
+ basictankchildinfobody.push(item[1].propertyInfos);
+ });
+ var _item = item;
+ basictankchildinfobody.forEach((item, index) => {
+ let tankfieldArr = [];
+ item.forEach((element, key) => {
+ tankfieldArr.push(
+ {
+ propertyName: "罐区",
+ propertyValue: element.tank,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "储罐编号",
+ propertyValue: element.tankid,
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "储存介质",
+ propertyValue: element.tankmedium,
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "储罐类型",
+ propertyValue: element.tanktype,
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "容量",
+ propertyValue: element.tankcapacity,
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "㎡",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "直径",
+ propertyValue: element.tankdiameter,
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "m",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "高度",
+ propertyValue: element.tankheight,
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "m",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "顶盖形式",
+ propertyValue: element.tanktectum,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "浮盘材质",
+ propertyValue: element.tanktexture,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "浮盘类型",
+ propertyValue: element.platetype,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "泡沫产生器型号",
+ propertyValue: element.foamgeneratorid,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "泡沫产生器形式",
+ propertyValue: element.foamgeneratortype,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "是否设置氮封惰化保护装置",
+ propertyValue: element.isprotect,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "防护堤高度",
+ propertyValue: element.fendinggroyneheight,
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "m",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "半固定泡沫灭火接口数量",
+ propertyValue: element.portnum,
+ propertyType: 2,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "个",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ },
+ {
+ propertyName: "其它设施",
+ propertyValue: element.else,
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: String(key + 1),
+ }
+ );
+ });
+ basictankchildinfobody = {
+ //
+ id: null,
+ name: "罐区" + Number(index + 1) + "/储罐信息",
+ type: 1,
+ addMode: 2,
+ basicGroupId: "",
+ order: Number(index + 2),
+ enabled: true,
+ submitted: true,
+ isOptional: true,
+ propertyInfos: tankfieldArr,
+ basicCategoryId: _item.basicCategoryId,
+ buildingBasicId: null,
+ buildingId: _item.buildingId,
+ companyId: this.unitinfo.id,
+ };
+ bodyObj.buildingBasicGroups.push(basictankchildinfobody);
+ });
+ } else {
+ bodyObj.buildingBasicGroups[2].buildingId = item.buildingId;
+ bodyObj.buildingBasicGroups[2].companyId = this.unitinfo.id;
+ bodyObj.buildingBasicGroups[2].propertyInfos.forEach((item) => {
+ item.propertyValue = "";
+ });
+ bodyObj.buildingBasicGroups[3].buildingId = item.buildingId;
+ bodyObj.buildingBasicGroups[3].companyId = this.unitinfo.id;
+ bodyObj.buildingBasicGroups[3].propertyInfos = [
{
- propertyName: "罐区",
- propertyValue: element.tank,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "罐区",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "储罐编号",
- propertyValue: element.tankid,
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "储罐编号",
+ propertyValue: "",
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "储存介质",
- propertyValue: element.tankmedium,
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "储存介质",
+ propertyValue: "",
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "储罐类型",
- propertyValue: element.tanktype,
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "储罐类型",
+ propertyValue: "",
+ propertyType: 0,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "容量",
- propertyValue: element.tankcapacity,
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "㎡",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "容量",
+ propertyValue: "",
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "㎡",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "直径",
- propertyValue:element.tankdiameter,
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "m",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "直径",
+ propertyValue: "",
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "m",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "高度",
- propertyValue: element.tankheight,
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "m",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "高度",
+ propertyValue: "",
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "m",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "顶盖形式",
- propertyValue: element.tanktectum,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "顶盖形式",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "浮盘材质",
- propertyValue: element.tanktexture,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "浮盘材质",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "浮盘类型",
- propertyValue: element.platetype,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "浮盘类型",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "泡沫产生器型号",
- propertyValue: element.foamgeneratorid,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "泡沫产生器型号",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "泡沫产生器形式",
- propertyValue: element.foamgeneratortype,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "泡沫产生器形式",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "是否设置氮封惰化保护装置",
- propertyValue: element.isprotect,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "是否设置氮封惰化保护装置",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "防护堤高度",
- propertyValue: element.fendinggroyneheight,
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "m",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "防护堤高度",
+ propertyValue: "",
+ propertyType: 2,
+ required: true,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "m",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "半固定泡沫灭火接口数量",
- propertyValue: element.portnum,
- propertyType: 2,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "个",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
+ propertyName: "半固定泡沫灭火接口数量",
+ propertyValue: "",
+ propertyType: 2,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "个",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
},
{
- propertyName: "其它设施",
- propertyValue: element.else,
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:String(key + 1)
- }
- )
- });
- basictankchildinfobody={//
- id: null,
- name: "罐区" + Number(index+1) + "/储罐信息",
- type: 1,
- addMode: 2,
- basicGroupId:'',
- order: Number(index + 2),
- enabled: true,
- submitted:true,
- isOptional:true,
- propertyInfos: tankfieldArr,
- basicCategoryId: _item.basicCategoryId,
- buildingBasicId: null,
- buildingId: _item.buildingId,
- companyId: this.unitinfo.id
- }
- bodyObj.buildingBasicGroups.push(basictankchildinfobody)
- });
- }else{
-
-
- bodyObj.buildingBasicGroups[2].buildingId = item.buildingId
- bodyObj.buildingBasicGroups[2].companyId = this.unitinfo.id
- bodyObj.buildingBasicGroups[2].propertyInfos.forEach(item=>{
- item.propertyValue = ""
- })
- bodyObj.buildingBasicGroups[3].buildingId = item.buildingId
- bodyObj.buildingBasicGroups[3].companyId = this.unitinfo.id
- bodyObj.buildingBasicGroups[3].propertyInfos = [
- {
- propertyName: "罐区",
- propertyValue: "",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "储罐编号",
- propertyValue: "",
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "储存介质",
- propertyValue: "",
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "储罐类型",
- propertyValue:"",
- propertyType: 0,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "容量",
- propertyValue: "",
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "㎡",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "直径",
- propertyValue:"",
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "m",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "高度",
- propertyValue: "",
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "m",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "顶盖形式",
- propertyValue: "",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "浮盘材质",
- propertyValue:"",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "浮盘类型",
- propertyValue: "",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "泡沫产生器型号",
- propertyValue:"",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "泡沫产生器形式",
- propertyValue: "",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "是否设置氮封惰化保护装置",
- propertyValue:"",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "防护堤高度",
- propertyValue:"",
- propertyType: 2,
- required: true,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "m",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "半固定泡沫灭火接口数量",
- propertyValue: "",
- propertyType: 2,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "个",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
- },
- {
- propertyName: "其它设施",
- propertyValue: "",
- propertyType: 0,
- required: false,
- ruleName: "",
- ruleValue: "",
- physicalUnit: "",
- order: 0,
- enabled: true,
- visible: true,
- tag:"1"
+ propertyName: "其它设施",
+ propertyValue: "",
+ propertyType: 0,
+ required: false,
+ ruleName: "",
+ ruleValue: "",
+ physicalUnit: "",
+ order: 0,
+ enabled: true,
+ visible: true,
+ tag: "1",
+ },
+ ];
+ // console.log(888,bodyObj)
+ bodyObj.buildingBasicGroups.splice(
+ 4,
+ bodyObj.buildingBasicGroups.length
+ );
}
- ]
- // console.log(888,bodyObj)
- bodyObj.buildingBasicGroups.splice(4,bodyObj.buildingBasicGroups.length)
- }
-
-
-
- let newbodyObj = []
- newbodyObj.push(bodyObj)
- // console.log(1111,newbodyObj)
- this.http.post("/api/BuildingBasicInfos",newbodyObj,{
- params:{
- companyId : this.unitId,
- buildingId :item.buildingId
+
+ let newbodyObj = [];
+ newbodyObj.push(bodyObj);
+ // console.log(1111,newbodyObj)
+ this.http
+ .post("/api/BuildingBasicInfos", newbodyObj, {
+ params: {
+ companyId: this.unitId,
+ buildingId: item.buildingId,
+ },
+ })
+ .subscribe(
+ (data: any) => {
+ this.houses[key].id = data[0].id;
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("建筑信息保存成功", "确定", config);
+ // alert("建筑信息保存成功")
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请检查输入数据是否有误", "确定", config);
+ }
+ );
}
- }).subscribe((data:any)=>{
- this.houses[key].id = data[0].id
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('建筑信息保存成功','确定',config);
- // alert("建筑信息保存成功")
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请检查输入数据是否有误','确定',config);
- })
- }
- if(item.buildtype == "地铁类"){
- let newObj = _.cloneDeep(item)
- delete newObj.username
- delete newObj.name
- delete newObj.tongyong
- delete newObj.ditie
- delete newObj.buildtype
- delete newObj.isCustomData
- delete newObj.buildingCustomData
- newObj.buildingBasicGroups.forEach(item => {
- item.propertyInfos.forEach(element => {
- delete element.isshowrule
- delete element.rulevalue
- if( element.propertyValue || element.propertyValue == 0){
- element.propertyValue = String(element.propertyValue)
- }
+ if (item.buildtype == "地铁类") {
+ let newObj = _.cloneDeep(item);
+ delete newObj.username;
+ delete newObj.name;
+ delete newObj.tongyong;
+ delete newObj.ditie;
+ delete newObj.buildtype;
+ delete newObj.isCustomData;
+ delete newObj.buildingCustomData;
+ newObj.buildingBasicGroups.forEach((item) => {
+ item.propertyInfos.forEach((element) => {
+ delete element.isshowrule;
+ delete element.rulevalue;
+ if (element.propertyValue || element.propertyValue == 0) {
+ element.propertyValue = String(element.propertyValue);
+ }
+ });
+ item.buildingId = newObj.buildingId;
+ item.companyId = this.unitinfo.id;
+ item.submitted = true;
});
- item.buildingId = newObj.buildingId
- item.companyId = this.unitinfo.id
- item.submitted = true
- });
- let newbodyObj2 = []
- newbodyObj2.push(newObj)
- this.http.post("/api/BuildingBasicInfos",newbodyObj2,{
- params:{
- companyId : this.unitId,
- buildingId :newObj.buildingId
- }
- }).subscribe((data:any)=>{
- this.houses[key].id = data[0].id
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('建筑信息保存成功','确定',config);
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请检查输入数据是否有误','确定',config);
- })
-
+ let newbodyObj2 = [];
+ newbodyObj2.push(newObj);
+ this.http
+ .post("/api/BuildingBasicInfos", newbodyObj2, {
+ params: {
+ companyId: this.unitId,
+ buildingId: newObj.buildingId,
+ },
+ })
+ .subscribe(
+ (data: any) => {
+ this.houses[key].id = data[0].id;
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("建筑信息保存成功", "确定", config);
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请检查输入数据是否有误", "确定", config);
+ }
+ );
+ }
}
- }
- })
-
-
- }}
\ No newline at end of file
+ });
+ }
+}
diff --git a/src/app/ui/dangerous/dangerous.component.html b/src/app/ui/dangerous/dangerous.component.html
index 1de8f49..c5cffc4 100644
--- a/src/app/ui/dangerous/dangerous.component.html
+++ b/src/app/ui/dangerous/dangerous.component.html
@@ -5,22 +5,22 @@
volume_up
-
-
-
- settings_voice
-
-
- 按住说话
+
-
-
search
+
+
+ settings_voice
+
+
+ 按住说话
+
+
+ search
+
-
@@ -28,7 +28,8 @@
-
{{item.name}}
+
{{item.name}}
@@ -51,11 +52,11 @@
-
+
-
+
-
{{detailNode.name}}
+
{{detailNode.name}}
x
@@ -68,9 +69,9 @@
储运注意事项
-
+
-
+
\ No newline at end of file
diff --git a/src/app/ui/data-push/data-push.component.ts b/src/app/ui/data-push/data-push.component.ts
index bda71aa..1748b01 100644
--- a/src/app/ui/data-push/data-push.component.ts
+++ b/src/app/ui/data-push/data-push.component.ts
@@ -1,30 +1,29 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit } from "@angular/core";
@Component({
- selector: 'app-data-push',
- templateUrl: './data-push.component.html',
- styleUrls: ['./data-push.component.scss']
+ selector: "app-data-push",
+ templateUrl: "./data-push.component.html",
+ styleUrls: ["./data-push.component.scss"],
})
export class DataPushComponent implements OnInit {
+ constructor() {}
- constructor() { }
-
- ngOnInit(): void {
-
- }
+ ngOnInit(): void {}
//路由配置
- routers:any = [
- {name:'基本信息', url: '/ui/plan/basicInfo'},
- {name:'平面图', url: '/ui/plan/planarGraph',id:'B56498312911454698'},
- {name:'四周毗邻', url: '/ui/plan/allaround'},
- {name:'消防设施', url: '/ui/plan/fire-fighting-device'},
- {name:'重点部位', url: '/ui/plan/key-site'},
- {name:'功能分区', url: '/ui/plan/FunctionDivisionLookComponent'},
- {name:'实景图', url: '/ui/plan/realistic-picture'},
- {name:'上传CAD', url: '/ui/plan/UploadingCADLookComponent'}
- ]
- open3D(){
- window.open("http://121.37.20.190:8088/%5B%E7%BD%91%E9%A1%B5%E7%89%88%5D%E8%B4%B5%E6%B8%AF%E6%B2%B9%E5%BA%93%E4%B8%89%E7%BB%B4%E7%81%AD%E7%81%AB%E9%A2%84%E6%A1%88/")
+ routers: any = [
+ { name: "基本信息", url: "/ui/plan/basicInfo" },
+ { name: "平面图", url: "/ui/plan/planarGraph", id: "168541740680000000" },
+ { name: "四周毗邻", url: "/ui/plan/allaround" },
+ { name: "消防设施", url: "/ui/plan/fire-fighting-device" },
+ { name: "重点部位", url: "/ui/plan/key-site" },
+ { name: "功能分区", url: "/ui/plan/FunctionDivisionLookComponent" },
+ { name: "实景图", url: "/ui/plan/realistic-picture" },
+ { name: "上传CAD", url: "/ui/plan/UploadingCADLookComponent" },
+ ];
+ open3D() {
+ window.open(
+ "http://123.60.214.242:10045/GuiGang/[%E7%BD%91%E9%A1%B5%E7%89%88]%E8%B4%B5%E6%B8%AF%E6%B2%B9%E5%BA%93%E4%B8%89%E7%BB%B4%E7%81%AD%E7%81%AB%E9%A2%84%E6%A1%88/index.html"
+ );
}
}
diff --git a/src/app/ui/plan-assistance/plan-assistance.component.html b/src/app/ui/plan-assistance/plan-assistance.component.html
index e2a1611..be6435a 100644
--- a/src/app/ui/plan-assistance/plan-assistance.component.html
+++ b/src/app/ui/plan-assistance/plan-assistance.component.html
@@ -12,13 +12,13 @@
{{item.Name}}
{{item.FireTeamName}}
- 已到场
-
+ 已到场
0">
-
-->
+
@@ -27,13 +27,13 @@
{{item.Name}}
{{item.FireTeamName}}
- 已到场
-
+ 已到场
0">
-
-->
+
diff --git a/src/app/ui/real-cases/real-cases.component.html b/src/app/ui/real-cases/real-cases.component.html
index f851039..891603b 100644
--- a/src/app/ui/real-cases/real-cases.component.html
+++ b/src/app/ui/real-cases/real-cases.component.html
@@ -1,91 +1,94 @@