Create a global method for document status tags (#305)

Nice it
pull/3759/head
elsiosanchez 2020-02-05 19:12:09 -04:00 committed by GitHub
parent cb326d4b82
commit 6837cc19b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 50 deletions

View File

@ -618,52 +618,6 @@ export default {
}
return field.name
},
/**
* add a tab depending on the status of the document
* @param {string} tag, document status key
*/
tagStatus(tag) {
let type
switch (tag) {
case 'VO':
type = 'danger'
break
case 'AP':
type = 'success'
break
case 'DR':
type = 'info'
break
case 'CL':
type = 'primary'
break
case 'CO':
type = 'success'
break
case '??':
type = 'info'
break
case 'IP':
type = 'warning'
break
case 'WC':
type = 'warning'
break
case 'WP':
type = 'warning'
break
case 'NA':
type = 'danger'
break
case 'IN':
type = 'danger'
break
case 'RE':
type = 'danger'
break
}
return type
},
/**
* @param {object} row, row data
* @param {object} field, field with attributes

View File

@ -97,8 +97,7 @@ const containerInfo = {
.then(response => {
var listRecord = {
recordCount: response.recordCount,
recorLogs: response.recordLogsList,
epale: true
recorLogs: response.recordLogsList
}
commit('addListRecordLogs', listRecord)
})

View File

@ -1,5 +1,6 @@
export {
isEmptyValue,
zeroPad
zeroPad,
tagStatus
} from '@/utils/ADempiere/valueUtils.js'

View File

@ -364,3 +364,49 @@ export function parsedValueComponent({ fieldType, value, referenceType, isMandat
}
return returnValue
}
/**
* add a tab depending on the status of the document
* @param {string} tag, document status key
*/
export function tagStatus(tag) {
let type
switch (tag) {
case 'VO':
type = 'danger'
break
case 'AP':
type = 'success'
break
case 'DR':
type = 'info'
break
case 'CL':
type = 'primary'
break
case 'CO':
type = 'success'
break
case '??':
type = 'info'
break
case 'IP':
type = 'warning'
break
case 'WC':
type = 'warning'
break
case 'WP':
type = 'warning'
break
case 'NA':
type = 'danger'
break
case 'IN':
type = 'danger'
break
case 'RE':
type = 'danger'
break
}
return type
}

View File

@ -228,7 +228,8 @@
<el-collapse-transition>
<div v-show="(currentKey === key)">
<span v-for="(list, index) in listLogs.changeLogs" :key="index">
<p><b> {{ list.displayColumnName }} :</b> <strike> <el-link type="danger"> {{ list.oldDisplayValue }} </el-link> </strike> <el-link type="success"> {{ list.newDisplayValue }} </el-link> </p>
<p v-if="list.columnName === 'DocStatus'"><b> {{ list.displayColumnName }} :</b> <strike> <el-tag :type="tagStatus(list.oldValue)"> {{ list.oldDisplayValue }} </el-tag> </strike> <el-tag :type="tagStatus(list.newValue)"> {{ list.newDisplayValue }} </el-tag> </p>
<p v-else><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>