Browse Source

封装接口重新定义

上海一张图
陈鹏飞 4 years ago
parent
commit
631121fb26
  1. 3
      src/app/data-collection/data-collection.module.ts
  2. 4
      src/app/data-collection/fire-force/fire-force.component.ts
  3. 4
      src/app/data-collection/linkage-forces/linkage-forces.component.ts
  4. 4
      src/app/data-collection/water-collection/water-collection.component.ts
  5. 2
      src/app/gis-management/gis-labeling/gis-labeling.component.ts
  6. 4
      src/app/key-unit/basicinfo/basicinfo.component.ts
  7. 2
      src/app/key-unit/router-gis/router-gis.component.ts
  8. 2
      src/modules/map/declare/KeDaSearch/keDaSearch.html
  9. 12
      src/modules/map/declare/KeDaSearch/keDaSearch.ts

3
src/app/data-collection/data-collection.module.ts

@ -47,9 +47,10 @@ import { AddWater, WaterCollectionComponent } from './water-collection/water-col
import { AddFireForce, FireForceComponent, ViewDetails } from './fire-force/fire-force.component';
import { AddLinkageForce, LinkageForcesComponent, ViewDetails2 } from './linkage-forces/linkage-forces.component';
import { NzTreeModule } from 'ng-zorro-antd/tree';
import { KedaSearchComponent } from '@src/modules/map/declare/KeDaSearch/keDaSearch';
@NgModule({
declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent,AddWater,AddFireForce,ViewDetails,AddLinkageForce,ViewDetails2],
declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent,AddWater,AddFireForce,ViewDetails,AddLinkageForce,ViewDetails2,KedaSearchComponent],
imports: [
CommonModule,
A11yModule,

4
src/app/data-collection/fire-force/fire-force.component.ts

@ -822,8 +822,8 @@ export class FireForceComponent implements OnInit {
var autoOptions = {
input: "tipinput"
};
let auto = MapFactory.AutocompleteInstance(autoOptions);
this.placeSearch = MapFactory.PlaceSearchInstance(); //构造地点查询类
let auto = MapFactory.AutocompleteInstance(autoOptions,this);
this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
auto.on("select", (e)=>{
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat}

4
src/app/data-collection/linkage-forces/linkage-forces.component.ts

@ -543,8 +543,8 @@ export class LinkageForcesComponent implements OnInit {
var autoOptions = {
input: "tipinput"
};
let auto = MapFactory.AutocompleteInstance(autoOptions);
this.placeSearch = MapFactory.PlaceSearchInstance(); //构造地点查询类
let auto = MapFactory.AutocompleteInstance(autoOptions,this);
this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
auto.on("select", (e)=>{
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat}

4
src/app/data-collection/water-collection/water-collection.component.ts

@ -547,8 +547,8 @@ export class WaterCollectionComponent implements OnInit {
var autoOptions = {
input: "tipinput"
};
let auto = MapFactory.AutocompleteInstance(autoOptions);
this.placeSearch = MapFactory.PlaceSearchInstance(); //构造地点查询类
let auto = MapFactory.AutocompleteInstance(autoOptions,this);
this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
auto.on("select", (e)=>{
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat}

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

@ -1338,7 +1338,7 @@ export class GisLabelingComponent implements OnInit {
var autoOptions = { city: info.city }
let keywords
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd
var autoComplete = MapFactory.AutocompleteInstance(autoOptions);
var autoComplete = MapFactory.AutocompleteInstance(autoOptions,that);
autoComplete.search(keywords, function (status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(() => {

4
src/app/key-unit/basicinfo/basicinfo.component.ts

@ -175,8 +175,8 @@ export class BasicinfoComponent implements OnInit {
var autoOptions = {
input: "tipinput"
};
var auto = MapFactory.AutocompleteInstance(autoOptions);
this.placeSearch = MapFactory.PlaceSearchInstance(); //构造地点查询类
var auto = MapFactory.AutocompleteInstance(autoOptions,this);
this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
auto.on("select", (e) => {
this.newPositionMarker.setPosition([e.poi.location.lng, e.poi.location.lat])
this.markerPosition2 = { x: e.poi.location.lng, y: e.poi.location.lat }

2
src/app/key-unit/router-gis/router-gis.component.ts

@ -126,7 +126,7 @@ export class RouterGISComponent implements OnInit {
var autoOptions = {city: info.city}
let keywords
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd
var autoComplete = MapFactory.AutocompleteInstance(autoOptions);
var autoComplete = MapFactory.AutocompleteInstance(autoOptions,that);
autoComplete.search(keywords, function(status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(()=>{

2
src/modules/map/declare/KeDaSearch/keDaSearch.html

@ -1,3 +1,3 @@
<div class="content" [ngStyle]="{'left': left+'px', 'top': top+'px', 'min-width': minWidth+'px'}" *ngIf="searchList.length">
<div class="content" [ngStyle]="{'left': leftCss,'top': topCss,'min-width': minWidthCss}" *ngIf="searchList.length">
<div *ngFor="let item of searchList" (click)="select(item)" class="item">{{item.name}}</div>
</div>

12
src/modules/map/declare/KeDaSearch/keDaSearch.ts

@ -13,9 +13,9 @@ export class KedaSearchComponent {
constructor() { }
static instance: KedaSearchComponent
public searchList:AutocompleteSelect[] = []; //list
public left:number = 0
public top:number = 0
public minWidth:number = 0
public leftCss:string = '0px';
public topCss:string = '0px';
public minWidthCss:string = '0px';
ngOnInit(): void {
KedaSearchComponent.instance = this
@ -25,9 +25,9 @@ export class KedaSearchComponent {
addDOMEvent (id:string) {
let input = document.getElementById(id)
let DOM = input.getBoundingClientRect()
this.left = DOM.left
this.top = DOM.top + DOM.height + 2
this.minWidth = DOM.width
// this.left = DOM.left
// this.top = DOM.top + DOM.height + 2
// this.minWidth = DOM.width
}
select(e) {

Loading…
Cancel
Save