@@ -104,22 +104,26 @@ import store from '@/store'
104
104
105
105
// Components and Mixins
106
106
import useDisplayedColumn from ' @/components/ADempiere/FieldDefinition/useDisplayedColumn.js'
107
+ import LatitudeField from ' ./latitudeField.vue'
108
+ import LongitudeField from ' ./longitudeField.vue'
109
+ import AltitudeField from ' ./altitudeField.vue'
107
110
108
111
// Constants
109
- import { ATTRIBUTES_BY_CAPTURE } from ' @/utils/ADempiere/dictionary/field/locationAddress'
110
112
import {
113
+ DISPLAY_COLUMN_PREFIX ,
114
+ UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX
115
+ } from ' @/utils/ADempiere/dictionaryUtils'
116
+ import {
117
+ ATTRIBUTES_BY_CAPTURE ,
111
118
URL_BASE_MAP
112
119
} from ' @/utils/ADempiere/dictionary/field/locationAddress'
113
120
114
121
// Utils and Helper Methods
115
122
import { isEmptyValue , isIdentifierEmpty } from ' @/utils/ADempiere/valueUtils.js'
116
123
import { setDefaultComponentSequence } from ' @/utils/ADempiere/dictionary/field/locationAddress'
117
- import { formatCoordinateByDecimal , removeDecimals } from ' @/utils/ADempiere/dictionary/field/locationAddress'
118
-
119
- //
120
- import LatitudeField from ' ./latitudeField.vue'
121
- import LongitudeField from ' ./longitudeField.vue'
122
- import AltitudeField from ' ./altitudeField.vue'
124
+ import {
125
+ generateDisplayedValue , formatCoordinateByDecimal , removeDecimals
126
+ } from ' @/utils/ADempiere/dictionary/field/locationAddress'
123
127
124
128
export default defineComponent ({
125
129
name: ' LocationAddressForm' ,
@@ -129,6 +133,7 @@ export default defineComponent({
129
133
LongitudeField,
130
134
AltitudeField
131
135
},
136
+
132
137
props: {
133
138
containerManager: {
134
139
type: Object ,
@@ -139,8 +144,10 @@ export default defineComponent({
139
144
default : () => ({})
140
145
}
141
146
},
147
+
142
148
setup (props ) {
143
149
const { columnName , containerUuid , parentUuid } = props .metadata
150
+
144
151
function openCoordinatesMap () {
145
152
let baseUrlMap = URL_BASE_MAP
146
153
if (! isEmptyValue (coordinates .value )) {
@@ -271,6 +278,7 @@ export default defineComponent({
271
278
parentUuid,
272
279
columnName
273
280
})
281
+
274
282
if (isEmptyValue (id)) {
275
283
return store .dispatch (' newLocation' )
276
284
.then (response => {
@@ -309,14 +317,76 @@ export default defineComponent({
309
317
* set context values to parent continer
310
318
* @param {object} values
311
319
*/
312
- function setParentValues (rowData ) {
313
- displayedValue .value = rowData .display_value
320
+ function setParentValues (recordRow ) {
321
+ const { columnName , elementName , isSameColumnElement } = props .metadata
322
+ const { uuid , id } = recordRow
323
+ const displayValue = generateDisplayedValue (recordRow)
324
+ displayedValue .value = displayValue
325
+
326
+ store .commit (' updateValueOfField' , {
327
+ parentUuid,
328
+ containerUuid,
329
+ columnName,
330
+ value: id
331
+ })
332
+ // set display column (name) value
333
+ store .commit (' updateValueOfField' , {
334
+ parentUuid,
335
+ containerUuid,
336
+ // DisplayColumn_'ColumnName'
337
+ columnName: DISPLAY_COLUMN_PREFIX + columnName,
338
+ value: displayValue
339
+ })
340
+ // set UUID value
341
+ store .commit (' updateValueOfField' , {
342
+ parentUuid,
343
+ containerUuid,
344
+ columnName: columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX ,
345
+ value: uuid
346
+ })
347
+ // update element column name (smart browse)
348
+ if (! isSameColumnElement) {
349
+ store .commit (' updateValueOfField' , {
350
+ parentUuid,
351
+ containerUuid,
352
+ columnName: elementName,
353
+ value: id
354
+ })
355
+ // set display column (name) value
356
+ store .commit (' updateValueOfField' , {
357
+ parentUuid,
358
+ containerUuid,
359
+ // DisplayColumn_'ColumnName'
360
+ columnName: DISPLAY_COLUMN_PREFIX + elementName,
361
+ value: displayValue
362
+ })
363
+ }
364
+
365
+ // implement container manager row
366
+ if (props .metadata .inTable ) {
367
+ props .containerManager .setCell ({
368
+ containerUuid,
369
+ rowIndex: props .metadata .rowIndex ,
370
+ rowUid: props .metadata .rowUid ,
371
+ columnName,
372
+ value: id
373
+ })
374
+ props .containerManager .setCell ({
375
+ containerUuid,
376
+ rowIndex: props .metadata .rowIndex ,
377
+ rowUid: props .metadata .rowUid ,
378
+ columnName: DISPLAY_COLUMN_PREFIX + columnName,
379
+ value: displayValue
380
+ })
381
+ return
382
+ }
383
+
314
384
store .dispatch (' notifyFieldChange' , {
315
385
containerUuid,
316
386
containerManager: props .containerManager ,
317
387
field: props .metadata ,
318
388
columnName,
319
- newValue: rowData . id
389
+ newValue: id
320
390
})
321
391
}
322
392
0 commit comments