mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-11 05:11:59 +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:
parent
cee3bd4179
commit
d6d9a2117e
@ -701,6 +701,12 @@ const data = {
|
|||||||
displayColumn,
|
displayColumn,
|
||||||
withOutColumnNames = []
|
withOutColumnNames = []
|
||||||
}) {
|
}) {
|
||||||
|
dispatch('setContext', {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
columnName,
|
||||||
|
value: newValue
|
||||||
|
})
|
||||||
const recordSelection = state.recordSelection.find(recordItem => {
|
const recordSelection = state.recordSelection.find(recordItem => {
|
||||||
return recordItem.containerUuid === containerUuid
|
return recordItem.containerUuid === containerUuid
|
||||||
})
|
})
|
||||||
@ -712,7 +718,6 @@ const data = {
|
|||||||
if (row[columnName] === newValue) {
|
if (row[columnName] === newValue) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const rowSelection = recordSelection.selection.find(itemRecord => {
|
const rowSelection = recordSelection.selection.find(itemRecord => {
|
||||||
return itemRecord[keyColumn] === rowKey
|
return itemRecord[keyColumn] === rowKey
|
||||||
})
|
})
|
||||||
|
@ -77,36 +77,33 @@ const panel = {
|
|||||||
componentPath: itemField.componentPath
|
componentPath: itemField.componentPath
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelType === 'table' || params.isAdvancedQuery) {
|
if (panelType === 'table' || params.isAdvancedQuery) {
|
||||||
itemField.isShowedFromUser = false
|
itemField.isShowedFromUser = false
|
||||||
if (count < 2 && itemField.isSelectionColumn && itemField.sequence >= 10) {
|
if (count < 2 && itemField.isSelectionColumn && itemField.sequence >= 10) {
|
||||||
itemField.isShowedFromUser = true
|
itemField.isShowedFromUser = true
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (['browser', 'process', 'report', 'form'].includes(panelType) ||
|
// For all
|
||||||
panelType === 'window' && params.isParentTab) {
|
if (['browser', 'process', 'report', 'form', 'table'].includes(panelType) || (panelType === 'window' && params.isParentTab)) {
|
||||||
dispatch('setContext', {
|
dispatch('setContext', {
|
||||||
parentUuid: params.parentUuid,
|
parentUuid: params.parentUuid,
|
||||||
containerUuid: params.uuid,
|
containerUuid: params.uuid,
|
||||||
columnName: itemField.columnName,
|
columnName: itemField.columnName,
|
||||||
value: itemField.value
|
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
|
||||||
})
|
})
|
||||||
}
|
if (parentField) {
|
||||||
|
parentField.dependentFieldsList.push(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)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -592,7 +589,6 @@ const panel = {
|
|||||||
columnName,
|
columnName,
|
||||||
value: newValue
|
value: newValue
|
||||||
})
|
})
|
||||||
|
|
||||||
// request context info field
|
// request context info field
|
||||||
if ((!isEmptyValue(field.value) || !isEmptyValue(newValue)) && !isEmptyValue(field.contextInfo) && !isEmptyValue(field.contextInfo.sqlStatement)) {
|
if ((!isEmptyValue(field.value) || !isEmptyValue(newValue)) && !isEmptyValue(field.contextInfo) && !isEmptyValue(field.contextInfo.sqlStatement)) {
|
||||||
let isSQL = false
|
let isSQL = false
|
||||||
|
@ -22,11 +22,18 @@ export const getContext = ({
|
|||||||
* @param {string} displayLogic
|
* @param {string} displayLogic
|
||||||
* @param {string} mandatoryLogic
|
* @param {string} mandatoryLogic
|
||||||
* @param {string} readOnlyLogic
|
* @param {string} readOnlyLogic
|
||||||
|
* @param {object} reference
|
||||||
* @param {string} defaultValue
|
* @param {string} defaultValue
|
||||||
* @returns {array} List column name of parent fields
|
* @returns {array} List column name of parent fields
|
||||||
*/
|
*/
|
||||||
export function getParentFields({ displayLogic, mandatoryLogic, readOnlyLogic, defaultValue }) {
|
export function getParentFields({
|
||||||
return Array.from(new Set([
|
displayLogic,
|
||||||
|
mandatoryLogic,
|
||||||
|
readOnlyLogic,
|
||||||
|
reference,
|
||||||
|
defaultValue
|
||||||
|
}) {
|
||||||
|
const parentFields = Array.from(new Set([
|
||||||
// For Display logic
|
// For Display logic
|
||||||
...evaluator.parseDepends(displayLogic),
|
...evaluator.parseDepends(displayLogic),
|
||||||
// For Mandatory Logic
|
// For Mandatory Logic
|
||||||
@ -36,6 +43,11 @@ export function getParentFields({ displayLogic, mandatoryLogic, readOnlyLogic, d
|
|||||||
// For Default Value
|
// For Default Value
|
||||||
...evaluator.parseDepends(defaultValue)
|
...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
|
let isError = false
|
||||||
const errorsList = []
|
const errorsList = []
|
||||||
value = String(value)
|
value = String(value)
|
||||||
|
|
||||||
if (isEmptyValue(value)) {
|
if (isEmptyValue(value)) {
|
||||||
return {
|
return {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user