1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Util } from '../../../shared/utils/utils';
@Component({
selector: 'app-input-intent-expectation',
templateUrl: './input-intent-expectation.component.html',
styleUrls: ['../intent-management.component.less']
})
export class InputIntentExpectationComponent implements OnInit {
constructor(
private Util: Util
) { }
@Input() showModel: boolean;
@Output() modalOpreation = new EventEmitter();
@Input() editExpectationTableData;
defaultParams:Object={
expectationId:'',
expectationName:'',
expectationType:'DELIVERY',
expectationObject:{
objectType:'CCVPN',
objectInstance:'',
},
expectationTargets:[]
};
currentIndex:number = -1;
listOfData: any[] = [];
intentTargetShow: boolean = false;
editTargetTableList: Object={};
expectationTypeList: any[] = [];
expectationObjectTypeList: any[] = [];
ngOnInit() {
this.expectationTypeList = [
{ label:'DELIVERY', value:'DELIVERY' },
{ label:'ASSURANCE', value:'ASSURANCE' }
]
this.expectationObjectTypeList = [
{ label:'CCVPN', value:'CCVPN' },
{ label:'SLICING', value:'SLICING' }
]
}
ngOnChanges() {
if (this.showModel) {
if (JSON.stringify(this.editExpectationTableData)!=='{}') {
this.defaultParams=this.editExpectationTableData
this.listOfData=this.defaultParams['expectationTargets']
}
}
}
handleCancel(): void {
this.modalOpreation.emit({ "cancel": true });
this.clearExpectationData()
}
handleOk(): void {
if(JSON.stringify(this.editExpectationTableData)==='{}'){
this.defaultParams['expectationId']=this.Util.getUuid()
}
this.modalOpreation.emit({ "cancel": false, "param": this.defaultParams });
this.clearExpectationData()
}
editTargetList(data,i): void {
this.editTargetTableList=JSON.parse(JSON.stringify(data))
this.currentIndex=i
this.intentTargetShow = true
}
deleteTargetList(i): void{
this.listOfData.splice(i,1)
}
clearExpectationData(): void{
this.showModel = false;
this.defaultParams = {
expectationId:'',
expectationName:'',
expectationType:'DELIVERY',
expectationObject:{
objectType:'CCVPN',
objectInstance:'',
},
expectationTargets:[]
};
this.listOfData=[]
}
inputIntentTargetShow(): void {
this.intentTargetShow = true;
}
inputIntentStateClose($event: any): void {
this.intentTargetShow = false;
this.editTargetTableList={}
if ($event.cancel) {
return;
}
if(this.currentIndex>-1){
this.listOfData[this.currentIndex]=$event.param
this.currentIndex=-1
}else{
this.listOfData.push($event.param)
}
this.defaultParams['expectationTargets']=this.listOfData
}
}
|