xufenglei
2017-12-27 4156fed8a32e81a61b706b8a17876f7a1fdcabb7
src/app/routes/systems/account/account.component.ts
@@ -22,14 +22,13 @@
  query: any = {
    pageIndex: 1,
    pageSize: 3,
    pageSize: 10,
    isDelete: this.options[1].value
  };
  data: any[] = [];
  total: 0;
  selectedRows: any[] = [];
  curRows: any[] = [];
  allChecked = false;
  indeterminate = false;
  sortMap: any = {};
@@ -50,7 +49,7 @@
      this.data = res.data.data;
      this.total = res.data.total;
      this.dataChange(this.data);
      this.refreshStatus();
    });
  }
@@ -95,20 +94,15 @@
  }
  checkAll(value: boolean) {
    this.curRows.forEach(i => {
    this.data.forEach(i => {
      i.checked = value;
    });
    this.refreshStatus();
  }
  dataChange(res: any) {
    this.curRows = res;
    this.refreshStatus();
  }
  refreshStatus() {
    const allChecked = this.curRows.every(value => value.checked);
    const allUnChecked = this.curRows.every(value => !value.checked);
    const allChecked = this.data.every(value => value.checked);
    const allUnChecked = this.data.every(value => !value.checked);
    this.allChecked = allChecked;
    this.indeterminate = (!allChecked) && (!allUnChecked);
    this.selectedRows = this.data.filter(value => value.checked);
@@ -118,11 +112,6 @@
    this.sortMap = {};
    this.sortMap[field] = value;
    this.query.sorter = value ? `${field} ${value}` : '';
    this.load(true);
  }
  reset(ls: any[]) {
    for (const item of ls) item.value = false;
    this.load(true);
  }