Commit 10f09abe authored by wangqinghua's avatar wangqinghua

创建运维项目

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