From c69ddde7828d777f04c6468c269aaa0aa03d72c9 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Thu, 02 Aug 2018 09:50:58 +0800
Subject: [PATCH] 文件修改

---
 src/app/routes/operation/device-status/device-status.component.ts |   78 ++++++++++++++++++++++++--------------
 1 files changed, 49 insertions(+), 29 deletions(-)

diff --git a/src/app/routes/operation/device-status/device-status.component.ts b/src/app/routes/operation/device-status/device-status.component.ts
index dbd700b..6967f52 100644
--- a/src/app/routes/operation/device-status/device-status.component.ts
+++ b/src/app/routes/operation/device-status/device-status.component.ts
@@ -7,12 +7,12 @@
 import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
 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 { CoordinatesPickerComponent } from '../../map/coordinates-picker/coordinates-picker.component';
+import { CoorPickerService } from '../../map/coordinates-picker/coordinates-picker.service';
 import { OrganizationService } from '@business/services/http/organization.service';
 import { ExampleService, Criteria } from '@business/services/util/example.service';
-import { AdjustConfigComponent } from '../../devices/basic-info/adjust-config/adjust-config.component';
 import { DeviceEditComponent } from '../../devices/basic-info/device-edit/device-edit.component';
+import { DeviceControllerService } from '../device-controller/device-controller.service';
 
 @Component({
   selector: 'app-device-status',
@@ -35,6 +35,24 @@
           { title: '���������', index: 'operateUser.name' },
           { title: '������������', width: '100px', type: 'date', index: 'createTime' },
           { title: '������������', width: '100px', type: 'date', index: 'installTime' },
+          {
+            title: '���������',
+            buttons: [
+              {
+                text: '������',
+                type: 'none',
+                click: (record: any) => this.addOrModify(record)
+              },
+              {
+                text: '������',
+                type: 'none',
+                click: (record: any) => {
+                  this.deviceControllerService.data = record;
+                  this.deviceControllerService.incumbent = 'data';
+                }
+              }
+            ]
+          }
         ];
         queryTextStream: Subject<string> = new Subject<string>();
         public queryMap: {orgId?: number, mpointId?: number, devMacOrName?: string}
@@ -50,7 +68,8 @@
           private modalHelper: ModalHelper,
           private coorPickerService: CoorPickerService,
           private organizationService: OrganizationService,
-          private http: _HttpClient
+          private http: _HttpClient,
+          private deviceControllerService: DeviceControllerService,
         ) { }
       
         ngOnInit() {
@@ -158,32 +177,33 @@
           if (!!configMap['mpointId'] && !d['monitorPoint']) {
             data['monitorPoint'] = this.getMonitorPoint(configMap['mpointId']);
           }
-          this.modalHelper.static(DeviceEditComponent, { data, configMap }).subscribe(
+          const isEditState = false;
+          this.modalHelper.static(DeviceEditComponent, { data,configMap,isEditState }).subscribe(
             (ret: { data: any, close: Function }) => {
-              // ������������
-              if (ret.data['id'] != null) {
-                const origData = d;
-                const isModified = Object.keys(ret.data).some(
-                  (key: string) => {
-                    return ret.data[key] !== origData[key];
-                  }
-                );
-                // ������������
-                if (!isModified) {
-                  ret.close();
-                  this.msgSrv.success('���������������������������');
-                  return;
-                }
-              }
-              this.deviceService.save(ret.data).subscribe(
-                (res: any) => {
-                  if (res.code === 1) {
-                    this.load();
-                    ret.close();
-                    this.msgSrv.success('���������������������');
-                  }
-                }
-              );
+              // // ������������
+              // if (ret.data['id'] != null) {
+              //   const origData = d;
+              //   const isModified = Object.keys(ret.data).some(
+              //     (key: string) => {
+              //       return ret.data[key] !== origData[key];
+              //     }
+              //   );
+              //   // ������������
+              //   if (!isModified) {
+              //     ret.close();
+              //     this.msgSrv.success('���������������������������');
+              //     return;
+              //   }
+              // }
+              // this.deviceService.save(ret.data).subscribe(
+              //   (res: any) => {
+              //     if (res.code === 1) {
+              //       this.load();
+              //       ret.close();
+              //       this.msgSrv.success('���������������������');
+              //     }
+              //   }
+              // );
             });
         }
         private getMonitorPoint(mpointId: number) {

--
Gitblit v1.8.0