You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.5 KiB
64 lines
1.5 KiB
import { Component, OnInit } from '@angular/core';
|
|
import {FormBuilder, FormGroup} from '@angular/forms';
|
|
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
|
|
import {CompanyService} from '../../../services/company.service';
|
|
|
|
@Component({
|
|
selector: 'app-company-list',
|
|
templateUrl: './company-list.component.html',
|
|
styleUrls: ['./company-list.component.scss']
|
|
})
|
|
export class CompanyListComponent implements OnInit {
|
|
|
|
dataObject: any = {};
|
|
tableLoading = true;
|
|
searchForm: FormGroup;
|
|
pageNum: number;
|
|
whereObject: any = {};
|
|
|
|
constructor(private modal: NzModalService,
|
|
private message: NzMessageService,
|
|
private companyService: CompanyService,
|
|
private form: FormBuilder) { }
|
|
|
|
ngOnInit(): void {
|
|
this.searchForm = this.form.group({
|
|
name: [null],
|
|
});
|
|
this.requestData(1);
|
|
}
|
|
|
|
/**
|
|
* 请求数据
|
|
*/
|
|
requestData(pageNum) {
|
|
this.tableLoading = true;
|
|
this.whereObject['pageNum'] = pageNum;
|
|
this.whereObject['pageSize'] = 10;
|
|
this.companyService.selectCompanyList(this.whereObject, data => {
|
|
if (data['return_code'] === '000000') {
|
|
this.dataObject = data['return_data'];
|
|
} else {
|
|
this.modal.error(data['return_msg']);
|
|
}
|
|
this.tableLoading = false;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 搜索
|
|
* @param whereObject 条件
|
|
*/
|
|
search(whereObject: object) {
|
|
this.whereObject = whereObject;
|
|
this.requestData(1);
|
|
}
|
|
|
|
/**
|
|
* 重置
|
|
*/
|
|
resetForm(): void {
|
|
this.searchForm.reset();
|
|
}
|
|
|
|
}
|
|
|