Commit 9448ef44 authored by wangqinghua's avatar wangqinghua

创建运维项目

parent a8c649a0
......@@ -126,6 +126,8 @@ import {OprCostComponent} from './project-manager/opr-cost/opr-cost.component';
import {OprCompanyComponent} from './project-manager/opr-company/opr-company.component';
import {ProjectService} from './project-manager/project.service';
import {CreateCompanyComponent} from './project-manager/modal/create-company/create-company.component';
import {TrackInfoComponent} from './project-manager/modal/track-info/track-info.component';
import {CreateProjectComponent} from './project-manager/modal/create-project/create-project.component';
@NgModule({
imports: [
......@@ -253,6 +255,8 @@ import {CreateCompanyComponent} from './project-manager/modal/create-company/cre
OprCostComponent,
OprCompanyComponent,
CreateCompanyComponent,
TrackInfoComponent,
CreateProjectComponent,
],
providers: [
OverAllService,
......
<nz-modal [nzWidth]="780" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [(nzSelectedIndex)]="tabNum" [nzType]="'card'" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="项目内容">
<form [formGroup]="validateForm" nz-form>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">公司名称</nz-form-label>
......@@ -64,4 +66,9 @@
</nz-form-control>
</nz-form-item>
</form>
</nz-tab>
<nz-tab nzTitle="跟踪信息">
<smart-track-info [maintainType]="0"></smart-track-info>
</nz-tab>
</nz-tabset>
</nz-modal>
......@@ -13,6 +13,7 @@ import {opr_company_type} from '../../project.constants';
export class CreateCompanyComponent implements OnInit {
@Output() done = new EventEmitter<any>();
tabNum = 0; //tabs面板的序列号
title;
isVisible = false;
......@@ -53,6 +54,7 @@ export class CreateCompanyComponent implements OnInit {
this.title = title;
this.cID = data.id;
console.log(data);
this.validateForm.patchValue(data);
}
handleCancel() {
......@@ -105,7 +107,7 @@ export class CreateCompanyComponent implements OnInit {
update() {
this.validateForm.addControl('id', new FormControl(this.cID));
this.systemSer.updateUser(this.validateForm.value).subscribe(
this.projectSer.updateMaintainCompany(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisible = false;
......@@ -120,4 +122,9 @@ export class CreateCompanyComponent implements OnInit {
);
}
//tabs切换
tabsChange(num) {
this.tabNum = num;
}
}
<nz-modal [nzWidth]="780" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [(nzSelectedIndex)]="tabNum" [nzType]="'card'" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="项目内容">
<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" 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="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-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-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-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="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="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="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-tab>
<nz-tab nzTitle="跟踪信息">
<smart-track-info [maintainType]="1"></smart-track-info>
</nz-tab>
</nz-tabset>
</nz-modal>
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 {SystemService} from '../../../system/system.service';
import {ProjectService} from '../../project.service';
@Component({
selector: 'smart-create-project',
templateUrl: './create-project.component.html',
styles: []
})
export class CreateProjectComponent implements OnInit {
@Output() done = new EventEmitter<any>();
tabNum = 0; //tabs面板的序列号
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)]],
officeName: [null],
officePrincipal: [null],
aPrincipal: [null],
amount: [null],
type: [null],
planWorkNum: [null],
workNum: [null],
status: [null],
companyId: [null],
teamId: [null],
startDate: [null],
endDate: [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);
this.validateForm.patchValue(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;
}
);
}
//tabs切换
tabsChange(num) {
this.tabNum = num;
}
}
<div class="padding-15">
<nz-table #nzTable [nzData]="warnList" [nzFrontPagination]="false" [nzTotal]="page.totalNum"
[nzPageIndex]="page.pageNum"
[nzPageSize]="page.pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="page.loading">
<thead>
<tr>
<th>时间</th>
<th>操作人</th>
<th>消息内容</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of nzTable.data">
<td>{{data.createTime | date:"yyyy-MM-dd HH:mm:ss"}}</td>
<td>{{data.createUserName}}</td>
<td>{{data.msg}}</td>
</tr>
</tbody>
</nz-table>
</div>
import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {SendLogComponent} from '../../../alarm/modal/send-log/send-log.component';
import {pageSize} from '../../../app.constants';
import {AlarmService} from '../../../alarm/alarm.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ProjectService} from '../../project.service';
@Component({
selector: 'smart-track-info',
templateUrl: './track-info.component.html',
styles: []
})
export class TrackInfoComponent implements OnInit {
@Input() maintainType;
@ViewChild('sendLog') sendLog: SendLogComponent;
@Output() total = new EventEmitter<any>();
warnList = [];
page = {
pageNum: 1,
pageCount: pageSize,
totalNum: 0,
loading: false,
};
constructor(public alarmSer: AlarmService, public message: NzMessageService,
private projectSer:ProjectService) {
}
ngOnInit() {
this.getList();
}
outGet() {
this.page.pageNum = 1;
this.getList();
}
getList() {
this.page.loading = true;
const data = {
pageNum: this.page.pageNum,
pageCount: this.page.pageCount,
obj: {
maintainType: this.maintainType
}
};
this.projectSer.selectMaintainProjectTrackMsg(data).subscribe(
(res) => {
if (res.errCode == 10000) {
if (res.data) {
this.warnList = res.data.data;
this.page.totalNum = res.data.totalNum;
}
}
this.page.loading = false;
}
);
}
change(e) {
this.page.pageNum = e;
this.getList();
}
showLog(data) {
this.sendLog.showModal(data);
}
}
......@@ -6,6 +6,15 @@ export const project_status = [
{key: '1', value: '已完成'},
];
//项目类型
export const project_type = [
{key: '0', value: '软件维护类'},
{key: '1', value: '硬件维护'},
{key: '2', value: '网络维护'},
{key: '3', value: '终端维护'},
{key: '4', value: '建设类'},
];
//运维公司类型
export const opr_company_type = [
{key: null, value: '全部'},
......
......@@ -145,4 +145,9 @@ export class ProjectService {
findById(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/cost/findById', data);
}
//跟踪信息
selectMaintainProjectTrackMsg(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/maintainProject/selectMaintainProjectTrackMsg', data);
}
}
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