From 8f66bdbad03a3f864a7a067b86934446fcecb120 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 23 Feb 2022 14:05:49 +0800 Subject: [PATCH] fix: addChildToParent > update > new data Signed-off-by: Wing-Kam Wong --- .../components/virtualCell/hasManyCell.vue | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue index 05ad634bb7..863777c5e7 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue @@ -142,7 +142,7 @@ import Pagination from '@/components/project/spreadsheet/components/pagination' import ListItems from '@/components/project/spreadsheet/components/virtualCell/components/listItems' import ListChildItems from '@/components/project/spreadsheet/components/virtualCell/components/listChildItems' import listChildItemsModal - from '@/components/project/spreadsheet/components/virtualCell/components/listChildItemsModal' +from '@/components/project/spreadsheet/components/virtualCell/components/listChildItemsModal' import { parseIfInteger } from '@/helpers' import ItemChip from '~/components/project/spreadsheet/components/virtualCell/components/itemChip' @@ -254,7 +254,7 @@ export default { return (this.meta && this.meta.columns && (this.meta.columns.filter(c => c._cn === this.childForeignKey).map(c => this.row[c._cn]).join('___') || this.meta.columns.filter(c => c.pk).map(c => this.row[c._cn]).join('___'))) || '' - }, + } }, watch: { isNew(n, o) { @@ -349,10 +349,7 @@ export default { this.newRecordModal = true }, async addChildToParent(child) { - console.log("invoking addChildToParent ...") - console.log(child) if (this.isNew && this.localState.every(it => it[this.childForeignKey] !== child[this.childPrimaryKey])) { - console.log(child) this.localState.push(child) this.$emit('update:localState', [...this.localState]) this.$emit('saveRow') @@ -364,19 +361,9 @@ export default { const _cn = this.childForeignKey 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, { - [_cn]: child[this.childForeignKey] - // [_cn]: - // (this.hm && child[`${this.hm._rtn}Read`] && child[`${this.hm._rtn}Read`][this.hm && _cn]) || parseIfInteger(this.parentId) + [_cn]: + (this.hm && child[`${this.hm._rtn}Read`] && child[`${this.hm._rtn}Read`][this.hm && _cn]) || parseIfInteger(this.parentId) }, { [_cn]: child[this.childForeignKey] }) @@ -410,7 +397,6 @@ export default { } }, getCellValue(cellObj) { - console.log(cellObj) if (cellObj) { if (this.childMeta && this.childPrimaryCol) { return cellObj[this.childPrimaryCol]