fengxiang
2018-05-11 fd7b11ec894b6f8c5cc736489c0f26eec35ad3ce
设备 增加 行业
3 files modified
69 ■■■■ changed files
src/app/business/entity/data.ts 1 ●●●● patch | view | raw | blame | history
src/app/routes/devices/basic-info/device-edit/device-edit.component.html 46 ●●●●● patch | view | raw | blame | history
src/app/routes/devices/basic-info/device-edit/device-edit.component.ts 22 ●●●●● patch | view | raw | blame | history
src/app/business/entity/data.ts
@@ -99,6 +99,7 @@
  mac?: any|Column;
  monitorPoint?: any|Column;
  monitorPointId?: any|Column;
  professionId?: any|Column;
  name?: any|Column;
  operateUser?: any|Column;
  operateUserId?: any|Column;
src/app/routes/devices/basic-info/device-edit/device-edit.component.html
@@ -60,6 +60,22 @@
          </div>
          <div nz-form-item  nz-row class="mb-sm">
            <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
              <label>生产时间</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback>
                <nz-datepicker nzSize="large"  style="width: 100%;" formControlName="createTime" nzShowTime  [nzPlaceHolder]="'选择时间'"
                [nzFormat]="'YYYY-MM-DD HH:mm:ss'" ></nz-datepicker>
            </div>
            <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
              <label>安装时间</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback>
                <nz-datepicker nzSize="large"  style="width: 100%;" formControlName="installTime" nzShowTime  [nzPlaceHolder]="'选择时间'"
                [nzFormat]="'YYYY-MM-DD HH:mm:ss'" ></nz-datepicker>
            </div>
          </div>
          <div nz-form-item  nz-row class="mb-sm">
            <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
              <label>监控站点</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback>
@@ -70,29 +86,25 @@
                </nz-select>
            </div>
            <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
              <label>具体地址</label>
              <label>行业</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback>
                <nz-select formControlName="professionId" [nzPlaceHolder]="'选择 所属行业'"
                nzAllowClear [nzFilter]="false" nzShowSearch (nzSearchChange)="monitorPointChange($event)" [nzNotFoundContent]="'无法找到'" >
                  <nz-option *ngFor="let option of professions" [nzLabel]="option.name" [nzValue]="option.id" [nzDisabled]="option.disabled">
                  </nz-option>
                </nz-select>
            </div>
          </div>
          <div nz-form-item  nz-row class="mb-sm">
            <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
              <label>具体地址</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="10" nzHasFeedback>
                <nz-input formControlName="address" maxlength="20" [nzPlaceHolder]="'设备安装的具体地址'">
                </nz-input>
            </div>
          </div>
          <div nz-form-item  nz-row class="mb-sm">
              <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
                <label>生产时间</label>
              </div>
              <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback>
                  <nz-datepicker nzSize="large"  style="width: 100%;" formControlName="createTime" nzShowTime  [nzPlaceHolder]="'选择时间'"
                  [nzFormat]="'YYYY-MM-DD HH:mm:ss'" ></nz-datepicker>
              </div>
              <div nz-form-label nz-col [nzSm]="4" [nzXs]="24">
                <label>安装时间</label>
              </div>
              <div nz-form-control nz-col [nzSpan]="7" nzHasFeedback>
                  <nz-datepicker nzSize="large"  style="width: 100%;" formControlName="installTime" nzShowTime  [nzPlaceHolder]="'选择时间'"
                  [nzFormat]="'YYYY-MM-DD HH:mm:ss'" ></nz-datepicker>
              </div>
            </div>
    <div class="modal-footer">
        <button nz-button type="button" (click)="close()">关闭</button>
        <button nz-button [nzType]="'primary'" [nzLoading]="isSaving">
src/app/routes/devices/basic-info/device-edit/device-edit.component.ts
@@ -8,7 +8,10 @@
import { Component, OnInit } from '@angular/core';
import { Device} from '@business/entity/data';
import { _Validators } from '@delon/abc';
import { PageBean } from '@business/entity/grid';
import { PageBean, ResultBean } from '@business/entity/grid';
import { _HttpClient } from '@delon/theme';
import { environment } from '@env/environment';
import { debug } from 'util';
@Component({
  selector: 'app-device-edit',
@@ -17,6 +20,7 @@
})
export class DeviceEditComponent implements OnInit {
  public monitorPoints: any [] = [];
  public professions: any [] = [];
  public deviceVersions: any [] = [];
  public operateUsers: any [] = [];
  public isSaving = false;
@@ -25,7 +29,8 @@
    private formBuilder: FormBuilder,
    private monitorPointService: MonitorPointService,
    private versionService: VersionService,
    private operateUserService: OperateUserService
    private operateUserService: OperateUserService,
    private  http:_HttpClient
  ) { }
  data: Device;
  validateForm: FormGroup;
@@ -34,14 +39,17 @@
    this.monitorPointChange(null);
    this.deviceVersionChange(null);
    this.operateUserChange(null);
    this.professionChange();
    if (this.data.createTime == null) {
        this.data.createTime = new Date().getTime();
    }
    debugger;
    const validates: Device = {
         name: [data.name, [Validators.required]],
         mac: [data.mac, [Validators.required]],
         deviceVersionId: [data.deviceVersionId],
         monitorPointId: [data.monitorPointId],
         professionId: [data.professionId],
         operateUserId: [data.operateUserId],
         address: [data.address],
         id: [data.id],
@@ -67,6 +75,16 @@
        ToolsService.markAsDirty(this.validateForm);
    }
   }
   professionChange(){
     this.http.get<ResultBean<any[]>>(environment.SERVER_BASH_URL+"profession/getall").subscribe(
         result => {
             if(!!result.code){
                 debugger;
                 this.professions = result.data;
             }
         }
     );
   }
   monitorPointChange(text) {
    const pageBean: PageBean = {pageIndex: 0, pageSize: 20};
    this.monitorPointService.getPagingList(pageBean, text).subscribe(