diff options
author | cyuamber <xuranyjy@chinamobile.com> | 2020-02-13 20:44:33 +0800 |
---|---|---|
committer | cyuamber <xuranyjy@chinamobile.com> | 2020-02-13 20:44:39 +0800 |
commit | c63489b9bb2071abc8180af4e53c2dcb143c127d (patch) | |
tree | bb7730cb155f693e3f5b719adeec72c708ac685d /usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts | |
parent | 3db71a09cb73e24eda6d36f39df2e35f123f290b (diff) |
feat:Optimize code for slice ordering and business code of csmf slicing
Change-Id: I62a00ed407796434239c2089788ac47330e1c0d8
Issue-ID: USECASEUI-368
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts index f31f4dd1..7fc95e41 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts @@ -2,7 +2,6 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {COMMUNICATION_FORM_ITEMS, COMMUNICATION_FORM_ADDRESS} from "../../../../../../constants/constants"; import {SlicingTaskServices} from "../../../../../core/services/slicingTaskServices"; import {NzMessageService} from "ng-zorro-antd"; - @Component({ selector: 'app-business-order', templateUrl: './business-order.component.html', @@ -31,12 +30,14 @@ export class BusinessOrderComponent implements OnInit { latency: null, expDataRateUL: null, resourceSharingLevel: "shared", - uEMobilityLevel: null, + uEMobilityLevel: "stationary", useInterval: null, coverageArea: '' }; areaList: any[] = []; isSpinning: boolean = false; + validateRules: any[] = []; + rulesText: any[] = []; AreaFormatting() { let areaList = ['Beijing;Beijing;Haidian District;Wanshoulu Street']; this.areaList = areaList.map((item: any) => { @@ -148,7 +149,68 @@ export class BusinessOrderComponent implements OnInit { this.cancel.emit(this.showModel) } + getRulesText = (words,title,val,index) => { + return this.rulesText[index] = words + title + }; + + validator(key,val,i){ + if(val === null || val.replace(/\s*/g,'').length<=0){ + this.validateRules[i] = true; + this.getRulesText('Please enter',key,val,i); + return false + }else { + this.validateRules[i] = false; + }if(key === 'maxNumberofUEs' && !/^([1-9]\d{0,4}|100000)$/.test(val) && isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Only numbers can be entered','','',i); + return false + }else if(key === 'maxNumberofUEs' && !/^([1-9]\d{0,4}|100000)$/.test(val) && !isNaN(val)){ + console.log("-----maxNumberofUEs") + this.validateRules[i] = true; + this.getRulesText('Scope: 1-100000','','',i); + return false + }else { + this.validateRules[i] = false; + }if((key === 'expDataRateDL' || key === 'expDataRateUL') && !/^([1-9]\d{2}|[1-3]\d{3}|3000)$/.test(val) && isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Only numbers can be entered','','',i); + return false + }else if((key === 'expDataRateDL' || key === 'expDataRateUL') && !/^([1-9]\d{2}|[1-3]\d{3}|3000)$/.test(val) && !isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Scope: 100-3000','','',i); + return false + }else { + this.validateRules[i] = false; + }if(key === 'latency' && !/^1[0-9]$|^[2-9]\d$|^1\d{2}$|^200$/.test(val) && isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Only numbers can be entered','','',i); + return false + }else if(key === 'latency' && !/^1[0-9]$|^[2-9]\d$|^1\d{2}$|^200$/.test(val) && !isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Scope: 10-200','','',i); + return false + }else { + this.validateRules[i] = false; + }if(key === 'useInterval' && !/^[1-9]\d*$/.test(val) && isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Only numbers can be entered','','',i); + return false + }else if(key === 'useInterval' && !/^[1-9]\d*$/.test(val) && !isNaN(val)){ + this.validateRules[i] = true; + this.getRulesText('Scope: >=1','','',i); + return false + }else { + this.validateRules[i] = false; + } + } + handleOk(): void { + Object.keys(this.slicing_order_info).forEach((item,index)=>{ + this.validator(item,this.slicing_order_info[item],index) + }); + if(this.validateRules.indexOf(true)>-1){ + return + }; const coverage_list: string[] = []; this.areaList.forEach( item => { let str: string = ''; |