1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

Fixed error with set context from tables and browsers, it is a problem when exist one field depending, example: (#461)

C_BPartner_Location_ID depending of C_BPartner_ID
This commit is contained in:
Yamel Senih 2020-04-24 15:48:08 -04:00 committed by GitHub
parent cee3bd4179
commit d6d9a2117e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 28 deletions

View File

@ -701,6 +701,12 @@ const data = {
displayColumn,
withOutColumnNames = []
}) {
dispatch('setContext', {
parentUuid,
containerUuid,
columnName,
value: newValue
})
const recordSelection = state.recordSelection.find(recordItem => {
return recordItem.containerUuid === containerUuid
})
@ -712,7 +718,6 @@ const data = {
if (row[columnName] === newValue) {
return
}
const rowSelection = recordSelection.selection.find(itemRecord => {
return itemRecord[keyColumn] === rowKey
})

View File

@ -77,36 +77,33 @@ const panel = {
componentPath: itemField.componentPath
})
}
if (panelType === 'table' || params.isAdvancedQuery) {
itemField.isShowedFromUser = false
if (count < 2 && itemField.isSelectionColumn && itemField.sequence >= 10) {
itemField.isShowedFromUser = true
count++
}
} else {
if (['browser', 'process', 'report', 'form'].includes(panelType) ||
panelType === 'window' && params.isParentTab) {
dispatch('setContext', {
parentUuid: params.parentUuid,
containerUuid: params.uuid,
columnName: itemField.columnName,
value: itemField.value
}
// For all
if (['browser', 'process', 'report', 'form', 'table'].includes(panelType) || (panelType === 'window' && params.isParentTab)) {
dispatch('setContext', {
parentUuid: params.parentUuid,
containerUuid: params.uuid,
columnName: itemField.columnName,
value: itemField.value
})
}
// Get dependent fields
if (!isEmptyValue(itemField.parentFieldsList) && itemField.isActive) {
itemField.parentFieldsList.forEach(parentColumnName => {
const parentField = listFields.find(parentFieldItem => {
return parentFieldItem.columnName === parentColumnName &&
parentColumnName !== itemField.columnName
})
}
// Get dependent fields
if (!isEmptyValue(itemField.parentFieldsList) && itemField.isActive) {
itemField.parentFieldsList.forEach(parentColumnName => {
const parentField = listFields.find(parentFieldItem => {
return parentFieldItem.columnName === parentColumnName &&
parentColumnName !== itemField.columnName
})
if (parentField) {
parentField.dependentFieldsList.push(itemField.columnName)
}
})
}
if (parentField) {
parentField.dependentFieldsList.push(itemField.columnName)
}
})
}
})
@ -592,7 +589,6 @@ const panel = {
columnName,
value: newValue
})
// request context info field
if ((!isEmptyValue(field.value) || !isEmptyValue(newValue)) && !isEmptyValue(field.contextInfo) && !isEmptyValue(field.contextInfo.sqlStatement)) {
let isSQL = false

View File

@ -22,11 +22,18 @@ export const getContext = ({
* @param {string} displayLogic
* @param {string} mandatoryLogic
* @param {string} readOnlyLogic
* @param {object} reference
* @param {string} defaultValue
* @returns {array} List column name of parent fields
*/
export function getParentFields({ displayLogic, mandatoryLogic, readOnlyLogic, defaultValue }) {
return Array.from(new Set([
export function getParentFields({
displayLogic,
mandatoryLogic,
readOnlyLogic,
reference,
defaultValue
}) {
const parentFields = Array.from(new Set([
// For Display logic
...evaluator.parseDepends(displayLogic),
// For Mandatory Logic
@ -36,6 +43,11 @@ export function getParentFields({ displayLogic, mandatoryLogic, readOnlyLogic, d
// For Default Value
...evaluator.parseDepends(defaultValue)
]))
// Validate reference
if (!isEmptyValue(reference)) {
parentFields.push(...evaluator.parseDepends(reference.validationCode))
}
return parentFields
}
/**
@ -60,7 +72,6 @@ export function parseContext({
let isError = false
const errorsList = []
value = String(value)
if (isEmptyValue(value)) {
return {
value: undefined,