Newer
Older
import {Component, OnInit, ViewChild} from '@angular/core';
import {CostModalComponent} from '../../project-manager/modal/cost-modal/cost-modal.component';
import {opr_cost_type, opr_time_type, project_status} from '../../project-manager/project.constants';
import {pageSize} from '../../app.constants';
import {WorkService} from '../../work/work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ProjectService} from '../../project-manager/project.service';
import {Router} from '@angular/router';
import {CommonService} from '../../shared/common/common.service';
import {DatePipe} from '@angular/common';
import {SystemChangeService} from '../system-change.service';
import {change_status, change_time_type} from '../system-change.constants';
import {ChangeCreateComponent} from '../modal/change-create/change-create.component';
import {ChangeVerityComponent} from '../modal/change-verity/change-verity.component';
import {TransforComponent} from '../../work/modal/transfor/transfor.component';
@Component({
selector: 'smart-change-manage',
templateUrl: './change-manage.component.html',
styles: []
})
export class ChangeManageComponent implements OnInit {
@ViewChild('smartChangeCreate') smartChangeCreate: ChangeCreateComponent;
@ViewChild('smartChangeVerity') smartChangeVerity: ChangeVerityComponent;
costType = [{label: '全部', value: null}, ...change_status];
timeType = [{label: '全部', value: null}, ...change_time_type];
time = {
startTime: '',
endTime: '',
type: null
};
page = {
list: [],
isLoading: false,
pageCount: pageSize,
pageNum: 1,
totalNum: null
};
obj = {
search: '', //填报人
constructor(private workSer: WorkService, private message: NzMessageService,
private router: Router, private commonSer: CommonService, private datePipe: DatePipe) {
}
ngOnInit() {
this.getList();
}
//获取列表
getList() {
this.page.isLoading = true;
const obj = {
obj: this.obj,
pageNum: this.page.pageNum,
pageCount: this.page.pageCount
};
(res) => {
if (res.errCode == 10000) {
this.page.list = res.data.data;
this.page.totalNum = res.data.totalNum;
this.page.isLoading = false;
}
}
);
}
//翻页
change(e) {
this.page.pageNum = e;
this.getList();
}
changeTimeType() {
this.obj.startTime = this.commonSer.getTimeByType(this.time.type).startTime;
this.obj.endTime = this.commonSer.getTimeByType(this.time.type).endTime;
this.page.pageNum = 1;
this.getList();
}
//搜索
search() {
this.page.pageNum = 1;
this.getList();
}
handleEditModal(data) {
this.smartChangeCreate.showEditModal(data, '提交审核');
deleteChange(data) {
this.commonSer.confirmThing(`提示`, `确定删除变更?`, () => {
const d = {
ids: [data.id]
};
this.systemChangeSer.sysChangeDelete(d).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success('删除成功');
this.getList();
}
}
);
});
showChangeModal(data) {
this.smartChangeVerity.showModal(data.id, '审核');
}
//转派
showTransforModal(data) {
this.smartTransfor.showTransforModal('变更转派', data.id);
}
//下载文件
downLoad() {
this.isDownLoad = true;
const d = {
format: 'excel'
};
this.systemChangeSer.sysChangeExport(d).subscribe(
(res) => {
this.isDownLoad = false;