Skip to content

Commit 075bd41

Browse files
committed
2 parents 05cd11a + b59825e commit 075bd41

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

eFormAPI/eFormAPI/Controllers/EntitySelectController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ public OperationDataResult<EntityGroup> GetEntityGroup(string entityGroupUid)
101101

102102
[HttpGet]
103103
[Route("api/selectable-groups/dict/{entityGroupUid}")]
104-
public OperationDataResult<List<CommonDictionaryTextModel>> GetEntityGroupDictionary(string entityGroupUid, string searchString)
104+
public OperationDataResult<List<CommonDictionaryTextModel>> GetEntityGroupDictionary(string entityGroupUid)
105105
{
106106
try
107107
{
108108
var core = _coreHelper.GetCore();
109109

110-
var entityGroup = core.EntityGroupRead(entityGroupUid, null, searchString);
110+
var entityGroup = core.EntityGroupRead(entityGroupUid);
111111

112112
var mappedEntityGroupDict = new List<CommonDictionaryTextModel>();
113113

eFormAPI/eFormAPI/Infrastructure/Helpers/CaseUpdateHelper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ public static List<string> GetFieldValuesByRequestField(CaseEditRequestField edi
107107
list.Add(val);
108108
}
109109
break;
110+
case "EntitySelect":
111+
var entitySelect = editRequestField?.FieldValues?.First();
112+
if (entitySelect?.Value != null && entitySelect?.FieldId != null)
113+
{
114+
string val = $"{entitySelect.FieldId}|{entitySelect.Value.ToString()}";
115+
list.Add(val);
116+
}
117+
break;
110118
case "MultiSelect":
111119
var multiFirst = editRequestField?.FieldValues?.First();
112120
if (multiFirst?.Value != null && multiFirst?.FieldId != null)

eform-client/src/app/modules/cases/components/case-edit-switch/case-edit-switch.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<element-entitysearch [(fieldValue)]="dataItem.fieldValues[0]" [entityGroupUid]="dataItem.entityGroupId"></element-entitysearch>
5555
</div>
5656
<div *ngSwitchCase="'EntitySelect'">
57-
<element-entityselect [(fieldValue)]="dataItem.fieldValues[0]"></element-entityselect>
57+
<element-entityselect [(fieldValue)]="dataItem.fieldValues[0]" [entityGroupUid]="dataItem.entityGroupId"></element-entityselect>
5858
</div>
5959
<div *ngSwitchDefault></div>
6060
</div>
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
22
import {CaseFieldValue, CommonDictionaryTextModel} from 'app/models';
3-
import {ISubscription} from 'rxjs/Subscription';
3+
import {EntitySearchService, EntitySelectService} from 'app/services';
44
import {FormControl} from '@angular/forms';
5+
import {ISubscription} from 'rxjs/Subscription';
56

67
@Component({
78
selector: 'element-entityselect',
@@ -11,9 +12,11 @@ import {FormControl} from '@angular/forms';
1112
export class ElementEntityselectComponent implements OnInit, OnDestroy {
1213
sub: ISubscription;
1314
selectControl = new FormControl();
14-
fieldValueObj: CaseFieldValue = new CaseFieldValue();
1515
items: Array<CommonDictionaryTextModel> = [];
1616

17+
fieldValueObj: CaseFieldValue = new CaseFieldValue();
18+
@Input() entityGroupUid: string;
19+
1720
@Input()
1821
get fieldValue() {
1922
return this.fieldValueObj;
@@ -23,14 +26,17 @@ export class ElementEntityselectComponent implements OnInit, OnDestroy {
2326
this.fieldValueObj = val;
2427
}
2528

26-
constructor() {
29+
constructor(private entitySelectService: EntitySelectService) {
2730
}
2831

2932
ngOnInit() {
3033
this.sub = this.selectControl.valueChanges.subscribe(value => this.onSelectedChanged(value));
31-
for (const keyValuePair of this.fieldValueObj.keyValuePairList) {
32-
this.items.push({id: keyValuePair.key, text: keyValuePair.value});
33-
}
34+
35+
this.entitySelectService.getEntitySelectableGroupDictionary(this.entityGroupUid).subscribe((operation => {
36+
if (operation && operation.success) {
37+
this.items = operation.model;
38+
}
39+
}));
3440
}
3541

3642
ngOnDestroy(): void {
@@ -40,5 +46,4 @@ export class ElementEntityselectComponent implements OnInit, OnDestroy {
4046
onSelectedChanged(value: string) {
4147
this.fieldValue.value = value;
4248
}
43-
4449
}

eform-client/src/app/services/entity-select.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export class EntitySelectService extends BaseService {
4141
return this.postModelOperationResult<AdvEntitySelectableGroupEditModel>(AdvSelectableEntityMethods.CreateSingle, model);
4242
}
4343

44-
public getEntitySelectableGroupDictionary = (entityGroupUid: string, searchString: string):
44+
public getEntitySelectableGroupDictionary = (entityGroupUid: string):
4545
Observable<OperationDataResult<Array<CommonDictionaryTextModel>>> => {
4646
return this.getWithOperationDataResult<Array<CommonDictionaryTextModel>>(AdvSelectableEntityMethods.GetAll + '/dict/'
47-
+ entityGroupUid + '?searchString=' + searchString);
47+
+ entityGroupUid);
4848
}
4949
}
5050

0 commit comments

Comments
 (0)