diff --git a/package.json b/package.json index ea7c34ca..89f1319b 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "vue-shortkey": "^3.1.7", "vue-split-panel": "^1.0.4", "vue-splitpane": "1.0.6", + "vue-workflow-chart": "^0.4.5", "vuedraggable": "2.24.3", "vuex": "3.6.2", "xlsx": "0.16.9" diff --git a/src/api/ADempiere/form/workflow-activity.js b/src/api/ADempiere/form/workflow-activity.js new file mode 100644 index 00000000..4673e434 --- /dev/null +++ b/src/api/ADempiere/form/workflow-activity.js @@ -0,0 +1,56 @@ +// 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 . + +// Get Instance for connectionimport { +import { request } from '@/utils/ADempiere/request' + +// List Activity +export function listActivity({ + formUuid +}) { + return request({ + url: '/form/addons/activitys', + method: 'get', + params: { + form_uuid: formUuid + } + }) + .then(listActivityResponse => { + return listActivityResponse + }) +} + +// Send Activity +export function sendActivity({ + formUuid, + activity, + message, + forward +}) { + return request({ + url: '/form/addons/send-activity', + method: 'post', + data: { + form_uuid: formUuid, + activity, + message, + forward + } + }) + .then(listActivityResponse => { + return listActivityResponse + }) +} diff --git a/src/api/ADempiere/workflow.js b/src/api/ADempiere/workflow.js index 96b12549..52241e95 100644 --- a/src/api/ADempiere/workflow.js +++ b/src/api/ADempiere/workflow.js @@ -92,3 +92,28 @@ export function requestListDocumentActions({ } }) } + +// Request a list of Activities from the user's Workflows +export function workflowActivities({ + userUuid, + pageSize, + pageToken +}) { + return request({ + url: '/workflow/workflow-activities', + method: 'get', + params: { + user_uuid: userUuid, + // Page Data + pageToken, + pageSize + } + }) + .then(listWorkflowActivities => { + return { + nextPageToken: listWorkflowActivities.next_page_token, + recordCount: listWorkflowActivities.record_count, + listWorkflowActivities: listWorkflowActivities.records + } + }) +} diff --git a/src/components/ADempiere/Form/WorkflowActivity/fieldsList.js b/src/components/ADempiere/Form/WorkflowActivity/fieldsList.js new file mode 100644 index 00000000..07fff51c --- /dev/null +++ b/src/components/ADempiere/Form/WorkflowActivity/fieldsList.js @@ -0,0 +1,76 @@ +// 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 elsiosanches@gmail.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 . + +// List of fields to send in search +// import language from '@/lang' +import language from '@/lang' + +export default [ + // History + { + elementColumnName: 'History', + isFromDictionary: true, + overwriteDefinition: { + handleFocusGained: true, + handleFocusLost: true, + handleKeyPressed: true, + handleKeyReleased: true, + handleActionKeyPerformed: true, + handleActionPerformed: true, + name: language.t('form.activity.filtersSearch.history'), + componentPath: 'FieldText', + size: 24, + sequence: 4, + isActiveLogics: true, + isMandatory: true, + isReadOnly: true + } + }, + // Messages + { + elementColumnName: 'TextMsg', + isFromDictionary: true, + overwriteDefinition: { + handleFocusGained: true, + handleFocusLost: true, + handleKeyPressed: true, + handleKeyReleased: true, + handleActionKeyPerformed: true, + handleActionPerformed: true, + size: 24, + sequence: 5, + isActiveLogics: true, + isMandatory: true + } + }, + // Forward + { + elementColumnName: 'Forward', + isFromDictionary: true, + overwriteDefinition: { + size: 24, + sequence: 6, + name: language.t('form.activity.filtersSearch.forward'), + handleFocusGained: true, + handleFocusLost: true, + handleKeyPressed: true, + handleKeyReleased: true, + handleActionKeyPerformed: true, + handleActionPerformed: true, + componentPath: 'FieldSelect' + } + } +] diff --git a/src/components/ADempiere/Form/WorkflowActivity/index.vue b/src/components/ADempiere/Form/WorkflowActivity/index.vue new file mode 100644 index 00000000..7ce1ad16 --- /dev/null +++ b/src/components/ADempiere/Form/WorkflowActivity/index.vue @@ -0,0 +1,384 @@ + + + + + + + + diff --git a/src/components/ADempiere/Form/index.vue b/src/components/ADempiere/Form/index.vue index e7ec38ad..7447bfd9 100644 --- a/src/components/ADempiere/Form/index.vue +++ b/src/components/ADempiere/Form/index.vue @@ -54,6 +54,9 @@ export default { case 'ProductInfo': form = import('@/components/ADempiere/Form/ProductInfo') break + case 'WFActivity': + form = import('@/components/ADempiere/Form/WorkflowActivity') + break case 'VPOS': form = import('@/components/ADempiere/Form/VPOS') break diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index bbf4c763..795c2926 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -556,6 +556,17 @@ export default { toolsPoint: { title: 'Point of Sale Tools' } + }, + activity: { + title: 'Your Workflow Activities', + filtersSearch: { + history: 'History records', + forward: 'Re-send' + }, + table: { + priority: 'Priority', + node: 'Node' + } } } } diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index 24ff88e4..1f2eb865 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -531,6 +531,17 @@ export default { toolsPoint: { title: 'Herramientas del Punto de Venta' } + }, + activity: { + title: 'Sus Actividades de Flujo de Trabajo', + filtersSearch: { + history: 'Registros históricos', + forward: 'Re-enviar' + }, + table: { + priority: 'Prioridad', + node: 'Nodo' + } } } } diff --git a/src/main.js b/src/main.js index 5d34b87c..3b4ff569 100644 --- a/src/main.js +++ b/src/main.js @@ -12,6 +12,7 @@ import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包 import VueSplit from 'vue-split-panel' import 'vue-resize/dist/vue-resize.css' import VueResize from 'vue-resize' +import WorkflowChart from 'vue-workflow-chart' /** * TODO: Waiting for PR to: * https://github.com/vue-extend/v-markdown/pull/4 @@ -53,6 +54,7 @@ Vue.use(VMarkdown) Vue.use(VueShortkey) Vue.use(VueSplit) Vue.use(VueResize) +Vue.use(WorkflowChart) Vue.use(Element, { size: Cookies.get('size') || 'medium', // set element-ui default size i18n: (key, value) => i18n.t(key, value), diff --git a/src/store/modules/ADempiere/WorkflowActivity.js b/src/store/modules/ADempiere/WorkflowActivity.js new file mode 100644 index 00000000..a5ffec84 --- /dev/null +++ b/src/store/modules/ADempiere/WorkflowActivity.js @@ -0,0 +1,51 @@ +import { + workflowActivities +} from '@/api/ADempiere/workflow.js' +import { showMessage } from '@/utils/ADempiere/notification.js' + +const activity = { + listActivity: [], + currentActivity: {} +} + +export default { + state: activity, + mutations: { + setActivity(state, activity) { + state.listActivity = activity + }, + setCurrentActivity(state, activity) { + state.currentActivity = activity + } + }, + actions: { + serverListActivity({ commit, getters, rootGetters }) { + workflowActivities({ + userUuid: rootGetters['user/getUserUuid'] + }) + .then(response => { + const { listWorkflowActivities } = response + commit('setActivity', listWorkflowActivities) + }) + .catch(error => { + console.warn(`serverListActivity: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + }, + selectedActivity({ commit }, activity) { + commit('setCurrentActivity', activity) + } + }, + getters: { + getCurrentActivity: (state) => { + return state.currentActivity + }, + getActivity: (state) => { + return state.listActivity + } + } +}