Skip to content

Commit b59825e

Browse files
authored
Merge pull request #85 from Gid733/master
Fixed entity-select behavior
2 parents b1518a5 + f5b0cde commit b59825e

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
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

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-entitysearch [(fieldValue)]="dataItem.fieldValues[0]" [entityGroupUid]="dataItem.entityGroupId"></element-entitysearch>
57+
<element-entityselect [(fieldValue)]="dataItem.fieldValues[0]" [entityGroupUid]="dataItem.entityGroupId"></element-entityselect>
5858
</div>
5959
<div *ngSwitchDefault></div>
6060
</div>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<ngx-select [items]="items"
2-
(typed)="onSelectInputChanged($event)"
32
[formControl]="selectControl"
43
[placeholder]="fieldValueObj.valueReadable">

eform-client/src/app/modules/cases/components/case-elements/element-entityselect/element-entityselect.component.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
22
import {CaseFieldValue, CommonDictionaryTextModel} from 'app/models';
3-
import {EntitySearchService} from 'app/services';
3+
import {EntitySearchService, EntitySelectService} from 'app/services';
44
import {FormControl} from '@angular/forms';
55
import {ISubscription} from 'rxjs/Subscription';
66

@@ -26,27 +26,23 @@ export class ElementEntityselectComponent implements OnInit, OnDestroy {
2626
this.fieldValueObj = val;
2727
}
2828

29-
constructor(private entitySearchService: EntitySearchService) {
29+
constructor(private entitySelectService: EntitySelectService) {
3030
}
3131

3232
ngOnInit() {
3333
this.sub = this.selectControl.valueChanges.subscribe(value => this.onSelectedChanged(value));
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 {
3743
this.sub.unsubscribe();
3844
}
3945

40-
onSelectInputChanged(searchString: string) {
41-
if (searchString.length > 2) {
42-
this.entitySearchService.getEntitySearchableGroupDictionary(this.entityGroupUid, searchString).subscribe((operation => {
43-
if (operation && operation.success) {
44-
this.items = operation.model;
45-
}
46-
}));
47-
}
48-
}
49-
5046
onSelectedChanged(value: string) {
5147
this.fieldValue.value = value;
5248
}

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)