Commit a8c649a0 authored by wangqinghua's avatar wangqinghua

创建运维团队

parent d4792a52
...@@ -43,7 +43,7 @@ Module ng g module my-module ...@@ -43,7 +43,7 @@ Module ng g module my-module
v2.0.1 修复选择节点之后 流量查询不出来 v2.0.1 修复选择节点之后 流量查询不出来
****上传文件到服务器****** ****上传文件到服务器******
scp -r 22 build/master root@10.10.38.99:/home/nginx/www/ scp -r build/master root@10.10.38.99:/home/nginx/www/
scp -r 22 build/wx root@10.10.38.99:/home/nginx/html/www/ scp -r 22 build/wx root@10.10.38.99:/home/nginx/html/www/
......
...@@ -125,6 +125,7 @@ import {OprProjectComponent} from './project-manager/opr-project/opr-project.com ...@@ -125,6 +125,7 @@ import {OprProjectComponent} from './project-manager/opr-project/opr-project.com
import {OprCostComponent} from './project-manager/opr-cost/opr-cost.component'; import {OprCostComponent} from './project-manager/opr-cost/opr-cost.component';
import {OprCompanyComponent} from './project-manager/opr-company/opr-company.component'; import {OprCompanyComponent} from './project-manager/opr-company/opr-company.component';
import {ProjectService} from './project-manager/project.service'; import {ProjectService} from './project-manager/project.service';
import {CreateCompanyComponent} from './project-manager/modal/create-company/create-company.component';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -251,6 +252,7 @@ import {ProjectService} from './project-manager/project.service'; ...@@ -251,6 +252,7 @@ import {ProjectService} from './project-manager/project.service';
OprProjectComponent, OprProjectComponent,
OprCostComponent, OprCostComponent,
OprCompanyComponent, OprCompanyComponent,
CreateCompanyComponent,
], ],
providers: [ providers: [
OverAllService, OverAllService,
......
<nz-modal [nzWidth]="780" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">
<form [formGroup]="validateForm" nz-form>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">公司名称</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="name" id="name">
<nz-form-explain *ngIf="validateForm.get('name').dirty && validateForm.get('name').errors">
用户登录名为6到50个字符!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<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">联系电话1</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="phone2">联系电话2</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="phone2" id="phone2">
<nz-form-explain *ngIf="validateForm.get('phone2').dirty && validateForm.get('phone2').errors">手机号码错误!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="type">维护类型</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-select name="type" formControlName="type" id="type" nzPlaceHolder="选择设备类型">
<ng-container *ngFor="let item of opr_company_type">
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="description">职责描述</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<textarea formControlName="description" nz-input rows="2" placeholder="职责描述"></textarea>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="group">相关附件</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-upload
[nzBeforeUpload]="beforeUpload"
[(nzFileList)]="fileList">
<button nz-button>
<i class="anticon anticon-upload"></i><span>上传</span>
</button>
</nz-upload>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {SystemService} from '../../../system/system.service';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
import {ProjectService} from '../../project.service';
import {opr_company_type} from '../../project.constants';
@Component({
selector: 'smart-create-company',
templateUrl: './create-company.component.html',
styles: []
})
export class CreateCompanyComponent implements OnInit {
@Output() done = new EventEmitter<any>();
title;
isVisible = false;
isOkLoading = false;
validateForm: FormGroup;
fileList: UploadFile[] = [];
opr_company_type = opr_company_type;
cID;
constructor(private fb: FormBuilder, private systemSer: SystemService,
private message: NzMessageService, private projectSer: ProjectService) {
}
ngOnInit(): void {
this.initForm();
}
initForm() {
this.validateForm = this.fb.group({
name: [null, [Validators.required, Validators.minLength(2), Validators.maxLength(50)]],
principal: [null],
principalId: [null],
type: [1, [Validators.required]],
phone: [null],
phone2: [null],
description: [null],
});
}
showAddModal(title) {
this.isVisible = true;
this.title = title;
}
showEditModal(data, title) {
this.isVisible = true;
this.title = title;
this.cID = data.id;
console.log(data);
}
handleCancel() {
this.isVisible = false;
this.initForm();
}
beforeUpload = (file: UploadFile): boolean => {
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || 'application/octet-stream';
if (!isExcel) {
this.message.error('请上传正确的文件!');
} else {
this.fileList[0] = file;
}
return false;
};
handleOk() {
for (let i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
if (this.validateForm.invalid) {
return false;
}
this.isOkLoading = true;
if (this.title == '新增运维公司') {
this.create();
}
if (this.title == '编辑运维公司') {
this.update();
}
}
create() {
this.projectSer.addMaintainCompany(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisible = false;
this.initForm();
this.done.emit();
this.message.success('新增运维公司成功');
} else {
this.message.error(res.errMsg);
}
this.isOkLoading = false;
}
);
}
update() {
this.validateForm.addControl('id', new FormControl(this.cID));
this.systemSer.updateUser(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisible = false;
this.initForm();
this.done.emit();
this.message.success('更新信息成功');
} else {
this.message.error(res.errMsg);
}
this.isOkLoading = false;
}
);
}
}
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</nz-radio-group> </nz-radio-group>
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
<button (click)="search()" <button (click)="handleAddModal()"
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>
...@@ -65,9 +65,11 @@ ...@@ -65,9 +65,11 @@
<td>{{data.projectNum}}</td> <td>{{data.projectNum}}</td>
<td>{{data.totalAmount}}</td> <td>{{data.totalAmount}}</td>
<td class="handle text-center main-color"> <td class="handle text-center main-color">
<span>编辑</span> <span (click)="handleEditModa(data)">编辑</span>
<span>查看</span> <span>查看</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
<smart-create-company #smartCreateCompany (done)="getList()"></smart-create-company>
import {Component, OnInit} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {opr_company_type, project_status} from '../project.constants'; import {opr_company_type, project_status} from '../project.constants';
import {pageSize} from '../../app.constants'; import {pageSize} from '../../app.constants';
import {WorkService} from '../../work/work.service'; import {WorkService} from '../../work/work.service';
...@@ -7,6 +7,7 @@ import {ProjectService} from '../project.service'; ...@@ -7,6 +7,7 @@ import {ProjectService} from '../project.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {CommonService} from '../../shared/common/common.service'; import {CommonService} from '../../shared/common/common.service';
import {DatePipe} from '@angular/common'; import {DatePipe} from '@angular/common';
import {CreateCompanyComponent} from '../modal/create-company/create-company.component';
@Component({ @Component({
selector: 'app-opr-company', selector: 'app-opr-company',
...@@ -15,6 +16,7 @@ import {DatePipe} from '@angular/common'; ...@@ -15,6 +16,7 @@ import {DatePipe} from '@angular/common';
}) })
export class OprCompanyComponent implements OnInit { export class OprCompanyComponent implements OnInit {
@ViewChild('smartCreateCompany') smartCreateCompany: CreateCompanyComponent;
companyType = opr_company_type; companyType = opr_company_type;
page = { page = {
...@@ -69,4 +71,13 @@ export class OprCompanyComponent implements OnInit { ...@@ -69,4 +71,13 @@ export class OprCompanyComponent implements OnInit {
this.getList(); this.getList();
} }
//新增运维公司
handleAddModal() {
this.smartCreateCompany.showAddModal('新增运维公司');
}
handleEditModa(item) {
this.smartCreateCompany.showEditModal(item, '编辑运维公司');
}
} }
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