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 => {
|
||||
|
@ -281,7 +281,11 @@ export default {
|
||||
return length;
|
||||
},
|
||||
getFieldObj (cKey) {
|
||||
return this.fields.filter(field => field.name === cKey || field.alias === cKey)[0];
|
||||
return this.fields.filter(field =>
|
||||
field.name === cKey ||
|
||||
field.alias === cKey ||
|
||||
`${field.table}.${field.name}` === cKey ||
|
||||
`${field.table}.${field.alias}` === cKey)[0];
|
||||
},
|
||||
isNull (value) {
|
||||
return value === null ? ' is-null' : '';
|
||||
|
Reference in New Issue
Block a user