1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +08:00

fix: #398 Wrong distribution of field size. (#399)

This commit is contained in:
Edwin Betancourt 2020-03-11 21:40:05 -04:00 committed by GitHub
parent d03de8b2a2
commit f0f0c81f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 60 deletions

View File

@ -186,7 +186,6 @@
:in-table="true" :in-table="true"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
parentUuid: parentUuid,
displayColumn: scope.row['DisplayColumn_' + fieldAttributes.columnName], displayColumn: scope.row['DisplayColumn_' + fieldAttributes.columnName],
tableIndex: scope.$index, tableIndex: scope.$index,
rowKey: scope.row[getterPanel.keyColumn], rowKey: scope.row[getterPanel.keyColumn],

View File

@ -43,7 +43,7 @@ export default {
if (this.metadata.inTable) { if (this.metadata.inTable) {
return 1 return 1
} }
return 5 return 4
}, },
typeTextBox() { typeTextBox() {
// String, Url, FileName... // String, Url, FileName...

View File

@ -4,6 +4,7 @@
v-model="value" v-model="value"
:inactive-text="$t('components.switchInactiveText')" :inactive-text="$t('components.switchInactiveText')"
:active-text="$t('components.switchActiveText')" :active-text="$t('components.switchActiveText')"
class="custom-field-yes-no"
:true-value="true" :true-value="true"
:false-value="false" :false-value="false"
:disabled="isDisabled" :disabled="isDisabled"
@ -83,3 +84,9 @@ export default {
} }
} }
</script> </script>
<style>
.custom-field-yes-no {
min-height: 34px;
}
</style>

View File

@ -75,7 +75,6 @@ import documentStatus from '@/components/ADempiere/Field/popover/documentStatus'
import operatorComparison from '@/components/ADempiere/Field/popover/operatorComparison' import operatorComparison from '@/components/ADempiere/Field/popover/operatorComparison'
import translated from '@/components/ADempiere/Field/popover/translated' import translated from '@/components/ADempiere/Field/popover/translated'
import calculator from '@/components/ADempiere/Field/popover/calculator' import calculator from '@/components/ADempiere/Field/popover/calculator'
import { FIELD_ONLY } from '@/components/ADempiere/Field/references'
import { DEFAULT_SIZE } from '@/components/ADempiere/Field/fieldSize' import { DEFAULT_SIZE } from '@/components/ADempiere/Field/fieldSize'
import { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils' import { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils'
import { showMessage } from '@/utils/ADempiere/notification' import { showMessage } from '@/utils/ADempiere/notification'
@ -94,18 +93,6 @@ export default {
calculator calculator
}, },
props: { props: {
parentUuid: {
type: String,
default: ''
},
containerUuid: {
type: String,
default: ''
},
panelType: {
type: String,
default: 'window'
},
// receives the property that is an object with all the attributes // receives the property that is an object with all the attributes
metadataField: { metadataField: {
type: Object, type: Object,
@ -144,7 +131,6 @@ export default {
fieldAttributes() { fieldAttributes() {
return { return {
...this.field, ...this.field,
panelType: this.panelType,
inTable: this.inTable, inTable: this.inTable,
isAdvancedQuery: this.isAdvancedQuery, isAdvancedQuery: this.isAdvancedQuery,
// DOM properties // DOM properties
@ -176,8 +162,8 @@ export default {
return '' return ''
}, },
getterIsShowedRecordNavigation() { getterIsShowedRecordNavigation() {
if (this.panelType === 'window') { if (this.field.panelType === 'window') {
return this.$store.getters.getIsShowedRecordNavigation(this.parentUuid) return this.$store.getters.getIsShowedRecordNavigation(this.field.parentUuid)
} }
return false return false
}, },
@ -207,7 +193,8 @@ export default {
return newSizes return newSizes
} }
if (this.panelType === 'window') { if (this.field.panelType === 'window') {
// TODO: Add FieldYesNo and name.length > 12 || 14
if (this.field.componentPath === 'FieldTextLong') { if (this.field.componentPath === 'FieldTextLong') {
return sizeField return sizeField
} }
@ -241,14 +228,14 @@ export default {
return sizeField return sizeField
}, },
getterContextProcessing() { getterContextProcessing() {
const processing = this.$store.getters.getContextProcessing(this.parentUuid) const processing = this.$store.getters.getContextProcessing(this.field.parentUuid)
if (processing === true || processing === 'Y') { if (processing === true || processing === 'Y') {
return true return true
} }
return false return false
}, },
getterContextProcessed() { getterContextProcessed() {
const processed = this.$store.getters.getContextProcessed(this.parentUuid) const processed = this.$store.getters.getContextProcessed(this.field.parentUuid)
if (processed === true || processed === 'Y') { if (processed === true || processed === 'Y') {
return true return true
} }
@ -258,7 +245,7 @@ export default {
return this.$store.getters.getOrders return this.$store.getters.getOrders
}, },
isDocuemntStatus() { isDocuemntStatus() {
if (this.panelType === 'window') { if (this.field.panelType === 'window') {
if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) { if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) {
return true return true
} }
@ -300,7 +287,7 @@ export default {
const isUpdateableAllFields = this.field.isReadOnly || this.field.isReadOnlyFromLogic const isUpdateableAllFields = this.field.isReadOnly || this.field.isReadOnlyFromLogic
if (this.panelType === 'window') { if (this.field.panelType === 'window') {
if (this.field.isAlwaysUpdateable) { if (this.field.isAlwaysUpdateable) {
return false return false
} }
@ -319,7 +306,7 @@ export default {
} }
return (!this.field.isUpdateable && isWithRecord) || (isUpdateableAllFields || this.field.isReadOnlyFromForm) return (!this.field.isUpdateable && isWithRecord) || (isUpdateableAllFields || this.field.isReadOnlyFromForm)
} else if (this.panelType === 'browser') { } else if (this.field.panelType === 'browser') {
if (this.inTable) { if (this.inTable) {
// browser result // browser result
return this.field.isReadOnly return this.field.isReadOnly
@ -337,24 +324,11 @@ export default {
return this.field.isMandatory || this.field.isMandatoryFromLogic return this.field.isMandatory || this.field.isMandatoryFromLogic
}, },
isFieldOnly() { isFieldOnly() {
if (this.inTable || this.field.isFieldOnly || this.verifyIsFieldOnly()) { if (this.inTable || this.field.isFieldOnly) {
return undefined return undefined
} }
return this.field.name return this.field.name
}, },
/**
* TODO: Evaluate the current field with the only fields contained in the
* constant FIELD_ONLY
* @return {boolean}
*/
verifyIsFieldOnly() {
const field = FIELD_ONLY.find(itemField => {
if (this.field.displayType === itemField.id) {
return true
}
})
return Boolean(field)
},
focusField() { focusField() {
if (this.isDisplayed && this.isMandatory() && !this.isReadOnly()) { if (this.isDisplayed && this.isMandatory() && !this.isReadOnly()) {
this.$refs[this.field.columnName].activeFocus() this.$refs[this.field.columnName].activeFocus()

View File

@ -286,15 +286,6 @@ export const FIELD_RANGE = [
} }
] ]
export const FIELD_ONLY = [
{
id: 28,
type: 'Button',
description: 'Command Button - starts a process',
alias: ['Button']
}
]
export const FIELD_NOT_SHOWED = [ export const FIELD_NOT_SHOWED = [
{ {
id: 28, id: 28,

View File

@ -31,20 +31,17 @@
:shadow="shadowGroup" :shadow="shadowGroup"
:body-style="{ padding: '10px' }" :body-style="{ padding: '10px' }"
> >
<el-row :gutter="gutterRow"> <el-row>
<template v-for="(fieldAttributes, subKey) in firstGroup.metadataFields"> <template v-for="(fieldAttributes, subKey) in firstGroup.metadataFields">
<field-definition <field-definition
:ref="fieldAttributes.columnName" :ref="fieldAttributes.columnName"
:key="subKey" :key="subKey"
:parent-uuid="parentUuid"
:container-uuid="containerUuid"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
optionCRUD, optionCRUD,
recordUuid: uuidRecord recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType"
:in-group="!getterIsShowedRecordNavigation" :in-group="!getterIsShowedRecordNavigation"
:is-advanced-query="isAdvancedQuery" :is-advanced-query="isAdvancedQuery"
/> />
@ -90,20 +87,17 @@
/> />
</div> </div>
</div> </div>
<el-row :gutter="gutterRow"> <el-row>
<template v-for="(fieldAttributes, subKey) in item.metadataFields"> <template v-for="(fieldAttributes, subKey) in item.metadataFields">
<field-definition <field-definition
:ref="fieldAttributes.columnName" :ref="fieldAttributes.columnName"
:key="subKey" :key="subKey"
:parent-uuid="parentUuid"
:container-uuid="containerUuid"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
optionCRUD, optionCRUD,
recordUuid: uuidRecord recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType"
:in-group="isPanelWindow && fieldGroups.length > 1" :in-group="isPanelWindow && fieldGroups.length > 1"
:is-advanced-query="isAdvancedQuery" :is-advanced-query="isAdvancedQuery"
/> />
@ -143,20 +137,17 @@
/> />
</div> </div>
</div> </div>
<el-row :gutter="gutterRow"> <el-row>
<template v-for="(fieldAttributes, subKey) in item.metadataFields"> <template v-for="(fieldAttributes, subKey) in item.metadataFields">
<field-definition <field-definition
:ref="fieldAttributes.columnName" :ref="fieldAttributes.columnName"
:key="subKey" :key="subKey"
:parent-uuid="parentUuid"
:container-uuid="containerUuid"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
optionCRUD, optionCRUD,
recordUuid: uuidRecord recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType"
:in-group="isPanelWindow && fieldGroups.length > 1" :in-group="isPanelWindow && fieldGroups.length > 1"
/> />
</template> </template>
@ -228,7 +219,6 @@ export default {
return { return {
fieldList: [], fieldList: [],
dataRecords: {}, dataRecords: {},
gutterRow: 0,
isLoadPanel: false, isLoadPanel: false,
isLoadRecord: false, isLoadRecord: false,
uuidRecord: this.$route.query.action, uuidRecord: this.$route.query.action,