邵佳豪 3 years ago
parent
commit
00c9e34ba1
  1. 65
      src/app/gis-management/gis-labeling/gis-labeling.component.ts

65
src/app/gis-management/gis-labeling/gis-labeling.component.ts

@ -1161,14 +1161,45 @@ export class GisLabelingComponent implements OnInit {
//搜索 //搜索
search() { search() {
let that = this
let placeSearch = MapFactory.PlaceSearchInstance(that); //构造地点查询类
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000;
this.allCompany = [] this.allCompany = []
let paramsdata: any = { Name: this.searchText || '' } let paramsdata: any = { Name: this.searchText || '' }
this.http.get("/api/Companies", { params: paramsdata }).subscribe((data: any) => { this.http.get("/api/Companies", { params: paramsdata }).subscribe((data: any) => {
if (data.items.length) { //数据库api 搜索
this.allCompany = data.items this.allCompany = data.items
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open(`搜索目标结果为${data.items.length}`, '确定', config); this.snackBar.open(`搜索目标结果为${data.items.length}`, '确定', config);
} else { //高德api 搜索
placeSearch.search(that.searchText, (status, result)=>{
if (status != "complete") {
this.snackBar.open(`搜索目标结果为0个`, '确定', config);
console.log(status,result)
return
}
if (result.poiList.pois.length) {
let resultList = []
result.poiList.pois.forEach((element: any) => {
let item = {
address: element.address,
buildingTypes: [],
id: null,
imageUrl: null,
location: {x: element.location.lng, y: element.location.lat},
name: element.name
}
resultList.push(item)
});
that.allCompany = resultList
that.snackBar.open(`搜索目标结果为${resultList.length}`, '确定', config);
} else {
that.snackBar.open(`搜索目标结果为0个`, '确定', config);
}
})
}
}) })
} }
@ -1269,6 +1300,13 @@ export class GisLabelingComponent implements OnInit {
//基本信息 //基本信息
baseInformation(e) { baseInformation(e) {
if (!e.id) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无单位数据', '确定', config);
return
}
this.leftDivState = true this.leftDivState = true
this.showLeftDiv = true this.showLeftDiv = true
this.appLeft.selectBaseInfo(e) //调用子组件方法 this.appLeft.selectBaseInfo(e) //调用子组件方法
@ -1295,6 +1333,13 @@ export class GisLabelingComponent implements OnInit {
//查看预案 //查看预案
seePlan(e) { seePlan(e) {
if (!e.id) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无单位数据', '确定', config);
return
}
let data = e let data = e
let dialogRef = this.dialog.open(LookPlanDialog, {//调用open方法打开对话框并且携带参数过去 let dialogRef = this.dialog.open(LookPlanDialog, {//调用open方法打开对话框并且携带参数过去
width: '1400px', width: '1400px',
@ -1309,9 +1354,16 @@ export class GisLabelingComponent implements OnInit {
//分享 //分享
share(e) { share(e) {
if (!e.id) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无单位数据', '确定', config);
return
}
let data = { let data = {
url: 'https://', url: 'https://',
buildingType: e.buildingTypes[0].name, buildingType: e.buildingTypes.length? e.buildingTypes[0].name : null,
address: e.address address: e.address
} }
let dialogRef = this.dialog.open(ShareUrlDialog, {//调用open方法打开对话框并且携带参数过去 let dialogRef = this.dialog.open(ShareUrlDialog, {//调用open方法打开对话框并且携带参数过去
@ -1503,7 +1555,7 @@ export class ShareUrlDialog {
qrCode qrCode
makeCode() { makeCode() {
this.qrCode = new QRCode(document.getElementById("qrcode"), { this.qrCode = new QRCode(document.getElementById("qrcode"), {
text: this.data.url, text: this.data.url || "",
width: 200, width: 200,
height: 200, height: 200,
colorDark: "#000000", colorDark: "#000000",
@ -1579,8 +1631,7 @@ export class LookPlanDialog {
ngOnInit() { ngOnInit() {
sessionStorage.setItem("companyId", this.data.id) sessionStorage.setItem("companyId", this.data.id || "")
console.log(this.data)
this.getAllPlans() this.getAllPlans()
} }
//关闭弹窗 //关闭弹窗

Loading…
Cancel
Save