From 39ea49edce74ae063ca0afd9b2966f861e256a3e Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Tue, 17 Apr 2018 13:18:36 +0800
Subject: [PATCH] ts fix,组织报警间隔时间设置

---
 src/app/routes/systems/organization/organization-list/organization-list.component.ts       |    4 
 src/app/routes/systems/registration/registration.component.ts                              |   12 +-
 src/app/routes/dashboard/workplace/workplace.component.ts                                  |   24 +++---
 tslint.json                                                                                |    2 
 src/app/routes/report/report.component.ts                                                  |   20 ++--
 src/app/routes/reports/demo/demo.component.ts                                              |   12 +-
 src/app/routes/systems/organization/organization-config/organization-config.component.html |   13 +++
 src/index.html                                                                             |  110 +++++++++++++++++++++++++--
 src/app/business/services/http/login.service.ts                                            |    2 
 src/app/business/entity/data.ts                                                            |    1 
 src/app/layout/default/header/header.component.html                                        |    2 
 src/app/routes/reports/query/query.component.ts                                            |   10 +-
 src/app/routes/systems/systems.module.ts                                                   |    2 
 src/app/routes/systems/organization/organization-config/organization-config.component.ts   |    3 
 src/app/routes/reports/excel/excel.component.ts                                            |    2 
 src/app/business/services/http/alarm-config.service.ts                                     |    1 
 16 files changed, 164 insertions(+), 56 deletions(-)

diff --git a/src/app/business/entity/data.ts b/src/app/business/entity/data.ts
index 06e1770..6cc45a1 100644
--- a/src/app/business/entity/data.ts
+++ b/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[];
diff --git a/src/app/business/services/http/alarm-config.service.ts b/src/app/business/services/http/alarm-config.service.ts
index 7e3cd14..620f69a 100644
--- a/src/app/business/services/http/alarm-config.service.ts
+++ b/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
diff --git a/src/app/business/services/http/login.service.ts b/src/app/business/services/http/login.service.ts
index 1889d2b..b5c1b6f 100644
--- a/src/app/business/services/http/login.service.ts
+++ b/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 {
diff --git a/src/app/layout/default/header/header.component.html b/src/app/layout/default/header/header.component.html
index 962e8b5..1c81766 100644
--- a/src/app/layout/default/header/header.component.html
+++ b/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>
diff --git a/src/app/routes/dashboard/workplace/workplace.component.ts b/src/app/routes/dashboard/workplace/workplace.component.ts
index 6c5442a..968fad1 100644
--- a/src/app/routes/dashboard/workplace/workplace.component.ts
+++ b/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 + '���';
     }
 }
diff --git a/src/app/routes/report/report.component.ts b/src/app/routes/report/report.component.ts
index 4fcfc16..ac0270b 100644
--- a/src/app/routes/report/report.component.ts
+++ b/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);
     }
   }
 }
diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts
index 305c4b6..42e6d90 100644
--- a/src/app/routes/reports/demo/demo.component.ts
+++ b/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;
diff --git a/src/app/routes/reports/excel/excel.component.ts b/src/app/routes/reports/excel/excel.component.ts
index 5d882ba..4f8149a 100644
--- a/src/app/routes/reports/excel/excel.component.ts
+++ b/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) {
diff --git a/src/app/routes/reports/query/query.component.ts b/src/app/routes/reports/query/query.component.ts
index 6e81d40..109f749 100644
--- a/src/app/routes/reports/query/query.component.ts
+++ b/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];
              }
         }
diff --git a/src/app/routes/systems/organization/organization-config/organization-config.component.html b/src/app/routes/systems/organization/organization-config/organization-config.component.html
index a313c29..c86d7d5 100644
--- a/src/app/routes/systems/organization/organization-config/organization-config.component.html
+++ b/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>
diff --git a/src/app/routes/systems/organization/organization-config/organization-config.component.ts b/src/app/routes/systems/organization/organization-config/organization-config.component.ts
index 9919313..607f51d 100644
--- a/src/app/routes/systems/organization/organization-config/organization-config.component.ts
+++ b/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);
 }
diff --git a/src/app/routes/systems/organization/organization-list/organization-list.component.ts b/src/app/routes/systems/organization/organization-list/organization-list.component.ts
index b1f794a..38ced8b 100644
--- a/src/app/routes/systems/organization/organization-list/organization-list.component.ts
+++ b/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));
   }
 }
diff --git a/src/app/routes/systems/registration/registration.component.ts b/src/app/routes/systems/registration/registration.component.ts
index 7a00abc..70aabde 100644
--- a/src/app/routes/systems/registration/registration.component.ts
+++ b/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();
diff --git a/src/app/routes/systems/systems.module.ts b/src/app/routes/systems/systems.module.ts
index 37edebf..dd8ad35 100644
--- a/src/app/routes/systems/systems.module.ts
+++ b/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';
 
diff --git a/src/index.html b/src/index.html
index e96f22e..04af5b5 100644
--- a/src/index.html
+++ b/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>
diff --git a/tslint.json b/tslint.json
index 0592ba4..54f1235 100644
--- a/tslint.json
+++ b/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,

--
Gitblit v1.8.0