diff --git a/src/app/ui/basicinfo/basicinfo.component.html b/src/app/ui/basicinfo/basicinfo.component.html
index f368979..e9348f1 100644
--- a/src/app/ui/basicinfo/basicinfo.component.html
+++ b/src/app/ui/basicinfo/basicinfo.component.html
@@ -104,10 +104,10 @@
(focus)="closeorganizationbox()">
-
+
单位照片:
-
-
+
+
@@ -118,9 +118,17 @@
-
-
-
+
diff --git a/src/app/ui/basicinfo/basicinfo.component.scss b/src/app/ui/basicinfo/basicinfo.component.scss
index d3562f7..585e67f 100644
--- a/src/app/ui/basicinfo/basicinfo.component.scss
+++ b/src/app/ui/basicinfo/basicinfo.component.scss
@@ -1,14 +1,14 @@
.topbox{
height: 485px;
width: 100%;
- // border-bottom: 1px solid black;
+ padding-bottom: 20px;
.mainbox{
height: 100%;
position: relative;
+ display: flex;
.mainleft{
width:800px;
height: 100%;
- // background-color: yellow;
float: left;
.inputbox{
width: 343px;
@@ -40,13 +40,8 @@
}
.addbtn{
width: 695px;
- position: absolute;
- bottom: -495px;
- text-align: center;
- margin-bottom:20px;
- button{
- margin: 0 4px;
- }
+ margin:20px 0;
+ padding-bottom: 20px;
}
.uploadimg{
width: 400px;
@@ -55,18 +50,13 @@
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;
-
+ cursor: pointer;
position: absolute;
top: 0px;
left: 79px;
@@ -76,29 +66,28 @@
}
.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;
-
+ flex: 1;
+ height: 430px;
+ margin-right: 100px;
+ position: relative;
+ .searchinput{
+ display: flex;
+ position: absolute;
+ left: 0;
+ top: 0;
+ p{
+
+ }
+ }
}
}
}
diff --git a/src/app/ui/basicinfo/basicinfo.component.ts b/src/app/ui/basicinfo/basicinfo.component.ts
index d6ee466..6b1f049 100644
--- a/src/app/ui/basicinfo/basicinfo.component.ts
+++ b/src/app/ui/basicinfo/basicinfo.component.ts
@@ -19,7 +19,7 @@ import { isNgTemplate } from '@angular/compiler';
import * as _ from 'lodash';
import Swiper from 'swiper';
import { LookMaster } from './lookmaster.component'
-
+declare var AMap: any;
@Component({
selector: 'app-basicinfo',
@@ -86,13 +86,72 @@ export class BasicinfoComponent implements OnInit {
allorganizing:any = [] //所有组织机构
constructor(private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { }
+ isMapLabel:boolean
ngOnInit(): void {
this.getallunittype()
this.getorganization()
// this.getunitinfo()
this.getunitallbuilding()
+
+
+ }
+
+ //地图标注位置
+ marker:any//单位点标记
+ markerPosition:any = {x: 0, y: 0}//单位坐标
+ labelGis(){
+ var map = new AMap.Map('container', {
+ zoom:12
+ })
+ if(this.isMapLabel){
+ this.marker = new AMap.Marker({
+ position: [this.unitinfo.location.x,this.unitinfo.location.y], // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+ draggable: true
+ });
+ map.add(this.marker);
+ map.setFitView();
+ this.marker.on('dragging', (e)=>{
+ this.markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat}
+ })
+ }
+
+ //输入提示
+ var autoOptions = {
+ input: "tipinput"
+ };
+ AMap.plugin(['AMap.PlaceSearch','AMap.AutoComplete'], () =>{
+ var auto = new AMap.AutoComplete(autoOptions);
+ var placeSearch = new AMap.PlaceSearch({
+ // map: map
+ // pageSize: 5, // 单页显示结果条数
+ // pageIndex: 1 // 页码
+ }); //构造地点查询类
+ auto.on("select", (e)=>{
+ placeSearch.search(e.poi.name, (status, result) => {
+ if(this.marker){
+ map.remove(this.marker);
+ }
+ this.isMapLabel = true
+ // 查询成功时,result即对应匹配的POI信息
+ var poi = result.poiList.pois[0];
+ this.markerPosition = {x: poi.location.lng, y: poi.location.lat}
+ this.marker = new AMap.Marker({
+ position: poi.location, // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+ title: poi.name,
+ draggable: true
+ });
+ map.add(this.marker);
+ map.setFitView();
+ this.marker.on('dragend', (e)=>{
+ this.markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat}
+ })
+ });
+ });//注册监听,当选中某条记录时会触发
+ });
+
}
+
//获得所有单位类型
getallunittype() {
this.http.get("/api/BuildingTypes/Simple").subscribe(data => {
@@ -105,57 +164,73 @@ export class BasicinfoComponent implements OnInit {
(data: any) => {
this.allorganizing = data;
this.dataSource.data = this.tree.toTree(data);
- this.getunitinfo();
+ let _this = this
+ this.getunitinfo().then((e)=>{
+ if(this.unitinfo.location && (this.unitinfo.location.x != 0 && this.unitinfo.location.y != 0) ){//已标注
+ _this.isMapLabel = true
+ _this.markerPosition = _this.unitinfo.location
+ }else{//未标注
+ _this.isMapLabel = false
+ }
+ this.labelGis()
+ })
}
)
}
//获得当前单位的基本信息
- getunitinfo(){
- this.http.get("/api/CompanyAccount/Company").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
+ async getunitinfo(){
+ let result = await new Promise((resolve, reject) => {
+ this.http.get("/api/CompanyAccount/Company").subscribe((data:any)=>{
+ if(data.buildingTypes.length){
+ sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id)
}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; // 临时变量更新没有副作用
- }
- });
+ sessionStorage.setItem('buildingTypeId',"")
+ }
+ let node
+ this.allorganizing.forEach(item => {
+ if(item.id == data.organizationId){
+ node = item
+ }
+ });
+ if(node){
+ if(!node.parentId){
+ this.selectedorganization = node.name
+ }else{
+ let namearr = [node.name]
+ let targetId = node.parentId; // 临时变量
+ for(let i = 0; i < node.level ; i++){
+ this.allorganizing.forEach(item => {
+ if(item.id == targetId ){
+ namearr.push(item.name)
+ targetId = item.parentId; // 临时变量更新没有副作用
+ }
+ });
+ }
+ namearr.reverse()
+ let str = ''
+ namearr.forEach(item=>{
+ str += '/' + item
+ })
+ this.selectedorganization = str.substr(1)
}
- namearr.reverse()
- let str = ''
- namearr.forEach(item=>{
- str += '/' + item
- })
- this.selectedorganization = str.substr(1)
}
- }
-
- this.unitinfo = data
- this.selectedorganizationid = data.organizationId
- if(data.imageUrl){
- this.imgsrc = data.imageUrl
- }
- if(data.buildingTypes[0]){
- this.defaultbuildingTypes = data.buildingTypes[0].id
- this.buildingTypesname = data.buildingTypes[0].name
- }
- })
+
+
+ this.unitinfo = data
+
+ resolve(this.unitinfo)
+ console.log(456789,this.unitinfo)
+ 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
+ }
+ })
+ })
+
}
//获得建筑自定义信息
getbuildingCustomData(){
@@ -848,7 +923,8 @@ export class BasicinfoComponent implements OnInit {
hasChild = (_: number, node: any) => node.expandable;
- imgsrc = "../../../assets/images/upload.jpg" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
+ imgsrc = "" //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数
+ noImg = '../../../assets/images/upload.jpg'
imgUrl = ""//返回来的图片地址后缀
file: any; //上传的文件
objectName: any; //上传对象名
@@ -1027,10 +1103,7 @@ export class BasicinfoComponent implements OnInit {
phone: value.linkphone,
address: value.unitaddress,
imageUrl: this.imgsrc,
- location: {
- x: 0,
- y: 0
- },
+ location: this.markerPosition,
modifiedTime: time,
organizationId: this.selectedorganizationid,
organizationName: null,
diff --git a/src/app/ui/collection-tools/collection-tools.component.html b/src/app/ui/collection-tools/collection-tools.component.html
index d59a1c3..bb56466 100644
--- a/src/app/ui/collection-tools/collection-tools.component.html
+++ b/src/app/ui/collection-tools/collection-tools.component.html
@@ -234,7 +234,7 @@