@ -4,7 +4,7 @@
* @Author : sueRimn
* @Author : sueRimn
* @Date : 2020 - 11 - 05 15 :27 : 58
* @Date : 2020 - 11 - 05 15 :27 : 58
* @LastEditors : sueRimn
* @LastEditors : sueRimn
* @LastEditTime : 2020 - 11 - 06 16 :36 : 48
* @LastEditTime : 2020 - 11 - 07 12 :38 : 14
* /
* /
import { Component , OnInit } from '@angular/core' ;
import { Component , OnInit } from '@angular/core' ;
import { HttpClient , HttpHeaders , HttpEventType } from '@angular/common/http' ;
import { HttpClient , HttpHeaders , HttpEventType } from '@angular/common/http' ;
@ -21,6 +21,7 @@ export class KnowRouteComponent implements OnInit {
constructor ( public snackBar : MatSnackBar , private http : HttpClient ) { }
constructor ( public snackBar : MatSnackBar , private http : HttpClient ) { }
ngOnInit ( ) : void {
ngOnInit ( ) : void {
// this.uploadSucced = JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx")) || []
}
}
unitinfo :any = {
unitinfo :any = {
id : '' ,
id : '' ,
@ -51,13 +52,14 @@ export class KnowRouteComponent implements OnInit {
//控制底部div显隐
//控制底部div显隐
showorfalse = "www"
showorfalse = "www"
//判断选中路线的值
//判断选中路线的值
chooseid = - 1
chooseid :any
//熟悉路线对象
//熟悉路线对象
knowRoute = [ { name : ` ` , idnum : "" } ]
knowRoute = [ { name : ` ` , idnum : "" } ]
//熟悉部位对象
//熟悉部位对象
knowBw = [ { name : "消控室" } , { name : "水泵房" } , { name : "疏散楼梯" } , { name : "各楼层" } , { name : "楼层消火栓" } , { name : "水泵结合器" } , { name : "室外消防水源" } ]
knowBw = [ { name : "消控室" } , { name : "水泵房" } , { name : "疏散楼梯" } , { name : "各楼层" } , { name : "楼层消火栓" } , { name : "水泵结合器" } , { name : "室外消防水源" } ]
textareazhi : ""
imgsrc = "../../../assets/images/upload.jpg" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
//没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
imgsrc = "../../../assets/images/upload.jpg"
imgUrl = "" //返回来的图片地址后缀
imgUrl = "" //返回来的图片地址后缀
file : any ; //上传的文件
file : any ; //上传的文件
objectName : any ; //上传对象名
objectName : any ; //上传对象名
@ -102,6 +104,12 @@ export class KnowRouteComponent implements OnInit {
this . isspinner = false
this . isspinner = false
this . imgUrl = data . objectName
this . imgUrl = data . objectName
this . imgsrc = ` /api/Objects/PlanPlatform/ ${ this . imgUrl } ?x-oss-process=image/resize,m_fill,h_170,w_299 `
this . imgsrc = ` /api/Objects/PlanPlatform/ ${ this . imgUrl } ?x-oss-process=image/resize,m_fill,h_170,w_299 `
console . log ( this . imgsrc )
//localStorage.setItem(this.clickName,this.imgsrc)
//this.uploadSucced.push({name:this.clickName,src:this.imgsrc,smark})
this . uploadSucced [ this . chooseid ] . src = this . imgsrc
//this.uploadSucced[this.chooseid].smark=this.textareazhi
console . log ( this . uploadSucced )
const config = new MatSnackBarConfig ( ) ;
const config = new MatSnackBarConfig ( ) ;
config . verticalPosition = 'top' ;
config . verticalPosition = 'top' ;
config . duration = 3000
config . duration = 3000
@ -159,17 +167,57 @@ export class KnowRouteComponent implements OnInit {
} )
} )
}
}
//熟悉部位点击事件
//熟悉部位点击事件
addRoute ( event ) {
addRoute ( event , item ) {
//console.log(event.target.innerHTML)
//console.log(event.target.innerHTML)
//this.knowRoute+=event.target.innerHTML+"🠖"
//this.knowRoute+=event.target.innerHTML+"🠖"
this . showorfalse = "show"
this . showorfalse = "show"
this . knowRoute . push ( { name :event.target.innerHTML , idnum : "🠖" } )
this . knowRoute . push ( { name :event.target.innerHTML , idnum : "🠖" } )
this . uploadSucced . push ( { name :item.name , src : "" , smark : "" } )
// console.log(this.chooseid)
console . log ( this . uploadSucced )
}
}
clickName
savekey
uploadSucced :any = JSON . parse ( localStorage . getItem ( sessionStorage . getItem ( "companyId" ) + "xxx" ) ) || [ ] //上传成功暂存对象
//熟悉路线点击事件
//熟悉路线点击事件
knowroutwClick ( event , key ) {
knowroutwClick ( event , key , item ) {
console . log ( event )
console . log ( 123 , key )
//console.log(this.chooseid)
this . showorfalse = "show"
this . uploadSucced [ key ] . smark = this . textareazhi
this . chooseid = key
this . chooseid = key
//event.target.style.border="1px solid #000000"
//event.target.style.border="1px solid #000000"
this . clickName = item . name + key + sessionStorage . getItem ( "companyId" )
console . log ( this . uploadSucced )
if ( JSON . parse ( localStorage . getItem ( sessionStorage . getItem ( "companyId" ) + "xxx" ) ) && JSON . parse ( localStorage . getItem ( sessionStorage . getItem ( "companyId" ) + "xxx" ) ) [ key ] . src != "" ) {
this . imgsrc = JSON . parse ( localStorage . getItem ( sessionStorage . getItem ( "companyId" ) + "xxx" ) ) [ key ] . src
this . textareazhi = JSON . parse ( localStorage . getItem ( sessionStorage . getItem ( "companyId" ) + "xxx" ) ) [ key ] . smark
//console.log(JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx"))[key])
} else if ( this . uploadSucced [ key ] . src != "" ) {
//this.imgsrc=this.uploadSucced[0].src
/ * f o r ( v a r i = 0 ; i < t h i s . u p l o a d S u c c e d . l e n g t h ; i + + ) {
if ( this . uploadSucced [ i ] . name == this . clickName ) {
console . log ( this . uploadSucced [ i ] . name )
this . imgsrc = this . uploadSucced [ i ] . src
} else { this . imgsrc = "../../../assets/images/upload.jpg" }
} * /
this . imgsrc = this . uploadSucced [ key ] . src
}
else {
this . imgsrc = "../../../assets/images/upload.jpg"
this . textareazhi = ""
}
}
//保存点击事件
savaClick ( ) {
/ * f o r ( v a r i = 0 ; i < t h i s . u p l o a d S u c c e d . l e n g t h ; i + + ) {
localStorage . setItem ( this . uploadSucced [ i ] . name , this . uploadSucced [ i ] . src )
} * /
this . uploadSucced [ this . chooseid ] . smark = this . textareazhi
localStorage . setItem ( sessionStorage . getItem ( "companyId" ) + "xxx" , JSON . stringify ( this . uploadSucced ) )
alert ( "保存成功" )
console . log ( JSON . parse ( localStorage . getItem ( sessionStorage . getItem ( "companyId" ) + "xxx" ) ) )
//this.snackBar.open('上传成功','确定',config);
}
}
}
}