1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

add context info the field (#834)

* add context info the field

* change traslation

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-11 17:44:31 -04:00 committed by GitHub
parent 50d51b7328
commit cae76f3016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 11 deletions

View File

@ -26,6 +26,9 @@
</div>
<el-scrollbar wrap-class="scroll-child">
<el-form ref="form" label-position="top" label-width="120px" style="overflow: auto;" @submit.native.prevent="notSubmitForm">
<el-form-item v-if="!isEmptyValue(messageText)" :label="$t('field.contextInfo')">
{{ messageText }}
</el-form-item>
<el-form-item :label="$t('field.container.description')">
{{ fieldAttributes.description }}
</el-form-item>
@ -50,6 +53,7 @@
<script>
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js'
import { parseContext } from '@/utils/ADempiere/contextUtils'
export default {
name: 'FieldContextInfo',
@ -71,6 +75,16 @@ export default {
computed: {
permissionRoutes() {
return this.$store.getters.permission_routes
},
messageText() {
if (!this.isEmptyValue(this.fieldAttributes.contextInfo.sqlStatement)) {
const contextInfo = this.$store.getters.getContextInfoField(this.fieldAttributes.contextInfo.uuid, this.fieldAttributes.contextInfo.sqlStatement)
if (this.isEmptyValue(contextInfo)) {
return ''
}
return contextInfo.messageText
}
return ''
}
},
watch: {
@ -78,6 +92,21 @@ export default {
this.value = value
}
},
created() {
if (this.isEmptyValue(this.messageText)) {
const sqlParse = parseContext({
parentUuid: this.fieldAttributes.parentUuid,
containerUuid: this.fieldAttributes.containerUuid,
value: this.fieldAttributes.contextInfo.sqlStatement,
isBooleanToString: true
})
this.$store.dispatch('getContextInfoValueFromServer', {
contextInfoId: this.fieldAttributes.contextInfo.id,
contextInfoUuid: this.fieldAttributes.contextInfo.uuid,
sqlStatement: sqlParse.value
})
}
},
methods: {
notSubmitForm(event) {
event.preventDefault()

View File

@ -71,7 +71,7 @@ export default {
this.edit = true
break
//
case 'informacion':
case 'Información':
break
}
},

View File

@ -332,6 +332,7 @@ export default {
preference: 'Preference',
logsField: 'Field Change Log',
logsFieldEmpty: 'The field is still unchanged',
contextInfo: 'Context Info',
codeTranslation: 'Translation Of ',
container: {
help: 'Help',

View File

@ -12,7 +12,7 @@ export default {
profile: 'Perfil',
ProcessActivity: 'Histórico Procesos',
withoutLog: 'No se Encontró Registro de Error ',
ProductInfo: 'Informacion de Producto',
ProductInfo: 'Información de Producto',
role: 'Rol',
organization: 'Organización',
warehouse: 'Almacén',
@ -303,11 +303,12 @@ export default {
},
field: {
field: 'Campo',
info: 'Informacion',
info: 'Información',
calculator: 'Calculadora',
preference: 'Preferencia',
codeTranslation: 'Traduccion de ',
logsField: 'Bitácora de Cambios',
contextInfo: 'Información del Contexto',
logsFieldEmpty: 'El campo no tiene cambios aún',
container: {
help: 'Ayuda',

View File

@ -731,16 +731,18 @@ const actions = {
contextInfoUuid,
sqlStatement
}) {
const contextInforField = getters.getContextInfoField(contextInfoUuid, sqlStatement)
if (contextInforField) {
return contextInforField
}
// const contextInforField = getters.getContextInfoField(contextInfoUuid, sqlStatement)
// console.log({ contextInforField })
// if (contextInforField) {
// return contextInforField
// }
return requestGetContextInfoValue({
id: contextInfoId,
uuid: contextInfoUuid,
query: sqlStatement
})
.then(contextInfoResponse => {
console.log({ contextInfoResponse })
commit('setContextInfoField', {
contextInfoUuid,
sqlStatement,

View File

@ -99,10 +99,11 @@ const getters = {
return selectionToServer
},
getContextInfoField: (state) => (contextInfoUuid, sqlStatement) => {
return state.contextInfoField.find(info =>
info.contextInfoUuid === contextInfoUuid &&
info.sqlStatement === sqlStatement
)
return state.contextInfoField.find(info => {
if ((info.contextInfoUuid === contextInfoUuid) && (info.sqlStatement === sqlStatement)) {
return info
}
})
},
getRecordPrivateAccess: (state) => (tableName, recordId) => {
if (!isEmptyValue(tableName) && !isEmptyValue(recordId)) {