Skip to content
opr-team.component.ts 2.65 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import {Component, OnInit, ViewChild} from '@angular/core';
wangqinghua's avatar
wangqinghua committed
import {opr_company_type, opr_team_type} from '../project.constants';
import {pageSize} from '../../app.constants';
import {WorkService} from '../../work/work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ProjectService} from '../project.service';
import {Router} from '@angular/router';
import {CommonService} from '../../shared/common/common.service';
import {DatePipe} from '@angular/common';
wangqinghua's avatar
wangqinghua committed
import {CreateTeamComponent} from '../modal/create-team/create-team.component';
wangqinghua's avatar
wangqinghua committed
import {TeamPeopleComponent} from '../modal/team-people/team-people.component';
import {TeamModalComponent} from '../modal/team-modal/team-modal.component';
wangqinghua's avatar
wangqinghua committed

@Component({
wangqinghua's avatar
wangqinghua committed
    selector: 'app-opr-team',
    templateUrl: './opr-team.component.html',
    styleUrls: ['./opr-team.component.css']
wangqinghua's avatar
wangqinghua committed
})
export class OprTeamComponent implements OnInit {
wangqinghua's avatar
wangqinghua committed
    @ViewChild('smartCreateTeam') smartCreateTeam: CreateTeamComponent;
    @ViewChild('smartTeamModal') smartTeamModal: TeamModalComponent;
    teamType = [{label: '全部', value: null}, ...opr_team_type];
wangqinghua's avatar
wangqinghua committed
    page = {
        list: [],
        isLoading: false,
        pageCount: pageSize,
        pageNum: 1,
        totalNum: null
    };

    obj = {
        name: '',
        type: null
    };

    constructor(private workSer: WorkService, private message: NzMessageService, private projectSer: ProjectService,
                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
        };
        this.projectSer.selectMaintainTeam(obj).subscribe(
            (res) => {
                if (res.errCode == 10000) {
                    this.page.list = res.data.data;
                    this.page.totalNum = res.data.totalNum;
                    this.page.isLoading = false;
                }
            }
        );
    }

    //翻页
    change(e) {
wangqinghua's avatar
wangqinghua committed
        if (e > 0) {
            this.page.pageNum = e;
            this.getList();
        }
wangqinghua's avatar
wangqinghua committed
    }

    //搜索
    search() {
        this.page.pageNum = 1;
        this.getList();
    }
wangqinghua's avatar
wangqinghua committed

    //新增运维团队
wangqinghua's avatar
wangqinghua committed
    handleAdd() {
wangqinghua's avatar
wangqinghua committed
        this.smartCreateTeam.showAddModal('新增运维团队');
    }
wangqinghua's avatar
wangqinghua committed

    //编辑团队
wangqinghua's avatar
wangqinghua committed
    handleEdit(item) {
        this.smartCreateTeam.showEditModal(item, '编辑运维团队');
wangqinghua's avatar
wangqinghua committed
    }

    //团队成员修改
wangqinghua's avatar
wangqinghua committed
    handleUpdateTeam(data) {
        this.smartTeamModal.showModal(data, `团队成员`);
wangqinghua's avatar
wangqinghua committed
    }
wangqinghua's avatar
wangqinghua committed
}