fengxiang
2018-06-15 565f5b26ee306966f0b4b9447b7a8f9b04a9fe00
改变暂存
2 files added
11 files modified
108 ■■■■ changed files
src/app/business/enum/types.enum.ts 12 ●●●●● patch | view | raw | blame | history
src/app/business/services/http/device.service.ts 2 ●●● patch | view | raw | blame | history
src/app/business/services/util/tools.service.ts 4 ●●●● patch | view | raw | blame | history
src/app/routes/dashboard/workplace/workplace.component.ts 18 ●●●● patch | view | raw | blame | history
src/app/routes/devices/basic-info/basic-info.component.ts patch | view | raw | blame | history
src/app/routes/devices/basic-info/device-edit/device-edit.component.ts 4 ●●●● patch | view | raw | blame | history
src/app/routes/devices/monitor-point/monitor-point.component.ts patch | view | raw | blame | history
src/app/routes/sensors/basic-info/basic-info.component.html 2 ●●●●● patch | view | raw | blame | history
src/app/routes/sensors/basic-info/basic-info.component.ts 11 ●●●●● patch | view | raw | blame | history
src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.html 6 ●●●●● patch | view | raw | blame | history
src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.ts 43 ●●●●● patch | view | raw | blame | history
src/app/routes/sensors/sensors.module.ts 4 ●●● patch | view | raw | blame | history
src/app/routes/systems/organization/organization-config/organization-config.component.html 2 ●●● patch | view | raw | blame | history
src/app/business/enum/types.enum.ts
@@ -9,11 +9,13 @@
    YEAR= 'YEAR', MONTH= 'MONTH', DAY= 'DAY', HOUR= 'HOUR', MINUTE= 'MINUTE'
}
export enum AreaRange {
    PROVINCE= 'PROVINCE',
    CITY= 'CITY',
    AREA= 'AREA',
    MONITORPOINT= 'MONITORPOINT',
    DEVICE= 'DEVICE'
    PROVINCE= 1,
    CITY= 2,
    AREA= 3,
    TOWN= 4,
    VILLAGE= 5,
    MONITORPOINT= 6,
    DEVICE= 7
}
export enum ResultCode {
    SUCCESS= 1, FAIL= 0
src/app/business/services/http/device.service.ts
@@ -34,7 +34,7 @@
  }
  public countByExample(example: ExampleService): Observable<ResultBean<number>> {
    return this.http.get(this.urls.count, { queryParams: example.getSqlParam()});
  };
  }
  public getPageByExample(page: PageBean, example: ExampleService): Observable<PageBean> {
    let orderByClause = '';
    const _queryParams = !!example ? example.getSqlParam() : '';
src/app/business/services/util/tools.service.ts
@@ -28,8 +28,8 @@
                 }
                );
      }
      public static toThousands(num: string): string {
        var num = (num || 0).toString(), result = '';
      public static toThousands(number: string): string {
        let num = (number || 0).toString(), result = '';
        while (num.length > 3) {
            result = ',' + num.slice(-3) + result;
            num = num.slice(0, num.length - 3);
src/app/routes/dashboard/workplace/workplace.component.ts
@@ -160,11 +160,11 @@
        //     });
        //     this.totalDeviceCount += fakeDC[i];
        // }
        let example1 = new ExampleService();
        let mo = moment();
        example1.or().andGreaterThanOrEqualTo({ name: "createTime", value: mo.format('YYYY-MM-01 00:00:00') });
        let example2 = new ExampleService();
        let example3 = new ExampleService();
        const example1 = new ExampleService();
        const mo = moment();
        example1.or().andGreaterThanOrEqualTo({ name: 'createTime', value: mo.format('YYYY-MM-01 00:00:00') });
        const example2 = new ExampleService();
        const example3 = new ExampleService();
        example3.or().andNotEqualTo({name:'state',value:4});
        zip(this.deviceService.countByExample(example1),
            this.deviceService.countByExample(example2),
@@ -176,7 +176,7 @@
                        this.totalDeviceCount = ToolsService.toThousands(rWithToltal.data.toString());
                        this.totalDeviceCountList = rWithList.data.map(item => {
                            return {x:item.time,y:item.count};
                        })
                        });
                        this.operNormalPercent = Math.round(rWithNormal.data/rWithToltal.data*100);
                        this.deviceCountLoading = false;
                        this.operationLoading = false;
@@ -184,9 +184,9 @@
                }
            );
        zip(
            this.http.get<ResultBean<{time: string,count: number}[]>>("alarm/count-by-times",{start: mo.format('YYYY-MM-01 00:00:00'),end: null,timeUnits: TimeUnits.DAY}),
            this.http.get<ResultBean<{time: string,count: number}[]>>("alarm/count-by-times",{start: mo.format('YYYY-MM-01 00:00:00'),end: null}),
            this.http.get<ResultBean<{time: string,count: number}[]>>("alarm/count-by-times",{start: mo.format('YYYY-MM-DD 00:00:00'),end: null})
            this.http.get<ResultBean<{time: string, count: number}[]>>('alarm/count-by-times', {start: mo.format('YYYY-MM-01 00:00:00'), end: null, timeUnits: TimeUnits.DAY}),
            this.http.get<ResultBean<{time: string, count: number}[]>>('alarm/count-by-times', {start: mo.format('YYYY-MM-01 00:00:00'), end: null}),
            this.http.get<ResultBean<{time: string, count: number}[]>>('alarm/count-by-times', {start: mo.format('YYYY-MM-DD 00:00:00'), end: null})
        ).subscribe(
            ([rWithList,rWithMonth,rWithDay]) => {
                 if(!!rWithList.code&&!!rWithMonth.code&&!!rWithDay.code){
src/app/routes/devices/basic-info/basic-info.component.ts
src/app/routes/devices/basic-info/device-edit/device-edit.component.ts
@@ -92,7 +92,7 @@
        }
        
    });
  };
  }
  close() {
     this.subject.destroy();
   }
@@ -107,7 +107,7 @@
    }
   }
   professionChange(){
     this.http.get<ResultBean<any[]>>(environment.SERVER_BASH_URL+"profession/getall").subscribe(
     this.http.get<ResultBean<any[]>>(environment.SERVER_BASH_URL + 'profession/getall').subscribe(
         result => {
             if(!!result.code){
                 this.professions = result.data;
src/app/routes/devices/monitor-point/monitor-point.component.ts
src/app/routes/sensors/basic-info/basic-info.component.html
@@ -57,6 +57,8 @@
                              <nz-popconfirm [nzTitle]="'确定要删除该'+grid.title+'吗?'" [nzOkText]="'Yes'" [nzCancelText]="'No'" (nzOnConfirm)="delete(row.id)" >
                                <a nz-popconfirm>删除</a>
                              </nz-popconfirm>
                            <span nz-table-divider></span>
                            <a (click)="configSensorUnit(row)">配置单位</a>
                     </td>
                </tr>
              </tbody>
src/app/routes/sensors/basic-info/basic-info.component.ts
@@ -7,6 +7,7 @@
import { Component, OnInit } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { SensorEditComponent } from './sensor-edit/sensor-edit.component';
import { SensorUnitComponent } from './sensor-unit/sensor-unit.component';
@@ -171,5 +172,15 @@
     }
     this.load();
  }
  configSensorUnit(d) {
    const data = {};
    if ( d != null) {
      Object.assign(data, d);
    }
    this.modalHelper.static(SensorUnitComponent, { data }).subscribe(
      res => {
}
    );
  }
}
src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.html
New file
@@ -0,0 +1,6 @@
<div class="modal-header">
    <div class="modal-title">配置-传感器单位</div>
</div>
<form [formGroup]="validateForm" (ngSubmit)="save($event,validateForm.value,validateForm.valid)" nz-form [nzType]="'horizontal'">
</form>
src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.ts
New file
@@ -0,0 +1,43 @@
import { Component, OnInit } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { NzModalSubject } from 'ng-zorro-antd';
import { FormGroup } from '@angular/forms';
@Component({
  selector: 'app-sensor-unit',
  templateUrl: './sensor-unit.component.html',
})
export class SensorUnitComponent implements OnInit {
    public isSaving = false;
    public validateForm: FormGroup;
    public data: any;
    constructor(
        private subject: NzModalSubject,
        private http: _HttpClient
    ) { }
    ngOnInit() {
    }
    save($event, value, valid) {
        $event.preventDefault();
        if (valid) {
          for (const i in this.validateForm.controls) {
            this.validateForm.controls[ i ].disable();
          }
          this.isSaving = true;
          Object.keys(value).forEach( (key: string) => {
                // '_'为前缀的为自定义属性
                if (!key.startsWith('_') && value[key] != null) {
                     this.data[key] = value[key];
                }
          } );
        } else {
          this.validate();
        }
    }
    validate() {
        for (const i in this.validateForm.controls) {
          this.validateForm.controls[ i ].markAsDirty();
        }
     }
}
src/app/routes/sensors/sensors.module.ts
@@ -8,6 +8,7 @@
import { _HttpClient } from '@delon/theme/services/http/http.client';
import { FormBuilder } from '@angular/forms';
import { SensorEditComponent } from './basic-info/sensor-edit/sensor-edit.component';
import { SensorUnitComponent } from './basic-info/sensor-unit/sensor-unit.component';
const routes: Routes = [
  {
@@ -17,7 +18,7 @@
    ]
  }
];
const COMPONENTS_NOROUNT = [SensorEditComponent];
const COMPONENTS_NOROUNT = [SensorEditComponent, SensorUnitComponent];
@NgModule({
  imports: [
    // 管道模块必须当前模块导入
@@ -28,6 +29,7 @@
  ],
  declarations: [    
    BasicInfoComponent,
    SensorUnitComponent,
    SensorEditComponent
  ],
  providers: [SensorsService, _HttpClient, FormBuilder],
src/app/routes/systems/organization/organization-config/organization-config.component.html
@@ -34,7 +34,7 @@
                </tr>
            </thead>
            <tbody formGroupName="alarmLevels" nz-tbody>
                <tr nz-tbody-tr *ngFor="let row of nzTable.data" formGroupName="{{row.sensorKey}}">
                <tr nz-tbody-tr style="height:50px;" *ngFor="let row of nzTable.data" formGroupName="{{row.sensorKey}}">
                    <td nz-td [nzCheckbox]="true">
                        <label nz-checkbox formControlName="enable"></label>