Support Documents Pendings (#189)
* Support Documents Pendings * Bugfix syntax * route getters according to the role * add send criteria from list of documents pendings * change translationspull/3759/head
parent
929301579c
commit
73b375ca74
|
@ -322,6 +322,9 @@ export function getContextInfoValueFromServer({ uuid, query }) {
|
||||||
export function getFavoritesFromServer(userUuid) {
|
export function getFavoritesFromServer(userUuid) {
|
||||||
return Instance.call(this).requestFavorites(userUuid)
|
return Instance.call(this).requestFavorites(userUuid)
|
||||||
}
|
}
|
||||||
|
export function getPendingDocumentsFromServer(userUuid, roleUuid) {
|
||||||
|
return Instance.call(this).requestPendingDocuments(userUuid, roleUuid)
|
||||||
|
}
|
||||||
|
|
||||||
export function requestReportViews({ tableName, processUuid }) {
|
export function requestReportViews({ tableName, processUuid }) {
|
||||||
return Instance.call(this).requestReportViews({ tableName: tableName, processUuid: processUuid })
|
return Instance.call(this).requestReportViews({ tableName: tableName, processUuid: processUuid })
|
||||||
|
|
|
@ -365,7 +365,8 @@ export default {
|
||||||
isLoadAllRecords: true,
|
isLoadAllRecords: true,
|
||||||
isReference: false,
|
isReference: false,
|
||||||
isNewRecord: false,
|
isNewRecord: false,
|
||||||
isWindow: true
|
isWindow: true,
|
||||||
|
criteria: {}
|
||||||
}
|
}
|
||||||
if (this.isPanelWindow) {
|
if (this.isPanelWindow) {
|
||||||
// TODO: use action notifyPanelChange with isShowedField in true
|
// TODO: use action notifyPanelChange with isShowedField in true
|
||||||
|
@ -399,7 +400,14 @@ export default {
|
||||||
parameters.referenceWhereClause = referenceInfo.whereClause
|
parameters.referenceWhereClause = referenceInfo.whereClause
|
||||||
} else if (route.query.action && route.query.action === 'create-new') {
|
} else if (route.query.action && route.query.action === 'create-new') {
|
||||||
parameters.isNewRecord = true
|
parameters.isNewRecord = true
|
||||||
} else if (route.query.action && route.query.action !== 'create-new' && route.query.action !== 'reference' && route.query.action !== 'advancedQuery') {
|
} else if (route.query.action && route.query.action === 'criteria') {
|
||||||
|
route.params.isReadParameters = true
|
||||||
|
Object.keys(route.params).forEach(param => {
|
||||||
|
if (!this.isEmptyValue(route.params[param])) {
|
||||||
|
parameters.criteria[param] = route.params[param]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (route.query.action && route.query.action !== 'create-new' && route.query.action !== 'reference' && route.query.action !== 'advancedQuery' && route.query.action !== 'criteria') {
|
||||||
parameters.isLoadAllRecords = false
|
parameters.isLoadAllRecords = false
|
||||||
parameters.value = route.query.action
|
parameters.value = route.query.action
|
||||||
parameters.tableName = this.metadata.tableName
|
parameters.tableName = this.metadata.tableName
|
||||||
|
@ -462,7 +470,8 @@ export default {
|
||||||
isReference: parameters.isReference,
|
isReference: parameters.isReference,
|
||||||
referenceWhereClause: parameters.referenceWhereClause,
|
referenceWhereClause: parameters.referenceWhereClause,
|
||||||
columnName: parameters.columnName,
|
columnName: parameters.columnName,
|
||||||
value: parameters.value
|
value: parameters.value,
|
||||||
|
criteria: parameters.criteria
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.length && !parameters.isNewRecord) {
|
if (response.length && !parameters.isNewRecord) {
|
||||||
|
@ -494,8 +503,8 @@ export default {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: this.$route.name,
|
name: this.$route.name,
|
||||||
query: {
|
query: {
|
||||||
action: this.dataRecords.UUID,
|
...this.$route.query,
|
||||||
...this.$route.query
|
action: this.dataRecords.UUID
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.$store.dispatch('notifyPanelChange', {
|
this.$store.dispatch('notifyPanelChange', {
|
||||||
|
@ -606,7 +615,7 @@ export default {
|
||||||
dataTransfer.setData('Text', '')
|
dataTransfer.setData('Text', '')
|
||||||
},
|
},
|
||||||
changePanelRecord(uuidRecord) {
|
changePanelRecord(uuidRecord) {
|
||||||
if (uuidRecord !== 'create-new' && uuidRecord !== 'reference' && uuidRecord !== 'advancedQuery') {
|
if (uuidRecord !== 'create-new' && uuidRecord !== 'reference' && uuidRecord !== 'advancedQuery' && uuidRecord !== 'criteria') {
|
||||||
var recordSelected = this.$store.getters.getDataRecordsList(this.containerUuid).find(record => record.UUID === uuidRecord)
|
var recordSelected = this.$store.getters.getDataRecordsList(this.containerUuid).find(record => record.UUID === uuidRecord)
|
||||||
if (recordSelected) {
|
if (recordSelected) {
|
||||||
this.dataRecords = recordSelected
|
this.dataRecords = recordSelected
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
<template>
|
||||||
|
<el-collapse v-model="activeDocuments" accordion>
|
||||||
|
<el-collapse-item name="documents">
|
||||||
|
<template slot="title">
|
||||||
|
<i class="el-icon-document" style="margin-right: 4px;margin-left: 10px;" /> {{ $t('profile.PendingDocuments') }}
|
||||||
|
</template>
|
||||||
|
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
|
||||||
|
<div class="recent-items">
|
||||||
|
<el-table :data="search.length ? filterResult(search) : documents" max-height="455" @row-click="handleClick">
|
||||||
|
<el-table-column
|
||||||
|
prop="recordCount"
|
||||||
|
width="60"
|
||||||
|
/>
|
||||||
|
<el-table-column>
|
||||||
|
<template slot="header" slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="search"
|
||||||
|
size="mini"
|
||||||
|
:metadata="scope"
|
||||||
|
:placeholder="$t('table.dataTable.search')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<span>{{ row.name }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-collapse-item>
|
||||||
|
</el-collapse>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'PendingDocuments',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
activeDocuments: 'documents',
|
||||||
|
documents: [],
|
||||||
|
search: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
getterPendingDocuments() {
|
||||||
|
return this.$store.getters.getPendingDocuments
|
||||||
|
},
|
||||||
|
cachedViews() {
|
||||||
|
return this.$store.getters.cachedViews
|
||||||
|
},
|
||||||
|
permissionRoutes() {
|
||||||
|
return this.$store.getters.permission_routes
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getPendingDocuments()
|
||||||
|
this.subscribeChanges()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getPendingDocuments() {
|
||||||
|
this.$store.dispatch('getPendingDocumentsFromServer')
|
||||||
|
.then(response => {
|
||||||
|
this.documents = response
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
subscribeChanges() {
|
||||||
|
this.$store.subscribe((mutation, state) => {
|
||||||
|
if (mutation.type === 'setPendingDocuments') {
|
||||||
|
this.recentItems = this.getterPendingDocuments
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClick(row) {
|
||||||
|
this.$store.dispatch('getWindowByUuid', { routes: this.permissionRoutes, windowUuid: row.windowUuid })
|
||||||
|
var windowRoute = this.$store.getters.getWindowRoute(row.windowUuid)
|
||||||
|
this.$router.push({
|
||||||
|
name: windowRoute.name,
|
||||||
|
params: {
|
||||||
|
...row.criteria
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
action: 'criteria'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// conditions for the registration amount (operador: row.criteria.whereClause)
|
||||||
|
},
|
||||||
|
filterResult(search) {
|
||||||
|
return this.documents.filter(item => this.ignoreAccent(item.name).toLowerCase().includes(this.ignoreAccent(search.toLowerCase())))
|
||||||
|
},
|
||||||
|
ignoreAccent(s) {
|
||||||
|
if (!s) { return '' }
|
||||||
|
return s.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.search_recent {
|
||||||
|
width: 50%!important;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
.recent-items {
|
||||||
|
height: 455px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.time {
|
||||||
|
float: left;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.card-box {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.card-content {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.icon-window {
|
||||||
|
font-size: x-large;
|
||||||
|
color: #36a3f7;
|
||||||
|
}
|
||||||
|
.action-tag {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -58,6 +58,9 @@ export default {
|
||||||
query: {
|
query: {
|
||||||
...this.$route.query,
|
...this.$route.query,
|
||||||
tabParent: String(newValue)
|
tabParent: String(newValue)
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
...this.$route.params
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.$route.meta.tabUuid = this.tabUuid
|
this.$route.meta.tabUuid = this.tabUuid
|
||||||
|
|
|
@ -37,7 +37,7 @@ export const tabMixin = {
|
||||||
// Current TabChildren
|
// Current TabChildren
|
||||||
currentTabChild(newValue, oldValue) {
|
currentTabChild(newValue, oldValue) {
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
this.$router.push({ query: { ...this.$route.query, tabChild: String(newValue) }})
|
this.$router.push({ query: { ...this.$route.query, tabChild: String(newValue) }, params: { ...this.$route.params }})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Load parent tab context
|
// Load parent tab context
|
||||||
|
|
|
@ -244,6 +244,7 @@ export default {
|
||||||
aboutMe: 'About Me',
|
aboutMe: 'About Me',
|
||||||
recentItems: 'Recent Items',
|
recentItems: 'Recent Items',
|
||||||
favorites: 'Favorites',
|
favorites: 'Favorites',
|
||||||
|
PendingDocuments: 'Pending Documents',
|
||||||
recentItemsName: 'Name Recent Items',
|
recentItemsName: 'Name Recent Items',
|
||||||
role: 'Role',
|
role: 'Role',
|
||||||
availableRoles: 'Available roles',
|
availableRoles: 'Available roles',
|
||||||
|
|
|
@ -219,6 +219,7 @@ export default {
|
||||||
aboutMe: 'Sobre Mi',
|
aboutMe: 'Sobre Mi',
|
||||||
recentItems: 'Artículos Recientes',
|
recentItems: 'Artículos Recientes',
|
||||||
favorites: 'Favoritos',
|
favorites: 'Favoritos',
|
||||||
|
PendingDocuments: 'Documentos Pendientes',
|
||||||
recentItemsName: 'Nombre Ítems Recientes',
|
recentItemsName: 'Nombre Ítems Recientes',
|
||||||
role: 'Rol',
|
role: 'Rol',
|
||||||
availableRoles: 'Roles disponibles',
|
availableRoles: 'Roles disponibles',
|
||||||
|
|
|
@ -9,8 +9,10 @@ const getters = {
|
||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
avatar: state => state.user.avatar,
|
avatar: state => state.user.avatar,
|
||||||
name: state => state.user.name,
|
name: state => state.user.name,
|
||||||
|
router: state => state.permission.addRoutes,
|
||||||
introduction: state => state.user.introduction,
|
introduction: state => state.user.introduction,
|
||||||
currentRole: state => state.user.currentRole,
|
currentRole: state => state.user.currentRole,
|
||||||
|
getRoleUuid: state => state.user.rol.uuid,
|
||||||
roles: state => state.user.roles,
|
roles: state => state.user.roles,
|
||||||
permission_routes: state => state.permission.routes,
|
permission_routes: state => state.permission.routes,
|
||||||
errorLogs: state => state.errorLog.logs
|
errorLogs: state => state.errorLog.logs
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
convertValueFromGRPC,
|
convertValueFromGRPC,
|
||||||
getContextInfoValueFromServer,
|
getContextInfoValueFromServer,
|
||||||
getFavoritesFromServer,
|
getFavoritesFromServer,
|
||||||
|
getPendingDocumentsFromServer,
|
||||||
requestPrintFormats
|
requestPrintFormats
|
||||||
} from '@/api/ADempiere'
|
} from '@/api/ADempiere'
|
||||||
import { convertValuesMapToObject, isEmptyValue, showMessage, convertAction } from '@/utils/ADempiere'
|
import { convertValuesMapToObject, isEmptyValue, showMessage, convertAction } from '@/utils/ADempiere'
|
||||||
|
@ -18,6 +19,7 @@ const data = {
|
||||||
recordDetail: [],
|
recordDetail: [],
|
||||||
recentItems: [],
|
recentItems: [],
|
||||||
favorites: [],
|
favorites: [],
|
||||||
|
pendingDocuments: [],
|
||||||
inGetting: [],
|
inGetting: [],
|
||||||
contextInfoField: [],
|
contextInfoField: [],
|
||||||
printFormatList: []
|
printFormatList: []
|
||||||
|
@ -67,6 +69,9 @@ const data = {
|
||||||
setFavorites(state, payload) {
|
setFavorites(state, payload) {
|
||||||
state.favorites = payload
|
state.favorites = payload
|
||||||
},
|
},
|
||||||
|
setPendingDocuments(state, payload) {
|
||||||
|
state.pendingDocuments = payload
|
||||||
|
},
|
||||||
setPageNumber(state, payload) {
|
setPageNumber(state, payload) {
|
||||||
payload.data.pageNumber = payload.pageNumber
|
payload.data.pageNumber = payload.pageNumber
|
||||||
},
|
},
|
||||||
|
@ -645,6 +650,41 @@ const data = {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getPendingDocumentsFromServer({ commit, getters, rootGetters }) {
|
||||||
|
const userUuid = rootGetters['user/getUserUuid']
|
||||||
|
const roleUuid = getters.getRoleUuid
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getPendingDocumentsFromServer(userUuid, roleUuid)
|
||||||
|
.then(response => {
|
||||||
|
const documentsList = response.getPendingdocumentsList().map(document => {
|
||||||
|
return {
|
||||||
|
formUuid: document.getFormuuid(),
|
||||||
|
name: document.getDocumentname(),
|
||||||
|
description: document.getDocumentdescription(),
|
||||||
|
criteria: {
|
||||||
|
type: document.getCriteria().getConditionsList(),
|
||||||
|
limit: document.getCriteria().getLimit(),
|
||||||
|
orderbyclause: document.getCriteria().getOrderbyclause(),
|
||||||
|
orderbycolumnList: document.getCriteria().getOrderbycolumnList(),
|
||||||
|
query: document.getCriteria().getQuery(),
|
||||||
|
referenceUuid: document.getCriteria().getReferenceuuid(),
|
||||||
|
tableName: document.getCriteria().getTablename(),
|
||||||
|
valuesList: document.getCriteria().getValuesList(),
|
||||||
|
whereClause: document.getCriteria().getWhereclause()
|
||||||
|
},
|
||||||
|
recordCount: document.getRecordcount(),
|
||||||
|
sequence: document.getSequence(),
|
||||||
|
windowUuid: document.getWindowuuid()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
commit('setPendingDocuments', documentsList)
|
||||||
|
resolve(documentsList)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* TODO: Add support to tab children
|
* TODO: Add support to tab children
|
||||||
* @param {object} objectParams
|
* @param {object} objectParams
|
||||||
|
@ -934,6 +974,9 @@ const data = {
|
||||||
getFavoritesList: (state) => {
|
getFavoritesList: (state) => {
|
||||||
return state.favorites
|
return state.favorites
|
||||||
},
|
},
|
||||||
|
getPendingDocuments: (state) => {
|
||||||
|
return state.pendingDocuments
|
||||||
|
},
|
||||||
getLanguageList: (state) => (roleUuid) => {
|
getLanguageList: (state) => (roleUuid) => {
|
||||||
return state.recordSelection.find(
|
return state.recordSelection.find(
|
||||||
record => record.containerUuid === roleUuid
|
record => record.containerUuid === roleUuid
|
||||||
|
|
|
@ -534,7 +534,8 @@ const windowControl = {
|
||||||
isReference = false,
|
isReference = false,
|
||||||
referenceWhereClause = '',
|
referenceWhereClause = '',
|
||||||
columnName,
|
columnName,
|
||||||
value
|
value,
|
||||||
|
criteria
|
||||||
} = parameters
|
} = parameters
|
||||||
const tab = rootGetters.getTab(parentUuid, containerUuid)
|
const tab = rootGetters.getTab(parentUuid, containerUuid)
|
||||||
|
|
||||||
|
@ -564,6 +565,14 @@ const windowControl = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isEmptyValue(criteria)) {
|
||||||
|
if (!isEmptyValue(parsedWhereClause)) {
|
||||||
|
parsedWhereClause += ' AND ' + criteria.whereClause
|
||||||
|
} else {
|
||||||
|
parsedWhereClause += criteria.whereClause
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var conditions = []
|
var conditions = []
|
||||||
if (tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) {
|
if (tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) {
|
||||||
conditions.push({
|
conditions.push({
|
||||||
|
|
|
@ -16,6 +16,12 @@ const ROUTES = {
|
||||||
action: undefined,
|
action: undefined,
|
||||||
tabParent: '0',
|
tabParent: '0',
|
||||||
tabChild: undefined
|
tabChild: undefined
|
||||||
|
},
|
||||||
|
DOCUMENTS_WINDOW: {
|
||||||
|
uuid: '8e50d7c8-fb40-11e8-a479-7a0060f0aa01',
|
||||||
|
action: undefined,
|
||||||
|
tabParent: '0',
|
||||||
|
tabChild: undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
<el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">
|
<el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">
|
||||||
<box-card />
|
<box-card />
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :xs="{span: 24}" :sm="{span: 24}" :md="{span: 24}" :lg="{span: 12}" :xl="{span: 12}" style="padding-right:8px;margin-bottom:30px;">
|
||||||
|
<pending-documents />
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -55,6 +58,7 @@ import TodoList from './components/TodoList'
|
||||||
import BoxCard from './components/BoxCard'
|
import BoxCard from './components/BoxCard'
|
||||||
import RecentItems from '@/components/ADempiere/RecentItems'
|
import RecentItems from '@/components/ADempiere/RecentItems'
|
||||||
import Favorites from '@/components/ADempiere/Favorites'
|
import Favorites from '@/components/ADempiere/Favorites'
|
||||||
|
import PendingDocuments from '@/components/ADempiere/PendingDocuments'
|
||||||
|
|
||||||
const lineChartData = {
|
const lineChartData = {
|
||||||
newVisitis: {
|
newVisitis: {
|
||||||
|
@ -88,7 +92,8 @@ export default {
|
||||||
TodoList,
|
TodoList,
|
||||||
BoxCard,
|
BoxCard,
|
||||||
RecentItems,
|
RecentItems,
|
||||||
Favorites
|
Favorites,
|
||||||
|
PendingDocuments
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue