Support add comment (#291)

* Support add comment

* add traslation

* add chat

* change color of parrafo
pull/3759/head
elsiosanchez 2020-01-31 18:00:31 -04:00 committed by GitHub
parent 7870fdbfab
commit e4729a4841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 38 deletions

View File

@ -484,3 +484,15 @@ export function requestListChatEntries({ uuid, pageToken, pageSize }) {
pageSize pageSize
}) })
} }
/**
* @param {string} tableName
* @param {string} recordId
* @param {string} comment
*/
export function requestCreateChatEntry({ tableName, recordId, comment }) {
return Instance.call(this).requestCreateChatEntry({
tableName,
recordId,
comment
})
}

View File

@ -278,7 +278,8 @@ export default {
message: 'Message', message: 'Message',
responsible: 'Responsible', responsible: 'Responsible',
workflowName: 'Name of Workflow Status', workflowName: 'Name of Workflow Status',
timeElapsed: 'Time Elapsed' timeElapsed: 'Time Elapsed',
addNote: 'Notas'
} }
} }
}, },

View File

@ -253,7 +253,8 @@ export default {
message: 'Mensaje', message: 'Mensaje',
responsible: 'Responsable', responsible: 'Responsable',
workflowName: 'Nombre de estado del flujo de trabajo', workflowName: 'Nombre de estado del flujo de trabajo',
timeElapsed: 'Tiempo transcurrido' timeElapsed: 'Tiempo transcurrido',
addNote: 'Notas'
} }
} }
}, },

View File

@ -1,4 +1,5 @@
import { requestListRecordsLogs, requestListWorkflowsLogs, requestListWorkflows, requestListRecordChats, requestListChatEntries } from '@/api/ADempiere/data' import { requestListRecordsLogs, requestListWorkflowsLogs, requestListWorkflows, requestListRecordChats, requestListChatEntries, requestCreateChatEntry } from '@/api/ADempiere/data'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
const containerInfo = { const containerInfo = {
state: { state: {
@ -6,7 +7,8 @@ const containerInfo = {
listRecordLogs: [], listRecordLogs: [],
listRecordChats: [], listRecordChats: [],
listChatEntries: [], listChatEntries: [],
ListWorkflows: [] listWorkflows: [],
note: []
}, },
mutations: { mutations: {
addListWorkflow(state, payload) { addListWorkflow(state, payload) {
@ -23,9 +25,25 @@ const containerInfo = {
}, },
addListChatEntries(state, payload) { addListChatEntries(state, payload) {
state.listChatEntries = payload state.listChatEntries = payload
},
addNote(state, payload) {
state.note = payload
} }
}, },
actions: { actions: {
createChatEntry({ commit, dispatch }, params) {
const tableName = params.tableName
const recordId = params.recordId
const comment = params.comment
return requestCreateChatEntry({ tableName, recordId, comment })
.then(response => {
dispatch('listChatEntries', {
tableName: params.tableName,
recordId: params.recordId
})
commit('addNote', response)
})
},
listWorkflowLogs({ commit, state, dispatch }, params) { listWorkflowLogs({ commit, state, dispatch }, params) {
const tableName = params.tableName const tableName = params.tableName
const recordId = params.recordId const recordId = params.recordId
@ -68,7 +86,8 @@ const containerInfo = {
.then(response => { .then(response => {
var listRecord = { var listRecord = {
recordCount: response.recordCount, recordCount: response.recordCount,
recorLogs: response.recordLogsList recorLogs: response.recordLogsList,
epale: true
} }
commit('addListRecordLogs', listRecord) commit('addListRecordLogs', listRecord)
}) })
@ -83,15 +102,16 @@ const containerInfo = {
const pageToken = 0 const pageToken = 0
return requestListRecordChats({ tableName, recordId, pageSize, pageToken }) return requestListRecordChats({ tableName, recordId, pageSize, pageToken })
.then(response => { .then(response => {
var listRecordChats = { var listRecord = {
recordChatsList: response.recordChatsList, recordChatsList: response.recordChatsList,
recordCount: response.recordCount, recordCount: response.recordCount,
epale: isEmptyValue(response.recordChatsList),
nextPageToken: response.nextPageToken nextPageToken: response.nextPageToken
} }
dispatch('listRecordChat', { dispatch('listRecordChat', {
chatUuid: response.recordChatsList[0].chatUuid chatUuid: response.recordChatsList[0].chatUuid
}) })
commit('addListRecordChats', listRecordChats) commit('addListRecordChats', listRecord)
}) })
.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}.`)

View File

@ -183,7 +183,7 @@
<el-collapse-transition> <el-collapse-transition>
<div v-show="(currentKey === key)"> <div v-show="(currentKey === key)">
<span v-for="(list, index) in listLogs.changeLogs" :key="index"> <span v-for="(list, index) in listLogs.changeLogs" :key="index">
<p><b> {{ list.displayColumnName }} :</b> <strike> {{ list.oldDisplayValue }} </strike> {{ list.newDisplayValue }} </p> <p><b> {{ list.displayColumnName }} :</b> <strike> <el-link type="danger"> {{ list.oldDisplayValue }} </el-link> </strike> <el-link type="success"> {{ list.newDisplayValue }} </el-link> </p>
</span> </span>
</div> </div>
</el-collapse-transition> </el-collapse-transition>
@ -270,11 +270,11 @@
> >
<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 <div
v-if="getIsChat" v-if="!gettersLisRecordChats.epale"
> >
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ $t('window.containerInfo.notes') }} {{ gettersLisRecordChats[0].description }} </span> <span>{{ $t('window.containerInfo.notes') }}</span>
</div> </div>
<el-scrollbar wrap-class="scroll-window-log-chat"> <el-scrollbar wrap-class="scroll-window-log-chat">
<el-timeline> <el-timeline>
@ -295,14 +295,20 @@
</el-scrollbar> </el-scrollbar>
</el-card> </el-card>
</div> </div>
<div <div>
v-else <el-card class="box-card">
v-loading="true" <div slot="header" class="clearfix">
:element-loading-text="$t('notifications.loading')" {{ $t('window.containerInfo.logWorkflow.addNote') }}
element-loading-spinner="el-icon-loading" </div>
element-loading-background="rgba(255, 255, 255, 0.8)" <el-input
class="loading-window" v-model="chatNote"
/> type="chatNote"
:rows="2"
placeholder="Please input"
@keyup.enter.native="sendComment(chatNote)"
/>
</el-card>
</div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
@ -354,6 +360,7 @@ export default {
isPanel: false, isPanel: false,
activeInfo: 'listRecordLogs', activeInfo: 'listRecordLogs',
show: false, show: false,
chatNote: '',
typeAction: 0, typeAction: 0,
isLoadingFromServer: false, isLoadingFromServer: false,
listRecordNavigation: 0, listRecordNavigation: 0,
@ -468,23 +475,20 @@ export default {
getIsChangeLog() { getIsChangeLog() {
if (this.isEmptyValue(this.gettersListRecordLogs)) { if (this.isEmptyValue(this.gettersListRecordLogs)) {
return false return false
} else {
return true
} }
return true
}, },
getIsWorkflowLog() { getIsWorkflowLog() {
if (this.isEmptyValue(this.gettersListWorkflow)) { if (this.isEmptyValue(this.gettersListWorkflow)) {
return false return false
} else {
return true
} }
return true
}, },
getIsChat() { getIsChat() {
if (this.isEmptyValue(this.gettersLischat)) { if (this.isEmptyValue(this.gettersLisRecordChats)) {
return false return false
} else {
return true
} }
return true
}, },
getTypeLogs() { getTypeLogs() {
const groupLog = this.gettersListRecordLogs.reduce((groupLog, item) => { const groupLog = this.gettersListRecordLogs.reduce((groupLog, item) => {
@ -506,7 +510,7 @@ export default {
return this.$store.getters.getChatEntries.chatEntriesList return this.$store.getters.getChatEntries.chatEntriesList
}, },
gettersLisRecordChats() { gettersLisRecordChats() {
return this.$store.getters.getListRecordChats.recordChatsList return this.$store.getters.getListRecordChats
}, },
gettersListWorkflow() { gettersListWorkflow() {
return this.$store.getters.getWorkflow return this.$store.getters.getWorkflow
@ -522,6 +526,12 @@ export default {
} }
}, },
watch: { watch: {
$route(value) {
this.$store.dispatch('listChatEntries', {
tableName: value.params.tableName,
recordId: value.params.recordId
})
},
'this.$route.params'(newValue, oldValue) { 'this.$route.params'(newValue, oldValue) {
if (!this.isEmptyValue(newValue)) { if (!this.isEmptyValue(newValue)) {
this.getIsRecordLocked() this.getIsRecordLocked()
@ -532,6 +542,14 @@ export default {
this.getWindow() this.getWindow()
}, },
methods: { methods: {
sendComment(comment) {
this.$store.dispatch('createChatEntry', {
tableName: this.$route.params.tableName,
recordId: this.$route.params.recordId,
comment: comment
})
this.chatNote = ''
},
showkey(key, index) { showkey(key, index) {
if (key === this.currentKey && index === this.typeAction) { if (key === this.currentKey && index === this.typeAction) {
this.currentKey = 1000 this.currentKey = 1000
@ -566,17 +584,24 @@ export default {
} }
}, },
handleClick(tab, event) { handleClick(tab, event) {
if (tab.name === 'listChatEntries') { 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 })
}) },
} else { refres() {
this.$store.dispatch(tab.name, { this.$store.dispatch('listWorkflowLogs', {
tableName: this.$route.params.tableName, tableName: this.$route.params.tableName,
recordId: this.$route.params.recordId recordId: this.$route.params.recordId
}) })
} this.$store.dispatch('listRecordLogs', {
tableName: this.$route.params.tableName,
recordId: this.$route.params.recordId
})
this.$store.dispatch('listChatEntries', {
tableName: this.$route.params.tableName,
recordId: this.$route.params.recordId
})
}, },
// callback new size // callback new size
onDrag(size) { onDrag(size) {
@ -825,7 +850,7 @@ export default {
max-height: 68vh !important; max-height: 68vh !important;
} }
.scroll-window-log-chat { .scroll-window-log-chat {
max-height: 68vh !important; max-height: 45vh !important;
} }
.el-card__header { .el-card__header {
background: rgba(245, 247, 250, 0.75); background: rgba(245, 247, 250, 0.75);