mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
Add Dictionary fields from ADempiere (#454)
This commit is contained in:
parent
ae787ba798
commit
b6450dc406
@ -28,8 +28,7 @@
|
||||
|
||||
<script>
|
||||
import formMixin from '@/components/ADempiere/Form/formMixin'
|
||||
import { COSTS_PLUS_PRICES, CHAR, TEXT } from '@/utils/ADempiere/references'
|
||||
|
||||
import { TEXT } from '@/utils/ADempiere/references'
|
||||
export default {
|
||||
name: 'TestView',
|
||||
mixins: [formMixin],
|
||||
@ -52,84 +51,97 @@ export default {
|
||||
methods: {
|
||||
setFieldsList() {
|
||||
const fieldsList = []
|
||||
let sequence = 10
|
||||
const sequenceIncrement = () => {
|
||||
sequence = sequence + 10
|
||||
return sequence
|
||||
}
|
||||
|
||||
fieldsList.push(this.createField({
|
||||
// Product Code
|
||||
this.createFieldFromDictionary({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
columnName: 'Value',
|
||||
definition: {
|
||||
name: 'Product Code/Bar Code',
|
||||
displayType: CHAR.id,
|
||||
panelType: this.panelType,
|
||||
sequence,
|
||||
size: 24
|
||||
elementColumnName: 'ProductValue',
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
sequence: 10,
|
||||
isMandatory: true
|
||||
}
|
||||
}))
|
||||
|
||||
fieldsList.push(this.createField({
|
||||
})
|
||||
.then(metadata => {
|
||||
fieldsList.push(metadata)
|
||||
}).catch(error => {
|
||||
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
// Product Name
|
||||
this.createFieldFromDictionary({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
columnName: 'Name',
|
||||
definition: {
|
||||
name: 'Product Name',
|
||||
elementColumnName: 'ProductName',
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
sequence: 20,
|
||||
isReadOnly: true
|
||||
}
|
||||
})
|
||||
.then(metadata => {
|
||||
fieldsList.push(metadata)
|
||||
}).catch(error => {
|
||||
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
// Product Description
|
||||
this.createFieldFromDictionary({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
elementColumnName: 'ProductDescription',
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
sequence: 30,
|
||||
displayType: TEXT.id,
|
||||
panelType: this.panelType,
|
||||
sequence: sequenceIncrement(),
|
||||
size: 24
|
||||
isReadOnly: true
|
||||
}
|
||||
}))
|
||||
|
||||
fieldsList.push(this.createField({
|
||||
})
|
||||
.then(metadata => {
|
||||
fieldsList.push(metadata)
|
||||
}).catch(error => {
|
||||
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
// Price List
|
||||
this.createFieldFromDictionary({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
columnName: 'Description',
|
||||
definition: {
|
||||
name: 'Product Description',
|
||||
displayType: TEXT.id,
|
||||
panelType: this.panelType,
|
||||
sequence: sequenceIncrement(),
|
||||
size: 24
|
||||
elementColumnName: 'PriceList',
|
||||
overwriteDefinition: {
|
||||
size: 16,
|
||||
sequence: 40,
|
||||
isReadOnly: true
|
||||
}
|
||||
}))
|
||||
|
||||
fieldsList.push(this.createField({
|
||||
})
|
||||
.then(metadata => {
|
||||
fieldsList.push(metadata)
|
||||
}).catch(error => {
|
||||
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
// Tax Amount
|
||||
this.createFieldFromDictionary({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
columnName: 'Price',
|
||||
definition: {
|
||||
name: 'Price',
|
||||
displayType: COSTS_PLUS_PRICES.id,
|
||||
panelType: this.panelType,
|
||||
sequence: sequenceIncrement(),
|
||||
size: 16
|
||||
elementColumnName: 'TaxAmt',
|
||||
overwriteDefinition: {
|
||||
size: 8,
|
||||
sequence: 50,
|
||||
isReadOnly: true
|
||||
}
|
||||
}))
|
||||
|
||||
fieldsList.push(this.createField({
|
||||
})
|
||||
.then(metadata => {
|
||||
fieldsList.push(metadata)
|
||||
}).catch(error => {
|
||||
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
// Total
|
||||
this.createFieldFromDictionary({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
columnName: 'Tax',
|
||||
definition: {
|
||||
name: 'Tax',
|
||||
displayType: COSTS_PLUS_PRICES.id,
|
||||
panelType: this.panelType,
|
||||
sequence: sequenceIncrement(),
|
||||
size: 8
|
||||
elementColumnName: 'GrandTotal',
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
sequence: 60,
|
||||
isReadOnly: true
|
||||
}
|
||||
}))
|
||||
|
||||
fieldsList.push(this.createField({
|
||||
containerUuid: this.metadata.containerUuid,
|
||||
columnName: 'Total',
|
||||
definition: {
|
||||
name: 'Total',
|
||||
displayType: COSTS_PLUS_PRICES.id,
|
||||
panelType: this.panelType,
|
||||
sequence: sequenceIncrement(),
|
||||
size: 24
|
||||
}
|
||||
}))
|
||||
|
||||
})
|
||||
.then(metadata => {
|
||||
fieldsList.push(metadata)
|
||||
}).catch(error => {
|
||||
console.warn(`LookupFactory: Get Field From Server (State) - Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
this.metadataList = fieldsList
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Field from '@/components/ADempiere/Field'
|
||||
import { createField, createFieldDictionary } from '@/utils/ADempiere/lookupFactory'
|
||||
import { createFieldFromDefinition, createFieldFromDictionary } from '@/utils/ADempiere/lookupFactory'
|
||||
|
||||
export default {
|
||||
name: 'FormMixn',
|
||||
@ -26,8 +26,8 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createField,
|
||||
createFieldDictionary,
|
||||
createFieldFromDefinition,
|
||||
createFieldFromDictionary,
|
||||
getPanel() {
|
||||
const panel = this.getterPanel
|
||||
if (panel) {
|
||||
|
@ -198,6 +198,12 @@ function getFactoryFromField({
|
||||
if (!isEmptyValue(overwriteDefinition.defaultValueTo)) {
|
||||
fieldDefinition.defaultValueTo = overwriteDefinition.defaultValueTo
|
||||
}
|
||||
if (!isEmptyValue(overwriteDefinition.displayType)) {
|
||||
fieldDefinition.displayType = overwriteDefinition.displayType
|
||||
}
|
||||
if (!isEmptyValue(overwriteDefinition.size)) {
|
||||
fieldDefinition.size = overwriteDefinition.size
|
||||
}
|
||||
}
|
||||
// Convert it
|
||||
return createFieldFromDefinition({
|
||||
|
Loading…
x
Reference in New Issue
Block a user