diff options
author | 2021-03-08 18:34:19 +0800 | |
---|---|---|
committer | 2021-03-09 03:14:04 +0000 | |
commit | fe0373c48edc239b3c69a923be17d1d4dc34143f (patch) | |
tree | 256e446b9742f250ab5dccd37586eaff2d9e3b83 /usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts | |
parent | 081feab4ae091216a274052ffe0c7f8dbe2f80e2 (diff) |
feat:commit UUI front end code
Change-Id: I4cf28e3b9e6f3ea44b52f028f5dfd70fbf650853
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Issue-ID: USECASEUI-525
Diffstat (limited to 'usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts new file mode 100644 index 00000000..3196bbba --- /dev/null +++ b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts @@ -0,0 +1,101 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { Util } from '../../../../../shared/utils/utils'; +import { onboardService } from '../../../../../core/services/onboard.service'; +import { Recorder } from '../../../../../shared/utils/recorder'; + +@Component({ + selector: 'app-input-business-order', + templateUrl: './input-business-order.component.html', + styleUrls: ['./input-business-order.component.less'] +}) +export class InputBusinessOrderComponent implements OnInit { + + constructor(private Util: Util, private Recorder: Recorder, private myhttp: onboardService) { } + + @Input() showModel: boolean; + @Output() modalOpreation = new EventEmitter(); + isSpinning: boolean = false; + communicationMessage: String = ""; + validateRulesShow: any[] = []; + rulesText: any[] = []; + radioValue: String = 'text'; + isPlay: boolean = false; + clickRepeat: boolean = false; + + ngOnInit() { + this.validateRulesShow = []; + this.rulesText = []; + this.communicationMessage = ''; + } + + ngOnChange() { + } + + handleCancel(): void { + this.showModel = false; + this.communicationMessage = ""; + this.modalOpreation.emit({ "cancel": true }); + } + + handleOk(): void { + if (this.clickRepeat) { + return; + } + this.clickRepeat = true; + if (this.radioValue === "text") { + this.submitFormMessage(); + return; + } + this.clickRepeat = false; + this.communicationMessage = ""; + this.showModel = false; + let defaultParams = { + coverageArea: "Beijing Beijing Haiding Wanshoulu", + expDataRateDL: "1000", + expDataRateUL: "1000", + latency: "10", + maxNumberofUEs: "10", + name: "exclusive slicing service", + resourceSharingLevel: "shared", + uEMobilityLevel: "stationary" + } + this.modalOpreation.emit({ "cancel": false, "param": defaultParams }); + } + submitFormMessage(): void { + this.Util.validator("communicationMessage", "communicationMessage", this.communicationMessage, 0, this.rulesText, this.validateRulesShow); + if (this.validateRulesShow.indexOf(true) > -1) { + this.clickRepeat = false; + return + } + let params = { + "title": "predict", + "text": this.communicationMessage + }; + this.myhttp["analysisInputText"](params) + .subscribe((data) => { + this.clickRepeat = false; + if (data === 0) { + return; + } + let orderForm = { ...data }; + this.communicationMessage = ""; + this.showModel = false; + this.modalOpreation.emit({ "cancel": false, "param": orderForm }); + }, (err) => { + this.clickRepeat = false; + console.log(err); + }) + } + startAudio(): void { + this.isPlay = true; + this.Recorder.beforeStartRecord(); + } + stopAudio(): void { + this.isPlay = false; + this.Recorder.stopRecord(); + } + playAudio(): void { + let audio = document.querySelector('audio'); + audio["src"] = this.Recorder.playRecord(); + } +} |