1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +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> </div>
<el-scrollbar wrap-class="scroll-child"> <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 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')"> <el-form-item :label="$t('field.container.description')">
{{ fieldAttributes.description }} {{ fieldAttributes.description }}
</el-form-item> </el-form-item>
@ -50,6 +53,7 @@
<script> <script>
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js' import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js'
import { parseContext } from '@/utils/ADempiere/contextUtils'
export default { export default {
name: 'FieldContextInfo', name: 'FieldContextInfo',
@ -71,6 +75,16 @@ export default {
computed: { computed: {
permissionRoutes() { permissionRoutes() {
return this.$store.getters.permission_routes 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: { watch: {
@ -78,6 +92,21 @@ export default {
this.value = value 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: { methods: {
notSubmitForm(event) { notSubmitForm(event) {
event.preventDefault() event.preventDefault()

View File

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

View File

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

View File

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

View File

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

View File

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