diff options
author | 2019-12-05 14:33:09 +0800 | |
---|---|---|
committer | 2019-12-05 14:33:21 +0800 | |
commit | 6077654ad074c2c07acf1434dfdec2fc5abd17d9 (patch) | |
tree | c458499190421a64587ff81df6b5f521e378c0a9 /usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts | |
parent | 19b190ce4d1042c769b93c50882b91e748af061d (diff) |
feat: Completed the submit function in the task processing dialog
Change-Id: I2ab002ce9876687921684f4834908701d98b0d1e
Issue-ID: USECASEUI-352
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts | 88 |
1 files changed, 83 insertions, 5 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts index 1a3a194e..92c50d15 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { WIRELESS_FORM_ITEMS, TRANSFRER_FORM_ITEMS, CORE_FORM_ITEMS } from '../.../../../../../../../../constants/constants' +import { WIRELESS_FORM_ITEMS, TRANSFRER_FORM_ITEMS, CORE_FORM_ITEMS, ADDRESS } from '../.../../../../../../../../constants/constants' @Component({ selector: 'app-subnet-params-model', @@ -12,6 +12,7 @@ export class SubnetParamsModelComponent implements OnInit { @Input() detailData: any; @Input() title: string; @Output() cancel = new EventEmitter<boolean>(); + @Output() paramsDataChange = new EventEmitter<any>(); transferFormItems = TRANSFRER_FORM_ITEMS; coreFormItems = CORE_FORM_ITEMS; @@ -32,8 +33,17 @@ export class SubnetParamsModelComponent implements OnInit { let areaList = [...this.detailData.an_coverage_area_ta_list]; this.areaList = areaList.map ( (item: any) => { let arr = item.split(';'); - item = arr.map( ite => { - let obj: any = {}; + item = arr.map( (ite, index) => { + let key: string; + if (!index) { + key = 'province'; + } else if (index === 1){ + key = 'city' + } else { + key = 'district' + } + const obj: any = {}; + obj.key = key; obj.selected = ite obj.options = [{name: ite, id: ite}] return obj @@ -42,8 +52,61 @@ export class SubnetParamsModelComponent implements OnInit { }) } - creatAreaList () { - + creatAreaList (): void { + let arr = [ + { + key: 'province', + selected: '', + options: [] + }, + { + key: 'city', + selected: '', + options: [] + }, + { + key: 'district', + selected: '', + options: [] + } + ] + this.areaList.push(arr) + } + + deleteAreaList (index: number): void { + this.areaList.splice(index,1); + } + + handleChange(area: any[], areaItem: any): void{ + if (areaItem.key === 'province' && areaItem.options.length <= 1) { + areaItem.options = ADDRESS; + } else if (areaItem.key === 'city' && areaItem.options.length <= 1) { + ADDRESS.forEach( item => { + if(item.name === area[0].selected) { + areaItem.options = item.city; + } + }) + }else if (areaItem.key === 'district' && areaItem.options.length <= 1) { + ADDRESS.forEach( (item: any) => { + item.city.forEach(city => { + if (city.name === area[1].selected) { + areaItem.options = city.county; + } + }) + }) + } + } + + handleChangeSelected(area: any[], areaItem: any) { + if (areaItem.key === 'province') { + area[1].selected = '' + area[1].options = []; + area[2].selected = ''; + area[2].options = []; + } else if (areaItem.key === 'city') { + area[2].selected = ''; + area[2].options = []; + } } handleCancel() { @@ -52,6 +115,21 @@ export class SubnetParamsModelComponent implements OnInit { } handleOk(): void { + let params: object; + if (this.title === '无线域') { + const an_coverage_area_ta_list: string[] = []; + this.areaList.forEach( item => { + let str: string = ''; + item.forEach( area => { + str += area.selected + ';'; + }) + an_coverage_area_ta_list.push(str.substring(0, str.length-1)); + }) + params = {...this.detailData, an_coverage_area_ta_list} + } else { + params = {...this.detailData} + } + this.paramsDataChange.emit(params) this.handleCancel() } |