Платформа 3V/Формы/Источники данных/Справочник/Фильтрация/От другого справочника: различия между версиями
< Платформа 3V | Формы | Источники данных | Справочник | Фильтрация
Перейти к навигации
Перейти к поиску
Строка 38: | Строка 38: | ||
|- | |- | ||
| conditionId || [[Платформа_3V/Формы/Правила| '''Условия''']], при которых применяется фильтр | | conditionId || [[Платформа_3V/Формы/Правила| '''Условия''']], при которых применяется фильтр | ||
− | | | + | |} |
− | + | == Пример: == | |
+ | Справочник "Контрагенты" содержит связный атрибут "Виды контрагентов". Можно создать клиентскую карточку в которой, при выборе из выпадающего списка "Вида контрагентов", элементы следующего выпадающего списка "Контрагенты" будут соответствовать ему. | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="width:800px; overflow:auto;"> | ||
+ | <div style="font-weight:bold;line-height:1.6;">JSON серверной карточки</div> | ||
+ | <div class="mw-collapsible-content mw-collapsed-content"> | ||
+ | <syntaxhighlight lang="JSON" line> | ||
+ | { | ||
+ | "id": 10735, | ||
+ | "name": "Пример фильтра от справочника (EntryFilterDto)", | ||
+ | "description": null, | ||
+ | "title": "Пример фильтрации_справочник от справочника", | ||
+ | "entrySettings": null, | ||
+ | "uiSources": [ | ||
+ | { | ||
+ | "actionConfirmation": { | ||
+ | "message": null, | ||
+ | "conditionId": null | ||
+ | }, | ||
+ | "controlsValueCalculateRulesIds": [], | ||
+ | "conditionalActions": [], | ||
+ | "onBeforeClickConditionalActions": [], | ||
+ | "submitRuleIds": [], | ||
+ | "id": 100, | ||
+ | "caption": "Сохранить", | ||
+ | "enable": true, | ||
+ | "visible": true, | ||
+ | "hint": null, | ||
+ | "uiDataSource": null, | ||
+ | "doActionOnChangeValue": true, | ||
+ | "onAfterChangeValueConditionalActions": null, | ||
+ | "onAfterChangeValueByClientConditionalActions": null, | ||
+ | "rebuildDependentsObjectOnChange": false, | ||
+ | "enableRuleIds": [], | ||
+ | "visibleRuleIds": [], | ||
+ | "access": null, | ||
+ | "isValueChanged": false, | ||
+ | "expressionId": null, | ||
+ | "discriminator": "ButtonSubmitSourceEntry" | ||
+ | }, | ||
+ | { | ||
+ | "dataSourceId": 2, | ||
+ | "nameTemplate": "", | ||
+ | "displayAttribute": null, | ||
+ | "hasMultipleValue": false, | ||
+ | "hasNullableValue": false, | ||
+ | "maxElements": null, | ||
+ | "hasServerFiltration": false, | ||
+ | "searchSettings": { | ||
+ | "maxElements": null, | ||
+ | "minInputChars": 2, | ||
+ | "searchMode": "Client", | ||
+ | "debounceMs": 300 | ||
+ | }, | ||
+ | "id": 1, | ||
+ | "caption": "Вид контрагента", | ||
+ | "enable": true, | ||
+ | "visible": true, | ||
+ | "hint": null, | ||
+ | "uiDataSource": { | ||
+ | "attribute": { | ||
+ | "id": 21, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "attributeId": null, | ||
+ | "sourceId": 1, | ||
+ | "discriminator": "UiDataSourceDictionary" | ||
+ | }, | ||
+ | "doActionOnChangeValue": true, | ||
+ | "onAfterChangeValueConditionalActions": null, | ||
+ | "onAfterChangeValueByClientConditionalActions": null, | ||
+ | "rebuildDependentsObjectOnChange": true, | ||
+ | "enableRuleIds": [], | ||
+ | "visibleRuleIds": [], | ||
+ | "access": null, | ||
+ | "isValueChanged": true, | ||
+ | "expressionId": null, | ||
+ | "discriminator": "DictionarySourceEntry" | ||
+ | }, | ||
+ | { | ||
+ | "dataSourceId": 3, | ||
+ | "nameTemplate": "", | ||
+ | "displayAttribute": null, | ||
+ | "hasMultipleValue": false, | ||
+ | "hasNullableValue": false, | ||
+ | "maxElements": null, | ||
+ | "hasServerFiltration": false, | ||
+ | "searchSettings": { | ||
+ | "maxElements": null, | ||
+ | "minInputChars": 2, | ||
+ | "searchMode": "Client", | ||
+ | "debounceMs": 300 | ||
+ | }, | ||
+ | "id": 2, | ||
+ | "caption": "Контрагенты", | ||
+ | "enable": true, | ||
+ | "visible": true, | ||
+ | "hint": null, | ||
+ | "doActionOnChangeValue": false, | ||
+ | "onAfterChangeValueConditionalActions": null, | ||
+ | "onAfterChangeValueByClientConditionalActions": null, | ||
+ | "rebuildDependentsObjectOnChange": true, | ||
+ | "enableRuleIds": [], | ||
+ | "visibleRuleIds": [], | ||
+ | "access": null, | ||
+ | "isValueChanged": false, | ||
+ | "expressionId": null, | ||
+ | "discriminator": "DictionarySourceEntry" | ||
+ | }, | ||
+ | { | ||
+ | "trimSpaces": false, | ||
+ | "defaultValue": null, | ||
+ | "value": null, | ||
+ | "id": 4, | ||
+ | "caption": "Технический", | ||
+ | "enable": true, | ||
+ | "visible": true, | ||
+ | "hint": null, | ||
+ | "uiDataSource": { | ||
+ | "attribute": { | ||
+ | "id": 2, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "attributeId": null, | ||
+ | "sourceId": 1, | ||
+ | "discriminator": "UiDataSourceDictionary" | ||
+ | }, | ||
+ | "doActionOnChangeValue": true, | ||
+ | "onAfterChangeValueConditionalActions": null, | ||
+ | "onAfterChangeValueByClientConditionalActions": null, | ||
+ | "rebuildDependentsObjectOnChange": false, | ||
+ | "enableRuleIds": [], | ||
+ | "visibleRuleIds": [], | ||
+ | "access": null, | ||
+ | "isValueChanged": false, | ||
+ | "expressionId": 1, | ||
+ | "discriminator": "StringSourceEntry" | ||
+ | } | ||
+ | ], | ||
+ | "entryDataSources": [ | ||
+ | { | ||
+ | "dictionaryId": 10736, | ||
+ | "hierarchyId": null, | ||
+ | "filter": null, | ||
+ | "sortingOptions": null, | ||
+ | "groupingOptions": null, | ||
+ | "dictionaryAttributes": null, | ||
+ | "defaultValue": [], | ||
+ | "defaultValueExpressionId": null, | ||
+ | "parameterId": null, | ||
+ | "dictionarySourceSelectionMode": "None", | ||
+ | "dataSourceAttributesAdditionsSettings": [], | ||
+ | "externalFileStorageUrl": null, | ||
+ | "filePrefix": null, | ||
+ | "defaultNewElementSettings": null, | ||
+ | "id": 1, | ||
+ | "name": "Справочник. Пример фильтра от справочника", | ||
+ | "isReadOnly": false, | ||
+ | "dataEditRuleIds": [], | ||
+ | "beforeSaveDataActions": [], | ||
+ | "afterSaveDataActions": [], | ||
+ | "discriminator": "DictionaryDataSource" | ||
+ | }, | ||
+ | { | ||
+ | "dictionaryId": 10754, | ||
+ | "hierarchyId": null, | ||
+ | "filter": null, | ||
+ | "sortingOptions": null, | ||
+ | "groupingOptions": null, | ||
+ | "dictionaryAttributes": null, | ||
+ | "defaultValue": [], | ||
+ | "defaultValueExpressionId": null, | ||
+ | "parameterId": null, | ||
+ | "dictionarySourceSelectionMode": "None", | ||
+ | "dataSourceAttributesAdditionsSettings": [], | ||
+ | "externalFileStorageUrl": null, | ||
+ | "filePrefix": null, | ||
+ | "defaultNewElementSettings": null, | ||
+ | "id": 2, | ||
+ | "name": "Вид контрагента", | ||
+ | "isReadOnly": true, | ||
+ | "dataEditRuleIds": [], | ||
+ | "beforeSaveDataActions": [], | ||
+ | "afterSaveDataActions": [], | ||
+ | "discriminator": "DictionaryDataSource" | ||
+ | }, | ||
+ | { | ||
+ | "dictionaryId": 10755, | ||
+ | "hierarchyId": null, | ||
+ | "filter": { | ||
+ | "dictionaryEntrySourceId": 2, | ||
+ | "sourceAttribute": { | ||
+ | "id": 1, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "attribute": { | ||
+ | "id": 21, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "conditionType": "AttributeInCollection", | ||
+ | "inversion": false, | ||
+ | "conditionId": null, | ||
+ | "discriminator": "EntryFilterDto" | ||
+ | }, | ||
+ | "sortingOptions": null, | ||
+ | "groupingOptions": null, | ||
+ | "dictionaryAttributes": [], | ||
+ | "defaultValue": [], | ||
+ | "defaultValueExpressionId": null, | ||
+ | "parameterId": null, | ||
+ | "dictionarySourceSelectionMode": "None", | ||
+ | "dataSourceAttributesAdditionsSettings": [], | ||
+ | "externalFileStorageUrl": null, | ||
+ | "filePrefix": null, | ||
+ | "defaultNewElementSettings": null, | ||
+ | "id": 3, | ||
+ | "name": "Контрагенты", | ||
+ | "isReadOnly": true, | ||
+ | "dataEditRuleIds": [], | ||
+ | "beforeSaveDataActions": [], | ||
+ | "afterSaveDataActions": [], | ||
+ | "discriminator": "DictionaryDataSource" | ||
+ | } | ||
+ | ], | ||
+ | "parameters": [], | ||
+ | "binaryConditionsRules": [], | ||
+ | "submitValidateRules": [], | ||
+ | "expressions": [ | ||
+ | { | ||
+ | "id": 1, | ||
+ | "expression": "[1]", | ||
+ | "returnFirstParameterValue": false, | ||
+ | "parameters": [ | ||
+ | { | ||
+ | "id": 1, | ||
+ | "allowMultipleValues": false, | ||
+ | "discriminator": "EntryExpressionDictionarySourceParameterDto", | ||
+ | "dictionarySourceId": 3, | ||
+ | "attributeId": 2, | ||
+ | "getFirstElementValue": false, | ||
+ | "useAllInstanceElements": false | ||
+ | } | ||
+ | ], | ||
+ | "comment": null | ||
+ | } | ||
+ | ], | ||
+ | "controlsValueCalculateRules": [], | ||
+ | "actions": [], | ||
+ | "conditionActionIdsOnOpen": [], | ||
+ | "conditionalActions": [], | ||
+ | "selectionSets": [], | ||
+ | "reportTemplates": [], | ||
+ | "useNewDependenciesBuilder": null | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | </div></div> |
Версия 14:32, 14 апреля 2021
СТРАНИЦА НАХОДИТСЯ В РАЗРАБОТКЕ
Фильтр EntryFilterDto позволяет выбрать данные в справочнике относительно другого связного справочника. Элементы одного справочника будут отображаться в зависимости от выбранных элементов другого справочника. Элемент "filter" добавляется в источник, который необходимо отфильтровать. Фильтр имеет следующую структуру:
1 "filter": {
2 "dictionaryEntrySourceId": 2,
3 "sourceAttribute": {
4 "id": 21,
5 "discriminator": "OwnAttributeDefinitionDto"
6 },
7 "attribute": {
8 "id": 1,
9 "discriminator": "OwnAttributeDefinitionDto"
10 },
11 "conditionType": "AttributeInCollection",
12 "inversion": false,
13 "conditionId": null,
14 "discriminator": "EntryFilterDto"
15 }
Описание свойств фильтра
Свойство | Описание |
---|---|
dictionaryEntrySourceId | Id источника - справочника, от значений которого будут фильтроваться данные |
sourceAttribute | Атрибут справочника, от значений которого будут фильтроваться данные |
attribute | Атрибут текущего источника, с которым связано значение справочника от которого идет фильтрация. Указывается номер Id и тип атрибута в данном случае собственный (OwnAttributeDefinitionDto), так как используются данные текущего справочника. |
discriminator | EntryFilterDto |
conditionType | Тип условий |
inversion | В значении "false" фильтр отберет удовлетворяющие ему значения, в значении "true" - все значения, которые наоборот не удовлетворяют ему |
conditionId | Условия, при которых применяется фильтр |
Пример:
Справочник "Контрагенты" содержит связный атрибут "Виды контрагентов". Можно создать клиентскую карточку в которой, при выборе из выпадающего списка "Вида контрагентов", элементы следующего выпадающего списка "Контрагенты" будут соответствовать ему.
JSON серверной карточки
1 {
2 "id": 10735,
3 "name": "Пример фильтра от справочника (EntryFilterDto)",
4 "description": null,
5 "title": "Пример фильтрации_справочник от справочника",
6 "entrySettings": null,
7 "uiSources": [
8 {
9 "actionConfirmation": {
10 "message": null,
11 "conditionId": null
12 },
13 "controlsValueCalculateRulesIds": [],
14 "conditionalActions": [],
15 "onBeforeClickConditionalActions": [],
16 "submitRuleIds": [],
17 "id": 100,
18 "caption": "Сохранить",
19 "enable": true,
20 "visible": true,
21 "hint": null,
22 "uiDataSource": null,
23 "doActionOnChangeValue": true,
24 "onAfterChangeValueConditionalActions": null,
25 "onAfterChangeValueByClientConditionalActions": null,
26 "rebuildDependentsObjectOnChange": false,
27 "enableRuleIds": [],
28 "visibleRuleIds": [],
29 "access": null,
30 "isValueChanged": false,
31 "expressionId": null,
32 "discriminator": "ButtonSubmitSourceEntry"
33 },
34 {
35 "dataSourceId": 2,
36 "nameTemplate": "",
37 "displayAttribute": null,
38 "hasMultipleValue": false,
39 "hasNullableValue": false,
40 "maxElements": null,
41 "hasServerFiltration": false,
42 "searchSettings": {
43 "maxElements": null,
44 "minInputChars": 2,
45 "searchMode": "Client",
46 "debounceMs": 300
47 },
48 "id": 1,
49 "caption": "Вид контрагента",
50 "enable": true,
51 "visible": true,
52 "hint": null,
53 "uiDataSource": {
54 "attribute": {
55 "id": 21,
56 "discriminator": "OwnAttributeDefinitionDto"
57 },
58 "attributeId": null,
59 "sourceId": 1,
60 "discriminator": "UiDataSourceDictionary"
61 },
62 "doActionOnChangeValue": true,
63 "onAfterChangeValueConditionalActions": null,
64 "onAfterChangeValueByClientConditionalActions": null,
65 "rebuildDependentsObjectOnChange": true,
66 "enableRuleIds": [],
67 "visibleRuleIds": [],
68 "access": null,
69 "isValueChanged": true,
70 "expressionId": null,
71 "discriminator": "DictionarySourceEntry"
72 },
73 {
74 "dataSourceId": 3,
75 "nameTemplate": "",
76 "displayAttribute": null,
77 "hasMultipleValue": false,
78 "hasNullableValue": false,
79 "maxElements": null,
80 "hasServerFiltration": false,
81 "searchSettings": {
82 "maxElements": null,
83 "minInputChars": 2,
84 "searchMode": "Client",
85 "debounceMs": 300
86 },
87 "id": 2,
88 "caption": "Контрагенты",
89 "enable": true,
90 "visible": true,
91 "hint": null,
92 "doActionOnChangeValue": false,
93 "onAfterChangeValueConditionalActions": null,
94 "onAfterChangeValueByClientConditionalActions": null,
95 "rebuildDependentsObjectOnChange": true,
96 "enableRuleIds": [],
97 "visibleRuleIds": [],
98 "access": null,
99 "isValueChanged": false,
100 "expressionId": null,
101 "discriminator": "DictionarySourceEntry"
102 },
103 {
104 "trimSpaces": false,
105 "defaultValue": null,
106 "value": null,
107 "id": 4,
108 "caption": "Технический",
109 "enable": true,
110 "visible": true,
111 "hint": null,
112 "uiDataSource": {
113 "attribute": {
114 "id": 2,
115 "discriminator": "OwnAttributeDefinitionDto"
116 },
117 "attributeId": null,
118 "sourceId": 1,
119 "discriminator": "UiDataSourceDictionary"
120 },
121 "doActionOnChangeValue": true,
122 "onAfterChangeValueConditionalActions": null,
123 "onAfterChangeValueByClientConditionalActions": null,
124 "rebuildDependentsObjectOnChange": false,
125 "enableRuleIds": [],
126 "visibleRuleIds": [],
127 "access": null,
128 "isValueChanged": false,
129 "expressionId": 1,
130 "discriminator": "StringSourceEntry"
131 }
132 ],
133 "entryDataSources": [
134 {
135 "dictionaryId": 10736,
136 "hierarchyId": null,
137 "filter": null,
138 "sortingOptions": null,
139 "groupingOptions": null,
140 "dictionaryAttributes": null,
141 "defaultValue": [],
142 "defaultValueExpressionId": null,
143 "parameterId": null,
144 "dictionarySourceSelectionMode": "None",
145 "dataSourceAttributesAdditionsSettings": [],
146 "externalFileStorageUrl": null,
147 "filePrefix": null,
148 "defaultNewElementSettings": null,
149 "id": 1,
150 "name": "Справочник. Пример фильтра от справочника",
151 "isReadOnly": false,
152 "dataEditRuleIds": [],
153 "beforeSaveDataActions": [],
154 "afterSaveDataActions": [],
155 "discriminator": "DictionaryDataSource"
156 },
157 {
158 "dictionaryId": 10754,
159 "hierarchyId": null,
160 "filter": null,
161 "sortingOptions": null,
162 "groupingOptions": null,
163 "dictionaryAttributes": null,
164 "defaultValue": [],
165 "defaultValueExpressionId": null,
166 "parameterId": null,
167 "dictionarySourceSelectionMode": "None",
168 "dataSourceAttributesAdditionsSettings": [],
169 "externalFileStorageUrl": null,
170 "filePrefix": null,
171 "defaultNewElementSettings": null,
172 "id": 2,
173 "name": "Вид контрагента",
174 "isReadOnly": true,
175 "dataEditRuleIds": [],
176 "beforeSaveDataActions": [],
177 "afterSaveDataActions": [],
178 "discriminator": "DictionaryDataSource"
179 },
180 {
181 "dictionaryId": 10755,
182 "hierarchyId": null,
183 "filter": {
184 "dictionaryEntrySourceId": 2,
185 "sourceAttribute": {
186 "id": 1,
187 "discriminator": "OwnAttributeDefinitionDto"
188 },
189 "attribute": {
190 "id": 21,
191 "discriminator": "OwnAttributeDefinitionDto"
192 },
193 "conditionType": "AttributeInCollection",
194 "inversion": false,
195 "conditionId": null,
196 "discriminator": "EntryFilterDto"
197 },
198 "sortingOptions": null,
199 "groupingOptions": null,
200 "dictionaryAttributes": [],
201 "defaultValue": [],
202 "defaultValueExpressionId": null,
203 "parameterId": null,
204 "dictionarySourceSelectionMode": "None",
205 "dataSourceAttributesAdditionsSettings": [],
206 "externalFileStorageUrl": null,
207 "filePrefix": null,
208 "defaultNewElementSettings": null,
209 "id": 3,
210 "name": "Контрагенты",
211 "isReadOnly": true,
212 "dataEditRuleIds": [],
213 "beforeSaveDataActions": [],
214 "afterSaveDataActions": [],
215 "discriminator": "DictionaryDataSource"
216 }
217 ],
218 "parameters": [],
219 "binaryConditionsRules": [],
220 "submitValidateRules": [],
221 "expressions": [
222 {
223 "id": 1,
224 "expression": "[1]",
225 "returnFirstParameterValue": false,
226 "parameters": [
227 {
228 "id": 1,
229 "allowMultipleValues": false,
230 "discriminator": "EntryExpressionDictionarySourceParameterDto",
231 "dictionarySourceId": 3,
232 "attributeId": 2,
233 "getFirstElementValue": false,
234 "useAllInstanceElements": false
235 }
236 ],
237 "comment": null
238 }
239 ],
240 "controlsValueCalculateRules": [],
241 "actions": [],
242 "conditionActionIdsOnOpen": [],
243 "conditionalActions": [],
244 "selectionSets": [],
245 "reportTemplates": [],
246 "useNewDependenciesBuilder": null
247 }