Newer
Older
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {ProjectService} from '../../project.service';
@Component({
selector: 'smart-company-modal',
templateUrl: './company-modal.component.html',
styles: []
isVisiable = false;
obj = {
name: ''
};
page = {
list: [],
isLoading: false,
totalNum: 0,
pageNum: 1,
pageCount: 5,
};
getList() {
this.page.isLoading = true;
const obj = {
obj: this.obj,
pageNum: this.page.pageNum,
pageCount: this.page.pageCount
};
this.projectSer.selectMaintainCompany(obj).subscribe(
(res) => {
if (res.errCode == 10000) {
this.page.list = res.data.data;
this.page.totalNum = res.data.totalNum;
this.page.isLoading = false;
}
}
);
}
PageDataChange(e) {
}
changePage(e) {
this.page.pageNum = e;
this.getList();
}
selectItem(item, e) {
console.log(e);
if (e) {
const arr = this.page.list.map(data => {
return data.id;
});
const old = this.inSelect;
if (old) {
const index = arr.indexOf(old.id);
this.page.list[index].checked = false;
}
this.inSelect = item;
} else {
this.inSelect = null;
handleOk() {
this.isVisiable = false;
this.done.emit(this.inSelect);
}