1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-11 13:39:48 +08:00

fix: Zoom window in context info field. (#286)

This commit is contained in:
EdwinBetanc0urt 2020-01-29 19:53:58 -04:00 committed by GitHub
parent 5a38ada770
commit 5beca7630a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 56 deletions

View File

@ -1,7 +1,7 @@
<template>
<span>
<el-popover
v-if="(contextInfo && contextInfo.isActive) || reference.zoomWindowList.length"
v-if="(fieldAttributes.contextInfo && fieldAttributes.contextInfo.isActive) || fieldAttributes.reference.zoomWindowList.length"
ref="contextInfoField"
placement="top"
width="300"
@ -9,17 +9,17 @@
>
<p
class="pre-formatted"
v-html="contextInfo.messageText.msgText"
v-html="fieldAttributes.contextInfo.messageText.msgText"
/>
<div>
<span class="custom-tittle-popover">
{{ name }}
{{ fieldAttributes.name }}
</span>
<template v-if="!isEmptyValue(help)">
: {{ help }}
<template v-if="!isEmptyValue(fieldAttributes.help)">
: {{ fieldAttributes.help }}
</template>
</div>
<template v-for="(zoomItem, index) in reference.zoomWindowList">
<template v-for="(zoomItem, index) in fieldAttributes.reference.zoomWindowList">
<el-button
:key="index"
type="text"
@ -31,37 +31,22 @@
</template>
</el-popover>
<span v-popover:contextInfoField>
{{ name }}
{{ fieldAttributes.name }}
</span>
</span>
</template>
<script>
import { showMessage } from '@/utils/ADempiere/notification'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
export default {
name: 'FieldContextInfo',
props: {
contextInfo: {
fieldAttributes: {
type: Object,
required: true
},
reference: {
type: Object,
required: true
},
columnName: {
type: String,
required: true
},
name: {
type: String,
default: undefined
},
help: {
type: String,
default: undefined
},
fieldValue: {
type: [Number, String, Boolean, Array, Object, Date],
default: undefined
@ -85,18 +70,21 @@ export default {
methods: {
showMessage,
redirect({ window }) {
this.$store.dispatch('getWindowByUuid', {
routes: this.permissionRoutes,
windowUuid: window.uuid
const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes,
attributeValue: window.uuid,
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
const windowRoute = this.$store.getters.getWindowRoute(window.uuid)
if (windowRoute) {
if (viewSearch) {
this.$router.push({
name: windowRoute.name,
name: viewSearch.name,
query: {
action: 'advancedQuery',
tabParent: 0,
[this.columnName]: this.value
[this.fieldAttributes.columnName]: this.value
}
})
} else {

View File

@ -20,12 +20,8 @@
<template slot="label">
<field-context-info
v-if="(field.contextInfo && field.contextInfo.isActive) || field.reference.zoomWindowList.length"
:name="field.name"
:field-attributes="fieldAttributes"
:field-value="field.value"
:help="field.help"
:context-info="field.contextInfo"
:reference="field.reference"
:column-name="field.columnName"
/>
<template v-else>
{{ isFieldOnly() }}
@ -43,17 +39,7 @@
<component
:is="componentRender"
:ref="field.columnName"
:metadata="{
...field,
panelType,
inTable,
isAdvancedQuery,
// DOM properties
required: isMandatory(),
readonly: isReadOnly(),
displayed: isDisplayed(),
disabled: !field.isActive
}"
:metadata="fieldAttributes"
:value-model="recordDataFields"
/>
</el-form-item>
@ -63,15 +49,7 @@
v-else
key="table-template"
:class="classField"
:metadata="{
...field,
panelType,
inTable,
// DOM properties
required: isMandatory(),
readonly: isReadOnly(),
disabled: !field.isActive
}"
:metadata="fieldAttributes"
:value-model="recordDataFields"
/>
</template>
@ -144,6 +122,19 @@ export default {
componentRender() {
return () => import(`@/components/ADempiere/Field/${this.field.componentPath}`)
},
fieldAttributes() {
return {
...this.field,
panelType: this.panelType,
inTable: this.inTable,
isAdvancedQuery: this.isAdvancedQuery,
// DOM properties
required: this.isMandatory(),
readonly: this.isReadOnly(),
displayed: this.isDisplayed(),
disabled: !this.field.isActive
}
},
getWidth() {
return this.$store.getters.getWidthLayout
},