Add ListRecordChat and ListChatEntries (#272)
* creating structure for the service * structure container info * waiting for service * service test * Support record Log of container info * style of the option Change Detail * Text formats * add color to event type * Add Disable of textLong * change style text long * Add service the ListRecordChats and ListChatEntries * Support Workflow * changing translationpull/3759/head
parent
16f74a429e
commit
99d49b91fc
|
@ -425,6 +425,17 @@ export function requestListWorkflowsLogs({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function requestListWorkflows({
|
||||||
|
tableName,
|
||||||
|
pageToken,
|
||||||
|
pageSize
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).requestListWorkflows({
|
||||||
|
tableName,
|
||||||
|
pageToken,
|
||||||
|
pageSize
|
||||||
|
})
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param {string} tableName
|
* @param {string} tableName
|
||||||
* @param {integer} recordId
|
* @param {integer} recordId
|
||||||
|
|
|
@ -273,15 +273,7 @@ export default {
|
||||||
notes: 'Notes',
|
notes: 'Notes',
|
||||||
changeLog: 'Change Log',
|
changeLog: 'Change Log',
|
||||||
workflowLog: 'Workflow Log',
|
workflowLog: 'Workflow Log',
|
||||||
changeDetail: 'Change Detail',
|
changeDetail: 'Detalle del cambio'
|
||||||
eventType: {
|
|
||||||
insert: 'Insert',
|
|
||||||
update: 'Update',
|
|
||||||
delete: 'Delete',
|
|
||||||
field: 'The Field',
|
|
||||||
newValue: 'New Value',
|
|
||||||
oldValue: 'Old Value'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -248,15 +248,7 @@ export default {
|
||||||
notes: 'Notas',
|
notes: 'Notas',
|
||||||
changeLog: 'Histórico de Cambios',
|
changeLog: 'Histórico de Cambios',
|
||||||
workflowLog: 'Histórico de Flujo de Trabajo',
|
workflowLog: 'Histórico de Flujo de Trabajo',
|
||||||
changeDetail: 'Detalle del cambio',
|
changeDetail: 'Detalle del cambio'
|
||||||
eventType: {
|
|
||||||
insert: 'Se Creo',
|
|
||||||
update: 'Se Actualizo',
|
|
||||||
delete: 'Eliminar',
|
|
||||||
field: 'El Campo',
|
|
||||||
newValue: 'Nuevo Valor',
|
|
||||||
oldValue: 'Antiguo Valor'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
import { requestListRecordsLogs, requestListWorkflowsLogs, requestListRecordChats, requestListChatEntries } from '@/api/ADempiere/data'
|
import { requestListRecordsLogs, requestListWorkflowsLogs, requestListWorkflows, requestListRecordChats, requestListChatEntries } from '@/api/ADempiere/data'
|
||||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
|
|
||||||
|
|
||||||
const containerInfo = {
|
const containerInfo = {
|
||||||
state: {
|
state: {
|
||||||
listworkflowLog: [],
|
listworkflowLog: [],
|
||||||
listRecordLogs: [],
|
listRecordLogs: [],
|
||||||
listRecordChats: [],
|
listRecordChats: [],
|
||||||
listChatEntries: []
|
listChatEntries: [],
|
||||||
|
ListWorkflows: []
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addListWorkflow(state, payload) {
|
addListWorkflow(state, payload) {
|
||||||
state.listworkflowLog = payload
|
state.listworkflowLog = payload
|
||||||
},
|
},
|
||||||
|
addListWorkflows(state, payload) {
|
||||||
|
state.listworkflows = payload
|
||||||
|
},
|
||||||
addListRecordLogs(state, payload) {
|
addListRecordLogs(state, payload) {
|
||||||
state.listRecordLogs = payload
|
state.listRecordLogs = payload
|
||||||
},
|
},
|
||||||
|
@ -23,14 +26,35 @@ const containerInfo = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
listWorkflowLogs({ commit, state }, params) {
|
listWorkflowLogs({ commit, state, dispatch }, params) {
|
||||||
const tableName = params.tableName
|
const tableName = params.tableName
|
||||||
const recordId = params.recordId
|
const recordId = params.recordId
|
||||||
const pageSize = 0
|
const pageSize = 0
|
||||||
const pageToken = 0
|
const pageToken = 0
|
||||||
|
dispatch('listWorkflows', {
|
||||||
|
tableName: tableName
|
||||||
|
})
|
||||||
return requestListWorkflowsLogs({ tableName, recordId, pageSize, pageToken })
|
return requestListWorkflowsLogs({ tableName, recordId, pageSize, pageToken })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('addListWorkflow', response)
|
var workflowLog = {
|
||||||
|
recordCount: response.recordCount,
|
||||||
|
workflowLogsList: response.workflowLogsList,
|
||||||
|
nextPageToken: response.nextPageToken
|
||||||
|
}
|
||||||
|
commit('addListWorkflow', workflowLog)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(`Error getting List workflow: ${error.message}. Code: ${error.code}.`)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
listWorkflows({ commit, state }, params) {
|
||||||
|
const tableName = params.tableName
|
||||||
|
const pageSize = 0
|
||||||
|
const pageToken = 0
|
||||||
|
return requestListWorkflows({ tableName, pageSize, pageToken })
|
||||||
|
.then(response => {
|
||||||
|
console.log(response)
|
||||||
|
commit('addListWorkflows', response)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error getting List workflow: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting List workflow: ${error.message}. Code: ${error.code}.`)
|
||||||
|
@ -53,26 +77,39 @@ const containerInfo = {
|
||||||
console.warn(`Error getting List Record Logs: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting List Record Logs: ${error.message}. Code: ${error.code}.`)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
listChatEntries({ commit }, params) {
|
listChatEntries({ commit, state, dispatch }, params) {
|
||||||
const tableName = params.tableName
|
const tableName = params.tableName
|
||||||
const recordId = params.recordId
|
const recordId = params.recordId
|
||||||
const pageSize = 0
|
const pageSize = 0
|
||||||
const pageToken = 0
|
const pageToken = 0
|
||||||
return requestListRecordChats({ tableName, recordId, pageSize, pageToken })
|
return requestListRecordChats({ tableName, recordId, pageSize, pageToken })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('addListChatEntries', response)
|
var listRecordChats = {
|
||||||
|
recordChatsList: response.recordChatsList,
|
||||||
|
recordCount: response.recordCount,
|
||||||
|
nextPageToken: response.nextPageToken
|
||||||
|
}
|
||||||
|
dispatch('listRecordChat', {
|
||||||
|
chatUuid: response.recordChatsList[0].chatUuid
|
||||||
|
})
|
||||||
|
commit('addListRecordChats', listRecordChats)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
listRecordChat({ commit }, params) {
|
listRecordChat({ commit, state }, params) {
|
||||||
const uuid = params.uuid
|
const uuid = params.chatUuid
|
||||||
const pageSize = 0
|
const pageSize = 0
|
||||||
const pageToken = 0
|
const pageToken = 0
|
||||||
return requestListChatEntries({ uuid, pageSize, pageToken })
|
return requestListChatEntries({ uuid, pageSize, pageToken })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('addListChatEntries', response)
|
var lisChat = {
|
||||||
|
chatEntriesList: response.chatEntriesList,
|
||||||
|
recordCount: response.recordCount,
|
||||||
|
nextPageToken: response.nextPageToken
|
||||||
|
}
|
||||||
|
commit('addListChatEntries', lisChat)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`)
|
||||||
|
@ -84,50 +121,11 @@ const containerInfo = {
|
||||||
return state.listworkflowLog.workflowLogsList
|
return state.listworkflowLog.workflowLogsList
|
||||||
},
|
},
|
||||||
getRecordLogs: (state) => {
|
getRecordLogs: (state) => {
|
||||||
const recordLogs = state.listRecordLogs.recorLogs
|
|
||||||
if (isEmptyValue(recordLogs)) {
|
|
||||||
const listRecord = [{
|
|
||||||
columnName: 'Compañía',
|
|
||||||
description: 'Compañía',
|
|
||||||
displayColumnName: 'Compañía',
|
|
||||||
eventType: 0,
|
|
||||||
eventTypeName: 'INSERT',
|
|
||||||
logDate: 0,
|
|
||||||
logUuid: 'e0c976cc-b49e-40fd-b52b-f2f5020436f6',
|
|
||||||
newDisplayValue: '',
|
|
||||||
newValue: '',
|
|
||||||
oldDisplayValue: '',
|
|
||||||
oldValue: '',
|
|
||||||
recordId: 100000,
|
|
||||||
sessionUuid: '',
|
|
||||||
tableName: '',
|
|
||||||
transactionName: '',
|
|
||||||
userName: '',
|
|
||||||
userUuid: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
columnName: 'Compañía',
|
|
||||||
description: 'Compañía',
|
|
||||||
displayColumnName: 'Compañía',
|
|
||||||
eventType: 0,
|
|
||||||
eventTypeName: 'INSERT',
|
|
||||||
logDate: 0,
|
|
||||||
logUuid: 'e0c976cc-b49e-40fd-b52b-f2f5020436f6',
|
|
||||||
newDisplayValue: '',
|
|
||||||
newValue: '',
|
|
||||||
oldDisplayValue: '',
|
|
||||||
oldValue: '',
|
|
||||||
recordId: 100000,
|
|
||||||
sessionUuid: '',
|
|
||||||
tableName: '',
|
|
||||||
transactionName: '',
|
|
||||||
userName: '',
|
|
||||||
userUuid: ''
|
|
||||||
}]
|
|
||||||
return listRecord
|
|
||||||
}
|
|
||||||
return state.listRecordLogs
|
return state.listRecordLogs
|
||||||
},
|
},
|
||||||
|
getListRecordChats: (state) => {
|
||||||
|
return state.listRecordChats
|
||||||
|
},
|
||||||
getChatEntries: (state) => {
|
getChatEntries: (state) => {
|
||||||
return state.listChatEntries
|
return state.listChatEntries
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,54 +158,136 @@
|
||||||
style="overflow: auto;max-height: 74vh;"
|
style="overflow: auto;max-height: 74vh;"
|
||||||
>
|
>
|
||||||
<span slot="label"><svg-icon icon-class="tree-table" /> {{ $t('window.containerInfo.changeLog') }} </span>
|
<span slot="label"><svg-icon icon-class="tree-table" /> {{ $t('window.containerInfo.changeLog') }} </span>
|
||||||
<el-card
|
<div
|
||||||
v-for="(listLogs, index) in getTypeLogs"
|
v-if="getIsChangeLog"
|
||||||
:key="index"
|
|
||||||
>
|
>
|
||||||
<el-timeline>
|
<el-card
|
||||||
<el-timeline-item
|
v-for="(listLogs, index) in getTypeLogs"
|
||||||
v-for="(evenType, key) in listLogs.logs"
|
:key="index"
|
||||||
:key="key"
|
>
|
||||||
:timestamp="translateDate(evenType.logDate)"
|
<el-timeline>
|
||||||
placement="top"
|
<el-timeline-item
|
||||||
:color="listLogs.eventTypeName === 'UPDATE' ? 'rgb(22, 130, 230)' : '#52c384'"
|
v-for="(evenType, key) in listLogs.logs"
|
||||||
>
|
:key="key"
|
||||||
<el-card shadow="hover" @click.native="changeField(evenType)">
|
:timestamp="translateDate(evenType.logDate)"
|
||||||
<div>
|
placement="top"
|
||||||
<span>{{ evenType.userName }}</span>
|
:color="listLogs.eventType === 1 ? 'rgb(22, 130, 230)' : 'rgba(67, 147, 239, 1)'"
|
||||||
<el-dropdown style="float: right;">
|
>
|
||||||
<span class="el-dropdown-link" style="color: #1682e6" @click="showkey(key)">
|
<el-card shadow="hover" @click.native="changeField(evenType)">
|
||||||
{{ $t('window.containerInfo.changeDetail') }}
|
<div>
|
||||||
</span>
|
<span>{{ evenType.userName }}</span>
|
||||||
</el-dropdown>
|
<el-dropdown style="float: right;">
|
||||||
</div>
|
<span class="el-dropdown-link" style="color: #1682e6" @click="showkey(key)">
|
||||||
<br>
|
{{ $t('window.containerInfo.changeDetail') }}
|
||||||
<el-collapse-transition>
|
</span>
|
||||||
<div v-show="currentKey === key" :key="key" class="text item">
|
</el-dropdown>
|
||||||
<span><p><b><i> {{ evenType.displayColumnName }}: </i></b> <strike>{{ evenType.oldDisplayValue }} </strike> {{ evenType.newDisplayValue }}</p></span>
|
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-transition>
|
<br>
|
||||||
</el-card>
|
<el-collapse-transition>
|
||||||
</el-timeline-item>
|
<div v-show="currentKey === key" :key="key" class="text item">
|
||||||
</el-timeline>
|
<span><p><b><i> {{ evenType.displayColumnName }}: </i></b> <strike>{{ evenType.oldDisplayValue }} </strike> {{ evenType.newDisplayValue }}</p></span>
|
||||||
</el-card>
|
</div>
|
||||||
|
</el-collapse-transition>
|
||||||
|
</el-card>
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
v-loading="true"
|
||||||
|
:element-loading-text="$t('notifications.loading')"
|
||||||
|
element-loading-spinner="el-icon-loading"
|
||||||
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
||||||
|
class="loading-window"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
name="listWorkflowLogs"
|
name="listWorkflowLogs"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span slot="label"><i class="el-icon-s-help" /> {{ $t('window.containerInfo.workflowLog') }} </span>
|
<span slot="label"><i class="el-icon-s-help" /> {{ $t('window.containerInfo.workflowLog') }} </span>
|
||||||
<el-card
|
<div
|
||||||
class="box-card"
|
v-if="getIsWorkflowLog"
|
||||||
style="overflow: auto;height: 50vh;"
|
|
||||||
>
|
>
|
||||||
{{ gettersrecorCount }}
|
<el-card
|
||||||
</el-card>
|
class="box-card"
|
||||||
|
>
|
||||||
|
<el-timeline>
|
||||||
|
<el-timeline-item
|
||||||
|
v-for="(workflow,index) in gettersListWorkflow"
|
||||||
|
:key="index"
|
||||||
|
:timestamp="translateDate(workflow.logDate)"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span> {{ workflow.workflowName }} </span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-steps
|
||||||
|
:space="200"
|
||||||
|
:active="workflow.workflowState"
|
||||||
|
align-center
|
||||||
|
process-status="process"
|
||||||
|
>
|
||||||
|
<el-step
|
||||||
|
v-for="(nodeList, key) in workflow.workflowEventsList"
|
||||||
|
:key="key"
|
||||||
|
:title="nodeList.nodeName"
|
||||||
|
:description="$t('login.userName')+ '' + nodeList.userName"
|
||||||
|
/>
|
||||||
|
</el-steps>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
v-loading="true"
|
||||||
|
:element-loading-text="$t('notifications.loading')"
|
||||||
|
element-loading-spinner="el-icon-loading"
|
||||||
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
||||||
|
class="loading-window"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
name="listChatEntries"
|
name="listChatEntries"
|
||||||
>
|
>
|
||||||
<span slot="label"><i class="el-icon-s-comment" /> {{ $t('window.containerInfo.notes') }} </span>
|
<span slot="label"><i class="el-icon-s-comment" /> {{ $t('window.containerInfo.notes') }} </span>
|
||||||
|
<div
|
||||||
|
v-if="getIsChat"
|
||||||
|
>
|
||||||
|
<el-card class="box-card">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>{{ $t('window.containerInfo.notes') }} {{ gettersLisRecordChats[0].description }} </span>
|
||||||
|
</div>
|
||||||
|
<el-timeline>
|
||||||
|
<el-timeline-item
|
||||||
|
v-for="(chats, key) in gettersLischat"
|
||||||
|
:key="key"
|
||||||
|
:timestamp="translateDate(chats.logDate)"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<div>
|
||||||
|
<span>{{ chats.userName }}</span>
|
||||||
|
<span>{{ chats.characterData }}</span>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
v-loading="true"
|
||||||
|
:element-loading-text="$t('notifications.loading')"
|
||||||
|
element-loading-spinner="el-icon-loading"
|
||||||
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
||||||
|
class="loading-window"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -366,21 +448,49 @@ export default {
|
||||||
gettersListRecordLogs() {
|
gettersListRecordLogs() {
|
||||||
return this.$store.getters.getRecordLogs.recorLogs
|
return this.$store.getters.getRecordLogs.recorLogs
|
||||||
},
|
},
|
||||||
|
getIsChangeLog() {
|
||||||
|
if (this.isEmptyValue(this.gettersListRecordLogs)) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getIsWorkflowLog() {
|
||||||
|
if (this.isEmptyValue(this.gettersListWorkflow)) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getIsChat() {
|
||||||
|
if (this.isEmptyValue(this.gettersLischat)) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
getTypeLogs() {
|
getTypeLogs() {
|
||||||
const reducer = this.gettersListRecordLogs.reduce((reducer, item) => {
|
const reducer = this.gettersListRecordLogs.reduce((reducer, item) => {
|
||||||
if (!reducer.includes(item.eventTypeName)) {
|
if (!reducer.includes(item.logId)) {
|
||||||
reducer.push(item.eventTypeName)
|
reducer.push(item.logId)
|
||||||
}
|
}
|
||||||
return reducer
|
return reducer
|
||||||
}, [])
|
}, [])
|
||||||
.map(i => {
|
.map(i => {
|
||||||
// agrup for logId
|
// agrup for logId
|
||||||
return {
|
return {
|
||||||
logs: this.gettersListRecordLogs.filter(b => b.eventTypeName === i),
|
logs: this.gettersListRecordLogs.filter(b => b.logId === i),
|
||||||
eventTypeName: i
|
logId: i
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return reducer
|
return reducer
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
gettersLischat() {
|
||||||
|
return this.$store.getters.getChatEntries.chatEntriesList
|
||||||
|
},
|
||||||
|
gettersLisRecordChats() {
|
||||||
|
return this.$store.getters.getListRecordChats.recordChatsList
|
||||||
},
|
},
|
||||||
gettersListWorkflow() {
|
gettersListWorkflow() {
|
||||||
return this.$store.getters.getWorkflow
|
return this.$store.getters.getWorkflow
|
||||||
|
@ -427,9 +537,6 @@ export default {
|
||||||
},
|
},
|
||||||
conteInfo() {
|
conteInfo() {
|
||||||
this.show = !this.show
|
this.show = !this.show
|
||||||
this.$store.dispatch('listRecordChat', {
|
|
||||||
uuid: this.$route.query.action
|
|
||||||
})
|
|
||||||
this.$store.dispatch('listChatEntries', {
|
this.$store.dispatch('listChatEntries', {
|
||||||
tableName: this.$route.params.tableName,
|
tableName: this.$route.params.tableName,
|
||||||
recordId: this.$route.params.recordId
|
recordId: this.$route.params.recordId
|
||||||
|
@ -444,9 +551,6 @@ export default {
|
||||||
},
|
},
|
||||||
handleClick(tab, event) {
|
handleClick(tab, event) {
|
||||||
if (tab.name === 'listChatEntries') {
|
if (tab.name === 'listChatEntries') {
|
||||||
this.$store.dispatch('listRecordChat', {
|
|
||||||
uuid: this.$route.query.action
|
|
||||||
})
|
|
||||||
this.$store.dispatch(tab.name, {
|
this.$store.dispatch(tab.name, {
|
||||||
tableName: this.$route.params.tableName,
|
tableName: this.$route.params.tableName,
|
||||||
recordId: this.$route.params.recordId
|
recordId: this.$route.params.recordId
|
||||||
|
|
Loading…
Reference in New Issue