Commit 73ef8491 authored by wangqinghua's avatar wangqinghua

update

parent ff17daaf
......@@ -87,18 +87,6 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="data_type">数据类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="data_type" formControlName="data_type" nzPlaceHolder="请选择数据类型">
<nz-option nzValue="0" nzLabel="十进制"></nz-option>
<nz-option nzValue="1" nzLabel="八进制"></nz-option>
<nz-option nzValue="2" nzLabel="二进制"></nz-option>
<nz-option nzValue="3" nzLabel="布尔"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('data_type').dirty && validateForm.get('data_type').errors">请选择数据类型!</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="units">单位</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="units" name="units" type="text" nz-input formControlName="units">
......@@ -132,14 +120,6 @@
<nz-form-explain *ngIf="validateForm.get('delay').dirty && validateForm.get('delay').errors">请输入数据更新间隔!</nz-form-explain>
</nz-form-control>
</nz-form-item>
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="interval">自定义时间间隔</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input id="interval" name="interval" placeholder="输入自定义时间间隔" type="text" nz-input-->
<!--formControlName="interval">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSpan]="6">历史数据保留时长(单位天)</nz-form-label>
<nz-form-control [nzSpan]="14" nzFor="history">
......@@ -155,21 +135,19 @@
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">存储值</nz-form-label>
<nz-form-control [nzSpan]="14">
<input type="text" name="storagevalue" nz-input formControlName="delta">
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">查看值</nz-form-label>
<nz-form-label [nzSpan]="6" nzFor="valuemapid">查看值</nz-form-label>
<nz-form-control [nzSpan]="14">
<input type="text" nz-input name="valuemapid" formControlName="valuemapid">
<nz-select name="valuemapid" formControlName="valuemapid" nzPlaceHolder="请选择查看值">
<nz-option nzValue="0" nzLabel="不变"></nz-option>
<ng-container *ngFor="let item of valueMapList">
<nz-option [nzValue]="item.valuemapid" [nzLabel]="item.name"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
<div class="modal-footer-btn">
<button nz-button (click)="handleCheckOk()" nzType="primary">下一步</button>
<button nz-button (click)="handleCheckOk()" nzType="primary">保存</button>
</div>
</nz-tab>
<nz-tab nzTitle="阈值设置" nzDisabled="true">
......@@ -186,16 +164,16 @@
<nz-form-label [nzSpan]="3" > <span *ngIf="i == 0">危险阈值</span> </nz-form-label>
<nz-form-control [nzSpan]="18" class="form-select">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzSpan]="6">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.and">
<nz-form-control nz-col [nzSpan]="4">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.and" *ngIf="i>0">
<nz-option nzValue=" and " nzLabel="并且"></nz-option>
<nz-option nzValue=" or " nzLabel="或"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="3">
<nz-form-control nz-col [nzSpan]="4">
<button class="tag-button" nz-button nzType="default">返回值</button>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="6">
<nz-form-control nz-col [nzSpan]="3">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.equal">
<nz-option nzValue="=" nzLabel="="></nz-option>
<nz-option nzValue=">" nzLabel=">"></nz-option>
......@@ -217,13 +195,13 @@
<nz-form-label [nzSpan]="3"><span *ngIf="i == 0;">故障阈值</span></nz-form-label>
<nz-form-control [nzSpan]="18" class="form-select">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzSpan]="6">
<nz-select name="interfaces_main" [(ngModel)]="fault.and">
<nz-form-control nz-col [nzSpan]="4">
<nz-select name="interfaces_main" [(ngModel)]="fault.and" *ngIf="i>0">
<nz-option nzValue=" and " nzLabel="并且"></nz-option>
<nz-option nzValue=" or " nzLabel="或"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="6">
<nz-form-control nz-col [nzSpan]="4">
<button class="tag-button" nz-button nzType="default">返回值</button>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="3">
......@@ -238,7 +216,7 @@
</nz-form-control>
<nz-form-control nz-col [nzSpan]="3">
<button *ngIf="i == 0" nz-button nzType="primary" (click)="addcondition()">添加条件</button>
<button *ngIf="i > 0" nz-button nzType="primary" (click)="deleteCondition(i)">删除条件</button>
<button *ngIf="i > 0" nz-button nzType="primary" (click)="deleteCondition(i)"><i class="anticon anticon-close-circle-o"></i></button>
</nz-form-control>
</div>
</nz-form-control>
......@@ -253,7 +231,6 @@
<textarea rows="4" nz-input [(ngModel)]="triggerObj.faultCondition"></textarea>
</nz-form-control>
</nz-form-item>
</ng-container>
<div class="modal-footer-btn">
<button nz-button (click)="saveTrigger()" nzType="primary">完成</button>
......
......@@ -38,6 +38,7 @@ export class BasiCheckComponent implements OnInit {
hostName; //主机name
itemId; //监控项id
interfaceList: any[];
valueMapList = [];
validateForm:FormGroup;
checkList; //监测点分类
interval; //间隔时长
......@@ -62,16 +63,19 @@ export class BasiCheckComponent implements OnInit {
faultCondition:'',
itemName:''
};
triggerId = [];
constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) {
}
ngOnInit() {
this.initForm();
this.getValuemap();
}
initForm(){
this.tabNum = 1;
this.tabNum = 0;
this.validateForm = this.fb.group({
hostid:[this.hostId],
name:[null,[Validators.required]],
......@@ -79,16 +83,14 @@ export class BasiCheckComponent implements OnInit {
key_:[null,[Validators.required]],
value_type:[null,[Validators.required]],
type:[null,[Validators.required]],
data_type:[null,[Validators.required]],
units:[null],
formula:[null,[Validators.required]],
history:['3600'],
trends:[null],
valuemapid:[null],
valuemapid:['0'],
delay:[null,[Validators.required]],
snmp_oid:[null],
snmp_community:[null],
delta:[null],
snmp_community:['public'],
applicationids:[null],
});
this.triggerObj = {
......@@ -113,20 +115,82 @@ export class BasiCheckComponent implements OnInit {
this.getItemType();
}
//映射值
getValuemap(){
this.overAllSer.findValuemap().subscribe(
(res)=>{
if(res.errCode == 10000){
this.valueMapList = res.data;
}else{
this.message.error(res.errMsg);
}
}
)
}
//编辑
showEditModal(hostId,id){
showEditModal(hostId,id,hostName){
this.title = "编辑监测点";
this.hostId = hostId;
this.isCheck = true;
this.itemId = id;
this.hostName = hostName;
this.overAllSer.findItemDetail(id).subscribe(
(res) => {
const data = res.data[0];
data.type += '';
data.interfaceid += "";
data.value_type += "";
data.data_type += "";
this.validateForm.patchValue(data);
data.triggers.forEach( (value)=> {
this.triggerId.push(value.triggerid);
let str = value.expression;
let equal = [];
let arr = [];
let con = "";
let a = str.split(" ");
a.forEach((e)=> { // 符号数组
let index1 = e.indexOf("}");
if(e == 'and' || e == 'or'){
equal.push(e);
}
if(index1 > -1){
let f = e.substring(index1+1,e.length);
con += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' +f +" ";
}else{
con += e + " ";
}
});
let c = str.replace(/and/g,"").replace(/or/g,"").split(" ");
c.forEach( (val,index)=> {
let index1 = val.indexOf("}");
let d = val.substring(index1+1,val.length);
let data;
if(index > 0){
data = {
and: " "+equal[index-1]+" ",
equal: d[0],
value: d.substring(1,c.length),
}
}else{
data = {
equal: d[0],
value: d.substring(1,c.length),
}
}
arr.push(data);
});
if(value.priority == 2 || value.priority == 3){ //危险
this.faultConditionList = arr;
this.triggerObj.condition = con;
}
if(value.priority == 4 || value.priority == 5){ //故障
this.conditionList = arr;
this.triggerObj.faultCondition = con;
}
});
}
);
......@@ -159,6 +223,7 @@ export class BasiCheckComponent implements OnInit {
this.validateForm.controls[ i ].updateValueAndValidity();
}
if(this.validateForm.invalid){
this.message.error("请输入必填信息");
return false;
}
this.validateForm.value.applicationids = [this.validateForm.value.applicationids];
......@@ -176,13 +241,14 @@ export class BasiCheckComponent implements OnInit {
(res) => {
if (res.errCode == 10000) {
this.message.success("创建监测点成功");
this.done.emit();
this.tabNum = 1;
}else{
this.message.error(res.errMsg);
}
},
(err) => {
this.message.info('系统错误');
this.message.error('系统错误');
}
);
}
......@@ -193,14 +259,15 @@ export class BasiCheckComponent implements OnInit {
this.overAllSer.itemUpdata(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isCheck = false;
this.initForm();
this.message.success("修改监测点成功");
this.done.emit();
this.tabNum = 1;
}else{
this.message.error(res.errMsg);
}
this.message.info(res.errMsg);
},
(err) => {
this.message.info('系统错误');
this.message.error('系统错误');
}
);
}
......@@ -288,20 +355,18 @@ export class BasiCheckComponent implements OnInit {
this.faultConditionList.forEach(res => {
data.faultCondition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value + res.and;
});
console.log(data.condition.substring(0,data.condition.length -4));
console.log(data.faultCondition.substring(0,data.faultCondition.length -4));
data.condition = data.condition.substring(0,data.condition.length -4);
data.faultCondition = data.faultCondition.substring(0,data.faultCondition.length -4);
} else { //高级
data.condition = this.triggerObj.condition;
data.faultCondition = this.triggerObj.faultCondition;
}
// if(this.title == "添加监测点"){
// this.createTrigger(data);
// }
// if(this.title == "编辑监测点"){
// this.updateTrigger(data);
// }
if(this.title == "添加监测点"){
this.createTrigger(data);
}
if(this.title == "编辑监测点"){
this.updateTrigger(data);
}
}
//1.创建阈值
createTrigger(data){
......@@ -314,7 +379,6 @@ export class BasiCheckComponent implements OnInit {
(response)=>{
if(response.errCode == 10000){
this.message.success("创建阈值成功");
this.done.emit();
this.initForm();
this.isCheck = false;
}else{
......@@ -327,15 +391,14 @@ export class BasiCheckComponent implements OnInit {
//2.修改阈值
updateTrigger(data){
const res = {
triggerid:'',
triggerid:this.triggerId,
itemName:this.validateForm.value.name,
faultCondition:data.faultCondition,
condition:data.condition
};
this.overAllSer.updateTrigger(data).subscribe(res=>{
this.overAllSer.updateTrigger(res).subscribe(res=>{
if(res.errCode == 10000){
this.message.success("修改阈值成功");
this.done.emit();
this.initForm();
this.isCheck = false;
}else{
......
......@@ -19,15 +19,6 @@
</nz-form-item>
</div>
<!--<div nz-col [nzSpan]="12">-->
<!--<nz-form-item nzFlex>-->
<!--<nz-form-label [nzSpan]="6" nzFor="invertoryname">品牌</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input id="invertoryname" nz-input placeholder="品牌" name="invertoryname"-->
<!--[(ngModel)]="validateForm.inventoryExtend.invertoryname">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--</div>-->
</div>
<div nz-row [nzGutter]="24">
......@@ -548,7 +539,7 @@
<div class="modal-footer-btn">
<button nz-button (click)="handleEditCancel()" nzType="primary">取消</button>
<button nz-button (click)="tabsChange(1)" nzType="primary">上一步</button>
<button nz-button (click)="handleEditCancel(1)" nzType="primary">完成</button>
<button nz-button (click)="handleEditCancel()" nzType="primary">完成</button>
</div>
</nz-tab>
</nz-tabset>
......
......@@ -55,7 +55,6 @@ export class BasicEditComponent implements OnInit {
this.tabNum = 0;
this.initForm();
this.getTemplate();
this.getGroup();
this.getTree();
}
......@@ -79,10 +78,12 @@ export class BasicEditComponent implements OnInit {
this.isBasicEdit = true;
this.modalTitle = '添加资源';
this.hostId = hostId;
this.getGroup();
}
//编辑
editModal(hostId, name, gId): void {
this.getGroup();
this.isBasicEdit = true;
this.hostId = hostId;
this.modalTitle = '编辑资源';
......@@ -100,10 +101,6 @@ export class BasicEditComponent implements OnInit {
this.validateForm.tls_subject = data.tls_subject + '';
this.validateForm.tls_psk = data.tls_psk + '';
this.validateForm.inventoryExtend = data.inventoryExtend;
// this.validateForm.inventoryExtend.invertoryname = data.inventoryExtend.invertoryname;
// this.validateForm.inventoryExtend.mac = data.inventoryExtend.mac;
// this.validateForm.inventoryExtend.storageLocation = data.inventoryExtend.storageLocation;
// this.validateForm.inventoryExtend.maintenanceExpiration = data.inventoryExtend.maintenanceExpiration;
this.validateForm.hostExtend.equipmentTypeid = data.hostExtend.equipmentTypeid +'';
this.validateForm.hostExtend.secondLevelTypeid = data.hostExtend.secondLevelTypeid +'';
this.validateForm.hostExtend.serviceid = data.hostExtend.serviceid +'';
......@@ -258,7 +255,7 @@ export class BasicEditComponent implements OnInit {
);
}
//getTree
//获取设备类型
getTree(){
this.overAllSer.findTree().subscribe(
(res)=>{
......
<p>
select-person works!
</p>
<!--添加资源-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()">
<div nz-form class="ant-advanced-search-form form-select">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8">
<nz-tree [(ngModel)]="nodes"></nz-tree>
</div>
<div nz-col [nzSpan]="8">
<nz-table #basicTable [nzData]="userList"
(nzCurrentPageDataChange)="currentPageDataChange($event)"
(nzPageIndexChange)="refreshStatus()"
(nzPageSizeChange)="refreshStatus()">
<thead>
<tr>
<th nzShowCheckbox [(nzChecked)]="allChecked" [nzIndeterminate]="indeterminate" (nzCheckedChange)="checkAll($event)"></th>
<th>姓名</th>
<th>手机号码</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="selectItem(data,$event)"></td>
<td>{{data.name}}</td>
<td>{{data.mobile}}</td>
</tr>
</tbody>
</nz-table>
</div>
<div nz-col [nzSpan]="8">
<p>已选中用户 <span >清空</span></p>
<p (click)="handle" *ngFor="let item of selectList;let i = index;">
<span>{{item.name}}</span>
<span>{{item.mobile}}</span>
<span (click)="deleteSelect(i)">X</span>
</p>
</div>
</div>
</div>
</nz-modal>
import { Component, OnInit } from '@angular/core';
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {NzTreeNode} from 'ng-zorro-antd';
import {SystemService} from '../../system/system.service';
import {ToTree} from '../../shared/common/toTree';
@Component({
selector: 'smart-select-person',
......@@ -6,10 +9,124 @@ import { Component, OnInit } from '@angular/core';
styles: []
})
export class SelectPersonComponent implements OnInit {
@Output() done = new EventEmitter();
constructor() { }
isVisible = false;
title;
groupList;
userList;
selectList = [];
nodes: any[];
allChecked = false;
checkedNumber = 0;
disabledButton = true;
indeterminate = false;
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService, private toTreeSer: ToTree) {
}
checkAll(value: boolean): void {
this.displayData.forEach(data => data.checked = value);
this.refreshStatus();
}
currentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void {
this.displayData = $event;
}
selectItem(item,e){
if(e){
this.selectList.push(item);
}else{
this.selectList.forEach((value,index)=>{
if(value.id == item.id){
this.selectList.splice(index,1)
}
})
}
this.refreshStatus()
}
deleteSelect(index){
this.selectList.splice(index,1);
}
refreshStatus(): void {
const allChecked = this.displayData.every(value => value.checked === true);
const allUnChecked = this.displayData.every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
this.disabledButton = !this.userList.some(value => value.checked);
this.checkedNumber = this.userList.filter(value => value.checked).length;
}
ngOnInit() {
}
init(){
this.selectList = [];
this.allChecked = false;
this.checkedNumber = 0;
this.disabledButton = true;
this.indeterminate = false;
}
showModal(title) {
this.getUser();
this.getGroup();
this.isVisible = true;
this.title = title;
}
getUser() {
const data = {
'name': '',
'orgId': '',
'pageNumber': '1',
'pageSize': '10'
};
this.systemSer.user(data).subscribe(
(res) => {
this.userList = res.data;
}
);
}
//组织信息
getGroup() {
this.systemSer.organization().subscribe(
(res) => {
this.groupList = res.data;
this.groupList.forEach(
res => {
res.title = res.name;
res.key = res.id;
}
);
this.nodeTree();
}
);
}
nodeTree() {
const tree = this.toTreeSer.listToTree('id', 'parentId', this.groupList,);
const list = tree.map(res => {
return new NzTreeNode(res);
});
this.nodes = list;
}
handleEditCancel(){
this.isVisible = false;
this.init();
}
handEditleOk(){
this.done.emit(this.selectList);
this.isVisible = false;
this.init();
}
}
......@@ -44,9 +44,11 @@ export class WarnListComponent implements OnInit {
this.alarmSer.eventFind(data).subscribe(
(res) => {
if(res.errCode == 10000){
if(res.data){
this.warnList = res.data.data;
this.totalNum = res.data.totalNum;
this.total.emit(this.totalNum);
}
}else{
this.message.info(res.errMsg);
}
......
......@@ -187,9 +187,6 @@
<nz-tab #thirdTabs nzTitle="历史告警" >
<smart-warn-list #warnList></smart-warn-list>
</nz-tab>
<nz-tab nzTitle="资产运维">
Content of Tab Pane 3
</nz-tab>
</nz-tabset>
</div>
</div>
......
......@@ -598,7 +598,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//编辑监测点
showEditModal(item){
this.smartCheck.showEditModal(this.hostId,item.itemid);
this.smartCheck.showEditModal(this.hostId,item.itemid,this.realName);
}
//添加or编辑监测点 之后
......
......@@ -48,7 +48,6 @@ export class GroupComponent implements OnInit {
this.checkedNumber = this.dataSet.filter(value => value.checked).length;
}
mouseAction(name: string, e: any): void {
console.log(name, e);
}
......
......@@ -76,7 +76,7 @@
<span *ngIf="data.status == 2">已结束</span>
</td>
<td class="handle text-center">
<span (click)="lookPlan(data.id)">查看</span>
<span (click)="lookPlan(data.id,data.title)">查看</span>
<span (click)="editPlan(data.id)">编辑</span>
<span (click)="deletePlan(data)">删除</span>
</td>
......
......@@ -90,8 +90,8 @@ export class InspectPlanComponent implements OnInit {
}
//查看计划
lookPlan(id){
this.smartLookPlan.showModal(id);
lookPlan(id,name){
this.smartLookPlan.showModal(id,name);
}
//删除计划
......
......@@ -17,7 +17,8 @@ export class LookPlanComponent implements OnInit {
ngOnInit() {
}
showModal(id){
showModal(id,name){
this.title = "计划:"+name;
this.isVisible = true;
this.workSer.findPlan(id).subscribe(
(res)=>{
......
......@@ -115,14 +115,20 @@
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="serviceid">参与人</nz-form-label>
<nz-form-control [nzSpan]="14">
<label nz-checkbox></label>
<button (click)="selectPerson1()" nz-button><span>选择</span></button>
<ng-container *ngFor="let item1 of participantsList;let i = index;">
<span>{{item1.username}}</span><span (click)="delete1(i)">X</span>
</ng-container>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="serviceid">负责人</nz-form-label>
<nz-form-control [nzSpan]="14">
<label nz-checkbox></label>
<button (click)="selectPerson2()" nz-button><span>选择</span></button>
<ng-container *ngFor="let item2 of principalsList;let i = index;">
<span>{{item2.username}}</span><span (click)="delete2(i)">X</span>
</ng-container>
</nz-form-control>
</nz-form-item>
......@@ -148,5 +154,5 @@
</div>
</form>
</nz-modal>
<smart-select-person #smartSelectPerson (done)="getUser($event)"></smart-select-person>
import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {Component, OnInit, ViewChild} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
import {SelectPersonComponent} from '../../../modal/select-person/select-person.component';
@Component({
selector: 'smart-plan-modal',
......@@ -9,6 +10,7 @@ import {NzMessageService, UploadFile} from 'ng-zorro-antd';
styles: []
})
export class PlanModalComponent implements OnInit {
@ViewChild('smartSelectPerson') smartSelectPerson: SelectPersonComponent;
planList;
planId;
......@@ -16,6 +18,10 @@ export class PlanModalComponent implements OnInit {
isVisiable = false;
validateForm: FormGroup;
fileList: UploadFile[] = [];
modalTitle;
participantsList; //参与人
principalsList; //负责人
constructor(private workSer: WorkService, private message: NzMessageService,
private fb: FormBuilder) {
......@@ -30,8 +36,8 @@ export class PlanModalComponent implements OnInit {
this.validateForm = this.fb.group({
title: [null],
typeId: [null],
startTime: [null],
endTime: [null],
startTime: [null, [Validators.required]],
endTime: [null, [Validators.required]],
cycleType: [null],
cycleNum: [null],
number: [null],
......@@ -85,7 +91,7 @@ export class PlanModalComponent implements OnInit {
if (this.title == '添加计划') {
this.create();
}
if (this.title = '编辑计划') {
if (this.title == '编辑计划') {
this.update();
}
}
......@@ -116,7 +122,7 @@ export class PlanModalComponent implements OnInit {
});
formData.append('json', JSON.stringify(this.validateForm.value));
formData.append('id', this.planId);
this.workSer.createPlan(formData).subscribe(
this.workSer.updatePlan(formData).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success('修改计划成功');
......@@ -133,4 +139,40 @@ export class PlanModalComponent implements OnInit {
this.isVisiable = false;
}
selectPerson1() {
this.modalTitle = '选择参与人';
this.smartSelectPerson.showModal(this.modalTitle);
}
selectPerson2() {
this.modalTitle = '选择负责人';
this.smartSelectPerson.showModal(this.modalTitle);
}
getUser(e) {
const arr = [];
e.forEach(res=>{
const data = {
username :res.name,
userId : res.id
}
arr.push(data);
})
if (this.modalTitle == '选择参与人') {
this.participantsList = arr;
}
if (this.modalTitle == '选择负责人') {
this.principalsList = arr;
}
}
//删除参与人
delete1(index){
this.participantsList.splice(index,1)
}
//删除负责人
delete2(index){
this.principalsList.splice(index,1)
}
}
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