mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-11 05:11:59 +08:00
fix: Display logic field when set empty value in parent field. (#357)
This commit is contained in:
parent
c4456850e2
commit
8f9c7f390d
@ -5,7 +5,7 @@
|
||||
<el-col></el-col> container-->
|
||||
<el-col
|
||||
v-if="!inTable"
|
||||
v-show="isDisplayed()"
|
||||
v-show="isDisplayed"
|
||||
key="is-panel-template"
|
||||
:xs="sizeFieldResponsive.xs"
|
||||
:sm="sizeFieldResponsive.sm"
|
||||
@ -19,7 +19,7 @@
|
||||
>
|
||||
<template slot="label">
|
||||
<field-operator-comparison
|
||||
v-if="isAdvancedQuery && isDisplayed()"
|
||||
v-if="isAdvancedQuery && isDisplayed"
|
||||
key="is-field-operator-comparison"
|
||||
:field-attributes="fieldAttributes"
|
||||
:field-value="field.value"
|
||||
@ -70,7 +70,8 @@ import FieldOperatorComparison from '@/components/ADempiere/Field/fieldPopovers/
|
||||
import FieldTranslated from '@/components/ADempiere/Field/fieldPopovers/fieldTranslated'
|
||||
import { FIELD_ONLY } from '@/components/ADempiere/Field/references'
|
||||
import { DEFAULT_SIZE } from '@/components/ADempiere/Field/fieldSize'
|
||||
import { fieldIsDisplayed } from '@/utils/ADempiere'
|
||||
import { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils'
|
||||
import { showMessage } from '@/utils/ADempiere/notification'
|
||||
|
||||
/**
|
||||
* This is the base component for linking the components according to the
|
||||
@ -141,11 +142,17 @@ export default {
|
||||
// DOM properties
|
||||
required: this.isMandatory(),
|
||||
readonly: this.isReadOnly(),
|
||||
displayed: this.isDisplayed(),
|
||||
displayed: this.isDisplayed,
|
||||
disabled: !this.field.isActive,
|
||||
isSelectCreated: this.isSelectCreated
|
||||
}
|
||||
},
|
||||
isDisplayed() {
|
||||
if (this.isAdvancedQuery) {
|
||||
return this.field.isShowedFromUser
|
||||
}
|
||||
return fieldIsDisplayed(this.field) && (this.isMandatory() || this.field.isShowedFromUser || this.inTable)
|
||||
},
|
||||
isSelectCreated() {
|
||||
return this.isAdvancedQuery &&
|
||||
!['FieldBinary', 'FieldDate', 'FieldSelect', 'FieldYesNo'].includes(this.field.componentPath) &&
|
||||
@ -167,7 +174,7 @@ export default {
|
||||
return false
|
||||
},
|
||||
sizeFieldResponsive() {
|
||||
if (!this.isDisplayed()) {
|
||||
if (!this.isDisplayed) {
|
||||
return DEFAULT_SIZE
|
||||
}
|
||||
|
||||
@ -267,12 +274,7 @@ export default {
|
||||
this.field = this.metadataField
|
||||
},
|
||||
methods: {
|
||||
isDisplayed() {
|
||||
if (this.isAdvancedQuery) {
|
||||
return this.field.isShowedFromUser
|
||||
}
|
||||
return fieldIsDisplayed(this.field) && (this.isMandatory() || this.field.isShowedFromUser || this.inTable)
|
||||
},
|
||||
showMessage,
|
||||
isReadOnly() {
|
||||
if (this.isAdvancedQuery) {
|
||||
if (['NULL', 'NOT_NULL'].includes(this.field.operator)) {
|
||||
@ -343,7 +345,7 @@ export default {
|
||||
return Boolean(field)
|
||||
},
|
||||
focusField() {
|
||||
if (this.isDisplayed() && this.isMandatory() && !this.isReadOnly()) {
|
||||
if (this.isDisplayed && this.isMandatory() && !this.isReadOnly()) {
|
||||
this.$refs[this.field.columnName].activeFocus()
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ const context = {
|
||||
*/
|
||||
setContext(state, payload) {
|
||||
let key = ''
|
||||
if (payload.parentUuid && !isEmptyValue(payload.value)) {
|
||||
if (payload.parentUuid) {
|
||||
key += payload.parentUuid + '|'
|
||||
|
||||
// set context for window
|
||||
|
@ -496,23 +496,22 @@ const panel = {
|
||||
// get field
|
||||
const field = fieldList.find(fieldItem => fieldItem.columnName === columnName)
|
||||
|
||||
if (!(isAdvancedQuery && ['IN', 'NOT_IN'].includes(field.operator))) {
|
||||
newValue = parsedValueComponent({
|
||||
fieldType: field.componentPath,
|
||||
referenceType: field.referenceType,
|
||||
value: newValue
|
||||
})
|
||||
|
||||
if (field.isRange) {
|
||||
valueTo = parsedValueComponent({
|
||||
if (!(panelType === 'table' || isAdvancedQuery)) {
|
||||
if (!['IN', 'NOT_IN'].includes(field.operator)) {
|
||||
newValue = parsedValueComponent({
|
||||
fieldType: field.componentPath,
|
||||
referenceType: field.referenceType,
|
||||
value: valueTo
|
||||
value: newValue
|
||||
})
|
||||
if (field.isRange) {
|
||||
valueTo = parsedValueComponent({
|
||||
fieldType: field.componentPath,
|
||||
referenceType: field.referenceType,
|
||||
value: valueTo
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(panelType === 'table' || isAdvancedQuery)) {
|
||||
// Call context management
|
||||
dispatch('setContext', {
|
||||
parentUuid,
|
||||
@ -555,9 +554,7 @@ const panel = {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAdvancedQuery) {
|
||||
// Change Dependents
|
||||
dispatch('changeDependentFieldsList', {
|
||||
parentUuid,
|
||||
|
@ -120,7 +120,7 @@ class evaluator {
|
||||
})
|
||||
// in context exists this column name
|
||||
if (value === null || value === undefined) {
|
||||
console.info(`.The column ${first} not exists in context.`)
|
||||
// console.info(`.The column ${first} not exists in context.`)
|
||||
return _defaultUndefined
|
||||
}
|
||||
firstEval = value // replace with it's value
|
||||
@ -186,10 +186,6 @@ class evaluator {
|
||||
value2 = false
|
||||
}
|
||||
|
||||
if ([value1, operand, value2].includes(null)) {
|
||||
return false
|
||||
}
|
||||
|
||||
let isValueLogic
|
||||
// TODO: Add '^' operand comparison
|
||||
switch (operand) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user