mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: value overridden when join tables with fields with same name
This commit is contained in:
@ -68,7 +68,7 @@
|
||||
class="tr"
|
||||
:class="{'selected': selectedRows.includes(row._id)}"
|
||||
@select-row="selectRow($event, row._id)"
|
||||
@update-field="updateField($event, row[primaryField.alias || primaryField.name])"
|
||||
@update-field="updateField($event, getPrimaryValue(row))"
|
||||
@contextmenu="contextMenu"
|
||||
/>
|
||||
</template>
|
||||
@ -200,6 +200,15 @@ export default {
|
||||
return this.resultsWithRows[index].fields[0].orgTable;
|
||||
return '';
|
||||
},
|
||||
getPrimaryValue (row) {
|
||||
const primaryFieldName = Object.keys(row).find(prop => [
|
||||
this.primaryField.alias,
|
||||
this.primaryField.name,
|
||||
`${this.primaryField.table}.${this.primaryField.alias}`,
|
||||
`${this.primaryField.table}.${this.primaryField.name}`
|
||||
].includes(prop));
|
||||
return row[primaryFieldName];
|
||||
},
|
||||
setLocalResults () {
|
||||
this.resetSort();
|
||||
this.localResults = this.resultsWithRows[this.resultsetIndex] && this.resultsWithRows[this.resultsetIndex].rows ? this.resultsWithRows[this.resultsetIndex].rows.map(item => {
|
||||
|
Reference in New Issue
Block a user