1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +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"
:metadata-field="{
...fieldAttributes,
parentUuid: parentUuid,
displayColumn: scope.row['DisplayColumn_' + fieldAttributes.columnName],
tableIndex: scope.$index,
rowKey: scope.row[getterPanel.keyColumn],

View File

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

View File

@ -4,6 +4,7 @@
v-model="value"
:inactive-text="$t('components.switchInactiveText')"
:active-text="$t('components.switchActiveText')"
class="custom-field-yes-no"
:true-value="true"
:false-value="false"
:disabled="isDisabled"
@ -83,3 +84,9 @@ export default {
}
}
</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 translated from '@/components/ADempiere/Field/popover/translated'
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 { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils'
import { showMessage } from '@/utils/ADempiere/notification'
@ -94,18 +93,6 @@ export default {
calculator
},
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
metadataField: {
type: Object,
@ -144,7 +131,6 @@ export default {
fieldAttributes() {
return {
...this.field,
panelType: this.panelType,
inTable: this.inTable,
isAdvancedQuery: this.isAdvancedQuery,
// DOM properties
@ -176,8 +162,8 @@ export default {
return ''
},
getterIsShowedRecordNavigation() {
if (this.panelType === 'window') {
return this.$store.getters.getIsShowedRecordNavigation(this.parentUuid)
if (this.field.panelType === 'window') {
return this.$store.getters.getIsShowedRecordNavigation(this.field.parentUuid)
}
return false
},
@ -207,7 +193,8 @@ export default {
return newSizes
}
if (this.panelType === 'window') {
if (this.field.panelType === 'window') {
// TODO: Add FieldYesNo and name.length > 12 || 14
if (this.field.componentPath === 'FieldTextLong') {
return sizeField
}
@ -241,14 +228,14 @@ export default {
return sizeField
},
getterContextProcessing() {
const processing = this.$store.getters.getContextProcessing(this.parentUuid)
const processing = this.$store.getters.getContextProcessing(this.field.parentUuid)
if (processing === true || processing === 'Y') {
return true
}
return false
},
getterContextProcessed() {
const processed = this.$store.getters.getContextProcessed(this.parentUuid)
const processed = this.$store.getters.getContextProcessed(this.field.parentUuid)
if (processed === true || processed === 'Y') {
return true
}
@ -258,7 +245,7 @@ export default {
return this.$store.getters.getOrders
},
isDocuemntStatus() {
if (this.panelType === 'window') {
if (this.field.panelType === 'window') {
if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) {
return true
}
@ -300,7 +287,7 @@ export default {
const isUpdateableAllFields = this.field.isReadOnly || this.field.isReadOnlyFromLogic
if (this.panelType === 'window') {
if (this.field.panelType === 'window') {
if (this.field.isAlwaysUpdateable) {
return false
}
@ -319,7 +306,7 @@ export default {
}
return (!this.field.isUpdateable && isWithRecord) || (isUpdateableAllFields || this.field.isReadOnlyFromForm)
} else if (this.panelType === 'browser') {
} else if (this.field.panelType === 'browser') {
if (this.inTable) {
// browser result
return this.field.isReadOnly
@ -337,24 +324,11 @@ export default {
return this.field.isMandatory || this.field.isMandatoryFromLogic
},
isFieldOnly() {
if (this.inTable || this.field.isFieldOnly || this.verifyIsFieldOnly()) {
if (this.inTable || this.field.isFieldOnly) {
return undefined
}
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() {
if (this.isDisplayed && this.isMandatory() && !this.isReadOnly()) {
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 = [
{
id: 28,

View File

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