|
|
@ -89,7 +89,7 @@ |
|
|
|
:has-many="childMeta.hasMany" |
|
|
|
:has-many="childMeta.hasMany" |
|
|
|
:belongs-to="childMeta.belongsTo" |
|
|
|
:belongs-to="childMeta.belongsTo" |
|
|
|
@cancel="selectedChild = null" |
|
|
|
@cancel="selectedChild = null" |
|
|
|
@input="$emit('loadTableData')" |
|
|
|
@input="onChildSave" |
|
|
|
:table="childMeta.tn" |
|
|
|
:table="childMeta.tn" |
|
|
|
v-model="selectedChild" |
|
|
|
v-model="selectedChild" |
|
|
|
:old-row="{...selectedChild}" |
|
|
|
:old-row="{...selectedChild}" |
|
|
@ -169,6 +169,13 @@ export default { |
|
|
|
await this.loadChildMeta() |
|
|
|
await this.loadChildMeta() |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
onChildSave() { |
|
|
|
|
|
|
|
if (this.isNew) { |
|
|
|
|
|
|
|
this.addChildToParent(this.selectedChild) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$emit('loadTableData') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
async showChildListModal() { |
|
|
|
async showChildListModal() { |
|
|
|
await this.loadChildMeta(); |
|
|
|
await this.loadChildMeta(); |
|
|
|
this.childListModal = true; |
|
|
|
this.childListModal = true; |
|
|
@ -241,7 +248,7 @@ export default { |
|
|
|
this.newRecordModal = true; |
|
|
|
this.newRecordModal = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
async addChildToParent(child) { |
|
|
|
async addChildToParent(child) { |
|
|
|
if (this.isNew) { |
|
|
|
if (this.isNew && this.localState.every(it => it[this.childForeignKey] !== child[this.childPrimaryKey])) { |
|
|
|
this.localState.push(child); |
|
|
|
this.localState.push(child); |
|
|
|
this.newRecordModal = false; |
|
|
|
this.newRecordModal = false; |
|
|
|
return; |
|
|
|
return; |
|
|
|