1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

feature/open-option-field-show-router (#819)

* add record access to the route

* Open Field Option Panel

* close clear type Action the router

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-07 15:33:21 -04:00 committed by GitHub
parent fb214ff034
commit a967a1f942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 93 additions and 4 deletions

View File

@ -217,6 +217,16 @@ export default {
this.clearVariables() this.clearVariables()
this.$children[0].visible = false this.$children[0].visible = false
this.$store.commit('changeShowRigthPanel', false) this.$store.commit('changeShowRigthPanel', false)
if (!this.isEmptyValue(this.$route.query.fieldColumnName)) {
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: '',
fieldColumnName: ''
}
}, () => {})
}
}) })
}, },
spanMethod({ row, column }) { spanMethod({ row, column }) {

View File

@ -109,6 +109,16 @@ export default {
}) })
} }
this.$store.commit('changeShowRigthPanel', false) this.$store.commit('changeShowRigthPanel', false)
if (!this.isEmptyValue(this.$route.query.fieldColumnName)) {
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: '',
fieldColumnName: ''
}
}, () => {})
}
} }
} }
} }

View File

@ -211,6 +211,16 @@ export default {
close() { close() {
this.$children[0].visible = false this.$children[0].visible = false
this.$store.commit('changeShowRigthPanel', false) this.$store.commit('changeShowRigthPanel', false)
if (!this.isEmptyValue(this.$route.query.fieldColumnName)) {
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: '',
fieldColumnName: ''
}
}, () => {})
}
}, },
remove() { remove() {
const isForCurrentUser = this.metadataList.find(field => field.columnName === 'AD_User_ID').value const isForCurrentUser = this.metadataList.find(field => field.columnName === 'AD_User_ID').value

View File

@ -64,7 +64,6 @@
placement="top" placement="top"
trigger="click" trigger="click"
style="padding: 0px;" style="padding: 0px;"
:hide="visibleForDesktop"
> >
<component <component
:is="optionFieldFComponentRender" :is="optionFieldFComponentRender"
@ -178,6 +177,21 @@
</el-submenu> </el-submenu>
</el-menu> </el-menu>
</template> </template>
<el-popover
v-if="openOptionField && !isEmptyValue(optionColumnName) && (optionColumnName === field.columnName) && showPopoverPath"
v-model="openOptionField"
placement="top-start"
width="400"
trigger="click"
>
<component
:is="optionFieldFComponentRender"
:field-attributes="fieldAttributes"
:source-field="fieldAttributes"
:field-value="valueField"
/>
<el-button slot="reference" type="text" :disabled="true" @click="openOptionField = !openOptionField" />
</el-popover>
<component <component
:is="componentRender" :is="componentRender"
:ref="field.columnName" :ref="field.columnName"
@ -242,7 +256,9 @@ export default {
return { return {
field: {}, field: {},
visibleForDesktop: false, visibleForDesktop: false,
triggerMenu: 'click' triggerMenu: 'click',
showPopoverPath: false,
optionColumnName: this.$route.query.fieldColumnName
} }
}, },
computed: { computed: {
@ -266,7 +282,9 @@ export default {
}, },
optionFieldFComponentRender() { optionFieldFComponentRender() {
let component let component
switch (this.contextMenuField.name) { const option = this.optionField.find(option => this.$route.query.typeAction === option.name)
const nameComponent = this.isEmptyValue(option) ? this.contextMenuField.name : this.$route.query.typeAction
switch (nameComponent) {
case this.$t('field.info'): case this.$t('field.info'):
component = () => import('@/components/ADempiere/Field/contextMenuField/contextInfo') component = () => import('@/components/ADempiere/Field/contextMenuField/contextInfo')
break break
@ -579,6 +597,28 @@ export default {
containerUuid: this.fieldAttributes.containerUuid, containerUuid: this.fieldAttributes.containerUuid,
columnName: this.fieldAttributes.columnName columnName: this.fieldAttributes.columnName
}) })
},
openOptionField: {
get() {
const option = this.optionField.find(option => this.$route.query.typeAction === option.name)
if (!this.isEmptyValue(this.$route.query) && option) {
return true
}
return false
},
set(value) {
if (!value) {
this.showPopoverPath = false
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: '',
fieldColumnName: ''
}
}, () => {})
}
}
} }
}, },
watch: { watch: {
@ -587,9 +627,17 @@ export default {
}, },
metadataField(value) { metadataField(value) {
this.field = value this.field = value
},
openOptionField(value) {
if (!value) {
this.showPopoverPath = false
}
} }
}, },
created() { created() {
this.timeOut = setTimeout(() => {
this.showPopoverPath = true
}, 2000)
// assined field with prop // assined field with prop
this.field = this.metadataField this.field = this.metadataField
if (this.field.isCustomField && !this.field.componentPath) { if (this.field.isCustomField && !this.field.componentPath) {
@ -628,6 +676,14 @@ export default {
this.$store.commit('changeShowRigthPanel', true) this.$store.commit('changeShowRigthPanel', true)
} else { } else {
this.visibleForDesktop = true this.visibleForDesktop = true
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: key,
fieldColumnName: this.field.columnName
}
}, () => {})
} }
this.$store.commit('changeShowPopoverField', true) this.$store.commit('changeShowPopoverField', true)
this.$store.dispatch('setOptionField', option) this.$store.dispatch('setOptionField', option)
@ -766,6 +822,9 @@ export default {
</style> </style>
<style lang="scss"> <style lang="scss">
.el-popover {
position: fixed;
}
.custom-tittle-popover { .custom-tittle-popover {
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;

View File

@ -243,7 +243,7 @@ export default {
return this.$store.getters.getWindow(this.windowUuid) return this.$store.getters.getWindow(this.windowUuid)
}, },
isShowedTabsChildren() { isShowedTabsChildren() {
if (this.windowMetadata && this.windowMetadata.isShowedTabsChildren) { if (this.windowMetadata && this.windowMetadata.isShowedTabsChildren && this.isEmptyValue(this.$route.query.typeAction)) {
return this.windowMetadata.isShowedTabsChildren return this.windowMetadata.isShowedTabsChildren
} }
return false return false