沈斌
2017-12-18 9ceeba8e3c31fe7357910c980f99d89e54f01df3
src/app/routes/users/installer/installer.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { getRule, saveRule, removeRule } from '../../../../../_mock/rule.service';
import { getInstaller } from '../../../../../_mock/installer.service';
@Component({
  selector: 'app-installer',
@@ -13,8 +14,8 @@
    pi: 1,
    ps: 10,
    sorter: '',
    status: -1,
    statusList: []
    u_name: '',
    u_mobile: ''
  };
  data: any[] = [];
  loading = false;
@@ -23,16 +24,9 @@
  totalCallNo = 0;
  allChecked = false;
  indeterminate = false;
  status = [
    { text: '关闭', value: false, type: 'default' },
    { text: '运行中', value: false, type: 'processing' },
    { text: '已上线', value: false, type: 'success' },
    { text: '异常', value: false, type: 'error' }
  ];
  sortMap: any = {};
  expandForm = false;
  modalVisible = false;
  description = '';
  constructor(public msg: NzMessageService) {}
@@ -42,13 +36,10 @@
  getData() {
    this.pageChange(1).then(() => {
      this.q.statusList = this.status.map((i, index) => i.value ? index : -1).filter(w => w !== -1);
      if (this.q.status && this.q.status > -1) this.q.statusList.push(this.q.status);
      console.log(this.q);
      this.data = getRule(this.q).map(i => {
        const statusItem = this.status[i.status];
        i.statusText = statusItem.text;
        i.statusType = statusItem.type;
      // this.q.statusList = this.status.map((i, index) => i.value ? index : -1).filter(w => w !== -1);
      // if (this.q.status && this.q.status > -1) this.q.statusList.push(this.q.status);
      // console.log(this.q);
      this.data = getInstaller(this.q).map(i => {
        return i;
      });
    });
@@ -56,14 +47,10 @@
  add() {
    this.modalVisible = true;
    this.description = '';
  }
  save() {
    this.loading = true;
    saveRule(this.description);
    this.getData();
    setTimeout(() => this.modalVisible = false, 500);
  }
  remove() {