Skip to content

Commit

Permalink
support Product Configuration (#969)
Browse files Browse the repository at this point in the history
* support Product Configuration

* paint flowchart dynamically

* minimal changes Workflow

* remove comment

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
  • Loading branch information
elsiosanchez and elsiosanchez committed Aug 6, 2021
1 parent 07bb5bd commit 44ad352
Show file tree
Hide file tree
Showing 13 changed files with 584 additions and 75 deletions.
41 changes: 41 additions & 0 deletions src/api/ADempiere/dictionary/workflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Yamel Senih ysenih@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// Get Instance for connection
import { request } from '@/utils/ADempiere/request'

/**
* Request dictionary workflow metadata
* @param {string} uuid universally unique identifier
* @param {number} id, identifier
*/
export function requestWorkflowMetadata({
uuid,
id
}) {
return request({
url: '/dictionary/workflow',
method: 'get',
params: {
uuid,
id
}
})
.then(workflowResponse => {
const { convertWorkflow } = require('@/utils/ADempiere/apiConverts/dictionary.js')
return convertWorkflow(workflowResponse)
})
}
26 changes: 26 additions & 0 deletions src/api/ADempiere/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,29 @@ export function workflowActivities({
}
})
}
// GET Workflows
/**
* Request Document Status List
* @param {string} tableName
* @param {number} pageSize
* @param {string} pageToken
*/
export function getWorkflow({
tableName,
pageSize,
pageToken
}) {
return request({
url: '/workflow/workflows',
method: 'get',
params: {
table_name: tableName,
// Page Data
pageToken,
pageSize
}
})
.then(listWorkflowActivities => {
return listWorkflowActivities
})
}
11 changes: 10 additions & 1 deletion src/components/ADempiere/Badge/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,16 @@ export default {
},
computed: {
getRecordNotification() {
return this.$store.getters.getNotificationProcess
return this.$store.getters.getNotificationProcess.map(item => {
if (item.typeActivity) {
return {
...item,
name: item.name + ' ' + item.quantityActivities
}
} else {
return item
}
})
}
},
watch: {
Expand Down
78 changes: 7 additions & 71 deletions src/components/ADempiere/Form/WorkflowActivity/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,12 @@
<el-main class="main">
<el-container style="height: 100%;">
<el-aside v-if="!isEmptyValue(currentActivity)" id="workflow" width="70%" style="background: white;">
<transition name="el-zoom-in-center">
<el-card v-show="show" :style="{position: 'absolute', zIndex: '5', left: leftContextualMenu + 'px', top: topContextualMenu + 'px'}" class="box-card">
<div slot="header" class="clearfix">
<span>
{{ infoNode.description }}
</span>
<el-button style="float: right; padding: 3px 0" type="text" icon="el-icon-close" @click="show = !show" />
</div>
<div v-if="!isEmptyValue(infoNode.nodeLogs)" class="text item" style="padding: 20px">
<el-timeline class="info">
<el-timeline-item
v-for="(logs, key) in infoNode.nodeLogs"
:key="key"
:timestamp="translateDate(logs.log_date)"
placement="top"
>
<el-card style="padding: 20px!important;">
<b> {{ $t('login.userName') }} </b> {{ logs.user_name }} <br>
{{ logs.text_message }}
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-card>
</transition>
<workflow-chart
<workflow
v-if="!isEmptyValue(node) && !isEmptyValue(currentActivity)"
:transitions="listWorkflowTransition"
:states="node"
:state-semantics="currentNode"
@state-click="onLabelClicked(node, $event)"
:node-transition-list="listWorkflowTransition"
:node-list="node"
:current-node="currentNode"
:workflow-logs="listProcessWorkflow"
/>
</el-aside>
<el-main v-if="!isEmptyValue(currentActivity)" style="overflow: hidden;">
Expand Down Expand Up @@ -105,12 +80,12 @@
<script>
import formMixin from '@/components/ADempiere/Form/formMixin.js'
import fieldsList from './fieldsList.js'
import WorkflowChart from 'vue-workflow-chart'
import Workflow from '@/components/ADempiere/Workflow'
export default {
name: 'WorkflowActivity',
components: {
WorkflowChart
Workflow
},
mixins: [
formMixin
Expand Down Expand Up @@ -184,9 +159,6 @@ export default {
}
},
watch: {
activityList(list) {
this.SendActivityListNotifier(list)
},
currentActivity(value) {
this.listWorkflow(value)
this.setCurrent()
Expand All @@ -199,9 +171,6 @@ export default {
}
},
methods: {
SendActivityListNotifier() {
this.$store.commit('addNotificationProcess', { name: this.$t('navbar.badge.activity') + ' ' + this.activityList.length, typeActivity: true })
},
setCurrent() {
const activity = this.activityList.find(activity => activity.node === this.currentActivity.node)
this.$refs.WorkflowActivity.setCurrentRow(activity)
Expand Down Expand Up @@ -347,27 +316,6 @@ export default {
}
</style>
<style scoped>
.info {
margin: 0px;
font-size: 14px;
list-style: none;
padding: 10px;
}
.vue-workflow-chart-state {
background-color: #fff;
padding: 20px;
border-radius: 3px;
color: #11353d;
font-size: 15px;
font-family: Open Sans;
/* font-weight: 600; */
margin-right: 20px;
margin-bottom: 20px;
max-width: 15%;
text-align: center;
-webkit-box-shadow: 0 2px 4px 0 rgb(0 0 0 / 20%);
box-shadow: 0 2px 4px 0 rgb(0 0 0 / 20%);
}
.panel_main {
height: 100%;
width: 100%;
Expand All @@ -387,15 +335,3 @@ export default {
transition: 0.3s;
display: block;
}
@import '~vue-workflow-chart/dist/vue-workflow-chart.css';
.vue-workflow-chart-state-delete {
color: white;
background: #AED5FE;
}
.vue-workflow-chart-transition-arrow-delete {
fill: #AED5FE;
}
.vue-workflow-chart-transition-path-delete {
stroke: #AED5FE;
}
</style>
173 changes: 173 additions & 0 deletions src/components/ADempiere/Workflow/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->
<template>
<el-container style="height: 100% !important;">
<el-main style="overflow: hidden;">
<transition name="el-zoom-in-bottom">
<el-card v-show="show" :style="{position: 'absolute', zIndex: '5', left: leftContextualMenu + 'px', top: topContextualMenu + 'px'}" class="box-card">
<div slot="header" class="clearfix">
<span>
{{ infoNode.description }}
</span>
<el-button style="float: right; padding: 3px 0" type="text" icon="el-icon-close" @click="show = !show" />
</div>
<div v-if="!isEmptyValue(infoNode.nodeLogs)" class="text item" style="padding: 20px">
<el-timeline class="info">
<el-timeline-item
v-for="(logs, key) in infoNode.nodeLogs"
:key="key"
:timestamp="translateDate(logs.log_date)"
placement="top"
>
<el-card style="padding: 20px!important;">
<b> {{ $t('login.userName') }} </b> {{ logs.user_name }} <br>
{{ logs.text_message }}
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-card>
</transition>
<workflow-chart
v-if="!isEmptyValue(nodeList)"
id="Diagrama"
:transitions="nodeTransitionList"
:states="nodeList"
:state-semantics="currentNode"
@state-click="onLabelClicked(nodeList, $event)"
/>
</el-main>
</el-container>
</template>

<script>
import WorkflowChart from 'vue-workflow-chart'
export default {
name: 'Workflow',
components: {
WorkflowChart
},
props: {
nodeList: {
type: Array,
default: () => []
},
nodeTransitionList: {
type: Array,
default: () => []
},
currentNode: {
type: Array,
default: () => [{
classname: 'delete',
id: ''
}]
},
workflowLogs: {
type: Array,
default: () => []
}
},
data() {
return {
show: false,
infoNode: {},
topContextualMenu: 0,
leftContextualMenu: 0
}
},
methods: {
onLabelClicked(type, id) {
this.infoNode = type.find(node => node.id === id)
const nodeLogs = this.workflowLogs.filter(node => node.node_uuid === this.infoNode.uuid)
this.infoNode.nodeLogs = nodeLogs
const menuMinWidth = 105
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
const offsetWidth = this.$el.offsetWidth // container width
const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = event.clientX - offsetLeft + 15 // 15: margin right
this.leftContextualMenu = left
if (left > maxLeft) {
this.leftContextualMenu = maxLeft
}
const offsetTop = this.$el.getBoundingClientRect().top
const top = event.clientY - offsetTop + 500
this.topContextualMenu = top
this.show = true
},
translateDate(value) {
return this.$d(new Date(value), 'long', this.language)
}
}
}
</script>

<style scoped>
.info {
margin: 0px;
font-size: 14px;
list-style: none;
padding: 10px;
}
.vue-workflow-chart-state {
background-color: #fff;
padding: 20px;
border-radius: 3px;
color: #11353d;
font-size: 15px;
font-family: Open Sans;
/* font-weight: 600; */
margin-right: 20px;
margin-bottom: 20px;
max-width: 15%;
text-align: center;
-webkit-box-shadow: 0 2px 4px 0 rgb(0 0 0 / 20%);
box-shadow: 0 2px 4px 0 rgb(0 0 0 / 20%);
}
.panel_main {
height: 100%;
width: 100%;
}
</style>
<style lang='scss'>
.scroll-child {
max-height: 450px;
}
.el-card {
border-radius: 4px;
border: 1px solid #e6ebf5;
background-color: #FFFFFF;
overflow: hidden;
color: #303133;
-webkit-transition: 0.3s;
transition: 0.3s;
display: block;
}
@import '~vue-workflow-chart/dist/vue-workflow-chart.css';
.vue-workflow-chart-state-delete {
color: white;
background: #AED5FE;
}
.vue-workflow-chart-transition-arrow-delete {
fill: #AED5FE;
}
.vue-workflow-chart-transition-path-delete {
stroke: #AED5FE;
}
</style>
Loading

0 comments on commit 44ad352

Please sign in to comment.