Feature/#116 field definition support (#169)
* add feature for go to print format setup window from report viewer * change translation * add feature for field condition in table records * add evaluate logic for display field definition * some changes * add evaluate logic * Fix error with evaluator in field definitionpull/3759/head
parent
e3563b6e4f
commit
521f0b28a0
|
@ -239,7 +239,7 @@
|
||||||
@keyup.enter.native="confirmEdit(scope.row)"
|
@keyup.enter.native="confirmEdit(scope.row)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>
|
<span v-else :style="getFieldDefinition(fieldAttributes.fieldDefinition, scope.row)">
|
||||||
{{ displayedValue(scope.row, fieldAttributes) }}
|
{{ displayedValue(scope.row, fieldAttributes) }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -281,6 +281,7 @@ import MainPanel from '@/components/ADempiere/Panel'
|
||||||
import { sortFields } from '@/utils/ADempiere'
|
import { sortFields } from '@/utils/ADempiere'
|
||||||
import { FIELD_READ_ONLY_FORM } from '@/components/ADempiere/Field/references'
|
import { FIELD_READ_ONLY_FORM } from '@/components/ADempiere/Field/references'
|
||||||
import { fieldIsDisplayed } from '@/utils/ADempiere'
|
import { fieldIsDisplayed } from '@/utils/ADempiere'
|
||||||
|
import evaluator from '@/utils/ADempiere/evaluator'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DataTable',
|
name: 'DataTable',
|
||||||
|
@ -919,6 +920,26 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
getFieldDefinition(fieldDefinition, row) {
|
||||||
|
var styleSheet = ''
|
||||||
|
if (fieldDefinition && (fieldDefinition.id !== null || fieldDefinition.conditions.length)) {
|
||||||
|
fieldDefinition.conditions.forEach(condition => {
|
||||||
|
var columns = evaluator.parseDepends(condition.condition)
|
||||||
|
var conditionLogic = condition.condition
|
||||||
|
columns.forEach(column => {
|
||||||
|
conditionLogic = conditionLogic.replace(/@/g, '')
|
||||||
|
conditionLogic = conditionLogic.replace(column, row[column])
|
||||||
|
conditionLogic = evaluator.evaluateLogic({
|
||||||
|
logic: conditionLogic
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (conditionLogic && condition.isActive) {
|
||||||
|
styleSheet = condition.styleSheet
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return styleSheet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,40 @@ export function convertField(fieldGRPC, moreAttributes = {}, typeRange = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fieldDefinition = fieldGRPC.getFielddefinition()
|
||||||
|
var fieldConditions = []
|
||||||
|
var fieldDefinitionValue = {
|
||||||
|
id: null,
|
||||||
|
uuid: '',
|
||||||
|
value: '',
|
||||||
|
name: '',
|
||||||
|
fieldGroupType: '',
|
||||||
|
conditions: fieldConditions,
|
||||||
|
isActive: false
|
||||||
|
}
|
||||||
|
if (fieldDefinition) {
|
||||||
|
if (fieldDefinition.getConditionsList()) {
|
||||||
|
fieldConditions = fieldDefinition.getConditionsList().map(condition => {
|
||||||
|
return {
|
||||||
|
id: condition.getId(),
|
||||||
|
uuid: condition.getUuid(),
|
||||||
|
condition: condition.getCondition(),
|
||||||
|
styleSheet: condition.getStylesheet(),
|
||||||
|
isActive: condition.getIsactive()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fieldDefinitionValue = {
|
||||||
|
id: fieldDefinition.getId(),
|
||||||
|
uuid: fieldDefinition.getUuid(),
|
||||||
|
value: fieldDefinition.getValue(),
|
||||||
|
name: fieldDefinition.getName(),
|
||||||
|
fieldGroupType: fieldDefinition.getFieldgrouptype(),
|
||||||
|
conditions: fieldConditions,
|
||||||
|
isActive: fieldDefinition.getIsactive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var componentReference = evalutateTypeField(fieldGRPC.getDisplaytype(), true)
|
var componentReference = evalutateTypeField(fieldGRPC.getDisplaytype(), true)
|
||||||
|
|
||||||
var parsedDefaultValue = fieldGRPC.getDefaultvalue()
|
var parsedDefaultValue = fieldGRPC.getDefaultvalue()
|
||||||
|
@ -137,6 +171,7 @@ export function convertField(fieldGRPC, moreAttributes = {}, typeRange = false)
|
||||||
isActive: fieldGRPC.getIsactive(),
|
isActive: fieldGRPC.getIsactive(),
|
||||||
// displayed attributes
|
// displayed attributes
|
||||||
fieldGroup: group,
|
fieldGroup: group,
|
||||||
|
fieldDefinition: fieldDefinitionValue,
|
||||||
displayType: fieldGRPC.getDisplaytype(),
|
displayType: fieldGRPC.getDisplaytype(),
|
||||||
componentPath: componentReference.type,
|
componentPath: componentReference.type,
|
||||||
isSupport: componentReference.support,
|
isSupport: componentReference.support,
|
||||||
|
@ -513,6 +548,40 @@ export function convertMessageTextFromGRPC(messageTextGRPC) {
|
||||||
return messageText
|
return messageText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function convertFieldDefinitionFromGRPC(contextInfoGRPC) {
|
||||||
|
// int32 id = 1;
|
||||||
|
// string uuid = 2;
|
||||||
|
// string value = 3;
|
||||||
|
// string name = 4;
|
||||||
|
// string fieldGroupType = 5;
|
||||||
|
// repeated FieldCondition conditions = 6;
|
||||||
|
// bool isActive = 7;
|
||||||
|
var contextInfo = {
|
||||||
|
id: null,
|
||||||
|
uuid: '',
|
||||||
|
value: '',
|
||||||
|
name: '',
|
||||||
|
fieldGroupType: '',
|
||||||
|
sqlStatement: '',
|
||||||
|
isActive: false,
|
||||||
|
messageText: convertMessageTextFromGRPC(undefined)
|
||||||
|
}
|
||||||
|
if (contextInfoGRPC !== undefined) {
|
||||||
|
contextInfo = {
|
||||||
|
id: contextInfoGRPC.getId(),
|
||||||
|
uuid: contextInfoGRPC.getUuid(),
|
||||||
|
name: contextInfoGRPC.getName(),
|
||||||
|
description: contextInfoGRPC.getDescription(),
|
||||||
|
sqlStatement: contextInfoGRPC.getSqlstatement(),
|
||||||
|
isActive: contextInfoGRPC.getIsactive(),
|
||||||
|
messageText: convertMessageTextFromGRPC(
|
||||||
|
contextInfoGRPC.getMessagetext()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contextInfo
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [assignedGroup]
|
* [assignedGroup]
|
||||||
* @param {array} fieldList Field of List with
|
* @param {array} fieldList Field of List with
|
||||||
|
|
Loading…
Reference in New Issue