diff options
author | 2022-09-08 15:32:27 +0800 | |
---|---|---|
committer | 2022-09-08 15:32:27 +0800 | |
commit | 7bdeb7cc89a8d60e4c3199f1922a6bf73a9d83c1 (patch) | |
tree | bfa45c3c2e02f3f07d760065654d5c3af7ae52c2 /usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts | |
parent | a6d5ef22e8874a33fbee58ec6813be4299b04d67 (diff) |
Intent analysis frontend
Issue-ID: USECASEUI-711
Signed-off-by: zoulingli128 <zll_1208@126.com>
Change-Id: I8f8636f6b47c5ba25e6f342c484fd8ffb5ed1d6d
Diffstat (limited to 'usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts new file mode 100644 index 00000000..5686b4f3 --- /dev/null +++ b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts @@ -0,0 +1,94 @@ +import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { Util } from '../../../shared/utils/utils'; + +@Component({ + selector: 'app-input-intent-state', + templateUrl: './input-intent-state.component.html', + styleUrls: ['../intent-management.component.less'] +}) +export class InputIntentStateComponent implements OnInit { + + constructor( + private Util: Util + ) { } + + currentIndex:number = -1; + listOfData: any[] = []; + intentConditionShow: boolean = false; + editConditionTableList: Object={}; + + ngOnInit() { + this.operatorList = [ + { label:'EQUALTO', value:'EQUALTO'}, + { label:'LARGETHAN', value:'LARGETHAN'}, + { label:'LESSTHAN', value:'LESSTHAN'} + ] + this.conditionType = 'value' + } + @Input() showModel: boolean; + @Output() modalOpreation = new EventEmitter(); + @Input() editTargetTableData; + + defaultParams:Object={ + targetId:'', + targetName:'', + targetConditions:[] + }; + + operatorList: any[] = []; + conditionType: string; + + ngOnChanges() { + if (this.showModel) { + if (JSON.stringify(this.editTargetTableData)!=='{}') { + this.defaultParams=this.editTargetTableData + } + } + } + handleCancel(): void { + this.modalOpreation.emit({ "cancel": true }); + this.clearTargetConditionData() + } + handleOk(): void { + if(JSON.stringify(this.editTargetTableData)==='{}'){ + this.defaultParams['targetId']=this.Util.getUuid() + } + this.modalOpreation.emit({ "cancel": false, "param": this.defaultParams }); + this.clearTargetConditionData() + } + inputTargetConditionShow(): void { + this.intentConditionShow = true; + } + inputIntentConditionClose($event: any): void { + this.intentConditionShow = false; + this.editConditionTableList={} + 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['targetConditions']=this.listOfData + } + editConditionList(data,i): void { + this.editConditionTableList=JSON.parse(JSON.stringify(data)) + this.currentIndex=i + this.intentConditionShow = true + } + deleteConditionList(i): void{ + this.listOfData.splice(i,1) + } + clearTargetConditionData(): void{ + this.showModel = false; + this.defaultParams = { + targetId:'', + targetName:'', + targetConditions:[] + }; + this.listOfData=[] + } + +} |