|
|
@ -54,7 +54,7 @@ |
|
|
|
:parent-meta="meta" |
|
|
|
:parent-meta="meta" |
|
|
|
:query-params="{ |
|
|
|
:query-params="{ |
|
|
|
...childQueryParams, |
|
|
|
...childQueryParams, |
|
|
|
where: isNew ? null :`~not(${childForeignKey},eq,${parentId})~or(${childForeignKey},is,null)`, |
|
|
|
where: isNew ? null :`~not(${childForeignKey},eq,${childForeignKeyVal != '' ? childForeignKeyVal : parentId})~or(${childForeignKey},is,null)`, |
|
|
|
}" |
|
|
|
}" |
|
|
|
:is-public="isPublic" |
|
|
|
:is-public="isPublic" |
|
|
|
:password="password" |
|
|
|
:password="password" |
|
|
@ -80,7 +80,7 @@ |
|
|
|
:column="column" |
|
|
|
:column="column" |
|
|
|
:query-params="{ |
|
|
|
:query-params="{ |
|
|
|
...childQueryParams, |
|
|
|
...childQueryParams, |
|
|
|
where: `(${childForeignKey},eq,${parentId})` |
|
|
|
where: `(${childForeignKey},eq,${childForeignKeyVal != '' ? childForeignKeyVal : parentId})` |
|
|
|
}" |
|
|
|
}" |
|
|
|
:is-public="isPublic" |
|
|
|
:is-public="isPublic" |
|
|
|
:row-id="parentId" |
|
|
|
:row-id="parentId" |
|
|
@ -252,6 +252,9 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
parentId() { |
|
|
|
parentId() { |
|
|
|
return this.meta && this.meta.columns ? this.meta.columns.filter(c => c.pk).map(c => this.row[c._cn]).join('___') : '' |
|
|
|
return this.meta && this.meta.columns ? this.meta.columns.filter(c => c.pk).map(c => this.row[c._cn]).join('___') : '' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
childForeignKeyVal() { |
|
|
|
|
|
|
|
return this.meta && this.meta.columns ? this.meta.columns.filter(c => c._cn === this.childForeignKey).map(c => this.row[c._cn]) : '' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -347,7 +350,10 @@ export default { |
|
|
|
this.newRecordModal = true |
|
|
|
this.newRecordModal = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
async addChildToParent(child) { |
|
|
|
async addChildToParent(child) { |
|
|
|
|
|
|
|
console.log("invoking addChildToParent ...") |
|
|
|
|
|
|
|
console.log(child) |
|
|
|
if (this.isNew && this.localState.every(it => it[this.childForeignKey] !== child[this.childPrimaryKey])) { |
|
|
|
if (this.isNew && this.localState.every(it => it[this.childForeignKey] !== child[this.childPrimaryKey])) { |
|
|
|
|
|
|
|
console.log(child) |
|
|
|
this.localState.push(child) |
|
|
|
this.localState.push(child) |
|
|
|
this.$emit('update:localState', [...this.localState]) |
|
|
|
this.$emit('update:localState', [...this.localState]) |
|
|
|
this.$emit('saveRow') |
|
|
|
this.$emit('saveRow') |
|
|
@ -359,15 +365,26 @@ export default { |
|
|
|
const _cn = this.childForeignKey |
|
|
|
const _cn = this.childForeignKey |
|
|
|
this.newRecordModal = false |
|
|
|
this.newRecordModal = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// wingkwong |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(_cn) // CustomerEmail |
|
|
|
|
|
|
|
console.log(parseIfInteger(this.parentId)) // 1 |
|
|
|
|
|
|
|
console.log(child[this.childForeignKey]) // user1@test.com |
|
|
|
|
|
|
|
console.log(this.hm) |
|
|
|
|
|
|
|
// console.log(child[`${this.hm._rtn}Read`][this.hm && this.parentMeta && this.parentMeta.columns.find(v => v.pv)._cn]) |
|
|
|
|
|
|
|
// console.log((this.hm && child[`${this.hm._rtn}Read`] && child[`${this.hm._rtn}Read`][this.hm && _cn]) || parseIfInteger(this.parentId)) |
|
|
|
|
|
|
|
console.log(child[this.childPrimaryCol]) |
|
|
|
await this.childApi.update(id, { |
|
|
|
await this.childApi.update(id, { |
|
|
|
[_cn]: parseIfInteger(this.parentId) |
|
|
|
[_cn]: child[this.childForeignKey] |
|
|
|
|
|
|
|
// [_cn]: |
|
|
|
|
|
|
|
// (this.hm && child[`${this.hm._rtn}Read`] && child[`${this.hm._rtn}Read`][this.hm && _cn]) || parseIfInteger(this.parentId) |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
[_cn]: child[this.childForeignKey] |
|
|
|
[_cn]: child[this.childForeignKey] |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.$emit('loadTableData') |
|
|
|
this.$emit('loadTableData') |
|
|
|
if ((this.childListModal || this.isForm) && this.$refs.childList) { |
|
|
|
if ((this.childListModal || this.isForm) && this.$refs.childList) { |
|
|
|
this.$refs.childList.loadData() |
|
|
|
await this.$refs.childList.loadData() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
async editChild(child) { |
|
|
|
async editChild(child) { |
|
|
@ -394,6 +411,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
getCellValue(cellObj) { |
|
|
|
getCellValue(cellObj) { |
|
|
|
|
|
|
|
console.log(cellObj) |
|
|
|
if (cellObj) { |
|
|
|
if (cellObj) { |
|
|
|
if (this.childMeta && this.childPrimaryCol) { |
|
|
|
if (this.childMeta && this.childPrimaryCol) { |
|
|
|
return cellObj[this.childPrimaryCol] |
|
|
|
return cellObj[this.childPrimaryCol] |
|
|
|