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