|
|
@ -36,8 +36,7 @@ |
|
|
|
:api="parentApi" |
|
|
|
:api="parentApi" |
|
|
|
:query-params="{ |
|
|
|
:query-params="{ |
|
|
|
...parentQueryParams, |
|
|
|
...parentQueryParams, |
|
|
|
isByPass, |
|
|
|
where: isNew ? null :`${btWhereClause}`, |
|
|
|
where: isNew ? null :`~not(${parentReferenceKey},eq,${parentReferenceVal})~or(${parentReferenceKey},is,null)`, |
|
|
|
|
|
|
|
}" |
|
|
|
}" |
|
|
|
:is-public="isPublic" |
|
|
|
:is-public="isPublic" |
|
|
|
:tn="bt && bt.rtn" |
|
|
|
:tn="bt && bt.rtn" |
|
|
@ -181,8 +180,16 @@ export default { |
|
|
|
parentReferenceKey() { |
|
|
|
parentReferenceKey() { |
|
|
|
return this.parentMeta && (this.parentMeta.columns.find(c => c.cn === this.bt.rcn) || {})._cn |
|
|
|
return this.parentMeta && (this.parentMeta.columns.find(c => c.cn === this.bt.rcn) || {})._cn |
|
|
|
}, |
|
|
|
}, |
|
|
|
parentReferenceVal() { |
|
|
|
btWhereClause() { |
|
|
|
return (this.row && this.row[this.parentReferenceKey]) || -1 |
|
|
|
// if parent reference key is pk, then filter out the selected value |
|
|
|
|
|
|
|
// else, filter out the selected value + empty values (as we can't set an empty value) |
|
|
|
|
|
|
|
const prk = this.parentReferenceKey |
|
|
|
|
|
|
|
const isPk = !!(this.parentMeta && (this.parentMeta.columns.find(c => c.pk && c._cn === prk))) || false |
|
|
|
|
|
|
|
let selectedValue = this.meta && this.meta.columns ? this.meta.columns.filter(c => c.cn === this.bt.cn).map(c => this.row[c._cn] || '').join('___') : '' |
|
|
|
|
|
|
|
if (this.parentMeta && (this.parentMeta.columns.find(c => c._cn === prk)).type !== 'string') { |
|
|
|
|
|
|
|
selectedValue = selectedValue || 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return `(${prk},not,${selectedValue})` + (!isPk ? `~and(${prk},not,)` : '') |
|
|
|
}, |
|
|
|
}, |
|
|
|
parentQueryParams() { |
|
|
|
parentQueryParams() { |
|
|
|
if (!this.parentMeta) { |
|
|
|
if (!this.parentMeta) { |
|
|
@ -223,9 +230,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
return null |
|
|
|
}, |
|
|
|
}, |
|
|
|
isByPass() { |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
isNew(n, o) { |
|
|
|
isNew(n, o) { |
|
|
|