fengxiang
2018-04-17 39ea49edce74ae063ca0afd9b2966f861e256a3e
ts fix,组织报警间隔时间设置
16 files modified
220 ■■■■ changed files
src/app/business/entity/data.ts 1 ●●●● patch | view | raw | blame | history
src/app/business/services/http/alarm-config.service.ts 1 ●●●● patch | view | raw | blame | history
src/app/business/services/http/login.service.ts 2 ●●● patch | view | raw | blame | history
src/app/layout/default/header/header.component.html 2 ●●● patch | view | raw | blame | history
src/app/routes/dashboard/workplace/workplace.component.ts 24 ●●●● patch | view | raw | blame | history
src/app/routes/report/report.component.ts 20 ●●●● patch | view | raw | blame | history
src/app/routes/reports/demo/demo.component.ts 12 ●●●● patch | view | raw | blame | history
src/app/routes/reports/excel/excel.component.ts 2 ●●● patch | view | raw | blame | history
src/app/routes/reports/query/query.component.ts 10 ●●●● patch | view | raw | blame | history
src/app/routes/systems/organization/organization-config/organization-config.component.html 13 ●●●●● patch | view | raw | blame | history
src/app/routes/systems/organization/organization-config/organization-config.component.ts 3 ●●●●● patch | view | raw | blame | history
src/app/routes/systems/organization/organization-list/organization-list.component.ts 4 ●●●● patch | view | raw | blame | history
src/app/routes/systems/registration/registration.component.ts 12 ●●●● patch | view | raw | blame | history
src/app/routes/systems/systems.module.ts 2 ●●● patch | view | raw | blame | history
src/index.html 110 ●●●●● patch | view | raw | blame | history
tslint.json 2 ●●● patch | view | raw | blame | history
src/app/business/entity/data.ts
@@ -107,6 +107,7 @@
export interface AlarmMode {
  enable: boolean|any[];
  interval: number;
  level1: AlarmStyle[]|any[];
  level2: AlarmStyle[]|any[];
  level3: AlarmStyle[]|any[];
src/app/business/services/http/alarm-config.service.ts
@@ -39,6 +39,7 @@
         let alarmMode = _alarmConfig.value.alarmMode;
         alarmMode = alarmMode == null ? {
          enable: false,
          interval: 120,
          level1: null,
          level2: null,
          level3: null
src/app/business/services/http/login.service.ts
@@ -65,7 +65,7 @@
        }
      );
  }
  get _refreshToken(){
  get _refreshToken() {
    return !!this.authorization.refreshToken ? this.authorization.refreshToken : this.refreshTokenFromLocal;
  }
  get refreshTokenFromLocal(): string {
src/app/layout/default/header/header.component.html
@@ -59,7 +59,7 @@
                <div class="item" nz-dropdown>
                    <i class="anticon anticon-setting"></i>
                </div>
                <div nz-menu style="width:200px">
                <div nz-menu style="width:200px;">
                    <div nz-menu-item class="theme-switch">
                        <header-theme></header-theme>
                    </div>
src/app/routes/dashboard/workplace/workplace.component.ts
@@ -76,14 +76,14 @@
        const fakeDC = [60, 135, 70, 112, 80, 170, 200, 140, 52, 119, 164, 230];
        for (let i = 0; i < 12; i += 1) {
            this.totalDeviceCountList.push({
                x: moment(today).subtract(-1*i, 'months').format(
                    "YYYY-MM"
                x: moment(today).subtract(-1 * i, 'months').format(
                    'YYYY-MM'
                ),
                y: fakeDC[i]
            });
            this.totalDeviceCount += fakeDC[i];
        }
        this.avgDeviceCount = (this.totalDeviceCount/12).toFixed(0);
        this.avgDeviceCount = (this.totalDeviceCount / 12).toFixed(0);
        const alarmData = [];
        const alarmData_1 = [];
@@ -114,7 +114,7 @@
        for (let i = 0; i < fakeY.length; i += 1) {
            visitData.push({
                x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format(
                    "YYYY-MM-DD"
                    'YYYY-MM-DD'
                ),
                y: fakeY[i]
            });
@@ -124,7 +124,7 @@
        for (let i = 0; i < fakeY2.length; i += 1) {
            visitData2.push({
                x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format(
                    "YYYY-MM-DD"
                    'YYYY-MM-DD'
                ),
                y: fakeY2[i]
            });
@@ -186,7 +186,7 @@
                status: Math.floor((Math.random() * 10) % 2)
            });
        }
        var res = {
        const res = {
            alarmData: alarmData,
            alarmData_1: alarmData_1,
            alarmData_2: alarmData_2,
@@ -222,7 +222,7 @@
            'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png'  // Webpack
        ];
        var activities = [
        const activities = [
            {
                id: 'trend-1',
                updatedAt: new Date(),
@@ -365,19 +365,19 @@
    salesPieData: any;
    salesTotal = 0;
    changeSaleType() {
        if(this.salesType == '0') {
        if (this.salesType == '0') {
            this.salesPieData = this.data.alertData;
        } else if(this.salesType == '1') {
        } else if (this.salesType == '1') {
            this.salesPieData = this.data.alertData_1;
        } else if(this.salesType == '2') {
        } else if (this.salesType == '2') {
            this.salesPieData = this.data.alertData_2;
        } else if(this.salesType == '3') {
        } else if (this.salesType == '3') {
            this.salesPieData = this.data.alertData_3;
        }
        if (this.salesPieData) this.salesTotal = this.salesPieData.reduce((pre, now) => now.y + pre, 0);
    }
    handlePieValueFormat(value: any) {
        return value + "次";
        return value + '次';
    }
}
src/app/routes/report/report.component.ts
@@ -14,7 +14,7 @@
export class ReportComponent implements OnInit {
  [x: string]: any;
  public spinning: boolean = true;
  public spinning = true;
  private echartOption = {
    backgroundColor: '',
@@ -82,10 +82,10 @@
    },
    tooltip: {
      trigger: 'item',
      formatter: "{a} <br/>{b}: {c} ({d}%)"
      formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    legend: {
      //x : 'center',
      // x : 'center',
      top: '10%',
      data: ['PM 2.5', 'PM 10', '一氧化碳(CO)', '二氧化硫(SO₂)', '臭氧(O₃)', '二氧化氮(NO₂)']
    },
@@ -113,7 +113,7 @@
        center: ['25%', '50%'],
        label: {
          normal: {
            formatter: "{b}:{d}%"
            formatter: '{b}:{d}%'
          }
        },
        labelLine: {
@@ -137,7 +137,7 @@
        center: ['75%', '50%'],
        label: {
          normal: {
            formatter: "{b}:{d}%",
            formatter: '{b}:{d}%',
          }
        },
        labelLine: {
@@ -159,9 +159,9 @@
  };
  ngOnInit() {
    const params = JSON.parse(sessionStorage.getItem("queryParams"));
    const params = JSON.parse(sessionStorage.getItem('queryParams'));
    if (!!params) {
      localStorage.removeItem("queryParams");
      localStorage.removeItem('queryParams');
      const items = this.items = JSON.parse(params.items);
      const timeType = params.type;
      this.http.get(environment.SERVER_BASH_URL + 'report/compare', {params: params}).subscribe((res: any) => {
@@ -191,7 +191,7 @@
              this.title = items[i].formatTime;
              items[i].deviceCount = deviceCounts[i];
              if (!items[i].monitorPointid) {
                items[i].monitorPointName = items[i].areaName
                items[i].monitorPointName = items[i].areaName;
              }
              const legendName = items[i].formatTime + label + (items[i].mac ? '设备:' + items[i].deviceName : (items[i].monitorPointid ? '监测点:' + items[i].monitorPointName : items[i].areaName));
              option.legend.data[i] = legendName;
@@ -233,8 +233,8 @@
        }
      });
    } else {
      this.msgSrv.error("页面错误,将关闭该页面!");
      setTimeout("window.close();", 1000);
      this.msgSrv.error('页面错误,将关闭该页面!');
      setTimeout('window.close();', 1000);
    }
  }
}
src/app/routes/reports/demo/demo.component.ts
@@ -204,11 +204,11 @@
    let validate = true;
    const queryItems = [];
    for (let i = 0; i < this.items.length; i++) {
      let areaName = '';
      let item = this.items[i];
      let queryItem: any = {};
      const areaName = '';
      const item = this.items[i];
      const queryItem: any = {};
      if ((!!item.time) && (item.monitorPointOptions.length > 0)) {
        for (var key in item) {
        for (const key in item) {
          if (item[key]) {
            queryItem[key] = item[key];
          }
@@ -240,7 +240,7 @@
    if (validate && this.timeType && query.reportType) {
      if (this._sensors) {
        const sensors = [];
        for (var key in this._sensors) {
        for (const key in this._sensors) {
          sensors.push(this._sensors[key]);
        }
        if (sensors.length > 0) {
@@ -249,7 +249,7 @@
      }
      query.items = JSON.stringify(queryItems);
      query.type = this.timeType.value;
      sessionStorage.setItem("queryParams", JSON.stringify(query));
      sessionStorage.setItem('queryParams', JSON.stringify(query));
    } else {
      this.msgSrv.error('请完善搜索项或删除查询条目');
      return false;
src/app/routes/reports/excel/excel.component.ts
@@ -177,7 +177,7 @@
      query.type = this.timeType.value;
      if (this._sensors) {
        const sensors = [];
        for (var key in this._sensors) {
        for (const key in this._sensors) {
          sensors.push(this._sensors[key]);
        }
        if (sensors.length > 0) {
src/app/routes/reports/query/query.component.ts
@@ -131,7 +131,7 @@
            if (!!text) {
                example.or().andEqualTo({ name: 'monitorPointId', value: this.monitorPoint.id })
                .andLike({name: 'text', value: text});
            }else {
            } else {
                example.or().andEqualTo({ name: 'monitorPointId', value: this.monitorPoint.id });
            }
            this.deviceService.getPageByExample(null, example).subscribe(
@@ -182,7 +182,7 @@
                    });
                    this._sensors = {};
                    // 未选 或者 半选状态
                }else {
                } else {
                    // 全选操作
                    children.forEach(element => {
                        element['checked'] = true;
@@ -191,7 +191,7 @@
                    data['checked'] = true;
                    data['halfChecked'] = false;
                }
            }else {
            } else {
                const parentData = event.node.parent.data;
                data['checked'] = !data['checked'];
                if (data['checked']) {
@@ -349,10 +349,10 @@
            } else {
                this._sensors = {};
            }
        }else {
        } else {
             if (!!data.checked) {
                this._sensors [data.id] = data.sensorKey;
             }else {
             } else {
                delete this._sensors[data.id];
             }
        }
src/app/routes/systems/organization/organization-config/organization-config.component.html
@@ -78,7 +78,7 @@
            <br/>
            <br/>
            <div *ngFor="let i of [1,2,3]" nz-form-item nz-row class="mb-sm">
                <div nz-form-label nz-col [nzSm]="3" [nzXs]="24">
                <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
                    <span [ngSwitch]="i">
                        <label *ngSwitchCase="1">一级报警方式:</label>
                        <label *ngSwitchCase="2">二级报警方式:</label>
@@ -96,6 +96,17 @@
                <br/>
                <br/>
            </div>
            <br/>
            <div nz-form-item nz-row class="mb-sm">
                <div nz-form-label nz-col [nzSm]="5" [nzXs]="24">
                    <span [ngSwitch]="i">
                        <label>报警间隔时间<small>(单位:分)</small>:</label>
                    </span>
                </div>
                <div nz-form-control nz-col [nzSpan]="12">
                    <nz-input-number style="width: 200px;"  formControlName="interval" [nzParser]="parserInt" nzMin="1" nzStep="1" nzDisabled="{{ !f.value['alarmMode']['enable'] }}"></nz-input-number>
                </div>
            </div>
        </div>
    </nz-card>
    <footer-toolbar errorCollect>
src/app/routes/systems/organization/organization-config/organization-config.component.ts
@@ -114,6 +114,7 @@
        alarmMode: this.formBuilder.group(
          {
            enable: [alarmMode.enable],
            interval: [alarmMode.interval],
            level1: [alarmMode.level1],
            level2: [alarmMode.level2],
            level3: [alarmMode.level3]
@@ -288,4 +289,6 @@
          );
       }
   }
   // 转整型
   parserInt = (value) => parseInt(value , 10);
}
src/app/routes/systems/organization/organization-list/organization-list.component.ts
@@ -228,7 +228,7 @@
    });
  }
  
  registration(row){
      sessionStorage.setItem("organization", JSON.stringify(row));
  registration(row) {
      sessionStorage.setItem('organization', JSON.stringify(row));
  }
}
src/app/routes/systems/registration/registration.component.ts
@@ -1,10 +1,10 @@
import {environment} from "../../../../environments/environment";
import {environment} from '../../../../environments/environment';
import {Component, OnInit, ViewChild} from '@angular/core';
import {SimpleTableColumn} from "@delon/abc";
import {SimpleTableColumn} from '@delon/abc';
import {_HttpClient} from '@delon/theme';
import {Subject} from "rxjs";
import * as moment from 'moment';
import {NzMessageService} from "ng-zorro-antd";
import {NzMessageService} from 'ng-zorro-antd';
import { Subject } from 'rxjs/Subject';
@Component({
  selector: 'app-registration',
  templateUrl: './registration.component.html',
@@ -41,11 +41,11 @@
      }
    },
  ];
  isVisible: boolean = false;
  isVisible = false;
  _date = new Date(Date.now() + 3600 * 24 * 1 * 1000);
  ngOnInit() {
    const organization = this.organization = JSON.parse(sessionStorage.getItem("organization"));
    const organization = this.organization = JSON.parse(sessionStorage.getItem('organization'));
    this.extraParams.organizationId = organization.id;
    this.queryTextStream.debounceTime(900).distinctUntilChanged().subscribe(value => {
      this.load();
src/app/routes/systems/systems.module.ts
@@ -15,7 +15,7 @@
import { AreacodeService } from '@business/services/http/areacode.service';
import { OrganizationConfigComponent } from './organization/organization-config/organization-config.component';
import { OrganizationListComponent } from './organization/organization-list/organization-list.component';
import { RegistrationComponent } from "./registration/registration.component";
import { RegistrationComponent } from './registration/registration.component';
import { SensorsService } from '@business/services/http/sensors.service';
import { BusinessModule } from '@business/business.module';
src/index.html
@@ -8,9 +8,101 @@
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <!-- Apple Touch Icon -->
    <!-- <link rel="apple-touch-icon" href="custom-icon.png"> -->
    <style type="text/css">.preloader{position:fixed;top:0;left:0;width:100%;height:100%;overflow:hidden;background:#49a9ee;z-index:9999;transition:opacity .65s}.preloader-hidden-add{opacity:1;display:block}.preloader-hidden-add-active{opacity:0}.preloader-hidden{display:none}.cs-loader{position:absolute;top:0;left:0;height:100%;width:100%}.cs-loader-inner{transform:translateY(-50%);top:50%;position:absolute;width:100%;color:#fff;text-align:center}.cs-loader-inner label{font-size:20px;opacity:0;display:inline-block}@keyframes lol{0%{opacity:0;transform:translateX(-300px)}33%{opacity:1;transform:translateX(0)}66%{opacity:1;transform:translateX(0)}100%{opacity:0;transform:translateX(300px)}}.cs-loader-inner label:nth-child(6){animation:lol 3s infinite ease-in-out}.cs-loader-inner label:nth-child(5){animation:lol 3s .1s infinite ease-in-out}.cs-loader-inner label:nth-child(4){animation:lol 3s .2s infinite ease-in-out}.cs-loader-inner label:nth-child(3){animation:lol 3s .3s infinite ease-in-out}.cs-loader-inner label:nth-child(2){animation:lol 3s .4s infinite ease-in-out}.cs-loader-inner label:nth-child(1){animation:lol 3s .5s infinite ease-in-out}</style>
    <!-- Apple Touch Icon -->
    <!-- <link rel="apple-touch-icon" href="custom-icon.png"> -->
    <style type="text/css">
        .preloader {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background: #49a9ee;
            z-index: 9999;
            transition: opacity 0.65s;
        }
        .preloader-hidden-add {
            opacity: 1;
            display: block;
        }
        .preloader-hidden-add-active {
            opacity: 0;
        }
        .preloader-hidden {
            display: none;
        }
        .cs-loader {
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
        }
        .cs-loader-inner {
            transform: translateY(-50%);
            top: 50%;
            position: absolute;
            width: 100%;
            color: #fff;
            text-align: center;
        }
        .cs-loader-inner label {
            font-size: 20px;
            opacity: 0;
            display: inline-block;
        }
        @keyframes lol {
            0% {
                opacity: 0;
                transform: translateX(-300px);
            }
            33% {
                opacity: 1;
                transform: translateX(0);
            }
            66% {
                opacity: 1;
                transform: translateX(0);
            }
            100% {
                opacity: 0;
                transform: translateX(300px);
            }
        }
        .cs-loader-inner label:nth-child(6) {
            animation: lol 3s infinite ease-in-out;
        }
        .cs-loader-inner label:nth-child(5) {
            animation: lol 3s .1s infinite ease-in-out;
        }
        .cs-loader-inner label:nth-child(4) {
            animation: lol 3s .2s infinite ease-in-out;
        }
        .cs-loader-inner label:nth-child(3) {
            animation: lol 3s .3s infinite ease-in-out;
        }
        .cs-loader-inner label:nth-child(2) {
            animation: lol 3s .4s infinite ease-in-out;
        }
        .cs-loader-inner label:nth-child(1) {
            animation: lol 3s .5s infinite ease-in-out;
        }
    </style>
</head>
<body>
@@ -18,12 +110,12 @@
    <div class="preloader">
        <div class="cs-loader">
            <div class="cs-loader-inner">
                <label>    ●</label>
                <label>    ●</label>
                <label>    ●</label>
                <label>    ●</label>
                <label>    ●</label>
                <label>    ●</label>
                <label> ●</label>
                <label> ●</label>
                <label> ●</label>
                <label> ●</label>
                <label> ●</label>
                <label> ●</label>
            </div>
        </div>
    </div>
tslint.json
@@ -68,7 +68,7 @@
    "no-switch-case-fall-through": true,
    "no-trailing-whitespace": false,
    "no-unnecessary-initializer": true,
    "no-unused-expression": false,
    "no-unused-expression": true,
    "no-use-before-declare": true,
    "no-var-keyword": true,
    "object-literal-sort-keys": false,