From 9d0d2b2e7ac29722f4c09b24fa6d171e2423be7e Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Sun, 27 Sep 2020 18:20:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basicinfo-look/basicinfo.component.html | 511 +++++ .../basicinfo-look/basicinfo.component.scss | 271 +++ .../ui/basicinfo-look/basicinfo.component.ts | 1974 +++++++++++++++++ .../basicinfo-look/lookmaster.component.html | 17 + .../ui/basicinfo-look/lookmaster.component.ts | 66 + src/app/ui/data-push/data-push.component.scss | 6 +- src/app/ui/data-push/data-push.component.ts | 2 +- src/app/ui/ui-routing.module.ts | 2 + src/app/ui/ui.module.ts | 4 +- 9 files changed, 2850 insertions(+), 3 deletions(-) create mode 100644 src/app/ui/basicinfo-look/basicinfo.component.html create mode 100644 src/app/ui/basicinfo-look/basicinfo.component.scss create mode 100644 src/app/ui/basicinfo-look/basicinfo.component.ts create mode 100644 src/app/ui/basicinfo-look/lookmaster.component.html create mode 100644 src/app/ui/basicinfo-look/lookmaster.component.ts diff --git a/src/app/ui/basicinfo-look/basicinfo.component.html b/src/app/ui/basicinfo-look/basicinfo.component.html new file mode 100644 index 0000000..61556ec --- /dev/null +++ b/src/app/ui/basicinfo-look/basicinfo.component.html @@ -0,0 +1,511 @@ +
+ + + + + + 单位信息 + keyboard_arrow_down + + +
+
+
+
+
+ * + 统一社会信用代码: + + + +
+
+ 统一社会信用代码格式不正确 +
+
+
+
+ * + 单位类型: + + + {{item.name}} + + +
+
+ * + 联系人: + + + +
+
+ * + 联系电话: + + + +
+
+ 电话号码格式不正确 +
+
+
+
+ * + 辖区中队: + + + +
+ +
+ * + 单位地址: + + + +
+
+ 单位照片: +
+ +
+ +
+ + +
+ + + +
+
+
+
+
+ + + +
+
+ + + +
+ + +
+
+ 建筑名称: + + + + * +
+
+ 建筑类型: + + + {{n.name}} + + + * +
+ +
+

{{item.name}}

+
+ {{i.propertyName}}({{i.physicalUnit}}) + + + + + + + + + + + + + + + + * +
+ {{i.rulevalue}} +
+
+
+ +
+ +

自定义信息

+
+
+ +
+ + + + : + + + + * +
+
+
+ + +
+ +
+
+ 建筑名称: + + + + * +
+
+ 建筑类型: + + + {{n.name}} + + + * +
+

{{item.buildingBasicGroups[0].name}}

+
+ {{i.propertyName}} ({{i.physicalUnit}}) + + + + + + + + + + + + + + + + * +
+ {{i.rulevalue}} +
+
+
+ + +
+
+ +

{{item.buildingBasicGroups[1].name}}

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + 装置区名称* + + 工艺流程* + + 火灾危险性* + + 灭火注意事项 + +
+
+ +
+ +

储罐信息

+
+ + + + +
+
+

{{x[0].name}}

+
+
+ {{i.propertyName}} {{i.physicalUnit}}: + + + + + * +
+ +
+

{{x[1].name}}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 罐区 + + 罐区编号* + + 储存介质* + + 储罐类型* + + 容量(m³)* + + 直径(m)* + + 高度(m)* + + 顶盖形式 + + 浮盘材质 + + 浮盘类型 + + 泡沫产生器型号 + + 泡沫产生器形式 + + 是否设置氮封惰化保护装置 + + 防护堤高度(m)* + + 半固定泡沫灭火接口数量 + + 其它设施 + +
+
+
+
+ + +
+ +

自定义信息

+
+
+ + +
+ + + + : + + + + * +
+
+ +
+ + + + +
+
+ +
+ +
+ +
+ +
+ + + + + + + + + diff --git a/src/app/ui/basicinfo-look/basicinfo.component.scss b/src/app/ui/basicinfo-look/basicinfo.component.scss new file mode 100644 index 0000000..658074b --- /dev/null +++ b/src/app/ui/basicinfo-look/basicinfo.component.scss @@ -0,0 +1,271 @@ +.topbox{ + height: 485px; + width: 100%; + color: white; + // border-bottom: 1px solid black; + input{ + color: white; + } + .mainbox{ + height: 100%; + position: relative; + .mainleft{ + width:800px; + height: 100%; + float: left; + .inputbox{ + width: 343px; + height: 58px; + margin:2px 6px; + float: left; + text-align: end; + } + .organizationbox{ + width:538px; + height: 200px; + // background: white; + position: absolute; + top: 164px; + left:166px; + z-index: 100; + border: 1px solid grey; + overflow: auto; + li{ + list-style: none; + + } + mat-tree-node{ + cursor: pointer; + } + mat-tree-node:hover{ + background: rgba(225, 225, 225, 0.8); + } + } + .addbtn{ + width: 695px; + position: absolute; + bottom: -495px; + text-align: center; + margin-bottom:20px; + button{ + margin: 0 4px; + } + } + .uploadimg{ + width: 400px; + height: 200px; + float: left; + margin-top:12px; + position: relative; + margin-left: 80px; + cursor: pointer; + span{ + float: left; + } + // img{ + // float: left; + // } + .uploadingimg{ + width: 299px; + height: 170px; + // background: url('../../../assets/images/upload2.png') no-repeat center center; + + position: absolute; + top: 0px; + left: 79px; + border: 1px dashed gray; + border-radius:3px; + } + + } + .image{ + // position: absolute; + // top: 199px; + // left: 160px; + // width: 299px; + // height: 170px; + input{ + // width: 299px; + // height: 170px; + width: 190px; + margin-top: 160px; + cursor: pointer; + } + // opacity:0; + + } + } + .mainright{ + float: left; + width: 600px; + height: 400px; + // position: absolute; + // right: 170px; + + } + } +} +.bottombox{ + // height:400px; + width: 100%; + // background-color: skyblue; + + .bottomtitle{ + height: 60px; + // background-color: orange; + line-height: 60px; + border-top: 1px solid black; + border-bottom: 1px solid black; + } + .houseinfobox{ + // height:340px; + overflow: auto; + .addhouseinfo{ + float: left; + } + .infobtnbox{ + margin-left: 800px; + position: absolute; + top: 30px; + right: 75px; + button{ + width: 80px; + height: 40px; + margin: 0 12px; + margin-top: 15px; + } + } + .infotitle{ + font-size: 28px; + font-weight: 900; + margin-left: 180px; + } + .houseinfoinput{ + width: 393px; + text-align: end; + margin-left:240px; + } + } +} + +.btn{ + width: 100%; + text-align: center; + button{ + margin: 0 8px; + } +} +.mat-spinner{ + margin-top: 58px; + margin-left: 203px; +} +.mat-table{ + width: 100%; +} + +table{ + width: 1000px; + thead{ + tr{ + th{ + width: 60px; + display: block; + float: left; + + } + } + } + tbody{ + tr{ + + td{ + width: 60px; + display: block; + float: left; + text-align: center; + } + } + } +} + +.deviceinfo{ + // border-bottom: 1px solid black;; + padding-bottom: 60px; +} +.tankdetailinfo{ + // border-bottom: 1px solid black;; + padding-bottom: 35px; + table{ + th{ + text-align: center; + } + } +} +.tankinfo{ + display: block; + width: 100%; + // height: 45px; + text-align: center; +} +// .adddeviceinfo{ +// // position: absolute; +// // left: 0px; +// } +.submit1{ + margin-left: -66px !important; +} +textarea { + vertical-align: middle; + border-radius: 5px; + padding: 5px; + width: 600px; + height: 110px; + resize: none; + } + //预览图片旋转角度 + .img1{ + transform:rotate(90deg) scale(0.55); + height: 100%; +} +.img2{ + transform:rotate(180deg); + // height: 100%; +} +.img3{ + transform:rotate(270deg) scale(0.55); + // height: 100%; +} +.img4{ + transform:rotate(90deg) scale(1.3); + // height: 100%; +} +.img5{ + transform:rotate(180deg); + // height: 100%; +} +.img6{ + transform:rotate(270deg) scale(1.3); + // height: 100%; +} +.imgbox{ + text-align: center; + height: 750px; + img{ + max-width: 1500px; + max-height: 740px; + } +} +.previewImgBottom{ + text-align: center; +} +.alert-danger { + margin-top: -16px; + text-align: left; + padding-left: 77px; + font-size: 12px; + color: red; + } + + .mat-expansion-panel{ + background-color:transparent!important +} \ 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 new file mode 100644 index 0000000..61e3af3 --- /dev/null +++ b/src/app/ui/basicinfo-look/basicinfo.component.ts @@ -0,0 +1,1974 @@ +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 Swiper from 'swiper'; +import { LookMaster2 } from './lookmaster.component' +import { Router,ActivatedRoute } from '@angular/router' + +@Component({ + 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: '', //组织机构名称 + buildingTypes: [ + { + id:'', + name:'' + } + ] + } + + 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 + return { + expandable: !!node.children && node.children.length > 0, + name: node.name, + level: level, + id: node.id, + parentId: node.parentId, + children: node.children + }; + } + treeControl = new FlatTreeControl(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) { } + + + unitId : any //当前单位id + ngOnInit(): void { + this.getallunittype() + this.getorganization() + // this.getunitinfo() + this.getunitallbuilding() + this.unitId = this.route.snapshot.queryParams.id + } + //获得所有单位类型 + getallunittype() { + 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(); + } + ) + } + //获得当前单位的基本信息 + getunitinfo(){ + + this.http.get(`/api/Companies/${this.unitId}`).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) + } + } + + 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 + } + }) + } + 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 + + + //数据格式化函数 将原始数据映射转化为表格需要的datasource + formatHandle(list) { + const result = [{}]; // tag 是从1开始,因此预置索引为0的项 + list.forEach((item) => { + const { tag, propertyName, propertyValue } = item; + if (result[tag] === undefined) { // 初始化对象 + result[tag] = {}; + } + const fieldMap = { // 字段映射,实现自动映射 + '罐区': 'tank', + '储罐编号': 'tankid', + '储存介质': 'tankmedium', + '储罐类型': 'tanktype', + '容量': 'tankcapacity', + '直径': 'tankdiameter', + '高度': 'tankheight', + '顶盖形式': 'tanktectum', + '浮盘材质': 'tanktexture', + '浮盘类型': 'platetype', + '泡沫产生器型号': 'foamgeneratorid', + '泡沫产生器形式': 'foamgeneratortype', + '是否设置氮封惰化保护装置': 'isprotect', + '防护堤高度': 'fendinggroyneheight', + '半固定泡沫灭火接口数量': 'portnum', + '其它设施': 'else' + }; + result[tag][fieldMap[propertyName]] = propertyValue; + }); + result.shift(); // 移除预置的 索引为0 的值 + return result; + } + + //将模板信息加工成附带自定义属性的信息 + 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] = [] + } + 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 + // if(noemptybigfordata.length > 4){ + // noemptybigfordata.forEach((item,index) => { + // if(!item.submitted && item.name !="装置信息"){ + // noemptybigfordata.splice(index, 1) + // } + // }) + // } + 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 + } + }); + 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] + } + + //点击建筑自定义信息的checkbox + isCustomData = false + checkCustomData(e){ + this.isCustomData = e.checked + } + //增加自定义信息行数 + addCustomData(item){ + item.buildingCustomData.customProperties.push({ + name: "", + value: "" + }) + } + //删除自定义信息行数 + deleteCustomData(item){ + item.buildingCustomData.customProperties.pop() + } + //得到建筑信息数据并进行处理 + allBuildings:any + getunitallbuilding(){ + this.houses = [] + this.unitId = this.route.snapshot.queryParams.id + 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" + } + } + + 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 + + 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 总体数组中 + } + } + // 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 = [ + [] + ] + // dataSourceArr = [] + 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] + } + 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); + } + 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 + }, + { + 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{ + const config = new MatSnackBarConfig(); + 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,并且把自定义信息属性赋值为空 + id: "", + customProperties: [ + { + name: "", + value: "" + } + ], + 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" + } + 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 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 + } + }); + 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 + } + + + + //点击不同的tab选项 + selecttab(e) { + } + + FunData(e){//切割数组 + let proportion = 2; //按照比例切割 + let num = 0; + let _data =[]; + for(let i=0;i { + 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) + } +} + + //关闭辖区中队隐藏框 + closeorganizationbox() { + this.isorganizationbox = false + } + + //打开辖区中队隐藏框 + openorganizationbox() { + this.isorganizationbox = true + } + + hasChild = (_: number, node: any) => node.expandable; + + // imgsrc = "../../../assets/upload.jpg" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数 + imgsrc = "" + imgUrl = ""//返回来的图片地址后缀 + file: any; //上传的文件 + objectName: any; //上传对象名 + uploadId: any; //上传分块上传事件编号 + isspinner:boolean=false //控制进度圈的显示隐藏 + PartNumberETag: any = []; //分块上传每次返回需要保存的信息 + //change选择文件 + filechange(e) { + 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 + } + setTimeout(() => { + 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() + } + } + + }, 500); + } + //查看单位大图 + lookmaster(){ + const dialogRef = this.dialog.open(LookMaster2, {//调用open方法打开对话框并且携带参数过去 + width: '1600px', + height:'900px', + data: {img:this.imgsrc} + }); + dialogRef.afterClosed().subscribe( + + ); + } + //上传文件 + startUploading() { + this.isspinner = true + let file = this.file || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + 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)=>{ + 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() + }) + } + } + + + + + //小于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 () { + 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 //切割文件开始位置 + let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 + let formData = new FormData() + formData.append("file",file.slice(start, end)) + + // 同步写法实现异步调用 + let result = await new Promise((resolve, reject) => { + // await 需要后面返回一个 promise 对象 + this.http.post(`/api/MultipartUpload/PlanPlatform/${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) + if (this.PartNumberETag.length === allSlice) { + 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控件文件 + }) + } + //删除具体建筑 + 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) + }) + } + } + + //提交单位基本信息 + onSubmit(value,invalid,form) { + if(invalid){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请填写必填项','确定',config); + }else{ + sessionStorage.setItem('buildingTypeId',value.unittype) + let time =new Date() + let body = { + id: this.unitinfo.id, + name: this.unitinfo.name, + usci: value.creditcode, + contacts: value.linkman, + phone: value.linkphone, + address: value.unitaddress, + imageUrl: this.imgsrc, + location: { + x: 0, + y: 0 + }, + modifiedTime: time, + organizationId: this.selectedorganizationid, + organizationName: null, + buildingTypes: [ + { + id: value.unittype, + 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); + } + }), + err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请填写正确信息','确定',config); + } + } + + + } + selected:any + + 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 == "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 + } + } + } + + //切换建筑类型 + 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=[] //用于存储石头化工的第一个表格 + //提交单位模板信息 + 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 + }, + 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); + }) + } + } + 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, + 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" + } + ] + } + 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 + } + } + + 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: "", + 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" + } + ] + // 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 + } + }).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) + } + }); + 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); + }) + + } + } + }) + + + }} \ No newline at end of file diff --git a/src/app/ui/basicinfo-look/lookmaster.component.html b/src/app/ui/basicinfo-look/lookmaster.component.html new file mode 100644 index 0000000..9cf352f --- /dev/null +++ b/src/app/ui/basicinfo-look/lookmaster.component.html @@ -0,0 +1,17 @@ +
单位照片
+
+
+ +
+ + +
+
+ +

暂无单位图片,请先上传

+
+
+ + +
+ diff --git a/src/app/ui/basicinfo-look/lookmaster.component.ts b/src/app/ui/basicinfo-look/lookmaster.component.ts new file mode 100644 index 0000000..7cd8875 --- /dev/null +++ b/src/app/ui/basicinfo-look/lookmaster.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; +import {FlatTreeControl} from '@angular/cdk/tree'; +import { HttpClient } from '@angular/common/http'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import {FormControl} from '@angular/forms'; +import { MatSnackBar } from '@angular/material/snack-bar'; + +@Component({ + selector: 'lookmaster', + templateUrl: './lookmaster.component.html', + styleUrls: ['./basicinfo.component.scss'] + }) + export class LookMaster2 { + // myControl = new FormControl(); + //注入MatDialogRef,可以用来关闭对话框 + //要访问对话框组件中的数据,必须使用MAT_DIALOG_DATA注入令牌 + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) {} + allunittype:any + ImgUrl:string + rotationAngle=0 + isheng:any + isshowimg:boolean + onNoClick(): void { + this.dialogRef.close(); + } + ngOnInit(): void { + if(this.data.img.indexOf('?') == -1){ + this.isshowimg = false + }else{ + this.isshowimg = true + var imgurl = this.data.img.split("?") + this.ImgUrl = imgurl[0] + } + + } + //点击旋转按钮时 + rotateA = 0 + rotateB = 0 + rotate(){ + var w= document.getElementsByClassName("imgitemdefault")[0]['naturalWidth']; + var h = document.getElementsByClassName("imgitemdefault")[0]['naturalHeight']; + + if(w > h){ + this.isheng = true + }else{ + this.isheng = false + } + if(this.isheng){ + this.rotateA += 90 + if(this.rotateA == 360){ + this.rotateA = 0 + } + }else{ + this.rotateB += 10 + if(this.rotateB == 40){ + this.rotateB = 0 + } + } + } + + + + + } + \ No newline at end of file diff --git a/src/app/ui/data-push/data-push.component.scss b/src/app/ui/data-push/data-push.component.scss index 808198a..b1ab0c6 100644 --- a/src/app/ui/data-push/data-push.component.scss +++ b/src/app/ui/data-push/data-push.component.scss @@ -15,6 +15,7 @@ overflow-x: hidden; overflow-y: auto; .publicRouter { + color: white; width: 100%; height: 50px; line-height: 50px; @@ -22,6 +23,9 @@ border-bottom: 1px solid #30bbec; cursor: pointer; } + .publicRouter:hover{ + background-color: #e6963c; + } } //右侧内容区 .right { @@ -30,5 +34,5 @@ } .routerLinkPlanActive { - background-color: rgba(13, 139, 241, 0.7); + background-color: #e88108; } \ 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 ea199b3..c76671f 100644 --- a/src/app/ui/data-push/data-push.component.ts +++ b/src/app/ui/data-push/data-push.component.ts @@ -15,7 +15,7 @@ export class DataPushComponent implements OnInit { //路由配置 routers:any = [ - {name:'基本信息', url: '/ui/plan/aaa'}, + {name:'基本信息', url: '/ui/plan/basicInfo'}, {name:'平面图', url: '/ui/plan/planarGraph'}, {name:'四周毗邻', url: '/ui/plan/bbb'}, {name:'消防设施', url: '/ui/plan/ccc'}, diff --git a/src/app/ui/ui-routing.module.ts b/src/app/ui/ui-routing.module.ts index 9dadb2e..de79c0a 100644 --- a/src/app/ui/ui-routing.module.ts +++ b/src/app/ui/ui-routing.module.ts @@ -8,6 +8,7 @@ import { PlanAssistanceComponent } from './plan-assistance/plan-assistance.compo import { RealCasesComponent } from './real-cases/real-cases.component'; import { SimilarPlansComponent } from './similar-plans/similar-plans.component'; import { DataPushComponent } from './data-push/data-push.component'; +import { BasicinfoLookComponent } from './basicinfo-look/basicinfo.component'; @@ -15,6 +16,7 @@ const routes: Routes = [ { path: 'plan', component:DataPushComponent, //子级路由 children:[ { path: 'planarGraph', component:planComponent}, + { path: 'basicInfo', component:BasicinfoLookComponent} ]}, { path: 'collectionTools', component:CollectionToolsComponent}, { path: 'dangerous', component:DangerousComponent}, diff --git a/src/app/ui/ui.module.ts b/src/app/ui/ui.module.ts index 20f6ea7..77b39d6 100644 --- a/src/app/ui/ui.module.ts +++ b/src/app/ui/ui.module.ts @@ -64,9 +64,11 @@ import { RealCasesComponent } from './real-cases/real-cases.component'; import { PlanAssistanceComponent } from './plan-assistance/plan-assistance.component'; import { CountdownModule } from 'ngx-countdown'; import { DataPushComponent } from './data-push/data-push.component'; +import { BasicinfoLookComponent } from './basicinfo-look/basicinfo.component'; +import { LookMaster2 } from './basicinfo-look/lookmaster.component'; @NgModule({ - declarations: [SafeHtmlPipe,GisComponent,UiComponent,PersonaldataComponent, ChangepasswordComponent,IsnoPipe,ConfirmpswDirective,TimePipe, CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent, DisposalNodeComponent, DangerousComponent, SimilarPlansComponent, RealCasesComponent, PlanAssistanceComponent,planComponent, DataPushComponent], + declarations: [SafeHtmlPipe,GisComponent,UiComponent,PersonaldataComponent, ChangepasswordComponent,IsnoPipe,ConfirmpswDirective,TimePipe, CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent, DisposalNodeComponent, DangerousComponent, SimilarPlansComponent, RealCasesComponent, PlanAssistanceComponent,planComponent, DataPushComponent,BasicinfoLookComponent,LookMaster2], imports: [ CommonModule, From 0c1864f3c9b333cc03597aa6d76f3579132680e5 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Sun, 27 Sep 2020 19:14:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app-routing.module.ts | 2 +- src/app/navigation/navigation.component.ts | 2 +- .../ui/basicinfo-look/basicinfo.component.ts | 42 ++++++++++++------- src/app/ui/data-push/data-push.component.scss | 2 +- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3aa1493..67d6fb2 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -12,7 +12,7 @@ import {MTokenK1Component} from './m-token-k1/m-token-k1.component' //K1秘钥 const routes: Routes = [ - {path:'',redirectTo:'ui/plan',pathMatch:'full',}, + {path:'',redirectTo:'ui/plan/basicInfo',pathMatch:'full',}, { path:'', component:NavigationComponent, diff --git a/src/app/navigation/navigation.component.ts b/src/app/navigation/navigation.component.ts index a9f819f..cb8dd24 100644 --- a/src/app/navigation/navigation.component.ts +++ b/src/app/navigation/navigation.component.ts @@ -23,7 +23,7 @@ export class NavigationComponent implements OnInit { //路由配置 routers:any = [ - {name:'数据推送', url: '/ui/plan'}, + {name:'数据推送', url: '/ui/plan/basicInfo'}, {name:'处置要点', url: '/ui/disposalNode'}, {name:'区域危险源', url: '/ui/dangerous'}, {name:'预案甄选', url: '/ui/similarPlans'}, diff --git a/src/app/ui/basicinfo-look/basicinfo.component.ts b/src/app/ui/basicinfo-look/basicinfo.component.ts index 61e3af3..5a2aa2a 100644 --- a/src/app/ui/basicinfo-look/basicinfo.component.ts +++ b/src/app/ui/basicinfo-look/basicinfo.component.ts @@ -19,6 +19,7 @@ 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' @Component({ selector: 'app-basicinfo-look', @@ -83,16 +84,26 @@ export class BasicinfoLookComponent implements OnInit { 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) { } + 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 : any //当前单位id + unitId = sessionStorage.getItem('companyId') //当前单位id ngOnInit(): void { - this.getallunittype() - this.getorganization() - // this.getunitinfo() - this.getunitallbuilding() - this.unitId = this.route.snapshot.queryParams.id + let token = sessionStorage.getItem('token') + if (token) { + 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() + }) + } + } //获得所有单位类型 getallunittype() { @@ -112,14 +123,13 @@ export class BasicinfoLookComponent implements OnInit { } //获得当前单位的基本信息 getunitinfo(){ + this.http.get(`/api/Companies/${sessionStorage.getItem('companyId')}`).subscribe((data:any)=>{ - this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ - - if(data.buildingTypes.length){ - sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) - }else{ - sessionStorage.setItem('buildingTypeId',"") - } + // 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){ @@ -323,7 +333,7 @@ export class BasicinfoLookComponent implements OnInit { allBuildings:any getunitallbuilding(){ this.houses = [] - this.unitId = this.route.snapshot.queryParams.id + this.unitId = sessionStorage.getItem('companyId') this.http.get("/api/Buildings",{ params:{ companyId:this.unitId @@ -952,7 +962,7 @@ export class BasicinfoLookComponent implements OnInit { config.duration = 3000 this.snackBar.open('请填写必填项','确定',config); }else{ - sessionStorage.setItem('buildingTypeId',value.unittype) + // sessionStorage.setItem('buildingTypeId',value.unittype) let time =new Date() let body = { id: this.unitinfo.id, diff --git a/src/app/ui/data-push/data-push.component.scss b/src/app/ui/data-push/data-push.component.scss index b1ab0c6..32ab452 100644 --- a/src/app/ui/data-push/data-push.component.scss +++ b/src/app/ui/data-push/data-push.component.scss @@ -34,5 +34,5 @@ } .routerLinkPlanActive { - background-color: #e88108; + background-color: rgba(240, 136, 14, 0.65); } \ No newline at end of file From 7da81fea287d4b1b14397faa771f342001bcc6bf Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Sun, 27 Sep 2020 19:15:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=B0=86=E5=89=A9?= =?UTF-8?q?=E4=BD=99=E6=96=87=E4=BB=B6=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/ui/allaround/allaround.component.html | 78 +++ src/app/ui/allaround/allaround.component.scss | 54 ++ .../ui/allaround/allaround.component.spec.ts | 25 + src/app/ui/allaround/allaround.component.ts | 78 +++ .../ui/allaround/imgdetails.component.html | 18 + src/app/ui/allaround/imgdetails.component.ts | 54 ++ src/app/ui/data-push/data-push.component.html | 3 + src/app/ui/data-push/data-push.component.scss | 2 +- src/app/ui/data-push/data-push.component.ts | 16 +- .../addGrouping.component.ts | 69 +++ .../addGrouping.html | 18 + .../fire-fighting-device.component.html | 193 +++++++ .../fire-fighting-device.component.scss | 145 +++++ .../fire-fighting-device.component.ts | 538 ++++++++++++++++++ .../imagesdata.component.html | 9 + .../imagesdata.component.ts | 82 +++ .../fire-fighting-device-look/previewImg.html | 17 + .../ui/key-site-look/key-site.component.html | 120 ++++ .../ui/key-site-look/key-site.component.scss | 58 ++ .../ui/key-site-look/key-site.component.ts | 173 ++++++ .../key-site-look/keyimgdetail.component.html | 0 .../key-site-look/keyimgdetail.component.ts | 17 + .../key-site-look/keysiteimgs.component.html | 18 + .../ui/key-site-look/keysiteimgs.component.ts | 55 ++ .../addRealPicture.html | 18 + .../editRealPicture.html | 18 + .../ui/realistic-picture-look/previewImg.html | 17 + .../realistic-picture.component.html | 59 ++ .../realistic-picture.component.scss | 174 ++++++ .../realistic-picture.component.ts | 410 +++++++++++++ .../threetype-plan.component.html | 3 + .../threetype-plan.component.scss | 0 .../threetype-plan.component.spec.ts | 25 + .../threetype-plan.component.ts | 15 + src/app/ui/ui-routing.module.ts | 12 +- src/app/ui/ui.module.ts | 11 +- 36 files changed, 2592 insertions(+), 10 deletions(-) create mode 100644 src/app/ui/allaround/allaround.component.html create mode 100644 src/app/ui/allaround/allaround.component.scss create mode 100644 src/app/ui/allaround/allaround.component.spec.ts create mode 100644 src/app/ui/allaround/allaround.component.ts create mode 100644 src/app/ui/allaround/imgdetails.component.html create mode 100644 src/app/ui/allaround/imgdetails.component.ts create mode 100644 src/app/ui/fire-fighting-device-look/addGrouping.component.ts create mode 100644 src/app/ui/fire-fighting-device-look/addGrouping.html create mode 100644 src/app/ui/fire-fighting-device-look/fire-fighting-device.component.html create mode 100644 src/app/ui/fire-fighting-device-look/fire-fighting-device.component.scss create mode 100644 src/app/ui/fire-fighting-device-look/fire-fighting-device.component.ts create mode 100644 src/app/ui/fire-fighting-device-look/imagesdata.component.html create mode 100644 src/app/ui/fire-fighting-device-look/imagesdata.component.ts create mode 100644 src/app/ui/fire-fighting-device-look/previewImg.html create mode 100644 src/app/ui/key-site-look/key-site.component.html create mode 100644 src/app/ui/key-site-look/key-site.component.scss create mode 100644 src/app/ui/key-site-look/key-site.component.ts create mode 100644 src/app/ui/key-site-look/keyimgdetail.component.html create mode 100644 src/app/ui/key-site-look/keyimgdetail.component.ts create mode 100644 src/app/ui/key-site-look/keysiteimgs.component.html create mode 100644 src/app/ui/key-site-look/keysiteimgs.component.ts create mode 100644 src/app/ui/realistic-picture-look/addRealPicture.html create mode 100644 src/app/ui/realistic-picture-look/editRealPicture.html create mode 100644 src/app/ui/realistic-picture-look/previewImg.html create mode 100644 src/app/ui/realistic-picture-look/realistic-picture.component.html create mode 100644 src/app/ui/realistic-picture-look/realistic-picture.component.scss create mode 100644 src/app/ui/realistic-picture-look/realistic-picture.component.ts create mode 100644 src/app/ui/threetype-plan/threetype-plan.component.html create mode 100644 src/app/ui/threetype-plan/threetype-plan.component.scss create mode 100644 src/app/ui/threetype-plan/threetype-plan.component.spec.ts create mode 100644 src/app/ui/threetype-plan/threetype-plan.component.ts diff --git a/src/app/ui/allaround/allaround.component.html b/src/app/ui/allaround/allaround.component.html new file mode 100644 index 0000000..9d94ca3 --- /dev/null +++ b/src/app/ui/allaround/allaround.component.html @@ -0,0 +1,78 @@ +
+ + +
+ +
+
+ +
+
+ +
+
+ + +
+
+ + +
+
+ + + +
+
+ +

暂无数据,请前往平面图进行相关数据录入

+
+
+ + +
+ +
+
+ +
+
+
+ + +
+
+ + +
+
+ + + +
+
+ +

暂无数据,请前往平面图进行相关数据录入

+
+
+ +
+
\ No newline at end of file diff --git a/src/app/ui/allaround/allaround.component.scss b/src/app/ui/allaround/allaround.component.scss new file mode 100644 index 0000000..3f723b9 --- /dev/null +++ b/src/app/ui/allaround/allaround.component.scss @@ -0,0 +1,54 @@ +.content { + width: 100%; + height: 90%; + padding: 10px; + overflow-y: auto; +} + +//图片外部div +.allImgs { + display: flex; + overflow-y: auto; + flex-direction: row; + flex-wrap: wrap; + .imgBox{ + width: 300px; + height: 250px; + margin: 25px 35px 35px 35px; + display: inline-block; + position: relative; + .fixedImg { + width: 100%; + height: 170px; + text-align: center; + margin-bottom: 3px; + img { + width: auto; + height: auto; + max-width: 100%; + height: 100%; + cursor:pointer;} + } + } +} + +//预览图片 +.previewImgBox { + width: 1500px; + height: 700px; + text-align: center; + img{ + width: auto; + height: auto; + max-width: 100%; + height: 100%;} +} +.previewImgBottom { + text-align: center; + height: 30px; + margin: 20px auto; +} +//预览图片旋转角度 +.rotateA {transform: rotate(90deg) scale(0.75);} +.rotateB {transform: rotate(180deg)} +.rotateC {transform: rotate(270deg) scale(0.75);} \ No newline at end of file diff --git a/src/app/ui/allaround/allaround.component.spec.ts b/src/app/ui/allaround/allaround.component.spec.ts new file mode 100644 index 0000000..7849804 --- /dev/null +++ b/src/app/ui/allaround/allaround.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AllaroundComponent } from './allaround.component'; + +describe('AllaroundComponent', () => { + let component: AllaroundComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AllaroundComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AllaroundComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/allaround/allaround.component.ts b/src/app/ui/allaround/allaround.component.ts new file mode 100644 index 0000000..4702938 --- /dev/null +++ b/src/app/ui/allaround/allaround.component.ts @@ -0,0 +1,78 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { ImgDetails } from './imgdetails.component' +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import { Router, ActivatedRoute } from '@angular/router'; + + + +@Component({ + selector: 'app-allaround', + templateUrl: './allaround.component.html', + styleUrls: ['./allaround.component.scss'] +}) +export class AllaroundComponent implements OnInit { + + constructor(private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private route:ActivatedRoute,) { } + + ngOnInit(): void { + this.getAllCompany() + this.getAllBuilding() + } + + AllAdjoining:any = []; //所有单位毗邻 + AllBuilding:any = []; //所有建筑 + 建筑毗邻图片 + + //获取所有单位毗邻图片 + getAllCompany () { + let id = {companyId:this.route.snapshot.queryParams.id} + this.http.get('/api/CompanyAdjoins',{params:id}).subscribe(data=>{ + this.AllAdjoining = data + this.AllAdjoining.forEach(element => {element.imgURL = element.imageUrls[0] +'?x-oss-process=image/resize,m_fill,h_170,w_299'}) + }) + } + + //获取所有建筑 + getAllBuilding () { + let id = {companyId:this.route.snapshot.queryParams.id} + this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{ + if (data.length) { + this.AllBuilding = data + this.AllBuilding.forEach(element => { + element.allImgs = [] + }); + this.getAllArchitecture()} + }) + } + + //获取所有建筑毗邻图片 + getAllArchitecture () { + this.AllBuilding.forEach(element => { + let id = {buildingId:element.id} + this.http.get('/api/BuildingAdjoins',{params:id}).subscribe(data=>{ + element.allImgs = data + element.allImgs.forEach(element => {element.imgURL = element.imageUrls[0] +'?x-oss-process=image/resize,m_fill,h_170,w_299'}); + }) + }); + } + + //预览图片 + imgdetails(e){ + if (e.length && e!=null) { + let data = e + const dialogRef = this.dialog.open(ImgDetails, {//调用open方法打开对话框并且携带参数过去 + width: '1600px', + height:'900px',data}); + dialogRef.afterClosed().subscribe(); + } else{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); + } + } + + + +} diff --git a/src/app/ui/allaround/imgdetails.component.html b/src/app/ui/allaround/imgdetails.component.html new file mode 100644 index 0000000..b341979 --- /dev/null +++ b/src/app/ui/allaround/imgdetails.component.html @@ -0,0 +1,18 @@ +
图片详情
+
+
+
+ +
+
+
+ + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/allaround/imgdetails.component.ts b/src/app/ui/allaround/imgdetails.component.ts new file mode 100644 index 0000000..0bc8d65 --- /dev/null +++ b/src/app/ui/allaround/imgdetails.component.ts @@ -0,0 +1,54 @@ +import { Component, OnInit, Inject, ɵConsole } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import Swiper from 'swiper'; + + + +@Component({ + selector: 'imgdetails', + templateUrl: './imgdetails.component.html', + styleUrls: ['./allaround.component.scss'] + }) + export class ImgDetails { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) { } + testSwiper: Swiper; + + ngOnInit(): void { + this.allImages = [] + this.data.forEach(element => { + element = `${element}?x-oss-process=image/auto-orient,1` + this.allImages.push(element) + }); + } + + ngAfterViewInit() { + this.testSwiper = new Swiper('.swiper-container', { + lazy: true, + direction: 'horizontal', + loop: false, + + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + } + }); + } + + allImages:any; //展示所有的图片 + rotationAngle:number=0; //旋转角度 + + //旋转图片 + rotate () { + this.rotationAngle = this.rotationAngle+90 + if (this.rotationAngle === 360) {this.rotationAngle = 0} + } + + + +} + \ No newline at end of file diff --git a/src/app/ui/data-push/data-push.component.html b/src/app/ui/data-push/data-push.component.html index 14e6e6c..a73de2d 100644 --- a/src/app/ui/data-push/data-push.component.html +++ b/src/app/ui/data-push/data-push.component.html @@ -3,6 +3,9 @@
{{item.name}}
+
+ 三维预案 +
diff --git a/src/app/ui/data-push/data-push.component.scss b/src/app/ui/data-push/data-push.component.scss index b1ab0c6..f7762b0 100644 --- a/src/app/ui/data-push/data-push.component.scss +++ b/src/app/ui/data-push/data-push.component.scss @@ -1,7 +1,7 @@ .content { width: 100%; height: 100%; - overflow: hidden; + // overflow: hidden; display: flex; } diff --git a/src/app/ui/data-push/data-push.component.ts b/src/app/ui/data-push/data-push.component.ts index c76671f..4bf58bb 100644 --- a/src/app/ui/data-push/data-push.component.ts +++ b/src/app/ui/data-push/data-push.component.ts @@ -17,13 +17,15 @@ export class DataPushComponent implements OnInit { routers:any = [ {name:'基本信息', url: '/ui/plan/basicInfo'}, {name:'平面图', url: '/ui/plan/planarGraph'}, - {name:'四周毗邻', url: '/ui/plan/bbb'}, - {name:'消防设施', url: '/ui/plan/ccc'}, - {name:'重点部位', url: '/ui/plan/ddd'}, + {name:'四周毗邻', url: '/ui/plan/allaround'}, + {name:'消防设施', url: '/ui/plan/fire-fighting-device'}, + {name:'重点部位', url: '/ui/plan/key-site'}, {name:'功能分区', url: '/ui/plan/eee'}, - {name:'实景图', url: '/ui/plan/fff'}, - {name:'上传CAD', url: '/ui/plan/ggg'}, - {name:'三维预案', url: '/ui/plan/hhh'}, + {name:'实景图', url: '/ui/plan/realistic-picture'}, + {name:'上传CAD', url: '/ui/plan/ggg'} + // {name:'三维预案', url: '/ui/plan/3DPlan'}, ] - + open3D(){ + window.open("http://39.106.78.171:8088/%E5%B9%BF%E8%A5%BF%E8%B4%B5%E6%B8%AF%E5%B8%82%E4%B8%89%E7%BB%B4%E7%81%AD%E7%81%AB%E9%A2%84%E6%A1%88/%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/") + } } diff --git a/src/app/ui/fire-fighting-device-look/addGrouping.component.ts b/src/app/ui/fire-fighting-device-look/addGrouping.component.ts new file mode 100644 index 0000000..ef3ae9d --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/addGrouping.component.ts @@ -0,0 +1,69 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; + + + +@Component({ + selector: 'imgsdatadetail', + templateUrl: './addGrouping.html', + styleUrls: ['./fire-fighting-device.component.scss'] + }) +export class ImgsDataDetail2 { + + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} + + ngOnInit(): void { + + } + + ngAfterViewInit(): void{ + + } + + //提交表单 + onSubmit (e) { + if (this.data.buildingId) { //建筑新建内置项 + let repeat = this.data.item.facilityItems.find(items=>items.name==e.name) + if (repeat==undefined) { + let header = {buildingId:this.data.buildingId, groupId:this.data.item.id} + let msg = { + isBuiltin: false, + details: '', + name: e.name, + isEachFloor: false, + order: this.data.item.facilityItems.length? this.data.item.facilityItems[this.data.item.facilityItems.length-1].order+1 : 0} + this.http.post('/api/CompanyAccount/BuildingFacilityItems',msg,{params:header}).subscribe(data=>{ + this.dialogRef.close(data); }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('当前分组下禁止创建名称相同内置项','确定',config); + } + } else { //单位新建内置项 + let repeat = this.data.facilityItems.find(item=>item.name==e.name) + if (repeat==undefined) { + let header = {groupId:this.data.id} + let msg = { + isBuiltin: false, + details: '', + name: e.name, + isEachFloor: false, + order: this.data.facilityItems.length? this.data.facilityItems[this.data.facilityItems.length-1].order+1 : 0} + this.http.post('/api/CompanyAccount/CompanyFacilityItems',msg,{params:header}).subscribe(data=>{ + this.dialogRef.close(data); }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('当前分组下禁止创建名称相同内置项','确定',config); + } + } //else + } + + + +} + \ No newline at end of file diff --git a/src/app/ui/fire-fighting-device-look/addGrouping.html b/src/app/ui/fire-fighting-device-look/addGrouping.html new file mode 100644 index 0000000..916fc28 --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/addGrouping.html @@ -0,0 +1,18 @@ +
创建消防设施内置项
+
+
+ + + + +

*注: 该名称不允许与当前分组内置项重名

+ +
+ + +
+
+
\ No newline at end of file diff --git a/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.html b/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.html new file mode 100644 index 0000000..44661db --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.html @@ -0,0 +1,193 @@ +
+ + +
+ +

暂无数据,请完善单位基本信息

+
+

{{item.name}}

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
{{header}}
{{body[header]? body[header] : '暂无数据'}}
+
+
+

楼层/区域名称: {{tableMsg.name? tableMsg.name: '暂无名称'}}

+ + + + + + + +
{{header}}
{{body[header]? body[header] : '暂无数据'}}
+
+
+
+ +
+
+
+ +
+ + + + +

{{item.name}}

+ +
+
+ + + + + + + {{radio.name}} + +
+
+ +
+
+ +
+
+ + +
+ +
+

{{item.name}}

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
{{header}}
{{body[header]? body[header] : '暂无数据'}}
+
+
+

楼层/区域名称: {{tableMsg.name? tableMsg.name : '暂无名称'}}

+ + + + + + + +
{{header}}
{{body[header]? body[header] : '暂无数据'}}
+
+
+
+ +
+
+
+ +
+ + + + +

{{item.name}}

+ +
+
+ + + + + + + {{radio.name}} + +
+
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.scss b/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.scss new file mode 100644 index 0000000..3ea1f32 --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.scss @@ -0,0 +1,145 @@ +.content { + width: 100%; + height: 90%; + padding: 10px; + overflow-y: auto; + .contentBox { + width: 90%; + height: 100%; + margin: 0 auto; + overflow-y: auto; + } +} +.mat-icon { + color: black; + cursor:pointer; +} + + + +//可展开面板每一行css +.mat-expansion-panel-header { + padding: 3px 24px; +} + +.firstContent { + width: 3%; +} +.textContent { + width: 12%; + color: black; + text-align: center; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.totalContent { + width: 25%; + color: black; + text-align: center; + white-space: pre-line; + max-height: 48px; + overflow-y: auto; +} +.lastTextContent { //textarea多行文本 + width: 45%; + color: black; + text-align: center; +} +input { + height: 22px; + line-height: 22px; + padding-left: 5px; + border-radius: 3px; +} +a { + color: #0000ff; +} + + + +//bottom用户输入框 +.InputField { + display: inline-block; + width: 40%; + text-align: right; + margin: 10px 25px; + input {width: 60%;} + label {margin-right: 10px;} +} +textarea { + vertical-align: middle; + border-radius: 5px; + padding: 5px; + width: 60%; + height: 36px; + resize: none; +} + + + +//表格样式 +.overflowTable { + width: 95%; + margin: 0 auto; + max-height: 300px; + overflow-y: auto; +} +.detailsTable { + margin: 10px 0; + table { + width: 100%; + text-align: center; + border-collapse:collapse; + word-break:break-all; + word-wrap:break-all; + table-layout:fixed; + th { + height: 35px; + border: 1px solid #999;} + td { + height: 35px; + border: 1px solid #999;} + } +} + + + +//滚动条样式 +::-webkit-scrollbar{ + width: 5px; + background-color: white; +} +::-webkit-scrollbar-thumb{ + background-color: #999; +} + + + +//img图片列表页面 +.imageList { + width: 100%; + height: 100%; + overflow-y: auto; + .imageListBox { + width: 100%; + height: 90%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + .imagesBox { + width: 300px; + height: 200px; + margin: 0 11px 0 11px; + display: inline-block; + img { + border: 1px solid #999; + width: auto; + height: auto; + max-width: 100%; + height: 170px; + cursor:pointer; + } + } + } +} diff --git a/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.ts b/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.ts new file mode 100644 index 0000000..cf62564 --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/fire-fighting-device.component.ts @@ -0,0 +1,538 @@ +import { Component, OnInit, ViewChild, Inject } from '@angular/core'; +import {HttpClient, HttpHeaders} from '@angular/common/http' +import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { ImgsDataDetail2 } from './addGrouping.component' +import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; +import { ImagesData2 } from './imagesdata.component' +import { Router,ActivatedRoute } from '@angular/router' + + +export interface Food { + value: string; + name: string; +} +@Component({ + selector: 'app-fire-fighting-device-look', + templateUrl: './fire-fighting-device.component.html', + styleUrls: ['./fire-fighting-device.component.scss'] +}) +export class FireFightingDeviceLookComponent implements OnInit { + + constructor(private router:Router,private route:ActivatedRoute,public http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } + + ngOnInit(): void { + this.getCompanyInformation() + this.getAllBuilding() + } + + //定义属性数据 + singleElection:Food[]=[ + {value:'true', name: '有'}, + {value:'false', name: '无'}] + + companyBuiltInGrouping:any = []; //单位消防设施内置分组 + companyDetails:any = []; //单位详情 + companyEachDetails:any = [] //单位每层详情 + companyOptionalGrouping:any = []; //单位消防设施可选分组 + + //获得单位基本信息 + getCompanyInformation () { + let companyId = this.route.snapshot.queryParams.id + this.http.get(`/api/Companies/${companyId}`).subscribe((data:any)=>{ + if (data.buildingTypes.length) { + let newData = {buildingType: data.buildingTypes[0].id,companyId : companyId} + this.http.get('/api/CompanyFacilities',{params:newData}).subscribe((data:any)=>{ //获得单位的消防设施 + this.companyBuiltInGrouping = data[0].summary.companyFacilityGroups + this.companyOptionalGrouping = data[0].summary.companyOptionalGroups + this.companyDetails = data[0].details + this.companyEachDetails = data[0].eachDetails + this.companyBuiltInGrouping.forEach(element => { //循环单位内置分组项 + element.selectBuiltInGrouping = [] + element.facilityItems.forEach((elements,index) => { + elements.total = element.facilityCount[index] + elements.expanded = false}); + }); + }) //http + } //if + + }) + } + + //创建单位消防设施内置分组项 + addCompanyGrouping (e) { + let data = e + let dialogRef = this.dialog.open(ImagesData2,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { e.facilityItems.push(data) } }); + } + + //保存单位消防设施内置分组项 + editCompanyGrouping(e) { + let header = {groupId:e.id} + let data = [] + e.facilityItems.forEach((element,index) => { + let msg = { + isBuiltin: element.isBuiltin, + details: element.details, + name: element.name, + isEachFloor: element.isEachFloor, + order: element.order} + data.push(msg) + if (index==e.facilityItems.length-1) { + this.http.post('/api/CompanyFacilityItems/Batch',data,{params:header}).subscribe(data=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据更新成功','确定',config); + }) } + }); //forEach + + } + + //checked单位消防设施内置分组项时 + checkedCompany (e,item,items) { + if (e.checked) { + item.selectBuiltInGrouping.push(items) + } else { + item.selectBuiltInGrouping.splice(item.selectBuiltInGrouping.findIndex(oldItem => oldItem == items), 1) + } + } + + //删除消防设施内置分组项 + deleteCompanyGrouping (e) { + if (e.selectBuiltInGrouping.length) { + let isDelete = confirm('您确定要删除吗') + if (isDelete) { + let msg:any = `?groupId=${e.id}` + e.selectBuiltInGrouping.forEach((element,index) => { + let data = `&name=${element.name}` + msg = msg + data + if (index === e.selectBuiltInGrouping.length-1) { + this.http.delete('/api/CompanyFacilityItems/Batch' + msg).subscribe(data=>{ + let deleteMsg = e.selectBuiltInGrouping + deleteMsg.forEach(deleteElement => { + e.facilityItems.splice(e.facilityItems.findIndex(item=>item.name==deleteElement.name),1) + }); + e.selectBuiltInGrouping = [] + + }) //http + } //if + }); //forEach + } + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择内置分组项','确定',config); + } + } + + //保存单位消防设施可选分组 + editCompanyOptional (e,item) { + e.stopPropagation() //阻止冒泡 + item.propertyInfos.forEach((element,index) => { + element.propertyValue = String(element.propertyValue) + if (index == item.propertyInfos.length-1 ) { + this.http.post('/api/CompanyOptionalGroups',item).subscribe(data=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据更新成功','确定',config); + }) + } //if + }); + } + + //单位消防设施切换展开面板 + SwitchBoard (e) { + e.expanded = !e.expanded + if (e.expanded) { //展开面板展开时 + if (e.isEachFloor) { //逐层统计时 + let data = this.companyEachDetails[e.name] + if (data) { + e.loopTable = [] + data.forEach(item => { + let tableMsg = {name:item.name, header:[], body:[]} + item.assets[0].propertyInfos.forEach(element => { //表头 + if (element.propertyType!=3) { + let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 + tableMsg.header.push(element.propertyName+unit)} + }); + item.assets.forEach(element => { //表格内容 + let everyBody = {} + element.propertyInfos.forEach((elements,index) => { + if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue } + if (elements.propertyType==6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } + if (elements.propertyType!=3 && elements.propertyName=='图片') { + let imgLength = [] + element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = String(imgLength.length) } + + }); //propertyInfos + tableMsg.body.push(everyBody) + }); //assets + e.loopTable.push(tableMsg) + }); + + } //data有数据时 + } else { //非逐层统计时 + let data = this.companyDetails[e.name] + if (data) { + e.header = [] + e.body = [] + data[0].propertyInfos.forEach(element => { //表头 + if (element.propertyType!=3) { + let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 + e.header.push(element.propertyName+unit)} + }); + data.forEach(element => { //表格内容 + let everyBody = {} + element.propertyInfos.forEach((elements,index) => { + if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue } + if (elements.propertyType==6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } + if (elements.propertyType!=3 && elements.propertyName=='图片') { + let imgLength = [] + element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = String(imgLength.length) } + + }); + e.body.push(everyBody) + }); + + } + } //非逐层统计时 + + + + } + } + + + + allBuildingGrouping:any; //所有建筑的消防设施 内置分组+可选分组 + //获取所有建筑 + getAllBuilding () { + let companyId = this.route.snapshot.queryParams.id + this.http.get('/api/Buildings',{params:{ + companyId:companyId + }}).subscribe((data:any)=>{ + this.allBuildingGrouping = data + if (this.allBuildingGrouping.length) { this.getAllBuildingFacilities() } + }) + } + + //获取所有建筑的消防设施 + getAllBuildingFacilities () { + let companyId = this.route.snapshot.queryParams.id + this.allBuildingGrouping.forEach(element => { + let header = {buildingId: element.id, buildingType: element.buildingTypes[0].id,companyId:companyId} + this.http.get('/api/BuildingFacilities',{params:header}).subscribe(data=>{ + element.buildingFacilityGroups = data[0].summary.buildingFacilityGroups + element.buildingOptionalGroups = data[0].summary.buildingOptionalGroups + element.buildingDetails = data[0].details + element.buildingEachDetails = data[0].eachDetails + element.buildingFacilityGroups.forEach((elements) => { //循环每个建筑内置分组项 + elements.selectBuiltInGrouping = [] + elements.facilityItems.forEach((newElement,index) => { + newElement.total = elements.facilityCount[index] + newElement.expanded = false }); + }); + }) + + }); + + } + + //创建建筑消防设施内置分组项 + addBuildingGrouping (e,item) { + let data = {buildingId: e.id, item} + let dialogRef = this.dialog.open(ImgsDataDetail2,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { item.facilityItems.push(data) } + }); + } + + //保存建筑消防设施内置分组项 + editBuildingGrouping (e,item) { + let companyId = this.route.snapshot.queryParams.id + let header = {companyId:companyId,buildingId:e.id, groupId:item.id} + let data = [] + item.facilityItems.forEach((element,index) => { + let msg = { + isBuiltin: element.isBuiltin, + details: element.details, + name: element.name, + isEachFloor: element.isEachFloor, + order: element.order} + data.push(msg) + if (index==item.facilityItems.length-1) { + this.http.post('/api/BuildingFacilityItems/Batch',data,{params:header}).subscribe(data=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据更新成功','确定',config); + }) } + }); //forEach + + } + + //删除建筑消防设施内置分组项 + deleteBuildingGrouping (e,item) { + if (item.selectBuiltInGrouping.length) { + let isDelete = confirm('您确定要删除吗') + if (isDelete) { + let msg:any = `?buildingId=${e.id}&groupId=${item.id}` + item.selectBuiltInGrouping.forEach((element,index) => { + let data = `&name=${element.name}` + msg = msg + data + if (index === item.selectBuiltInGrouping.length-1) { + this.http.delete('/api/BuildingFacilityItems/Batch'+msg).subscribe(data=>{ + let deleteMsg = item.selectBuiltInGrouping + deleteMsg.forEach(deleteElement => { + item.facilityItems.splice(item.facilityItems.findIndex(items=>items.name==deleteElement.name),1) + }); + item.selectBuiltInGrouping = [] + + }) //http + } //if + }) //forEach + } + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择内置分组项','确定',config); + } + } + + //保存建筑消防设施可选分组 + editBuildingOptional (e,item) { + let companyId = this.route.snapshot.queryParams.id + e.stopPropagation() //阻止冒泡 + item.propertyInfos.forEach((element,index) => { + element.propertyValue = String(element.propertyValue) + if (index == item.propertyInfos.length-1 ) { + this.http.post('/api/BuildingOptionalGroups',item,{params:{ + companyId :companyId + }}).subscribe(data=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据更新成功','确定',config); + }) + } //if + }); + } + + //建筑消防设施切换展开面板 + SwitchBuildingBoard (item,e) { + e.expanded = !e.expanded + if (e.expanded) { //展开面板展开时 + if (e.isEachFloor) { //逐层统计时 + let data = item.buildingEachDetails[e.name] + if (data) { + e.loopTable = [] + data.forEach(item => { + let tableMsg = {name:item.name, header:[], body:[]} + item.assets[0].propertyInfos.forEach(element => { //表头 + if (element.propertyType!=3) { + let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 + tableMsg.header.push(element.propertyName+unit)} + }); + item.assets.forEach(element => { //表格内容 + let everyBody = {} + element.propertyInfos.forEach((elements,index) => { + if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue } + if (elements.propertyType==6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } + if (elements.propertyType!=3 && elements.propertyName=='图片') { + let imgLength = [] + element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = String(imgLength.length) } + + }); //propertyInfos + tableMsg.body.push(everyBody) + }); //assets + e.loopTable.push(tableMsg) + }); + + } //data有数据时 + } else { //非逐层统计时 + let data = item.buildingDetails[e.name] + if (data) { + e.header = [] + e.body = [] + data[0].propertyInfos.forEach(element => { //表头 + if (element.propertyType!=3) { + let unit = element.physicalUnit? '('+ element.physicalUnit +')' : '' //单位 + e.header.push(element.propertyName+unit)} + }); + data.forEach(element => { //表格内容 + let everyBody = {} + element.propertyInfos.forEach((elements,index) => { + if (elements.propertyType!=3 && elements.propertyName!='图片' && elements.propertyType!=6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue } + if (elements.propertyType==6) { + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = elements.propertyValue=='1'?'是':'否' } + if (elements.propertyType!=3 && elements.propertyName=='图片') { + let imgLength = [] + element.propertyInfos.find(item=>{ if(item.propertyType==3){imgLength.push(item)} }) + let unit = elements.physicalUnit? '('+ elements.physicalUnit +')' : '' //单位 + everyBody[elements.propertyName+unit] = String(imgLength.length) } + + }); + e.body.push(everyBody) + }); + + } + } //非逐层统计时 + + + + } + } + + //单位消防设施预览图片 + previewImg (e) { + if (e.isEachFloor) { //逐层统计时 + let newData = this.companyEachDetails[e.name] + if (newData) { + let data = {name:e.name, images:[]} + let imgName + newData.forEach(item => { + item.assets.forEach(element => { + element.propertyInfos.forEach( elements => { + if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} + if (elements.propertyType===3) { + elements.propertyName = imgName + data.images.push(elements)} }); + }); + }); //newDate + + if (data.images.length) { + let dialogRef = this.dialog.open(ImagesData2,{width:'1350px',height:'700px',data}); //打开图片弹窗 + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); + } + + } else{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); } + } else { //非逐层统计时 + let newData = this.companyDetails[e.name] + let imgName + if (newData) { + let data = {name:e.name, images:[]} + newData.forEach(element => { + element.propertyInfos.forEach(elements => { + if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} + if (elements.propertyType===3) { + elements.propertyName = imgName + data.images.push(elements)} }); + }); + if (data.images.length) { + let dialogRef = this.dialog.open(ImagesData2,{width:'1350px',height:'700px',data}); //打开图片弹窗 + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); + } + + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); } + } + + } + + //建筑消防设施预览图片 + previewBuildingImg (item,e) { + if (e.isEachFloor) { //逐层统计时 + let newData = item.buildingEachDetails[e.name] + if (newData) { + let data = {name:e.name, images:[]} + let imgName + newData.forEach(item => { + item.assets.forEach(element => { + element.propertyInfos.forEach( elements => { + if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} + if (elements.propertyType===3) { + elements.propertyName = imgName + data.images.push(elements)} }); + }); + }); //newDate + + if (data.images.length) { + let dialogRef = this.dialog.open(ImagesData2,{width:'1350px',height:'700px',data}); //打开图片弹窗 + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); + } + + } else{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); } + } else { //非逐层统计时 + let newData = item.buildingDetails[e.name] + let imgName + if (newData) { + let data = {name:e.name, images:[]} + newData.forEach(element => { + element.propertyInfos.forEach(elements => { + if (elements.propertyName.includes('名称')) {imgName = elements.propertyValue} + if (elements.propertyType===3) { + elements.propertyName = imgName + data.images.push(elements)} + }); + }); + if (data.images.length) { + let dialogRef = this.dialog.open(ImagesData2,{width:'1350px',height:'700px',data}); //打开图片弹窗 + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); + } + + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); } + } + + } + + + + +} + diff --git a/src/app/ui/fire-fighting-device-look/imagesdata.component.html b/src/app/ui/fire-fighting-device-look/imagesdata.component.html new file mode 100644 index 0000000..534df3e --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/imagesdata.component.html @@ -0,0 +1,9 @@ +
+
{{data.name}}
+
+
+ + +
+
+
\ No newline at end of file diff --git a/src/app/ui/fire-fighting-device-look/imagesdata.component.ts b/src/app/ui/fire-fighting-device-look/imagesdata.component.ts new file mode 100644 index 0000000..5def2fe --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/imagesdata.component.ts @@ -0,0 +1,82 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import Swiper from 'swiper'; + + + +@Component({ + selector: 'imagesdata', + templateUrl: './imagesdata.component.html', + styleUrls: ['./fire-fighting-device.component.scss'] + }) +export class ImagesData2 { + + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public dialog: MatDialog) {} + + ngOnInit(): void { + this.data.images.forEach(element => { + element.newImageUrl = `${element.propertyValue}?x-oss-process=image/resize,m_fill,h_170,w_299` + }); + } + + //查看大图 + seeImage (index) { + let data = { + allImages:this.data.images, + imgIndex: index} + let dialogRef = this.dialog.open(previewBigImg2, + {width: '1600px', + height:'900px',data}); + } + +} + + + +@Component({ + selector: 'previewBigImg', + templateUrl: './previewImg.html', + styleUrls: ['../realistic-picture-look/realistic-picture.component.scss'] +}) +export class previewBigImg2 { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) { } + testSwiper: Swiper; + + ngOnInit(): void { + this.allImages = this.data.allImages + this.allImages.forEach(element => { + element.previewImageUrl = `${element.propertyValue}?x-oss-process=image/auto-orient,1` //处理图片URL地址 + }); + } + + ngAfterViewInit() { + this.testSwiper = new Swiper('.swiper-container', { + lazy: true, + initialSlide: this.data.imgIndex, + direction: 'horizontal', + loop: false, + + + + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + } + }); + } + + allImages:any; //展示所有的图片 + rotationAngle:number=0; //旋转角度 + + //旋转图片 + rotate () { + this.rotationAngle = this.rotationAngle+90 + if (this.rotationAngle === 360) {this.rotationAngle = 0} + } + +} + \ No newline at end of file diff --git a/src/app/ui/fire-fighting-device-look/previewImg.html b/src/app/ui/fire-fighting-device-look/previewImg.html new file mode 100644 index 0000000..cd20d6a --- /dev/null +++ b/src/app/ui/fire-fighting-device-look/previewImg.html @@ -0,0 +1,17 @@ +
图片详情
+
+
+
+ +
+
+
+ + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/key-site-look/key-site.component.html b/src/app/ui/key-site-look/key-site.component.html new file mode 100644 index 0000000..8af5827 --- /dev/null +++ b/src/app/ui/key-site-look/key-site.component.html @@ -0,0 +1,120 @@ +
+ + +
+ +
+

重点部位情况

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
重点部位名称 + {{element.name}} + 重点部位所在位置 + {{element.position}} + 建筑结构 + {{element.structure}} + 使用性质 + {{element.nature}} + 主要危险性 + {{element.hazards}} + 图片 + 查看图片 +
+

暂无数据,请前往平面图进行相关数据录入

+
+
+

重点提示

+ +

+ +

+
+ +
+
+ + +
+ +
+

重点部位情况

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
重点部位名称 + {{element.name}} + 重点部位所在位置 + {{element.position}} + 建筑结构 + {{element.structure}} + 使用性质 + {{element.nature}} + 主要危险性 + {{element.hazards}} + 图片 + 查看图片 +
+

暂无数据,请前往平面图进行相关数据录入

+
+
+

重点提示

+ +

+ +

+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/app/ui/key-site-look/key-site.component.scss b/src/app/ui/key-site-look/key-site.component.scss new file mode 100644 index 0000000..3fbf2eb --- /dev/null +++ b/src/app/ui/key-site-look/key-site.component.scss @@ -0,0 +1,58 @@ +.content { + width: 100%; + height: 90%; + padding: 10px; + overflow-y: auto; + .contentBox{ + width: 100%; + height: 100%; + overflow-y: auto; + text-align: center; + margin: 0 auto; + } +} +table { + width: 90%; + margin: 15px auto; + text-align: center; + .cdk-header-cell { + text-align: center; + } +} + +//重点提示 +.tips{ + width: 75%; + height: 150px; + border: 1px solid black; + border-radius: 5px; + margin: 15px auto; + text-align: center; + padding: 25px; + textarea { + resize: none; + width: 100%; + height: 100%; + } +} + +//预览图片旋转角度 +.rotateA {transform: rotate(90deg) scale(0.75);} +.rotateB {transform: rotate(180deg)} +.rotateC {transform: rotate(270deg) scale(0.75);} +//预览图片 +.previewImgBox { + width: 1500px; + height: 700px; + text-align: center; + img{ + width: auto; + height: auto; + max-width: 100%; + height: 100%;} +} +.previewImgBottom { + text-align: center; + height: 30px; + margin: 20px auto; +} diff --git a/src/app/ui/key-site-look/key-site.component.ts b/src/app/ui/key-site-look/key-site.component.ts new file mode 100644 index 0000000..ba659df --- /dev/null +++ b/src/app/ui/key-site-look/key-site.component.ts @@ -0,0 +1,173 @@ +import { Component, OnInit, ViewChild, Inject } from '@angular/core'; +import {HttpClient} from '@angular/common/http' +import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import { KeySiteImgs2 } from './keysiteimgs.component' +import { ActivatedRoute } from '@angular/router'; + + + +@Component({ + selector: 'app-key-site-look', + templateUrl: './key-site.component.html', + styleUrls: ['./key-site.component.scss'] +}) +export class KeySiteLookComponent implements OnInit { + + constructor(public http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private route:ActivatedRoute,) { } + + displayedColumns: string[] = ['mainname', 'position', 'construction', 'nature', 'danger', 'img']; + + ngOnInit(): void { + this.getCompanyPostion() + this.getCompanyTips() + this.getAllBuilding() + } + + allCompanyPosition:any = []; //所有单位重点部位 + companyTips:any; //所有单位重点提示 + companyInput:any; //单位重点提示数据 + allBuilding:any = []; //所有建筑 + 建筑重点部位 + 建筑重点提示 + + //获取单位重点部位 + getCompanyPostion () { + let id = {companyId:this.route.snapshot.queryParams.id} + this.http.get('/api/CompanyImportantLocations',{params:id}).subscribe(data=>{ + this.allCompanyPosition = data + }) + } + + //获取单位重点提示 + getCompanyTips () { + let id = {companyId:this.route.snapshot.queryParams.id} + this.http.get('/api/CompanyImportantTips',{params:id}).subscribe((data:any)=>{ + if (data) { + this.companyTips = data + this.companyInput = data.details} + }) + } + + //获取所有建筑 + getAllBuilding () { + let id = {companyId:this.route.snapshot.queryParams.id} + this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{ + if (data.length) { + this.allBuilding = data + this.allBuilding.forEach(element => { + element.position = [] //建筑重点部位 + element.tips = null //建筑重点提示 + element.companyInput = null }) //建筑重点提示数据 + this.getAllBuildingPositon() + this.getAllBuildingTips() + } + }) + } + + //获取所有建筑重点部位 + getAllBuildingPositon () { + this.allBuilding.forEach(element => { + let id = {buildingId:element.id} + this.http.get('/api/BuildingImportantLocations',{params:id}).subscribe(data=>{ + element.position = data + }) + }); + } + + //获取所有建筑重点提示 + getAllBuildingTips () { + this.allBuilding.forEach(element => { + let id = {buildingId:element.id} + this.http.get('/api/BuildingImportantTips',{params:id}).subscribe((data:any)=>{ + if (data) { + element.tips = data + element.companyInput = data.details} + }) + }); + } + + //保存单位重点提示 + Preservation () { + if (this.companyTips) { //编辑单位重点提示 + let data = { + companyId: this.companyTips.companyId, + id: this.companyTips.id, + details: this.companyInput} + this.http.put(`/api/CompanyImportantTips/${this.companyTips.id}`,data).subscribe(data=>{ + this.getCompanyTips() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据修改成功','确定',config); + }) + } else { //新增单位重点提示 + let data = { + companyId: this.route.snapshot.queryParams.id, + id : "", + details: this.companyInput || ""} + this.http.post('/api/CompanyImportantTips',data).subscribe(data=>{ + this.getCompanyTips() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据修改成功','确定',config); + }) + } + } + + //保存建筑重点提示 + PreservationBuilding (e) { + if (e.tips) { //编辑建筑重点提示 + let data = { + buildingId: e.id, + id: e.tips.id, + details: e.companyInput} + this.http.put(`/api/BuildingImportantTips/${e.tips.id}`,data).subscribe(data=>{ + this.toUpdate(e) + }) + } else { //新增重点单位提示 + let data = { + buildingId: e.id, + details: e.companyInput || ""} + this.http.post('/api/BuildingImportantTips',data).subscribe(data=>{ + this.toUpdate(e) + }) + } + } + + //查看图片 + seeImg (e) { + if (e.length) { + let data = e + const dialogRef = this.dialog.open(KeySiteImgs2, {//调用open方法打开对话框并且携带参数过去 + width: '1600px', + height:'900px',data}); + dialogRef.afterClosed().subscribe(); + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('暂无图片数据','确定',config); + } + } + + //封装方法获取更新当前tab页重点提示 + toUpdate (e) { + let id = {buildingId:e.id} + this.http.get('/api/BuildingImportantTips',{params:id}).subscribe((data:any)=>{ + if (data) { + this.allBuilding.forEach(element => { + if (element.id === e.id) { + element.tips = data + element.companyInput = data.details} + }); + } // if + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据修改成功','确定',config); + }) + } + + + +} diff --git a/src/app/ui/key-site-look/keyimgdetail.component.html b/src/app/ui/key-site-look/keyimgdetail.component.html new file mode 100644 index 0000000..e69de29 diff --git a/src/app/ui/key-site-look/keyimgdetail.component.ts b/src/app/ui/key-site-look/keyimgdetail.component.ts new file mode 100644 index 0000000..655cf04 --- /dev/null +++ b/src/app/ui/key-site-look/keyimgdetail.component.ts @@ -0,0 +1,17 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import Swiper from 'swiper'; + + + +@Component({ + selector: 'keyimgdetail', + templateUrl: './keyimgdetail.component.html', + styleUrls: ['./key-site.component.scss'] + }) +export class KeyImgDetail { + +} + \ No newline at end of file diff --git a/src/app/ui/key-site-look/keysiteimgs.component.html b/src/app/ui/key-site-look/keysiteimgs.component.html new file mode 100644 index 0000000..992faec --- /dev/null +++ b/src/app/ui/key-site-look/keysiteimgs.component.html @@ -0,0 +1,18 @@ +
图片详情
+
+
+
+ +
+
+
+ + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/key-site-look/keysiteimgs.component.ts b/src/app/ui/key-site-look/keysiteimgs.component.ts new file mode 100644 index 0000000..fb90d71 --- /dev/null +++ b/src/app/ui/key-site-look/keysiteimgs.component.ts @@ -0,0 +1,55 @@ +import { Component, OnInit, Inject ,ViewChild} from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import Swiper from 'swiper'; + + + +@Component({ + selector: 'keysiteimgs', + templateUrl: './keysiteimgs.component.html', + styleUrls: ['./key-site.component.scss'] + }) + +export class KeySiteImgs2 { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) { } + testSwiper: Swiper; + + ngOnInit(): void { + this.allImages = [] + this.data.forEach(element => { + element = `${element}?x-oss-process=image/auto-orient,1` + this.allImages.push(element) + }); + } + + ngAfterViewInit() { + + this.testSwiper = new Swiper('.swiper-container', { + direction: 'horizontal', + loop: false, + lazy: true, + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + } + }); + + } + + allImages:any; //展示所有的图片 + rotationAngle:number=0; //旋转角度 + + //旋转图片 + rotate () { + this.rotationAngle = this.rotationAngle+90 + if (this.rotationAngle === 360) {this.rotationAngle = 0} + } + + + +} + \ No newline at end of file diff --git a/src/app/ui/realistic-picture-look/addRealPicture.html b/src/app/ui/realistic-picture-look/addRealPicture.html new file mode 100644 index 0000000..542256f --- /dev/null +++ b/src/app/ui/realistic-picture-look/addRealPicture.html @@ -0,0 +1,18 @@ +
创建实景图分组
+
+
+ + + + + +
+ + +
+ +
+
\ No newline at end of file diff --git a/src/app/ui/realistic-picture-look/editRealPicture.html b/src/app/ui/realistic-picture-look/editRealPicture.html new file mode 100644 index 0000000..820857d --- /dev/null +++ b/src/app/ui/realistic-picture-look/editRealPicture.html @@ -0,0 +1,18 @@ +
编辑实景图分组
+
+
+ + + + + +
+ + +
+ +
+
\ No newline at end of file diff --git a/src/app/ui/realistic-picture-look/previewImg.html b/src/app/ui/realistic-picture-look/previewImg.html new file mode 100644 index 0000000..1cde6b9 --- /dev/null +++ b/src/app/ui/realistic-picture-look/previewImg.html @@ -0,0 +1,17 @@ +
图片详情
+
+
+
+ +
+
+
+ + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/realistic-picture-look/realistic-picture.component.html b/src/app/ui/realistic-picture-look/realistic-picture.component.html new file mode 100644 index 0000000..0f42fc6 --- /dev/null +++ b/src/app/ui/realistic-picture-look/realistic-picture.component.html @@ -0,0 +1,59 @@ +
+
+
+
+ 实景图 + +
+
+
+
+ folder{{item.name}} +
+
+ 暂无数据 +
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+ check_circle +
+ + + 保存 + 删除 +
+ +

暂无数据

+
+ + +
+ +
+
diff --git a/src/app/ui/realistic-picture-look/realistic-picture.component.scss b/src/app/ui/realistic-picture-look/realistic-picture.component.scss new file mode 100644 index 0000000..cfbc003 --- /dev/null +++ b/src/app/ui/realistic-picture-look/realistic-picture.component.scss @@ -0,0 +1,174 @@ +.content { + margin: 0 0 0 10px; + width: 100%; + height: 90%; + overflow-y: auto; + display: flex; + .leftBox { + flex: 15%; + padding-top: 10px; + .bank { + display: flex; + padding-left: 10px; + .mat-icon {margin-right: 15px;} + } + } + .rightBox { + border-left: 1px solid #999; + flex: 85%; + display: flex; + flex-direction: column; + .topBox { + flex: 5%; padding: 10px; + display: flex; + :first-child {flex: 85%;}; + :last-child {flex: 15%;} + } + .bottomBox { + flex: 95%; + padding: 5px 0 0 25px; + overflow: auto; + .imgsBoxflex { + display: flex; + flex-direction: row; + flex-wrap: wrap; + } + } + } +} + +//icon统一样式 +.mat-icon { + cursor:pointer; + width: 18px; + height: 18px; + vertical-align:top; + margin-right: 10px; +} +.title {margin-right: 30px;font-weight: 500; font-size: 18px;} + +.material { + cursor:pointer; + height: 30px; + font-size: 16px; + margin-top: 10px; + padding-left: 15px; + span { + max-width: 200px; + display: inline-block; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; + } + .btn { + color: #FFC122; + } +} +.imgBox{ + width: 300px; + height: 200px; + margin: 0 35px 35px 0; + display: inline-block; + position: relative; + .fixedImg { + width: 100%; + height: 170px; + text-align: center; + margin-bottom: 3px; + img { + width: auto; + height: auto; + max-width: 100%; + height: 100%; + cursor:pointer; + } + } + input{ + font-size:12px; + width: 100px; + height:18px; + border-radius:3px; + border:1px solid #c8cccf; + outline:0; + text-align:left; + padding-left: 5px; + display:inline-block; + cursor: pointer;} + input::-webkit-input-placeholder{ + color: #986655; + font-size: 12px; + } + a {display: inline-block; + width: 45px; + height: 24px; + line-height: 24px; + text-align: center; + border-radius: 3px; + background-color: #2196F3; + font-size: 14px; + color: #fff;} +} +.uploadFileFixed { + position: relative; + .uploadFile { + opacity:0; + display: inline-block; + width: 88px; + height: 36px; + position: absolute; + top: 0px; + left: 0px; + } +} +//分页 +.mat-paginator { + background-color: rgba(255,255,255,0); + padding-right: 10%; +} +.isLoading{ + display: inline-block; + margin-left: 15px; + top: 8px; +} + +//左侧实景图文件样式 +.leftFile { + background-color: rgba(225,225,225,0.8); +} +//选中图片样式 +.selectImg { + -webkit-filter: drop-shadow(0px 0px 5px #000); + filter: drop-shadow(0px 0px 5px #000); + border: 1px solid red; +} +.checkedImg { + position: absolute; + top: 1px; + right: 1px; + color:#00FF00; + font-size: 30px; + z-index: 999; +} +//预览图片旋转角度 +.rotateA {transform: rotate(90deg) scale(0.75);} +.rotateB {transform: rotate(180deg)} +.rotateC {transform: rotate(270deg) scale(0.75);} + + + +//预览图片 +.previewImgBox { + width: 1500px; + height: 700px; + text-align: center; + img{ + width: auto; + height: auto; + max-width: 100%; + height: 100%;} +} +.previewImgBottom { + text-align: center; + height: 30px; + margin: 20px auto; +} diff --git a/src/app/ui/realistic-picture-look/realistic-picture.component.ts b/src/app/ui/realistic-picture-look/realistic-picture.component.ts new file mode 100644 index 0000000..cf1dc66 --- /dev/null +++ b/src/app/ui/realistic-picture-look/realistic-picture.component.ts @@ -0,0 +1,410 @@ +import { Component, OnInit, Inject, ViewChild } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { FileUploader } from 'ng2-file-upload'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import Swiper from 'swiper'; +import { Router,ActivatedRoute } from '@angular/router' + +@Component({ + selector: 'app-realistic-picture-look', + templateUrl: './realistic-picture.component.html', + styleUrls: ['./realistic-picture.component.scss'] +}) +export class RealisticPictureLookComponent implements OnInit { + uploader:FileUploader = new FileUploader({ //初始化上传文件 + url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`, + method: "POST", + itemAlias: "uploadedfile", + autoUpload: false, + removeAfterUpload:true, + }); + + constructor(private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } + + ngOnInit(): void { + let companyId = this.route.snapshot.queryParams.id + this.http.get('/api/RealityImageGroups',{params:{ + companyId : companyId + }}).subscribe((data:any)=>{ + this.allRealPicture = data + this.selectReal = data[0] + this.getAllRealPicture() + }) + } + + companyId:any; //单位编号 + allRealPicture:any=[]; //所有实景图文件 + selectReal:any; //选中的实景图文件 + selectRealIndex:number=0; //选中的实景图文件下标 + allImages:any=[]; //实景图文件对应所有的实景图 + isDownload:boolean = false; //是否批量下载 + downloadList:any = []; //选中需要下载的图片 + + //分页 + @ViewChild(MatPaginator, {static: true}) + paginator: MatPaginator; + length:any; //共多少条数据 + pageSize:any = '12'; //每页条数 + pageSizeOptions: number[] = [12] //设置每页条数 + PageNumber:any; //第几页 + + //分页切换 + chagePage (e) { + this.PageNumber = e.pageIndex+1 + this.getAllRealPicture() + } + + //获取所有实景图分组 + getAllGrouping () { + let companyId = this.route.snapshot.queryParams.id + this.http.get('/api/RealityImageGroups',{params:{ + companyId : companyId + }}).subscribe((data:any)=>{ + this.allRealPicture = data + this.selectReal = data[this.selectRealIndex] + }) + } + + //获取实景图分组对应实景图 + getAllRealPicture () { + if (this.selectReal) { + let data ={ + groupId: this.selectReal.id, + PageNumber: this.PageNumber || 1, + pageSize: this.pageSize, + } + this.http.get('/api/RealityImages',{params:data}).subscribe((data:any)=>{ + this.allImages = data.items + this.length = data.totalCount + this.pageSize = data.pageSize + this.downloadList = [] + this.allImages.forEach(element => { //每张图片设置选中状态为false + element.newImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址 + element.checked = false //图片是否选中布尔值 + element.nameStart = element.name.substring(0,element.name.lastIndexOf(".")); //图片名称前缀 + element.nameEnd = element.name.substring(element.name.lastIndexOf("."),element.name.length); //图片名称后缀 + }); + + }) + } + } + + //切换左侧实景图文件 + changeReal (e,index) { + if (this.selectRealIndex != index) { + this.selectReal = e + this.selectRealIndex = index + this.isDownload = false + this.downloadList = [] + this.getAllRealPicture() + } + } + + //选择批量下载 + download () { + this.isDownload = !this.isDownload + if (!this.isDownload) { //取消批量下载时数组清空 + this.allImages.forEach(element => {element.checked = false}); + this.downloadList = [] + } + } + + // 预览图片---批量选择图片 + operation (e,index) { + if (this.isDownload) { //批量选择图片 + e.checked = !e.checked + if (e.checked==true) {this.downloadList.push(e)} + else {this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1)} + } else { //预览图片 + let data = { + allImages:this.allImages, + imgIndex: index} + let dialogRef = this.dialog.open(previewImg3, + {width: '1600px', + height:'900px',data}); + dialogRef.afterClosed().subscribe(); + } + + } + + //新建实景图文件 + addReal () { + + } + + //编辑实景图文件 + editReal () { + + } + + //删除实景图文件 + delete () { + let companyId = this.route.snapshot.queryParams.id + if (this.selectReal) { + let isDelete = confirm('您确定要删除吗') + if (isDelete) { + this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data=>{ + this.http.get('/api/RealityImageGroups',{params:{ + companyId : companyId + }}).subscribe((data:any)=>{ + this.allRealPicture = data + this.selectReal = data[this.selectRealIndex] + this.allImages = [] + this.getAllRealPicture() + }) + }) + } + } + } + + + + //实景图修改 + preservationImg (e) { + let data = { + id:e.id, + name:e.nameStart+e.nameEnd, + imageUrl:e.imageUrl, + realityImageGroupId:e.realityImageGroupId + } + this.http.put(`/api/RealityImages/${e.id}`,data).subscribe(data=>{ + this.getAllRealPicture() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('图片修改成功','确定',config); + }) + } + + //实景图删除 + deleteImg (e) { + let isDelete = confirm('您确定要删除吗') + if (isDelete) { + this.http.delete(`/api/RealityImages/${e.id}`).subscribe(data=>{ + this.getAllRealPicture() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('图片删除成功','确定',config); + }) + this.http.delete(`/api/Objects/PlanPlatform/${e.imageUrl}`).subscribe(data=>{}) + } + } + + + + + + isLoading:boolean = false; //loading加载 + //上传文件↓ + file:any; //上传的文件 + objectName:any; //上传对象名 + uploadId:any; //上传分块上传事件编号 + + //change选择文件 + uploadFile (e) { + if (this.selectReal) { + this.file = e.target.files[0] || null //上传的文件 + let URL = window.URL.createObjectURL(this.file) + var img = new Image() + img.src = URL + let that = this + img.onload = function () { + if(img.width>=4096 || img.height>=5000 ){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + that.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); + that.uploader.clearQueue(); //清空input控件文件 + (document.getElementById('uploadFile')).value = null //清空input框缓存 + }else{ that.startUploading() } + } //onload + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择或创建实景图文件夹','确定',config); + this.uploader.clearQueue(); //清空input控件文件 + (document.getElementById('uploadFile')).value = null //清空input框缓存 + } + } + + //上传文件 + startUploading () { + let file = this.file || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + let shardSize = 5 * 1024 * 1024 //5MB一个分片 + let maxdSize = 20 * 1024 * 1024 //限制20MB + + if (file && fileSize<=shardSize) { //上传文件<=5MB时 + this.uploader.queue[0].upload();//开始上传 + this.uploader.queue[0].onSuccess = (response, status, headers) => { + if (status == 201) { // 上传文件成功,上传文件后获取服务器返回的数据 + let tempRes = JSON.parse(response); + this.objectName = tempRes.objectName + this.addRealImg() + }else { // 上传文件后获取服务器返回的数据错误 + let tempRes = JSON.parse(response); + }}; + } else if (file && fileSize>shardSize && fileSize5MB时,分块上传 + let data = {filename: file.name} + this.isLoading = true + this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.companyId}/RealImgs`,{},{params:data}).subscribe((data:any)=>{ //初始化分段上传 + this.objectName = data.objectName + this.uploadId = data.uploadId + this.subsectionUploading() + }) + } + + } + + PartNumberETag:any=[]; //每次返回需要保存的信息 + //开始分段上传 + 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 //切割文件开始位置 + let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 + let formData = new FormData() + formData.append("file",file.slice(start, end)) + + //同步写法实现异步调用 + let result = await new Promise((resolve, reject) => { + // await 需要后面返回一个 promise 对象 + this.http.post(`/api/MultipartUpload/PlanPlatform/${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) + if (this.PartNumberETag.length === allSlice) {this.endUploading()} + }//for循环 + + } + + //完成分块上传 + endUploading () { + let data = this.PartNumberETag + let paramsData = {uploadId:this.uploadId} + this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{ + this.addRealImg() //上传完成后,发送请求创建实景图 + this.isLoading = false + this.uploader.clearQueue(); //清空input控件文件 + this.PartNumberETag =[] //清空保存返回的信息 + }) + } + + //上传图片成功后获取url地址发送请求创建实景图 + addRealImg () { + let data = { + name: this.file.name, + imageUrl:this.objectName, + realityImageGroupId: this.selectReal.id, + } + this.http.post('/api/RealityImages',data).subscribe(data=>{ + (document.getElementById('uploadFile')).value = null //清空input框缓存 + this.getAllRealPicture() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('图片上传成功','确定',config); + }) + } + + + + //批量下载↓ + //开始下载 + async batchDownload () { + if (this.downloadList.length) { //开始批量循环下载 + this.isLoading = true + for (let i=0;i{ + this.http.get(`/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}`,{responseType: 'blob'},).subscribe(data=>{ + let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址 + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + link.setAttribute("download", this.downloadList[i].name); + document.body.appendChild(link); + link.click(); + result('success')}) + }) + if(i == this.downloadList.length-1) { //判断是否下载完毕 + this.isLoading = false + this.isDownload = false + this.allImages.forEach(element => {element.checked = false}); + this.downloadList = []} + + } //for循环 + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择图片','确定',config);} + } + + + + + +} + + + +//预览图片组件 +@Component({ + selector: 'app-previewImg', + templateUrl: './previewImg.html', + styleUrls: ['./realistic-picture.component.scss'] +}) +export class previewImg3 { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) { } + testSwiper: Swiper; + + ngOnInit(): void { + this.allImages = this.data.allImages + this.allImages.forEach(element => { + element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址 + }); + } + + ngAfterViewInit() { + this.testSwiper = new Swiper('.swiper-container', { + lazy: true, + initialSlide: this.data.imgIndex, + direction: 'horizontal', + loop: false, + + + + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + } + }); + } + + allImages:any; //展示所有的图片 + rotationAngle:number=0; //旋转角度 + + //旋转图片 + rotate () { + this.rotationAngle = this.rotationAngle+90 + if (this.rotationAngle === 360) {this.rotationAngle = 0} + } + +} + + diff --git a/src/app/ui/threetype-plan/threetype-plan.component.html b/src/app/ui/threetype-plan/threetype-plan.component.html new file mode 100644 index 0000000..643b6b5 --- /dev/null +++ b/src/app/ui/threetype-plan/threetype-plan.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/src/app/ui/threetype-plan/threetype-plan.component.scss b/src/app/ui/threetype-plan/threetype-plan.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/ui/threetype-plan/threetype-plan.component.spec.ts b/src/app/ui/threetype-plan/threetype-plan.component.spec.ts new file mode 100644 index 0000000..2dd589e --- /dev/null +++ b/src/app/ui/threetype-plan/threetype-plan.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ThreetypePlanComponent } from './threetype-plan.component'; + +describe('ThreetypePlanComponent', () => { + let component: ThreetypePlanComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ThreetypePlanComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ThreetypePlanComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/threetype-plan/threetype-plan.component.ts b/src/app/ui/threetype-plan/threetype-plan.component.ts new file mode 100644 index 0000000..0d0903e --- /dev/null +++ b/src/app/ui/threetype-plan/threetype-plan.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-threetype-plan', + templateUrl: './threetype-plan.component.html', + styleUrls: ['./threetype-plan.component.scss'] +}) +export class ThreetypePlanComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/ui/ui-routing.module.ts b/src/app/ui/ui-routing.module.ts index de79c0a..4f046a4 100644 --- a/src/app/ui/ui-routing.module.ts +++ b/src/app/ui/ui-routing.module.ts @@ -9,6 +9,11 @@ import { RealCasesComponent } from './real-cases/real-cases.component'; import { SimilarPlansComponent } from './similar-plans/similar-plans.component'; import { DataPushComponent } from './data-push/data-push.component'; import { BasicinfoLookComponent } from './basicinfo-look/basicinfo.component'; +import { AllaroundComponent } from './allaround/allaround.component'; +import { FireFightingDeviceLookComponent } from './fire-fighting-device-look/fire-fighting-device.component'; +import { KeySiteLookComponent } from './key-site-look/key-site.component'; +import { RealisticPictureLookComponent } from './realistic-picture-look/realistic-picture.component'; +import { ThreetypePlanComponent } from './threetype-plan/threetype-plan.component'; @@ -16,7 +21,12 @@ const routes: Routes = [ { path: 'plan', component:DataPushComponent, //子级路由 children:[ { path: 'planarGraph', component:planComponent}, - { path: 'basicInfo', component:BasicinfoLookComponent} + { path: 'basicInfo', component:BasicinfoLookComponent}, + { path: 'allaround', component:AllaroundComponent}, + { path: 'fire-fighting-device', component:FireFightingDeviceLookComponent}, + { path: 'key-site', component:KeySiteLookComponent}, + { path: 'realistic-picture', component:RealisticPictureLookComponent}, + { path: '3DPlan', component:ThreetypePlanComponent}, ]}, { path: 'collectionTools', component:CollectionToolsComponent}, { path: 'dangerous', component:DangerousComponent}, diff --git a/src/app/ui/ui.module.ts b/src/app/ui/ui.module.ts index 77b39d6..9f34a9e 100644 --- a/src/app/ui/ui.module.ts +++ b/src/app/ui/ui.module.ts @@ -66,9 +66,18 @@ import { CountdownModule } from 'ngx-countdown'; import { DataPushComponent } from './data-push/data-push.component'; import { BasicinfoLookComponent } from './basicinfo-look/basicinfo.component'; import { LookMaster2 } from './basicinfo-look/lookmaster.component'; +import { AllaroundComponent } from './allaround/allaround.component'; +import { ImgDetails } from './allaround/imgdetails.component'; +import { FireFightingDeviceLookComponent } from './fire-fighting-device-look/fire-fighting-device.component'; +import { ImagesData2, previewBigImg2 } from './fire-fighting-device-look/imagesdata.component'; +import { ImgsDataDetail2 } from './fire-fighting-device-look/addGrouping.component'; +import { KeySiteLookComponent } from './key-site-look/key-site.component'; +import { KeySiteImgs2 } from './key-site-look/keysiteimgs.component'; +import { RealisticPictureLookComponent, previewImg3 } from './realistic-picture-look/realistic-picture.component'; +import { ThreetypePlanComponent } from './threetype-plan/threetype-plan.component'; @NgModule({ - declarations: [SafeHtmlPipe,GisComponent,UiComponent,PersonaldataComponent, ChangepasswordComponent,IsnoPipe,ConfirmpswDirective,TimePipe, CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent, DisposalNodeComponent, DangerousComponent, SimilarPlansComponent, RealCasesComponent, PlanAssistanceComponent,planComponent, DataPushComponent,BasicinfoLookComponent,LookMaster2], + declarations: [SafeHtmlPipe,GisComponent,UiComponent,PersonaldataComponent, ChangepasswordComponent,IsnoPipe,ConfirmpswDirective,TimePipe, CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent, DisposalNodeComponent, DangerousComponent, SimilarPlansComponent, RealCasesComponent, PlanAssistanceComponent,planComponent, DataPushComponent,BasicinfoLookComponent,LookMaster2,AllaroundComponent,ImgDetails,FireFightingDeviceLookComponent,ImagesData2,ImgsDataDetail2,KeySiteLookComponent,KeySiteImgs2,previewBigImg2,RealisticPictureLookComponent,previewImg3, ThreetypePlanComponent], imports: [ CommonModule,