| | |
| | | "angular-qq-maps": "^1.0.1", |
| | | "angular-split": "^1.0.0-rc.0", |
| | | "angular-tree-component": "^7.0.1", |
| | | "angular2-baidu-map": "^4.1.0", |
| | | "angular2-baidu-map": "^4.3.2", |
| | | "core-js": "^2.5.1", |
| | | "echarts": "^4.0.4", |
| | | "file-saver": "^1.3.3", |
| | |
| | | this.data = pageData.data.map(row => { |
| | | row['index'] = index++; |
| | | return row; |
| | | }); |
| | | }); |
| | | this.total = pageData.total; |
| | | const pages = Math.ceil(this.total / this.pageSize); |
| | | this.pageIndex = this.pageIndex > pages ? pages : this.pageIndex; |
| | | } |
| | | } |
| | | refreshStatus() { |
| | |
| | | public getListUrl () { |
| | | return this.urls.list; |
| | | } |
| | | public getSqlParams(queryMap: {[key: string]: number|string}) { |
| | | const example = new ExampleService(); |
| | | const orgId = !!queryMap.orgId ? queryMap.orgId : null; |
| | | const mpointId = !!queryMap.mpointId ? queryMap.mpointId : null; |
| | | const devMacOrName = !!queryMap.devMacOrName && !!(<string>queryMap.devMacOrName).trim() ? queryMap.devMacOrName : null; |
| | | let criWithMac: Criteria = null; |
| | | let criWithName: Criteria = null; |
| | | if (!!devMacOrName) { |
| | | criWithName = example.or().andLike({name: 'name', value: '%' + devMacOrName + '%'}); |
| | | criWithMac = example.or().andLike({name: 'mac', value: '%' + devMacOrName + '%'}); |
| | | } |
| | | if (!!mpointId) { |
| | | if (!!devMacOrName) { |
| | | criWithName.andEqualTo({name: 'monitorPointId', value: mpointId}); |
| | | criWithMac.andEqualTo({name: 'monitorPointId', value: mpointId}); |
| | | }else { |
| | | example.or().andEqualTo({name: 'monitorPointId', value: mpointId}); |
| | | } |
| | | } else if (!!orgId) { |
| | | if (!!devMacOrName) { |
| | | criWithName.andCondition(`monitor_point_id in (select id from monitor_point where organization_id = ${orgId})`); |
| | | criWithMac.andCondition(`monitor_point_id in (select id from monitor_point where organization_id = ${orgId})`); |
| | | }else { |
| | | example.or().andCondition(`monitor_point_id in (select id from monitor_point where organization_id = ${orgId})`); |
| | | } |
| | | } |
| | | return example.getSqlParam(); |
| | | } |
| | | |
| | | constructor(private http: _HttpClient) { } |
| | | delete(...ids: number[]): Observable< ResultBean<any> > { |
| | | return this.http.post(this.urls.delete, ids); |
| | |
| | | () => !isExpireModelShow |
| | | ).subscribe( (event: HttpErrorResponse) => { |
| | | isExpireModelShow = true; |
| | | if (!!event.error) { |
| | | let errorMsg = ''; |
| | | let errorMsg = ''; |
| | | if (!!event && !!event.error) { |
| | | const erroCode = !!event.error['errorCode'] ? Number.parseInt(event.error['errorCode']) : 0; |
| | | switch (erroCode) { |
| | | case 10: errorMsg = '未登录,请登录'; break; |
| | | case 11: errorMsg = '登录过期,请重新登录'; break; |
| | | case 12: errorMsg = '账号过期,请联系供应商'; break; |
| | | case 0: errorMsg = '服务器处于离线状态'; break; |
| | | case 0: errorMsg = '服务器处于离线状态'; break; |
| | | default: errorMsg = '登录过期,请重新登录'; break; |
| | | } |
| | | // 清空refresh信息,不再刷新 |
| | | this.loginService.clearRefreshToken(); |
| | | this.model.info({ |
| | | maskClosable: false, |
| | | title: errorMsg, |
| | | onOk: () => { |
| | | isExpireModelShow = false; |
| | | this.goTo('/passport/login'); |
| | | } |
| | | }); |
| | | } |
| | | }else { |
| | | errorMsg = '服务器处于离线状态'; |
| | | } |
| | | // 清空refresh信息,不再刷新 |
| | | this.loginService.clearRefreshToken(); |
| | | this.model.info({ |
| | | maskClosable: false, |
| | | title: errorMsg, |
| | | onOk: () => { |
| | | isExpireModelShow = false; |
| | | this.goTo('/passport/login'); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | get loginService(): LoginService { |
| | |
| | | import { CoorPicker, Device } from '@business/entity/data'; |
| | | import { AdjustConfigComponent } from './adjust-config/adjust-config.component'; |
| | | import { DeviceEditComponent } from './device-edit/device-edit.component'; |
| | | import { ModalHelper } from '@delon/theme'; |
| | | import { ModalHelper, _HttpClient } from '@delon/theme'; |
| | | import { NzModalService, NzMessageService } from 'ng-zorro-antd'; |
| | | import { PageBean, ResultBean } from '@business/entity/grid'; |
| | | import { DeviceService } from '@business/services/http/device.service'; |
| | | import { Component, OnInit, ElementRef, ViewChild } from '@angular/core'; |
| | | import { SimpleTableColumn } from '@delon/abc'; |
| | | import { SimpleTableColumn, SimpleTableComponent } from '@delon/abc'; |
| | | import { Subject } from 'rxjs/Subject'; |
| | | import { CoordinatesPickerComponent } from 'app/routes/map/coordinates-picker/coordinates-picker.component'; |
| | | import { CoorPickerService } from 'app/routes/map/coordinates-picker/coordinates-picker.service'; |
| | | import { OrganizationService } from '@business/services/http/organization.service'; |
| | | import { ExampleService } from '@business/services/util/example.service'; |
| | | import { ExampleService, Criteria } from '@business/services/util/example.service'; |
| | | |
| | | @Component({ |
| | | selector: 'app-basic-info', |
| | |
| | | public msgSrv: NzMessageService, |
| | | private modalHelper: ModalHelper, |
| | | private coorPickerService: CoorPickerService, |
| | | private organizationService: OrganizationService |
| | | private organizationService: OrganizationService, |
| | | private http: _HttpClient |
| | | ) { } |
| | | |
| | | ngOnInit() { |
| | |
| | | }); |
| | | } |
| | | load() { |
| | | this.extraParams.queryParams = this.deviceService.getSqlParams(this.queryMap); |
| | | const example = this.initQueryExample(); |
| | | this.extraParams.queryParams = example.getSqlParam(); |
| | | this.selectedRows = []; |
| | | this.simpleTable.load(); |
| | | this.deviceService.countByExample(example).subscribe( |
| | | res => { |
| | | if (!!res && !!res.code) { |
| | | setTimeout(() => { |
| | | const count = res.data; |
| | | const pages = Math.ceil(count / this.simpleTable.ps); |
| | | const pi = this.simpleTable.pi > pages ? pages : this.simpleTable.pi; |
| | | this.simpleTable.load(pi); |
| | | }, 1); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | } |
| | | private initQueryExample() { |
| | | const example = new ExampleService(); |
| | | const orgId = !!this.queryMap.orgId ? this.queryMap.orgId : null; |
| | | const mpointId = !!this.queryMap.mpointId ? this.queryMap.mpointId : null; |
| | | const devMacOrName = !!this.queryMap.devMacOrName && !!(<string>this.queryMap.devMacOrName).trim() ? this.queryMap.devMacOrName : null; |
| | | let criWithMac: Criteria = null; |
| | | let criWithName: Criteria = null; |
| | | if (!!devMacOrName) { |
| | | criWithName = example.or().andLike({name: 'name', value: '%' + devMacOrName + '%'}); |
| | | criWithMac = example.or().andLike({name: 'mac', value: '%' + devMacOrName + '%'}); |
| | | } |
| | | if (!!mpointId) { |
| | | if (!!devMacOrName) { |
| | | criWithName.andEqualTo({name: 'monitorPointId', value: mpointId}); |
| | | criWithMac.andEqualTo({name: 'monitorPointId', value: mpointId}); |
| | | }else { |
| | | example.or().andEqualTo({name: 'monitorPointId', value: mpointId}); |
| | | } |
| | | } else if (!!orgId) { |
| | | if (!!devMacOrName) { |
| | | criWithName.andCondition(`monitor_point_id in (select id from monitor_point where organization_id = ${orgId})`); |
| | | criWithMac.andCondition(`monitor_point_id in (select id from monitor_point where organization_id = ${orgId})`); |
| | | }else { |
| | | example.or().andCondition(`monitor_point_id in (select id from monitor_point where organization_id = ${orgId})`); |
| | | } |
| | | } |
| | | return example; |
| | | } |
| | | delete(...id: number[]) { |
| | | this.deviceService.delete(...id).subscribe( |
| | |
| | | } |
| | | ); |
| | | } |
| | | @ViewChild('simpleTable') simpleTable: { load: Function }; |
| | | @ViewChild('simpleTable') simpleTable: SimpleTableComponent; |
| | | queryTextChanged(event) { |
| | | this.queryTextStream.next(this.queryText); |
| | | } |
| | |
| | | </div> |
| | | <div nz-form-item nz-row class="mb-sm"> |
| | | <div nz-form-label nz-col [nzSm]="4" [nzXs]="24"> |
| | | <label>设备型号</label> |
| | | <label nz-form-item-required>设备型号</label> |
| | | </div> |
| | | <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback> |
| | | <nz-select formControlName="deviceVersionId" [nzPlaceHolder]="'选择 设备(输入名称搜索)'" |
| | |
| | | </div> |
| | | <div nz-form-item nz-row class="mb-sm"> |
| | | <div nz-form-label nz-col [nzSm]="4" [nzXs]="24"> |
| | | <label>监控站点</label> |
| | | <label nz-form-item-required>监控站点</label> |
| | | </div> |
| | | <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback> |
| | | <nz-select formControlName="monitorPointId" [nzPlaceHolder]="'选择 监控站点(输入名称搜索)'" |
| | | nzAllowClear [nzFilter]="false" nzShowSearch (nzSearchChange)="monitorPointChange($event)" [nzNotFoundContent]="'无法找到'" > |
| | | <nz-select formControlName="monitorPointId" [nzPlaceHolder]="'选择 监控站点(输入名称搜索)'" nzAllowClear [nzFilter]="false" nzShowSearch (nzSearchChange)="monitorPointChange($event)" [nzNotFoundContent]="'无法找到'" > |
| | | <nz-option *ngFor="let option of monitorPoints" [nzLabel]="option.name" [nzValue]="option.id" [nzDisabled]="option.disabled"> |
| | | </nz-option> |
| | | </nz-select> |
| | |
| | | import { DeviceService } from '@business/services/http/device.service'; |
| | | import { Component, OnInit } from '@angular/core'; |
| | | import { Device, MonitorPoint} from '@business/entity/data'; |
| | | import { _Validators } from '@delon/abc'; |
| | | import { PageBean, ResultBean } from '@business/entity/grid'; |
| | | import { _HttpClient } from '@delon/theme'; |
| | | import { environment } from '@env/environment'; |
| | |
| | | const validates: Device = { |
| | | name: [data.name, [Validators.required]], |
| | | mac: [data.mac, [Validators.required], [this.macAsyncValidator]], |
| | | deviceVersionId: [data.deviceVersionId], |
| | | monitorPointId: [data.monitorPointId], |
| | | deviceVersionId: [data.deviceVersionId, [Validators.required]], |
| | | monitorPointId: [data.monitorPointId, [Validators.required]], |
| | | professionId: [data.professionId], |
| | | operateUserId: [data.operateUserId], |
| | | address: [data.address], |
| | |
| | | const pageBean: PageBean = {pageIndex: 0, pageSize: 100}; |
| | | const orgId = this.configMap.orgId; |
| | | const example = new ExampleService(); |
| | | text = !!text && !!text.trim() ? text : null; |
| | | text = !!text && !!text.trim() ? '%' + text + '%' : null; |
| | | example.or() |
| | | .andEqualTo({name: 'organizationId', value: this.configMap.orgId}) |
| | | .andEqualTo({name: 'name', value: text}); |
| | | .andLike({name: 'name', value: text}); |
| | | this.monitorPointService.getPageByExample(pageBean, example).subscribe( |
| | | (res: PageBean) => { |
| | | if (res != null && res.data != null) { |
| | |
| | | let _areas = null; |
| | | if (areaNames != null) { |
| | | _areas = { |
| | | label: Object.values(areaNames).filter(d=>d).join('/'), |
| | | label: Object.values(areaNames).filter(d => d).join('/'), |
| | | value: data.areaCode |
| | | }; |
| | | } |
| | |
| | | <span></span> |
| | | </div> |
| | | <div nz-col [nzSpan]="7"> |
| | | <nz-input maxlength="20" [(ngModel)]="queryTest" [nzPlaceHolder]="'请输入地址(省 市 区 路 多少号)'"> |
| | | <nz-input #queryText maxlength="20" [nzPlaceHolder]="'请输入地址(省 市 区 路 多少号)'"> |
| | | </nz-input> |
| | | </div> |
| | | <div nz-col [nzSpan]="1"> |
| | | <button nz-button [nzType]="'primary'" (click)="mapSearch($event)" class="mr-sm"> |
| | | <button nz-button [nzType]="'primary'" (click)="mapSearch(queryText._value,true)" class="mr-sm"> |
| | | <i class="anticon anticon-search"></i><span>搜索</span> |
| | | </button> |
| | | </div> |
| | |
| | | export class CoordinatesPickerComponent implements OnInit { |
| | | Default_LNG = 121; |
| | | Default_LAT = 31.4; |
| | | showZoom = 19; |
| | | isSaving = false; |
| | | markerOption: { |
| | | point: Point, |
| | |
| | | ngOnInit(): void { |
| | | this.data = this.coorPickerService.data; |
| | | let lng = this.data.longitude; |
| | | lng = lng === 0 || lng == null ? this.Default_LNG : lng; |
| | | lng = !lng ? this.Default_LNG : lng; |
| | | this.data.longitude = lng; |
| | | let lat = this.data.latitude; |
| | | lat = lat === 0 || lat == null ? this.Default_LAT : lat; |
| | | lat = !lat ? this.Default_LAT : lat; |
| | | this.data.latitude = lat; |
| | | this.options = { |
| | | minZoom: 3, |
| | | maxZoom: 19, |
| | | cursor: 'default', |
| | | centerAndZoom: { |
| | | lng: lng, |
| | | lat: lat, |
| | | zoom: 19 |
| | | centerAndZoom: { |
| | | lng: this.data.longitude, |
| | | lat: this.data.latitude, |
| | | zoom: this.showZoom |
| | | }, |
| | | enableKeyboard: true |
| | | }; |
| | |
| | | && this.data.longitude === this.Default_LNG |
| | | && !!this.data.address |
| | | && !!this.data.address.trim()) { |
| | | this._localSearch.search(this.data.address); |
| | | this.mapSearch(this.data.address); |
| | | } |
| | | } |
| | | queryTest: string; |
| | | mapSearch(param: any) { |
| | | let text = this.queryTest; |
| | | text = text == null || text.trim() === '' ? '昆山市' : text; |
| | | this._localSearch.search(text); |
| | | city: string; |
| | | // queryText: string; |
| | | mapSearch(queryText: string, isSearch?: boolean) { |
| | | |
| | | if (!!queryText && !!queryText.trim()) { |
| | | this.city = !!this.city ? this.city : '北京市'; |
| | | const end = queryText.indexOf('市') + 1; |
| | | if (end > 0) { |
| | | let start = queryText.indexOf('省') + 1; |
| | | start = start > 0 ? start : queryText.indexOf('区') + 1; |
| | | start = start > end ? 0 : start; |
| | | if (start < end) { |
| | | this.city = queryText.slice(start, end).trim(); |
| | | if (!!this.city) { |
| | | this._map.setCurrentCity(this.city); |
| | | } |
| | | } |
| | | } |
| | | console.log(this.city); |
| | | const myGeo = new this._BMap.Geocoder(); |
| | | const that = this; |
| | | that._map.setCurrentCity(that.city); |
| | | myGeo.getPoint(queryText, function(point){ |
| | | let getPoint = false; |
| | | if (point) { |
| | | that.data.latitude = point.lat; |
| | | that.data.longitude = point.lng; |
| | | getPoint = true; |
| | | }else { |
| | | console.log('您选择地址没有解析到结果!'); |
| | | } |
| | | that.markerOption.point = { |
| | | lng: that.data.longitude, |
| | | lat: that.data.latitude |
| | | }; |
| | | that.options.centerAndZoom = { |
| | | lng: that.data.longitude, |
| | | lat: that.data.latitude, |
| | | zoom: that.showZoom |
| | | }; |
| | | // setTimeout(() => { |
| | | if (getPoint && !isSearch) { |
| | | that._map.centerAndZoom(point, that.showZoom); |
| | | |
| | | } else { |
| | | that._localSearch.search(queryText); |
| | | } |
| | | // }, 3000); |
| | | }, that.city); |
| | | } |
| | | } |
| | | clickMap(e: any) { |
| | | this.markerOption.point = { |
| | |
| | | mobx ">=3" |
| | | mobx-angular ">=1" |
| | | |
| | | angular2-baidu-map@^4.1.0: |
| | | version "4.1.0" |
| | | resolved "https://registry.yarnpkg.com/angular2-baidu-map/-/angular2-baidu-map-4.1.0.tgz#9992840349a78e3d3c3eaf3b3857fd85e59ccb32" |
| | | angular2-baidu-map@^4.3.2: |
| | | version "4.3.2" |
| | | resolved "http://registry.npm.taobao.org/angular2-baidu-map/download/angular2-baidu-map-4.3.2.tgz#bd85d10692e863f97479b640071ef59fe5b1e001" |
| | | dependencies: |
| | | tslib "^1.7.1" |
| | | |
| | | angular2-cookie@^1.2.6: |
| | | version "1.2.6" |