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
})
}
/**
* @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',
responsible: 'Responsible',
workflowName: 'Name of Workflow Status',
timeElapsed: 'Time Elapsed'
timeElapsed: 'Time Elapsed',
addNote: 'Notas'
}
}
},

View File

@ -253,7 +253,8 @@ export default {
message: 'Mensaje',
responsible: 'Responsable',
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 = {
state: {
@ -6,7 +7,8 @@ const containerInfo = {
listRecordLogs: [],
listRecordChats: [],
listChatEntries: [],
ListWorkflows: []
listWorkflows: [],
note: []
},
mutations: {
addListWorkflow(state, payload) {
@ -23,9 +25,25 @@ const containerInfo = {
},
addListChatEntries(state, payload) {
state.listChatEntries = payload
},
addNote(state, payload) {
state.note = payload
}
},
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) {
const tableName = params.tableName
const recordId = params.recordId
@ -68,7 +86,8 @@ const containerInfo = {
.then(response => {
var listRecord = {
recordCount: response.recordCount,
recorLogs: response.recordLogsList
recorLogs: response.recordLogsList,
epale: true
}
commit('addListRecordLogs', listRecord)
})
@ -83,15 +102,16 @@ const containerInfo = {
const pageToken = 0
return requestListRecordChats({ tableName, recordId, pageSize, pageToken })
.then(response => {
var listRecordChats = {
var listRecord = {
recordChatsList: response.recordChatsList,
recordCount: response.recordCount,
epale: isEmptyValue(response.recordChatsList),
nextPageToken: response.nextPageToken
}
dispatch('listRecordChat', {
chatUuid: response.recordChatsList[0].chatUuid
})
commit('addListRecordChats', listRecordChats)
commit('addListRecordChats', listRecord)
})
.catch(error => {
console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`)

View File

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