Commit 10f09abe authored by wangqinghua's avatar wangqinghua

创建运维项目

parent 9448ef44
......@@ -26,60 +26,48 @@
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="principal">甲方名称</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="principal" id="principal">
<nz-form-explain *ngIf="validateForm.get('principal').dirty && validateForm.get('principal').errors">
用户登录名为2到16个字符!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<!-- <nz-form-item>-->
<!-- <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="phone">乙方名称</nz-form-label>-->
<!-- <nz-form-control [nzSm]="14" [nzXs]="24">-->
<!-- <input nz-input formControlName="phone" id="phone">-->
<!-- </nz-form-control>-->
<!-- </nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="phone">乙方名称</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="startDate">开始时间</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="phone" id="phone">
<nz-form-explain *ngIf="validateForm.get('phone').dirty && validateForm.get('phone').errors">手机号码错误!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="phone">开始时间</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="phone" id="phone">
<nz-form-explain *ngIf="validateForm.get('phone').dirty && validateForm.get('phone').errors">手机号码错误!
</nz-form-explain>
<nz-date-picker
[nzFormat]="timeFormat"
formControlName="startDate" id="startDate"
nzPlaceHolder="终止时间"></nz-date-picker>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="phone">终止时间</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="endDate">终止时间</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="phone" id="phone">
<nz-form-explain *ngIf="validateForm.get('phone').dirty && validateForm.get('phone').errors">手机号码错误!
</nz-form-explain>
<nz-date-picker
[nzFormat]="timeFormat"
formControlName="endDate" id="endDate"
nzPlaceHolder="终止时间"></nz-date-picker>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="principal">项目金额</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="amount">项目金额</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="principal" id="principal">
<nz-form-explain *ngIf="validateForm.get('principal').dirty && validateForm.get('principal').errors">
用户登录名为2到16个字符!
</nz-form-explain>
<input nz-input formControlName="amount" id="amount">
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="principal">单位负责人</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="officePrincipal">单位负责人</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="principal" id="principal">
<nz-form-explain *ngIf="validateForm.get('principal').dirty && validateForm.get('principal').errors">
用户登录名为2到16个字符!
</nz-form-explain>
<input nz-input formControlName="officePrincipal" id="officePrincipal">
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="principal">乙方维护组长</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="aPrincipal">乙方维护组长</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="principal" id="principal">
<nz-form-explain *ngIf="validateForm.get('principal').dirty && validateForm.get('principal').errors">
用户登录名为2到16个字符!
</nz-form-explain>
<input nz-input formControlName="principal" id="aPrincipal">
</nz-form-control>
</nz-form-item>
......
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
import {opr_company_type} from '../../project.constants';
import {opr_company_type, project_type} from '../../project.constants';
import {SystemService} from '../../../system/system.service';
import {ProjectService} from '../../project.service';
......@@ -13,13 +13,14 @@ import {ProjectService} from '../../project.service';
export class CreateProjectComponent implements OnInit {
@Output() done = new EventEmitter<any>();
tabNum = 0; //tabs面板的序列号
timeFormat = 'yyyy-MM-dd';
title;
isVisible = false;
isOkLoading = false;
validateForm: FormGroup;
fileList: UploadFile[] = [];
opr_company_type = opr_company_type;
opr_company_type = project_type;
cID;
......@@ -39,11 +40,7 @@ export class CreateProjectComponent implements OnInit {
aPrincipal: [null],
amount: [null],
type: [null],
planWorkNum: [null],
workNum: [null],
status: [null],
companyId: [null],
teamId: [null],
principal: [null],
startDate: [null],
endDate: [null],
});
......@@ -58,12 +55,12 @@ export class CreateProjectComponent implements OnInit {
this.isVisible = true;
this.title = title;
this.cID = data.id;
console.log(data);
this.validateForm.patchValue(data);
}
handleCancel() {
this.isVisible = false;
this.initForm();
}
......@@ -86,22 +83,26 @@ export class CreateProjectComponent implements OnInit {
return false;
}
this.isOkLoading = true;
if (this.title == '新增运维公司') {
if (this.title == '新增运维项目') {
this.create();
}
if (this.title == '编辑运维公司') {
if (this.title == '编辑运维项目') {
this.update();
}
}
create() {
this.projectSer.addMaintainCompany(this.validateForm.value).subscribe(
this.validateForm.patchValue({
startDate: new Date(this.validateForm.value.startDate).getTime(),
endDate: new Date(this.validateForm.value.endDate).getTime(),
});
this.projectSer.addMaintainProject(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisible = false;
this.initForm();
this.done.emit();
this.message.success('新增运维公司成功');
this.message.success('新增运维项目成功');
} else {
this.message.error(res.errMsg);
}
......@@ -112,13 +113,13 @@ export class CreateProjectComponent implements OnInit {
update() {
this.validateForm.addControl('id', new FormControl(this.cID));
this.systemSer.updateUser(this.validateForm.value).subscribe(
this.projectSer.updateMaintainProject(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisible = false;
this.initForm();
this.done.emit();
this.message.success('更新信息成功');
this.message.success('更新项目成功');
} else {
this.message.error(res.errMsg);
}
......
......@@ -49,7 +49,7 @@
</nz-radio-group>
</div>
<div nz-col nzSpan="3">
<button (click)="search()"
<button (click)="handleOpenModal()"
nz-button nzType="default"><i class="anticon anticon-search" style="color: #6097b7"></i>新增运维项目
</button>
</div>
......@@ -107,3 +107,5 @@
</tr>
</tbody>
</nz-table>
<smart-create-project #smartCreateProject (done)="getList()"></smart-create-project>
......@@ -10,6 +10,7 @@ import {CommonService} from '../../shared/common/common.service';
import {DatePipe} from '@angular/common';
import {ProjectService} from '../project.service';
import {project_status} from '../project.constants';
import {CreateProjectComponent} from '../modal/create-project/create-project.component';
@Component({
selector: 'app-opr-project',
......@@ -17,6 +18,7 @@ import {project_status} from '../project.constants';
styleUrls: ['./opr-project.component.css']
})
export class OprProjectComponent implements OnInit {
@ViewChild('smartCreateProject') smartCreateProject: CreateProjectComponent;
timeFormat = 'yyyy';
......@@ -38,7 +40,7 @@ export class OprProjectComponent implements OnInit {
keyword: ''
};
constructor(private workSer: WorkService, private message: NzMessageService,private projectSer:ProjectService,
constructor(private workSer: WorkService, private message: NzMessageService, private projectSer: ProjectService,
private router: Router, private commonSer: CommonService, private datePipe: DatePipe) {
}
......@@ -79,4 +81,8 @@ export class OprProjectComponent implements OnInit {
this.getList();
}
handleOpenModal() {
this.smartCreateProject.showAddModal('新增运维项目');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment