/* * @Descripttion: * @version: * @Author: sueRimn * @Date: 2020-12-25 16:13:50 * @LastEditors: sueRimn * @LastEditTime: 2021-08-16 11:12:52 */ import { Component, Inject, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { HttpClient } from '@angular/common/http' declare var CryptoJS import { DomSanitizer } from '@angular/platform-browser'; import { Viewer as photoViewer } from 'photo-sphere-viewer'; import Viewer from 'viewerjs'; declare var echarts: any; @Component({ selector: 'app-wait-examineer', templateUrl: './wait-examineer.component.html', styleUrls: ['./wait-examineer.component.scss'] }) export class WaitExamineerComponent implements OnInit { constructor(private http: HttpClient, public snackBar: MatSnackBar, private sanitizer: DomSanitizer, public dialog: MatDialog) { } preparelevels: any//编制级别下拉框 ngOnInit(): void { sessionStorage.setItem('gisplan', 'look') let level = sessionStorage.getItem("level"); //编制级别下拉框 if (level == "0") {//如果是总队 this.preparelevels = [ { name: "总队", value: "0" }, { name: "支队", value: "1" }, { name: "大队", value: "2" }, { name: "中队", value: "3" } ] } if (level == "1") {//如果是支队 this.preparelevels = [ { name: "支队", value: "1" }, { name: "大队", value: "2" }, { name: "中队", value: "3" } ] } if (level == "2") {//如果是大队 this.preparelevels = [ { name: "大队", value: "2" }, { name: "中队", value: "3" } ] } if (level == "3") {//如果是中队 this.preparelevels = [ { name: "中队", value: "3" } ] } this.getAlltabledate() this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src); } planTypeIndex //平面图类型 选择是总平面图还是层平面图 selectedIndexChange(e) { this.selected.setValue(e) if (e == 1) { this.planTypeIndex = 'zong' } else if (e == 2) { this.planTypeIndex = 'ceng' } } src: any //毕生word文档地址 iframeSrc: any //毕生word文档地址 ---> 主要转成frame安全链接 selected = new FormControl(0); //选项卡 实例 level = ''//操作类型 js//组织机构 addtime//时间 projectlevel//预案级别 previewshow = false//预览得分是否显示 tableDate isallDate = true//是否显示完成数据,默认显示 companyBuiltInGrouping = ["基本信息", "四周毗邻", "消防设施"] indexbar //饼状图实例 indexzhu PlanLevel//编制级别 count//一共多少条 checked//是否选中 chuorzhong//判断初审还是终审 radioid//选中的id shenheTable = []//选中要审核的对象 showtype = -1//0:word,1:全景图,2:二维三维,3:重点单位 compantData = { name: '', buildingTypes: [], address: '' } organizationName planData id itemid companyId fetchUrl companyName plantypes //获取表格数据 getAlltabledate() { let paramsdata: any = { Operation: this.level || [], ContentType: Number(this.projectlevel) || [], Level: this.PlanLevel || [], verifyState: [0, 3], PlanType:this.plantypes||[] } this.http.get("/api/ContentVerifies", { params: paramsdata }).subscribe((data: any) => { this.tableDate = data.items this.count = data.totalCount }) } //提交查询 onSubmit(value) { this.getAlltabledate() } //刷新 record() { this.level = '' this.projectlevel = '' this.PlanLevel = '' this.plantypes=[] let level = sessionStorage.getItem("level"); this.getAlltabledate() } lookImg(imgUrl,type?:boolean) { // console.log(imgUrl) let dom = document.getElementById(`viewerjs`) let pObjs = dom.childNodes; let node = document.createElement("img") node.style.display = "none"; if(type){ let src = imgUrl.split("?")[0] node.src = src }else{ node.src = "/api/Objects/PlanPlatform/" + imgUrl; } node.id = 'imgxxx' dom.appendChild(node) setTimeout(() => { let viewer = new Viewer(document.getElementById(`viewerjs`), { hidden: () => { dom.removeChild(pObjs[0]); viewer.destroy(); } }); node.click(); }, 0); } //radio点击事件 viewer//全景图对象 waterData: any//需要传递给子组件的水源信息 LinkageForceDetailInfo: any//需要传递给子组件的联动力量信息 fireForceDetailInfo: any//需要传递给子组件的消防力量信息 postlevel: any selectedItem: any differentContent: any//当前单位变更数据 differentContentOfUnitInfo: any//当前单位变更数据 之 单位信息 differentContentOfBuildingsInfo: any//当前单位变更数据 之 建筑信息 differentContentOfFunction: any = []//当前单位变更数据 之 功能分区 differentContentOfPicture: any//当前单位变更数据 之 实景图 bianzhi = false radioClick(e, item) { this.selectedItem = item //console.log(item) // console.log('当前选择的信息',JSON.parse(this.selectedItem.differentContent) ) if (item.contentType == 11 && this.selectedItem.differentContent) { let differentContent = JSON.parse(this.selectedItem.differentContent) //console.log('差异信息', differentContent) // 单位信息 this.differentContentOfUnitInfo = differentContent.filter(item => item.propertyName == 'basicInfo') // 实景图 this.differentContentOfPicture = differentContent.filter(item => item.propertyName == 'realityImageGroups') if (differentContent.filter(item => item.propertyName == 'buildings').length != 0) { //建筑信息 this.differentContentOfBuildingsInfo = JSON.parse(JSON.stringify(differentContent.filter(item => item.propertyName == 'buildings')[0])) function resolveDiff(list: Array, path?: Array): Array { let resultList: Array = []; for (let i = 0; i < list.length; i++) { if (path == null) path = []; let item = list[i]; //递归最底层 if (!item.childrens.length) { let res = new Result(); res.path = path.concat([item.displayName]); res.oldValue = item.oldValue; res.newValue = item.newValue; resultList.push(res); } else { !!item.displayName && path.push(item.displayName); let deepList = resolveDiff(item.childrens, path) resultList = resultList.concat(deepList); } } return resultList; } this.differentContentOfBuildingsInfo.childrens.forEach(element => { element.difData = resolveDiff(element.childrens) }); //console.log('建筑信息', this.differentContentOfBuildingsInfo) //功能分区 let differentContentOfFunction = JSON.parse(JSON.stringify(differentContent.filter(item => item.propertyName == 'buildings')[0])) this.differentContentOfFunction = [] differentContentOfFunction.childrens.forEach(item => { item.childrens.forEach(i => { if (i.propertyName == "buildingFunctionalDivisions") { i.propertyName = item.propertyName this.differentContentOfFunction.push(i) } }); }); } } // console.log('功能分区', this.differentContentOfFunction) this.showtype = -1 this.organizationName = '' this.itemid = item.itemId this.id = item.id this.fetchUrl = '' this.viewer = {} if (item.contentType == 11) { this.bianzhi = false window.setTimeout(() => { this.showtype = 3 sessionStorage.setItem('companyId', item.itemId) }, 0) } else if (item.contentType == 12) { this.bianzhi = false //水源 this.http.get(`/api/WaterSources/${item.itemId}`).subscribe((data) => { this.waterData = data this.showtype = 12 }) } else if (item.contentType == 13) { this.bianzhi = false //消防力量 this.http.get(`/api/CustomFireForce/${item.itemId}`).subscribe((data: any) => { if (data.forceType != 0) {//如果是其他消防力量 this.postlevel = 4 } else { this.postlevel = data.level } if (data.fireForceDetailInfo && data.fireForceDetailInfo.location) { this.fireForceDetailInfo = data.fireForceDetailInfo this.showtype = 13 } else if (!data.fireForceDetailInfo) { //提示 该提交内容为空,从未保存过,请驳回该审核 this.showtype = 666 } else { data.fireForceDetailInfo.location = { x: null, y: null } this.fireForceDetailInfo = data.fireForceDetailInfo this.showtype = 13 } }) } else if (item.contentType == 14) { this.bianzhi = false //联动力量 this.http.get(`/api/LinkageForces/${item.itemId}`).subscribe((data: any) => { data.location ? null : data.location = { x: null, y: null } this.LinkageForceDetailInfo = data this.showtype = 14 }) } else { this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data: any) => { //console.log('预案信息',data) this.companyId = data.companyId this.companyName = data.companyName if (data.planType != 2 && data.planType != 1) { if (data.planMode == 2) { this.showtype = 0 this.bianzhi = true this.src = `/CreatePlanOnlineFive?navIsOpen=false&companyId=${data.companyId}&planName=${data.name}&unitName=${data.companyName}&planCategory=${data.planCategory}&planId=${data.id}&unitTypeId=${data.company.buildingTypes[0].id}&orName=${data.company.organizationName}&orId=${data.company.organizationId}&pattern=false` this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src); //this.src=`/keyUnit/viewunitinfoplan?id=${data.companyId}&orName=${data.company.organizationId}&orId=${data.company.organizationName}` } else { this.bianzhi = false this.fetchUrl = data.attachmentUrls[0] var index = this.fetchUrl.indexOf("\/") if (this.fetchUrl.substr(0, index) == 'psw') { this.showtype = 1 var obj = document.getElementById('viewer') if (obj != null) { obj.innerHTML = '' } window.setTimeout(() => { this.viewer = new photoViewer({ container: document.querySelector('#viewer'), panorama: '/api/Objects/PlanPlatform/' + this.fetchUrl, }); }) } else { this.lookWord() } } } else { this.bianzhi = false this.organizationName = item.organizationName this.planData = data this.handleData() return } }) } if (e.checked) { this.shenheTable.push(item) } else { for (var i = 0; i < this.shenheTable.length; i++) { if (this.shenheTable[i].id == item.id) { this.shenheTable.splice(i, 1) } } } this.radioid = item.itemId } //毕升 lookWord() { console.log('lookWord') this.showtype = 0 //let src let suffix = this.fetchUrl.split('.')[this.fetchUrl.split('.').length - 1].toLowerCase() if (suffix == 'docx' || suffix == 'doc') { let arr = this.fetchUrl.split('.') arr[arr.length - 1] = 'pdf' this.src = `/api/Objects/PlanPlatform/` + arr.join('.') } else if (suffix == 'pdf') { this.src = `/api/Objects/PlanPlatform/` + this.fetchUrl } this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src); } //查看按钮跳转 lookNew() { window.open(this.src) } //查看二维三维预案 thirdPartyURL planType twoOrthree handleData() { this.compantData = { name: '', buildingTypes: [], address: '' } this.planType = this.planData.planMode let data = this.planData if (data.planType == 1) { this.twoOrthree = 2 } else if (data.planType == 2) { this.twoOrthree = 3 } if (this.planData.planMode == 0) { //预案planMode=0时, 查看word //this.lookWord() } else if (this.planData.planMode == 1) { //预案planMode=1时, 解析文档 } else if (this.planData.planMode == 2) { //预案planMode=2时, 跳查看页面组件 this.showtype = 2 this.http.get(`/api/Plans/${data.companyId}`).subscribe((data: any) => { data && data.company ? this.compantData = data.company : null }) sessionStorage.setItem("buildingTypeId", this.compantData.buildingTypes.length ? this.compantData.buildingTypes[0].id : undefined); sessionStorage.setItem("companyId", this.companyId); sessionStorage.setItem("planId", this.itemid); sessionStorage.setItem("editable", '0'); sessionStorage.setItem("planName", data.name) let companyId = sessionStorage.getItem("companyId") this.thirdPartyURL = this.sanitizer.bypassSecurityTrustResourceUrl(`/keyUnit/viewunitinfoplans?id=${companyId}`); //window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`) } else if (this.planData.planMode == 3) { //预案planMode=3时, 第三方网址' this.showtype = 2 this.http.get(`/api/Plans/${data.companyId}`).subscribe((data: any) => { data && data.company ? this.compantData = data.company : null }) //this.dialog.open(show3D,{width:'1350px',height:'700px',data:{url:data.url}}); //打开图片弹窗 this.thirdPartyURL = this.sanitizer.bypassSecurityTrustResourceUrl(data.url) } } //打开三维预案弹窗 oopen3Dshow() { this.dialog.open(show3D, { width: '1650px', height: '850px', data: { url: this.thirdPartyURL, twoOrthree: this.twoOrthree, radioid: this.radioid } }); } //变更数据和全部数据切换按钮 buttonChange() { this.isallDate = !this.isallDate this.previewshow = false } //同意操作 agree() { var agreeList = [] var companyAgreeList = [] const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 if (this.shenheTable.length == 0) { this.snackBar.open('请勾选要审核的条目!', '确定', config); } else { const dialogRef = this.dialog.open(remark, { width: '460px', height: '290px', data: { shenhedata: this.shenheTable, type: 1, radioid: this.radioid } }); dialogRef.afterClosed().subscribe(result => { this.shenheTable = [] this.showtype = -1 this.getAlltabledate() }); } } //拒绝操作 refuse() { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 var refuseList = [] var companyrefuseList = [] if (this.shenheTable.length == 0) { this.snackBar.open('请选择要审核的预案!', '确定', config); } else { const dialogRef = this.dialog.open(remark, { width: '460px', height: '290px', data: { shenhedata: this.shenheTable, type: 2, radioid: this.radioid } }); dialogRef.afterClosed().subscribe(result => { this.shenheTable = [] this.showtype = -1 this.getAlltabledate() }); } } //分数饼状图 bar() { var ec = echarts as any; this.indexbar = ec.init(document.getElementById('indexbar'), 'light'); var option = { tooltip: { trigger: 'item', formatter: '{a}
{b}: {c} ({d}%)' }, title: { text: '总分', left: 'center', bottom: 70, textStyle: { color: '#FFFFFF', fontSize: 16 } }, series: [ { name: '分数', type: 'pie', radius: ['50%', '70%'], bottom: 50, avoidLabelOverlap: false, label: { show: true, position: 'center', fontSize: 16, color: '#FFFFFF' }, labelLine: { show: false }, data: [ { value: 93, name: '93分', itemStyle: { color: '#2196F3' } }, { value: 7, itemStyle: { color: '#FFFFFF' } } ] } ] }; this.indexbar.setOption(option); } //分数柱状图 zhu() { var ec = echarts as any; this.indexzhu = ec.init(document.getElementById('zhu'), 'light'); var option = { grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'value', show: false, axisLine: { show: false }, splitLine: { show: false }, axisTick: { show: false }, }, yAxis: { type: 'category', axisTick: { show: false }, axisLine: { show: false }, axisLabel: { color: "#FFFFFF", fontSize: 16 }, data: ['实战演练记录', '六熟悉记录', '上传CAD', '实景图', '功能分区', '重点单位', '消防设施', '四周毗邻', '基本信息'] }, series: [ { type: 'bar', stack: '总量', showBackground: true, backgroundStyle: { color: '#FFFFFF' }, label: { show: true, position: 'inside', fontSize: 14, formatter: '{c}分' }, data: [ { value: 18, itemStyle: { color: '#58D091' } }, { value: 16, itemStyle: { color: '#58D091' } }, { value: 19, itemStyle: { color: '#58D091' } }, { value: 16, itemStyle: { color: '#58D091' } }, { value: 16, itemStyle: { color: '#58D091' } }, { value: 13, itemStyle: { color: '#FFCC00' } }, { value: 6, itemStyle: { color: '#FF4D4D' } }, { value: 19, itemStyle: { color: '#58D091' } }, { value: 16, itemStyle: { color: '#58D091' } }, ] }, { type: 'bar', stack: '总量', label: { show: false, position: 'insideRight' }, data: [2, 4, 1, 4, 4, 7, 14, 1, 4], itemStyle: { color: "#FFFFFF", }, }, ] } this.indexzhu.setOption(option); } preview() { this.previewshow = !this.previewshow if (this.previewshow) { window.setTimeout(() => { this.bar() this.zhu() }, 0) } } //判断iframe是否加载完成 iftrue=true ifranmeLoad(){ var iframe = document.getElementById("myiframe"); iframe.onload = function(){ } this.iftrue=!this.iftrue } } //二三维预案查看 @Component({ selector: 'app-wait-examineer-show3D', templateUrl: './show3D.html', styleUrls: ['./wait-examineer.component.scss'] }) export class show3D { constructor(private sanitizer: DomSanitizer, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data, public dialog: MatDialog) { } ngOnInit(): void { this.threedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.data.url.changingThisBreaksApplicationSecurity) } threedUrl } //审批意见弹窗 @Component({ selector: 'app-wait-examineer-remark', templateUrl: './remark.html', styleUrls: ['./wait-examineer.component.scss'] }) export class remark { constructor(private http: HttpClient, private sanitizer: DomSanitizer, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data, public dialog: MatDialog, public snackBar: MatSnackBar) { } ngOnInit(): void { this.shenheTable = this.data.shenhedata this.radioid = this.data.radioid } companyrefuseList = [] refuseList = [] shenheTable = [] companyAgreeList = [] agreeList = [] remark radioid //取消 close() { this.dialogRef.close() } //确定 define() { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 if (this.data.type == 1) { //同意操作 // console.log(this.shenheTable) //单个审核 if (this.shenheTable.length == 1) { //重点单位审核 if (this.shenheTable[0].contentType == 11) { let body: any = { id: this.shenheTable[0].id, itemId: this.shenheTable[0].itemId, verifyState: 4, contentType: 11, remark: this.remark || '', title: this.shenheTable[0].title + '基本信息' } this.http.put(`/api/ContentVerifies`, body).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() //this.getAlltabledate() }) } else if (this.shenheTable[0].contentType == 12 || this.shenheTable[0].contentType == 13 || this.shenheTable[0].contentType == 14) { let body: any = { id: this.shenheTable[0].id, itemId: this.shenheTable[0].itemId, verifyState: 4, contentType: this.shenheTable[0].contentType, remark: this.remark || '', title: this.shenheTable[0].title } this.http.put(`/api/ContentVerifies`, body).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } else { //预案审核 if (this.shenheTable[0].verifyState == 0) { let body: any = { auditStatus: 16, auditOpinion: this.remark || '' } this.http.put(`/api/PlanAudits/${this.shenheTable[0].itemId}/First`, body).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() //this.getAlltabledate() }) } else if (this.shenheTable[0].verifyState == 3) { let body: any = { auditStatus: 2, auditOpinion: this.remark || '' } this.http.put(`/api/PlanAudits/${this.radioid}`, body).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() //this.getAlltabledate() }) } } this.shenheTable = [] } //批量审核 else { if (this.shenheTable[0].contentType == 11 || this.shenheTable[0].contentType == 12) { //批量审批水源和重点单位 for (var i = 0; i < this.shenheTable.length; i++) { var body = { id: this.shenheTable[i].id, itemId: this.shenheTable[i].itemId, verifyState: 4, remark: this.remark } this.companyAgreeList.push(body) } this.http.put(`/api/ContentVerifies/Batch`, this.companyAgreeList).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } else { //批量审核预案 for (var i = 0; i < this.shenheTable.length; i++) { var cart = { planComponentId: this.shenheTable[i].itemId, auditStatus: this.shenheTable[i].verifyState == 3 ? 2 : 16, auditOpinion: this.remark || '' } this.agreeList.push(cart) } this.http.put(`/api/PlanAudits/Batch`, this.agreeList).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } this.shenheTable = [] } } else { //单个审核拒绝 if (this.shenheTable.length == 1) { //重点单位审核拒绝 if (this.shenheTable[0].contentType == 11) { let body: any = { id: this.shenheTable[0].id, itemId: this.shenheTable[0].itemId, verifyState: 5, contentType: 11, remark: this.remark, title: this.shenheTable[0].title + '基本信息' } this.http.put(`/api/ContentVerifies`, body).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() //this.getAlltabledate() }) } else if (this.shenheTable[0].contentType == 12 || this.shenheTable[0].contentType == 13 || this.shenheTable[0].contentType == 14) { let body: any = { id: this.shenheTable[0].id, itemId: this.shenheTable[0].itemId, verifyState: 5, contentType: this.shenheTable[0].contentType, remark: this.remark, title: this.shenheTable[0].title } this.http.put(`/api/ContentVerifies`, body).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } else { //预案审核拒绝 if (this.shenheTable[0].verifyState == 0) { let refbody = { auditOpinion: this.remark, auditStatus: 32 } this.http.put(`/api/PlanAudits/${this.shenheTable[0].itemId}/First`, refbody).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } else if (this.shenheTable[0].verifyState == 3) { let refbody = { auditOpinion: this.remark, auditStatus: 4 } this.http.put(`/api/PlanAudits/${this.radioid}`, refbody).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } } this.shenheTable = [] } //批量审核 else { if (this.shenheTable[0].contentType == 11 || this.shenheTable[0].contentType == 12) { //批量审批水源和重点单位 for (var i = 0; i < this.shenheTable.length; i++) { var bodyre = { id: this.shenheTable[i].id, itemId: this.shenheTable[i].itemId, remark: this.remark, verifyState: 5 } this.companyrefuseList.push(bodyre) } this.http.put(`/api/ContentVerifies/Batch`, this.companyrefuseList).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } else { for (var i = 0; i < this.shenheTable.length; i++) { var carts = { planComponentId: this.shenheTable[i].itemId, auditStatus: this.shenheTable[i].verifyState == 3 ? 4 : 32, auditOpinion: this.remark } this.refuseList.push(carts) } this.http.put(`/api/PlanAudits/Batch`, this.refuseList).subscribe(data => { this.snackBar.open('操作成功!', '确定', config); this.dialogRef.close() }) } this.shenheTable = [] } } } } class DiffItem { newValue: any oldValue: any childrens: Array operation: number displayName: string propertyName: string } class Result { path: string[] oldValue: any newValue: any }