mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-12 22:29:59 +08:00
REfactory from Panjian changes, update gRPC library and components (#526)
This commit is contained in:
parent
5bbe07532b
commit
40cc40a9ab
@ -3,12 +3,3 @@ ENV = 'development'
|
|||||||
|
|
||||||
# base api
|
# base api
|
||||||
VUE_APP_BASE_API = '/dev-api'
|
VUE_APP_BASE_API = '/dev-api'
|
||||||
|
|
||||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
|
||||||
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
|
||||||
# It only does one thing by converting all import() to require().
|
|
||||||
# This configuration can significantly increase the speed of hot updates,
|
|
||||||
# when you have a large number of pages.
|
|
||||||
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
|
|
||||||
|
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
|
||||||
|
3
.github/ISSUE_TEMPLATE/question.md
vendored
3
.github/ISSUE_TEMPLATE/question.md
vendored
@ -19,8 +19,10 @@ Asking questions about use
|
|||||||
|
|
||||||
#### Steps to reproduce
|
#### Steps to reproduce
|
||||||
1. [xxx]
|
1. [xxx]
|
||||||
|
<!--
|
||||||
2. [xxx]
|
2. [xxx]
|
||||||
3. [xxxx]
|
3. [xxxx]
|
||||||
|
-->
|
||||||
|
|
||||||
#### Screenshot or Gif
|
#### Screenshot or Gif
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ Please only use Codepen, JSFiddle, CodeSandbox or a github repo
|
|||||||
|
|
||||||
#### Other relevant information
|
#### Other relevant information
|
||||||
- Your OS:
|
- Your OS:
|
||||||
|
- Web Browser:
|
||||||
- Node.js version:
|
- Node.js version:
|
||||||
- vue-element-admin version:
|
- vue-element-admin version:
|
||||||
|
|
||||||
|
19
README.es.md
19
README.es.md
@ -74,7 +74,7 @@ Sea un patrocinante y coloque su logo en nuestro LEEME en GitHub con un enlace d
|
|||||||
```
|
```
|
||||||
- Iniciar / Cerrar Sesión
|
- Iniciar / Cerrar Sesión
|
||||||
|
|
||||||
- Permisos de Authentication
|
- Permisos de Autenticación
|
||||||
- Permisos basado en ADempiere
|
- Permisos basado en ADempiere
|
||||||
- Página de Permisos
|
- Página de Permisos
|
||||||
- Directivas de permisos
|
- Directivas de permisos
|
||||||
@ -82,18 +82,21 @@ Sea un patrocinante y coloque su logo en nuestro LEEME en GitHub con un enlace d
|
|||||||
- Autenticación por dos pasos
|
- Autenticación por dos pasos
|
||||||
|
|
||||||
- Construcción Multi-entorno
|
- Construcción Multi-entorno
|
||||||
- dev sit stage producción
|
- Desarrollo (dev)
|
||||||
|
- sit
|
||||||
|
- Escenario de pruebas (stage),
|
||||||
|
- Producción (prod)
|
||||||
|
|
||||||
- Características Globales
|
- Características Globales
|
||||||
- I18n
|
- I18n
|
||||||
- Temas dinámicos
|
- Temas dinámicos
|
||||||
- Dynamic sidebar (soporte a rutas multi-nivel)
|
- Menu lateral dinámico (soporte a rutas multi-nivel)
|
||||||
- Barra de rutas dinámica
|
- Barra de rutas dinámica
|
||||||
- Tags-view (Tab page Support right-click operation)
|
- Tags-view (Pestañas de página, Soporta operación de clic derecho)
|
||||||
- Svg Sprite
|
- Svg Sprite
|
||||||
- Datos de simulación con Mock
|
- Datos de simulación con Mock
|
||||||
- Pantalla completa
|
- Pantalla completa
|
||||||
- Responsive Sidebar
|
- Menu lateral responsivo
|
||||||
|
|
||||||
- Editor
|
- Editor
|
||||||
- Editor de Texto Enriquecido
|
- Editor de Texto Enriquecido
|
||||||
@ -104,7 +107,7 @@ Sea un patrocinante y coloque su logo en nuestro LEEME en GitHub con un enlace d
|
|||||||
- Exportación a Excel
|
- Exportación a Excel
|
||||||
- Carga de Excel
|
- Carga de Excel
|
||||||
- Visualización de Excel
|
- Visualización de Excel
|
||||||
- Exportación como zip
|
- Exportación como ZIP
|
||||||
|
|
||||||
- Tabla
|
- Tabla
|
||||||
- Tabla Dinámica
|
- Tabla Dinámica
|
||||||
@ -139,7 +142,7 @@ Sea un patrocinante y coloque su logo en nuestro LEEME en GitHub con un enlace d
|
|||||||
- Página de Guías
|
- Página de Guías
|
||||||
- ECharts (Gráficos)
|
- ECharts (Gráficos)
|
||||||
- Portapapeles
|
- Portapapeles
|
||||||
- Convertidor de Markdown a html
|
- Convertidor de Markdown a HTML
|
||||||
```
|
```
|
||||||
|
|
||||||
## Iniciando
|
## Iniciando
|
||||||
@ -210,7 +213,7 @@ Navegadores modernos e Internet Explorer 10+.
|
|||||||
|
|
||||||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Safari |
|
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Safari |
|
||||||
| --------- | --------- | --------- | --------- |
|
| --------- | --------- | --------- | --------- |
|
||||||
| IE10, IE11, Edge| últimas 2 versiones| últimas 2 versiones| últimas 2 versiones
|
| IE10, IE11, Edge | últimas 2 versiones | últimas 2 versiones | últimas 2 versiones |
|
||||||
|
|
||||||
## Licencia
|
## Licencia
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Understanding and learning this knowledge in advance will greatly help the use o
|
|||||||
|
|
||||||
[](https://codesandbox.io/s/github/PanJiaChen/vue-element-admin/tree/CodeSandbox)
|
[](https://codesandbox.io/s/github/PanJiaChen/vue-element-admin/tree/CodeSandbox)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="900" src="https://wpimg.wallstcn.com/a5894c1b-f6af-456e-82df-1151da0839bf.png">
|
<img width="900" src="https://wpimg.wallstcn.com/a5894c1b-f6af-456e-82df-1151da0839bf.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -83,7 +83,10 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s
|
|||||||
- Permission configuration page
|
- Permission configuration page
|
||||||
|
|
||||||
- Multi-environment build
|
- Multi-environment build
|
||||||
- dev sit stage prod
|
- Develop (dev)
|
||||||
|
- sit
|
||||||
|
- Stage Test (stage)
|
||||||
|
- Production (prod)
|
||||||
|
|
||||||
- Global Features
|
- Global Features
|
||||||
- I18n
|
- I18n
|
||||||
@ -209,7 +212,7 @@ Modern browsers and Internet Explorer 10+.
|
|||||||
|
|
||||||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Safari |
|
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](https://godban.github.io/browsers-support-badges/)</br>Safari |
|
||||||
| --------- | --------- | --------- | --------- |
|
| --------- | --------- | --------- | --------- |
|
||||||
| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions
|
| IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions |
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
'@vue/app'
|
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
|
||||||
]
|
'@vue/cli-plugin-babel/preset'
|
||||||
|
],
|
||||||
|
'env': {
|
||||||
|
'development': {
|
||||||
|
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
|
||||||
|
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
|
||||||
|
// https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
|
||||||
|
'plugins': ['dynamic-import-node']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Mock from 'mockjs'
|
const Mock = require('mockjs')
|
||||||
|
|
||||||
const List = []
|
const List = []
|
||||||
const count = 100
|
const count = 100
|
||||||
@ -27,7 +27,7 @@ for (let i = 0; i < count; i++) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export default [
|
module.exports = [
|
||||||
{
|
{
|
||||||
url: '/vue-element-admin/article/list',
|
url: '/vue-element-admin/article/list',
|
||||||
type: 'get',
|
type: 'get',
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import Mock from 'mockjs'
|
const Mock = require('mockjs')
|
||||||
import { param2Obj } from '../src/utils'
|
const { param2Obj } = require('./utils')
|
||||||
|
|
||||||
import user from './user'
|
const user = require('./user')
|
||||||
import role from './role'
|
const role = require('./role')
|
||||||
import article from './article'
|
const article = require('./article')
|
||||||
import search from './remote-search'
|
const search = require('./remote-search')
|
||||||
|
|
||||||
const mocks = [
|
const mocks = [
|
||||||
...user,
|
...user,
|
||||||
@ -16,7 +16,7 @@ const mocks = [
|
|||||||
// for front mock
|
// for front mock
|
||||||
// please use it cautiously, it will redefine XMLHttpRequest,
|
// please use it cautiously, it will redefine XMLHttpRequest,
|
||||||
// which will cause many of your third-party libraries to be invalidated(like progress event).
|
// which will cause many of your third-party libraries to be invalidated(like progress event).
|
||||||
export function mockXHR() {
|
function mockXHR() {
|
||||||
// mock patch
|
// mock patch
|
||||||
// https://github.com/nuysoft/Mock/issues/300
|
// https://github.com/nuysoft/Mock/issues/300
|
||||||
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
|
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
|
||||||
@ -54,4 +54,7 @@ export function mockXHR() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default mocks
|
module.exports = {
|
||||||
|
mocks,
|
||||||
|
mockXHR
|
||||||
|
}
|
||||||
|
@ -8,7 +8,7 @@ const mockDir = path.join(process.cwd(), 'mock')
|
|||||||
|
|
||||||
function registerRoutes(app) {
|
function registerRoutes(app) {
|
||||||
let mockLastIndex
|
let mockLastIndex
|
||||||
const { default: mocks } = require('./index.js')
|
const { mocks } = require('./index.js')
|
||||||
const mocksForServer = mocks.map(route => {
|
const mocksForServer = mocks.map(route => {
|
||||||
return responseFake(route.url, route.type, route.response)
|
return responseFake(route.url, route.type, route.response)
|
||||||
})
|
})
|
||||||
@ -44,9 +44,6 @@ const responseFake = (url, type, respond) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = app => {
|
module.exports = app => {
|
||||||
// es6 polyfill
|
|
||||||
require('@babel/register')
|
|
||||||
|
|
||||||
// parse app.body
|
// parse app.body
|
||||||
// https://expressjs.com/en/4x/api.html#req.body
|
// https://expressjs.com/en/4x/api.html#req.body
|
||||||
app.use(bodyParser.json())
|
app.use(bodyParser.json())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Mock from 'mockjs'
|
const Mock = require('mockjs')
|
||||||
|
|
||||||
const NameList = []
|
const NameList = []
|
||||||
const count = 100
|
const count = 100
|
||||||
@ -10,7 +10,7 @@ for (let i = 0; i < count; i++) {
|
|||||||
}
|
}
|
||||||
NameList.push({ name: 'mock-Pan' })
|
NameList.push({ name: 'mock-Pan' })
|
||||||
|
|
||||||
export default [
|
module.exports = [
|
||||||
// username search
|
// username search
|
||||||
{
|
{
|
||||||
url: '/vue-element-admin/search/user',
|
url: '/vue-element-admin/search/user',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Mock from 'mockjs'
|
const Mock = require('mockjs')
|
||||||
import { deepClone } from '../../src/utils/index.js'
|
const { deepClone } = require('../utils')
|
||||||
import { asyncRoutes, constantRoutes } from './routes.js'
|
const { asyncRoutes, constantRoutes } = require('./routes.js')
|
||||||
|
|
||||||
const routes = deepClone([...constantRoutes, ...asyncRoutes])
|
const routes = deepClone([...constantRoutes, ...asyncRoutes])
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ const roles = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
export default [
|
module.exports = [
|
||||||
// mock get all routes form server
|
// mock get all routes form server
|
||||||
{
|
{
|
||||||
url: '/vue-element-admin/routes',
|
url: '/vue-element-admin/routes',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Just a mock data
|
// Just a mock data
|
||||||
|
|
||||||
export const constantRoutes = [
|
const constantRoutes = [
|
||||||
{
|
{
|
||||||
path: '/redirect',
|
path: '/redirect',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
@ -72,7 +72,7 @@ export const constantRoutes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
export const asyncRoutes = [
|
const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/permission',
|
path: '/permission',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
@ -523,3 +523,8 @@ export const asyncRoutes = [
|
|||||||
|
|
||||||
{ path: '*', redirect: '/404', hidden: true }
|
{ path: '*', redirect: '/404', hidden: true }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
constantRoutes,
|
||||||
|
asyncRoutes
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@ const users = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default [
|
module.exports = [
|
||||||
// user login
|
// user login
|
||||||
{
|
{
|
||||||
url: '/vue-element-admin/user/login',
|
url: '/vue-element-admin/user/login',
|
||||||
|
48
mock/utils.js
Normal file
48
mock/utils.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* @param {string} url
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
function param2Obj(url) {
|
||||||
|
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
|
||||||
|
if (!search) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
const obj = {}
|
||||||
|
const searchArr = search.split('&')
|
||||||
|
searchArr.forEach(v => {
|
||||||
|
const index = v.indexOf('=')
|
||||||
|
if (index !== -1) {
|
||||||
|
const name = v.substring(0, index)
|
||||||
|
const val = v.substring(index + 1, v.length)
|
||||||
|
obj[name] = val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is just a simple version of deep copy
|
||||||
|
* Has a lot of edge cases bug
|
||||||
|
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
|
||||||
|
* @param {Object} source
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
function deepClone(source) {
|
||||||
|
if (!source && typeof source !== 'object') {
|
||||||
|
throw new Error('error arguments', 'deepClone')
|
||||||
|
}
|
||||||
|
const targetObj = source.constructor === Array ? [] : {}
|
||||||
|
Object.keys(source).forEach(keys => {
|
||||||
|
if (source[keys] && typeof source[keys] === 'object') {
|
||||||
|
targetObj[keys] = deepClone(source[keys])
|
||||||
|
} else {
|
||||||
|
targetObj[keys] = source[keys]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return targetObj
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
param2Obj,
|
||||||
|
deepClone
|
||||||
|
}
|
203
package.json
203
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "adempiere-vue",
|
"name": "adempiere-vue",
|
||||||
"version": "4.2.1",
|
"version": "4.3.1",
|
||||||
"description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features",
|
"description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features",
|
||||||
"author": "Pan <panfree23@gmail.com>",
|
"author": "Pan <panfree23@gmail.com>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@ -9,29 +9,101 @@
|
|||||||
"url": "https://github.com/EdwinBetanc0urt/"
|
"url": "https://github.com/EdwinBetanc0urt/"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "GPL-3.0-or-later",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vue-cli-service serve",
|
"start": "vue-cli-service serve",
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
|
"lint": "eslint --ext .js,.vue src",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "vue-cli-service build",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"new": "plop",
|
||||||
"test:unit": "jest --clearCache && vue-cli-service test:unit",
|
|
||||||
"test:ci": "npm run lint && npm run test:unit",
|
|
||||||
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
|
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
|
||||||
"new": "plop"
|
"test:unit": "jest --clearCache && vue-cli-service test:unit",
|
||||||
|
"test:ci": "npm run lint && npm run test:unit"
|
||||||
},
|
},
|
||||||
"husky": {
|
"dependencies": {
|
||||||
"hooks": {
|
"@adempiere/grpc-access-client": "^1.2.3",
|
||||||
"pre-commit": "lint-staged"
|
"@adempiere/grpc-core-client": "^1.2.3",
|
||||||
}
|
"@adempiere/grpc-data-client": "^2.4.9",
|
||||||
|
"@adempiere/grpc-dictionary-client": "^1.4.5",
|
||||||
|
"@adempiere/grpc-enrollment-client": "^1.1.2",
|
||||||
|
"@adempiere/grpc-pos-client": "^1.4.1",
|
||||||
|
"axios": "0.19.2",
|
||||||
|
"clipboard": "2.0.6",
|
||||||
|
"codemirror": "5.56.0",
|
||||||
|
"core-js": "3.6.5",
|
||||||
|
"driver.js": "0.9.8",
|
||||||
|
"dropzone": "5.7.2",
|
||||||
|
"echarts": "4.8.0",
|
||||||
|
"element-ui": "2.13.2",
|
||||||
|
"file-saver": "2.0.2",
|
||||||
|
"fuse.js": "3.4.4",
|
||||||
|
"js-cookie": "2.2.1",
|
||||||
|
"jsonlint": "1.6.3",
|
||||||
|
"jszip": "3.5.0",
|
||||||
|
"moment": "^2.27.0",
|
||||||
|
"normalize.css": "8.0.1",
|
||||||
|
"nprogress": "0.2.0",
|
||||||
|
"path-to-regexp": "2.4.0",
|
||||||
|
"pinyin": "2.9.1",
|
||||||
|
"screenfull": "5.0.2",
|
||||||
|
"script-loader": "0.7.2",
|
||||||
|
"sortablejs": "1.10.2",
|
||||||
|
"tui-editor": "1.4.10",
|
||||||
|
"v-markdown": "^1.0.2",
|
||||||
|
"vue": "2.6.11",
|
||||||
|
"vue-content-loading": "^1.6.0",
|
||||||
|
"vue-count-to": "1.0.13",
|
||||||
|
"vue-i18n": "8.19.0",
|
||||||
|
"vue-multipane": "^0.9.5",
|
||||||
|
"vue-resize": "^0.5.0",
|
||||||
|
"vue-router": "3.3.4",
|
||||||
|
"vue-shortkey": "^3.1.7",
|
||||||
|
"vue-split-panel": "^1.0.4",
|
||||||
|
"vue-splitpane": "1.0.6",
|
||||||
|
"vuedraggable": "^2.24.0",
|
||||||
|
"vuex": "3.5.1",
|
||||||
|
"xlsx": "0.16.4"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"devDependencies": {
|
||||||
"src/**/*.{js,vue}": [
|
"@vue/cli-plugin-babel": "4.4.6",
|
||||||
"eslint --fix",
|
"@vue/cli-plugin-eslint": "4.4.6",
|
||||||
"git add"
|
"@vue/cli-plugin-unit-jest": "4.4.6",
|
||||||
]
|
"@vue/cli-service": "4.4.6",
|
||||||
|
"@vue/test-utils": "1.0.3",
|
||||||
|
"autoprefixer": "9.8.5",
|
||||||
|
"babel-eslint": "10.1.0",
|
||||||
|
"babel-jest": "26.1.0",
|
||||||
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
||||||
|
"chalk": "4.1.0",
|
||||||
|
"chokidar": "3.4.1",
|
||||||
|
"connect": "3.7.0",
|
||||||
|
"eslint": "7.5.0",
|
||||||
|
"eslint-plugin-vue": "6.2.2",
|
||||||
|
"html-webpack-plugin": "4.3.0",
|
||||||
|
"husky": "4.2.5",
|
||||||
|
"lint-staged": "10.2.11",
|
||||||
|
"mockjs": "1.1.0",
|
||||||
|
"plop": "2.7.3",
|
||||||
|
"runjs": "4.4.2",
|
||||||
|
"sass": "1.26.10",
|
||||||
|
"sass-loader": "8.0.2",
|
||||||
|
"script-ext-html-webpack-plugin": "2.1.4",
|
||||||
|
"serve-static": "1.14.1",
|
||||||
|
"svg-sprite-loader": "5.0.0",
|
||||||
|
"svgo": "1.3.2",
|
||||||
|
"vue-template-compiler": "2.6.11"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions"
|
||||||
|
],
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/PanJiaChen/vue-element-admin/issues"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.9",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"vue",
|
"vue",
|
||||||
@ -42,95 +114,20 @@
|
|||||||
"admin-template",
|
"admin-template",
|
||||||
"management-system"
|
"management-system"
|
||||||
],
|
],
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"lint-staged": {
|
||||||
|
"src/**/*.{js,vue}": [
|
||||||
|
"eslint --fix",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged"
|
||||||
|
}
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/PanJiaChen/vue-element-admin.git"
|
"url": "git+https://github.com/PanJiaChen/vue-element-admin.git"
|
||||||
},
|
}
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/PanJiaChen/vue-element-admin/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@adempiere/grpc-access-client": "^1.2.2",
|
|
||||||
"@adempiere/grpc-core-client": "^1.1.8",
|
|
||||||
"@adempiere/grpc-data-client": "^2.4.6",
|
|
||||||
"@adempiere/grpc-dictionary-client": "^1.4.4",
|
|
||||||
"@adempiere/grpc-enrollment-client": "^1.1.1",
|
|
||||||
"@adempiere/grpc-pos-client": "^1.3.4",
|
|
||||||
"axios": "0.19.2",
|
|
||||||
"clipboard": "2.0.6",
|
|
||||||
"codemirror": "5.53.2",
|
|
||||||
"core-js": "^3.6.5",
|
|
||||||
"driver.js": "0.9.8",
|
|
||||||
"dropzone": "5.7.0",
|
|
||||||
"echarts": "4.7.0",
|
|
||||||
"element-ui": "2.13.2",
|
|
||||||
"file-saver": "2.0.2",
|
|
||||||
"fuse.js": "3.4.4",
|
|
||||||
"js-cookie": "2.2.1",
|
|
||||||
"jsonlint": "1.6.3",
|
|
||||||
"jszip": "3.4.0",
|
|
||||||
"mime-type": "^3.0.7",
|
|
||||||
"moment": "^2.24.0",
|
|
||||||
"normalize.css": "8.0.1",
|
|
||||||
"nprogress": "0.2.0",
|
|
||||||
"path-to-regexp": "2.4.0",
|
|
||||||
"pinyin": "2.9.0",
|
|
||||||
"screenfull": "5.0.2",
|
|
||||||
"script-loader": "0.7.2",
|
|
||||||
"showdown": "1.9.1",
|
|
||||||
"sortablejs": "1.10.2",
|
|
||||||
"tui-editor": "1.4.10",
|
|
||||||
"v-markdown": "^1.0.2",
|
|
||||||
"vue": "2.6.11",
|
|
||||||
"vue-count-to": "1.0.13",
|
|
||||||
"vue-i18n": "8.17.4",
|
|
||||||
"vue-multipane": "^0.9.5",
|
|
||||||
"vue-resize": "^0.5.0",
|
|
||||||
"vue-router": "3.3.2",
|
|
||||||
"vue-shortkey": "^3.1.7",
|
|
||||||
"vue-split-panel": "^1.0.4",
|
|
||||||
"vue-splitpane": "1.0.6",
|
|
||||||
"vuedraggable": "^2.23.2",
|
|
||||||
"vuex": "3.4.0",
|
|
||||||
"xlsx": "0.15.6"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "7.9.0",
|
|
||||||
"@babel/register": "7.9.0",
|
|
||||||
"@vue/cli-plugin-babel": "4.3.1",
|
|
||||||
"@vue/cli-plugin-eslint": "4.3.1",
|
|
||||||
"@vue/cli-plugin-unit-jest": "^4.3.1",
|
|
||||||
"@vue/cli-service": "4.3.1",
|
|
||||||
"@vue/test-utils": "1.0.0-beta.33",
|
|
||||||
"autoprefixer": "^9.7.6",
|
|
||||||
"babel-core": "7.0.0-bridge.0",
|
|
||||||
"babel-eslint": "^10.1.0",
|
|
||||||
"babel-jest": "^25.5.1",
|
|
||||||
"chalk": "4.0.0",
|
|
||||||
"chokidar": "3.4.0",
|
|
||||||
"connect": "3.7.0",
|
|
||||||
"eslint": "^6.8.0",
|
|
||||||
"eslint-plugin-vue": "6.2.2",
|
|
||||||
"html-webpack-plugin": "4.2.1",
|
|
||||||
"husky": "^4.2.5",
|
|
||||||
"lint-staged": "10.2.0",
|
|
||||||
"mockjs": "1.1.0",
|
|
||||||
"node-sass": "^4.14.0",
|
|
||||||
"plop": "2.6.0",
|
|
||||||
"runjs": "^4.4.2",
|
|
||||||
"sass-loader": "^8.0.2",
|
|
||||||
"script-ext-html-webpack-plugin": "2.1.4",
|
|
||||||
"serve-static": "^1.14.1",
|
|
||||||
"svg-sprite-loader": "4.2.7",
|
|
||||||
"svgo": "1.3.2",
|
|
||||||
"vue-template-compiler": "2.6.11"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8.9",
|
|
||||||
"npm": ">= 3.0.0"
|
|
||||||
},
|
|
||||||
"browserslist": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,2 @@
|
|||||||
exports.notEmpty = name => {
|
exports.notEmpty = name => v =>
|
||||||
return v => {
|
!v || v.trim() === '' ? `${name} is required` : true
|
||||||
if (!v || v.trim === '') {
|
|
||||||
return `${name} is required`
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
57
src/api/ADempiere/field/location.js
Normal file
57
src/api/ADempiere/field/location.js
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
const tableName = 'C_Location'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a location and return the created entity
|
||||||
|
* @param {array} attributes
|
||||||
|
*/
|
||||||
|
export function requestCreateLocationAddress({
|
||||||
|
attributes
|
||||||
|
}) {
|
||||||
|
const { createEntity } = require('@/api/ADempiere/persistence.js')
|
||||||
|
|
||||||
|
return createEntity({
|
||||||
|
tableName,
|
||||||
|
attributes,
|
||||||
|
formatReturn: 'object'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get location entity by identifier
|
||||||
|
* @param {number} id as C_Location_ID
|
||||||
|
* @param {string} uuid
|
||||||
|
*/
|
||||||
|
export function requestGetLocationAddress({
|
||||||
|
id,
|
||||||
|
uuid
|
||||||
|
}) {
|
||||||
|
const { getEntity } = require('@/api/ADempiere/persistence.js')
|
||||||
|
|
||||||
|
return getEntity({
|
||||||
|
tableName,
|
||||||
|
recordId: id,
|
||||||
|
recordUuid: uuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing location by id or uuid
|
||||||
|
* @param {number} id as C_Location_ID
|
||||||
|
* @param {string} uuid
|
||||||
|
* @param {array} attributes, all attributes (including empty values)
|
||||||
|
*/
|
||||||
|
export function requestUpdateLocationAddress({
|
||||||
|
id,
|
||||||
|
uuid,
|
||||||
|
attributes
|
||||||
|
}) {
|
||||||
|
const { updateEntity } = require('@/api/ADempiere/persistence.js')
|
||||||
|
|
||||||
|
return updateEntity({
|
||||||
|
tableName,
|
||||||
|
recordId: id,
|
||||||
|
recordUuid: uuid,
|
||||||
|
attributes,
|
||||||
|
formatReturn: 'object'
|
||||||
|
})
|
||||||
|
}
|
261
src/api/ADempiere/form/point-of-sales.js
Normal file
261
src/api/ADempiere/form/point-of-sales.js
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
import { POSInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||||
|
import Criteria from '@/utils/ADempiere/criteria.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* method in price-checking.js as getProductPrice
|
||||||
|
*/
|
||||||
|
export { getProductPrice as findProduct } from '@/api/ADempiere/form/price-checking.js'
|
||||||
|
|
||||||
|
// List Point of sales
|
||||||
|
export function requestlistPointOfSales({
|
||||||
|
userUuid,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).listPointOfSales({
|
||||||
|
userUuid,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create order from POS
|
||||||
|
export function createOrder({
|
||||||
|
posUuid,
|
||||||
|
customerUuid,
|
||||||
|
documentTypeUuid
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).createOrder({
|
||||||
|
posUuid,
|
||||||
|
customerUuid,
|
||||||
|
documentTypeUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update order from POS
|
||||||
|
export function updateOrder({
|
||||||
|
orderUuid,
|
||||||
|
posUuid,
|
||||||
|
customerUuid,
|
||||||
|
description
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).updateOrder({
|
||||||
|
orderUuid,
|
||||||
|
posUuid,
|
||||||
|
customerUuid,
|
||||||
|
description
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create order line from order uuid and product
|
||||||
|
export function createOrderLine({
|
||||||
|
orderUuid,
|
||||||
|
warehouseUuid,
|
||||||
|
productUuid,
|
||||||
|
chargeUuid,
|
||||||
|
description,
|
||||||
|
quantity,
|
||||||
|
price,
|
||||||
|
discountRate
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).createOrderLine({
|
||||||
|
orderUuid,
|
||||||
|
warehouseUuid,
|
||||||
|
productUuid,
|
||||||
|
chargeUuid,
|
||||||
|
description,
|
||||||
|
quantity,
|
||||||
|
price,
|
||||||
|
discountRate
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create order line from order uuid and product
|
||||||
|
export function getOrder(orderUuid) {
|
||||||
|
return Instance.call(this).getOrder({ orderUuid })
|
||||||
|
}
|
||||||
|
|
||||||
|
// List orders from pos uuid
|
||||||
|
export function requestListOrders({
|
||||||
|
posUuid,
|
||||||
|
documentNo,
|
||||||
|
businessPartnerUuid,
|
||||||
|
grandTotal,
|
||||||
|
openAmount,
|
||||||
|
isPaid,
|
||||||
|
isProcessed,
|
||||||
|
isAisleSeller,
|
||||||
|
isInvoiced,
|
||||||
|
dateOrderedFrom,
|
||||||
|
dateOrderedTo,
|
||||||
|
salesRepresentativeUuid,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
}) {
|
||||||
|
const criteria = new Criteria({ tableName: 'C_Order' })
|
||||||
|
|
||||||
|
/*
|
||||||
|
criteria.addCondition({
|
||||||
|
columnName: 'DocumentNo',
|
||||||
|
value: documentNo
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'C_BPartner_ID_UUID',
|
||||||
|
value: businessPartnerUuid
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'GrandTotal',
|
||||||
|
value: grandTotal
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'OpenAmt',
|
||||||
|
value: openAmount
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'IsPaid',
|
||||||
|
value: isPaid
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'Processed',
|
||||||
|
value: isProcessed
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'IsAisleSeller',
|
||||||
|
value: isAisleSeller
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'IsInvoiced',
|
||||||
|
value: isInvoiced
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'DateOrderedFrom',
|
||||||
|
value: dateOrderedFrom
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'DateOrderedTo',
|
||||||
|
value: dateOrderedTo
|
||||||
|
}).addCondition({
|
||||||
|
columnName: 'SalesRep_ID_UUID',
|
||||||
|
value: salesRepresentativeId
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
|
return Instance.call(this).listOrders({
|
||||||
|
posUuid,
|
||||||
|
documentNo,
|
||||||
|
businessPartnerUuid,
|
||||||
|
grandTotal,
|
||||||
|
openAmount,
|
||||||
|
isPaid,
|
||||||
|
isProcessed,
|
||||||
|
isAisleSeller,
|
||||||
|
isInvoiced,
|
||||||
|
dateOrderedFrom,
|
||||||
|
dateOrderedTo,
|
||||||
|
salesRepresentativeUuid,
|
||||||
|
criteria: criteria.getCriteria(),
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateOrderLine orders from pos uuid
|
||||||
|
export function updateOrderLine({
|
||||||
|
orderLineUuid,
|
||||||
|
description,
|
||||||
|
quantity,
|
||||||
|
price,
|
||||||
|
discountRate
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).updateOrderLine({
|
||||||
|
orderLineUuid,
|
||||||
|
description,
|
||||||
|
quantity,
|
||||||
|
price,
|
||||||
|
discountRate
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete Order Line
|
||||||
|
export function deleteOrderLine({
|
||||||
|
orderLineUuid
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).deleteOrderLine({
|
||||||
|
orderLineUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listOrderLines({
|
||||||
|
orderUuid
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).listOrderLines({
|
||||||
|
orderUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getKeyLayout({ keyLayoutUuid }) {
|
||||||
|
return Instance.call(this).getKeyLayout({
|
||||||
|
keyLayoutUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListProductPrice
|
||||||
|
export function requestListProductPrice({
|
||||||
|
searchValue,
|
||||||
|
priceListUuid,
|
||||||
|
businessPartnerUuid,
|
||||||
|
warehouseUuid,
|
||||||
|
validFrom,
|
||||||
|
// Query
|
||||||
|
criteria,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
}) {
|
||||||
|
return Instance.call(this).requestListProductPrice({
|
||||||
|
searchValue,
|
||||||
|
priceListUuid,
|
||||||
|
businessPartnerUuid,
|
||||||
|
warehouseUuid,
|
||||||
|
validFrom,
|
||||||
|
// Query
|
||||||
|
criteria,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestPrintOrder({
|
||||||
|
orderUuid
|
||||||
|
}) {
|
||||||
|
console.info(`Print order ${orderUuid}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestGenerateImmediateInvoice({
|
||||||
|
posId,
|
||||||
|
posUuid
|
||||||
|
}) {
|
||||||
|
console.info(`Generate imediate invoice with POS id ${posId}, and uuid ${posUuid}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestCompletePreparedOrder({
|
||||||
|
orderUuid
|
||||||
|
}) {
|
||||||
|
console.info(`Complete prepared order ${orderUuid}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestReverseSalesTransaction({
|
||||||
|
orderUuid
|
||||||
|
}) {
|
||||||
|
console.info(`Reverse sales transaction ${orderUuid}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestCreateWithdrawal({
|
||||||
|
posId,
|
||||||
|
posUuid
|
||||||
|
}) {
|
||||||
|
console.info(`Withdrall cash with POS id ${posId}, and uuid ${posUuid}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestCreateNewCustomerReturnOrder({
|
||||||
|
orderUuid
|
||||||
|
}) {
|
||||||
|
console.info(`New Customer Return Order ${orderUuid}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestCashClosing({
|
||||||
|
posId,
|
||||||
|
posUuid
|
||||||
|
}) {
|
||||||
|
console.info(`Cash closing with POS id ${posId}, and uuid ${posUuid}`)
|
||||||
|
}
|
@ -6,10 +6,15 @@ import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
|||||||
* @param {string} tableName
|
* @param {string} tableName
|
||||||
* @param {array} attributesList
|
* @param {array} attributesList
|
||||||
*/
|
*/
|
||||||
export function createEntity({ tableName, attributes }) {
|
export function createEntity({
|
||||||
|
tableName,
|
||||||
|
attributes,
|
||||||
|
formatReturn = 'array'
|
||||||
|
}) {
|
||||||
return Instance.call(this).requestCreateEntity({
|
return Instance.call(this).requestCreateEntity({
|
||||||
tableName,
|
tableName,
|
||||||
attributesList: attributes
|
attributesList: attributes,
|
||||||
|
formatToConvert: formatReturn
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,12 +25,19 @@ export function createEntity({ tableName, attributes }) {
|
|||||||
* @param {string} recordUuid
|
* @param {string} recordUuid
|
||||||
* @param {array} attributesList
|
* @param {array} attributesList
|
||||||
*/
|
*/
|
||||||
export function updateEntity({ tableName, recordId, recordUuid, attributes }) {
|
export function updateEntity({
|
||||||
|
tableName,
|
||||||
|
recordId,
|
||||||
|
recordUuid,
|
||||||
|
attributes,
|
||||||
|
formatReturn = 'array'
|
||||||
|
}) {
|
||||||
return Instance.call(this).requestUpdateEntity({
|
return Instance.call(this).requestUpdateEntity({
|
||||||
tableName,
|
tableName,
|
||||||
recordId,
|
recordId,
|
||||||
recordUuid,
|
recordUuid,
|
||||||
attributesList: attributes
|
attributesList: attributes,
|
||||||
|
formatToConvert: formatReturn
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +116,7 @@ export function getEntitiesList({
|
|||||||
* @param {string} tableName
|
* @param {string} tableName
|
||||||
* @param {string} language
|
* @param {string} language
|
||||||
* @param {string} recordUuid
|
* @param {string} recordUuid
|
||||||
* @param {integer} recordId
|
* @param {number} recordId
|
||||||
*/
|
*/
|
||||||
export function requestTranslations({ tableName, language, recordUuid, recordId, pageToken, pageSize }) {
|
export function requestTranslations({ tableName, language, recordUuid, recordId, pageToken, pageSize }) {
|
||||||
return Instance.call(this).requestListTranslations({
|
return Instance.call(this).requestListTranslations({
|
||||||
@ -116,3 +128,20 @@ export function requestTranslations({ tableName, language, recordUuid, recordId,
|
|||||||
pageSize
|
pageSize
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Download a resource from file name
|
||||||
|
export function getResource({ resourceUuid }, callBack = {
|
||||||
|
onData: () => {},
|
||||||
|
onStatus: () => {},
|
||||||
|
onEnd: () => {}
|
||||||
|
}) {
|
||||||
|
const stream = Instance.call(this).getResource({
|
||||||
|
resourceUuid
|
||||||
|
})
|
||||||
|
|
||||||
|
stream.on('data', (response) => callBack.onData(response))
|
||||||
|
stream.on('status', (status) => callBack.onStatus(status))
|
||||||
|
stream.on('end', (end) => callBack.onEnd(end))
|
||||||
|
|
||||||
|
return stream
|
||||||
|
}
|
||||||
|
@ -43,11 +43,15 @@ export function getWarehousesList({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Country definition from server using id or uuid for record
|
/**
|
||||||
export function getCountryDefinition({ countryUuid, countryId }) {
|
* Get Country definition from server using id or uuid for record
|
||||||
|
* @param {string} uuid
|
||||||
|
* @param {number} id
|
||||||
|
*/
|
||||||
|
export function getCountryDefinition({ uuid, id }) {
|
||||||
return SystemCoreInstance.call(this).requestGetCountry({
|
return SystemCoreInstance.call(this).requestGetCountry({
|
||||||
countryUuid,
|
uuid,
|
||||||
countryId
|
id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,3 +59,91 @@ export function getCountryDefinition({ countryUuid, countryId }) {
|
|||||||
export function listLanguages({ pageToken, pageSize }) {
|
export function listLanguages({ pageToken, pageSize }) {
|
||||||
return Instance.call(this).requestListLanguages({ pageToken, pageSize })
|
return Instance.call(this).requestListLanguages({ pageToken, pageSize })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function requestCreateBusinessPartner({
|
||||||
|
value,
|
||||||
|
taxId,
|
||||||
|
duns,
|
||||||
|
naics,
|
||||||
|
name,
|
||||||
|
lastName,
|
||||||
|
description,
|
||||||
|
contactName,
|
||||||
|
eMail,
|
||||||
|
phone,
|
||||||
|
businessPartnerGroupUuid,
|
||||||
|
// Location
|
||||||
|
address1,
|
||||||
|
address2,
|
||||||
|
address3,
|
||||||
|
address4,
|
||||||
|
cityUuid,
|
||||||
|
cityName,
|
||||||
|
postalCode,
|
||||||
|
regionUuid,
|
||||||
|
regionName,
|
||||||
|
countryUuid,
|
||||||
|
posUuid
|
||||||
|
}) {
|
||||||
|
return SystemCoreInstance.call(this).requestCreateBusinessPartner({
|
||||||
|
value,
|
||||||
|
taxId,
|
||||||
|
duns,
|
||||||
|
naics,
|
||||||
|
name,
|
||||||
|
lastName,
|
||||||
|
description,
|
||||||
|
contactName,
|
||||||
|
eMail,
|
||||||
|
phone,
|
||||||
|
businessPartnerGroupUuid,
|
||||||
|
// Location
|
||||||
|
address1,
|
||||||
|
address2,
|
||||||
|
address3,
|
||||||
|
address4,
|
||||||
|
cityUuid,
|
||||||
|
cityName,
|
||||||
|
postalCode,
|
||||||
|
regionUuid,
|
||||||
|
regionName,
|
||||||
|
countryUuid,
|
||||||
|
posUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestGetBusinessPartner({
|
||||||
|
searchValue
|
||||||
|
}) {
|
||||||
|
return SystemCoreInstance.call(this).requestGetBusinessPartner({
|
||||||
|
searchValue
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestListBusinessPartner({
|
||||||
|
searchValue,
|
||||||
|
value,
|
||||||
|
name,
|
||||||
|
contactName,
|
||||||
|
eMail,
|
||||||
|
postalCode,
|
||||||
|
phone,
|
||||||
|
// Query
|
||||||
|
criteria,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
}) {
|
||||||
|
return SystemCoreInstance.call(this).requestListBusinessPartner({
|
||||||
|
searchValue,
|
||||||
|
value,
|
||||||
|
name,
|
||||||
|
contactName,
|
||||||
|
eMail,
|
||||||
|
postalCode,
|
||||||
|
phone,
|
||||||
|
// Query
|
||||||
|
criteria,
|
||||||
|
pageSize,
|
||||||
|
pageToken
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -13,12 +13,11 @@ export function login({
|
|||||||
userPass,
|
userPass,
|
||||||
role
|
role
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
return Instance.call(this).requestLoginDefault({
|
return Instance.call(this).requestLoginDefault({
|
||||||
userName,
|
userName,
|
||||||
userPass
|
userPass
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get User Info from session Uuid or token
|
// Get User Info from session Uuid or token
|
||||||
@ -39,11 +38,6 @@ export function logout(sessionUuid) {
|
|||||||
return Instance.call(this).requestLogOut(sessionUuid)
|
return Instance.call(this).requestLogOut(sessionUuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get User menu from server
|
|
||||||
export function getMenu(sessionUuid) {
|
|
||||||
return Instance.call(this).requestUserMenuFromSession(sessionUuid)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} attributes.sessionUuid
|
* @param {string} attributes.sessionUuid
|
||||||
@ -51,6 +45,10 @@ export function getMenu(sessionUuid) {
|
|||||||
* @param {string} attributes.organizationUuid
|
* @param {string} attributes.organizationUuid
|
||||||
* @param {string} attributes.warehouseUuid
|
* @param {string} attributes.warehouseUuid
|
||||||
*/
|
*/
|
||||||
|
// Get User menu from server
|
||||||
|
export function getMenu(sessionUuid) {
|
||||||
|
return Instance.call(this).requestUserMenuFromSession(sessionUuid)
|
||||||
|
}
|
||||||
export function changeRole(attributes) {
|
export function changeRole(attributes) {
|
||||||
return Instance.call(this).requestChangeRole(attributes)
|
return Instance.call(this).requestChangeRole(attributes)
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
</el-popover>
|
</el-popover>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Badge',
|
name: 'Badge',
|
||||||
@ -82,10 +83,14 @@ export default {
|
|||||||
instanceUuid: getRecordNotification.instanceUuid,
|
instanceUuid: getRecordNotification.instanceUuid,
|
||||||
fileName: getRecordNotification.download
|
fileName: getRecordNotification.download
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`${this.name} Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'ProcessActivity'
|
name: 'ProcessActivity'
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`${this.name} Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,11 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/mixinInfo'
|
import MixinInfo from './mixinInfo.js'
|
||||||
import chatTextLong from '@/components/ADempiere/Field/chatTextLong'
|
import chatTextLong from '@/components/ADempiere/Field/chatTextLong'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChatEntries',
|
name: 'ChatEntries',
|
||||||
components: {
|
components: {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export const MixinInfo = {
|
export default {
|
||||||
|
name: 'MixinContainerInfo',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentKey: 100,
|
currentKey: 100,
|
||||||
@ -50,7 +51,7 @@ export const MixinInfo = {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
sendComment() {
|
sendComment() {
|
||||||
var chatTextLong = this.$store.getters.getChatTextLong
|
const chatTextLong = this.$store.getters.getChatTextLong
|
||||||
if (!this.isEmptyValue(chatTextLong)) {
|
if (!this.isEmptyValue(chatTextLong)) {
|
||||||
this.$store.dispatch('createChatEntry', {
|
this.$store.dispatch('createChatEntry', {
|
||||||
tableName: this.$route.params.tableName,
|
tableName: this.$route.params.tableName,
|
||||||
|
@ -33,8 +33,10 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/mixinInfo'
|
import MixinInfo from './mixinInfo.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RecordLogs',
|
name: 'RecordLogs',
|
||||||
mixins: [MixinInfo],
|
mixins: [MixinInfo],
|
||||||
|
@ -64,8 +64,10 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/mixinInfo'
|
import MixinInfo from './mixinInfo.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkflowLogs',
|
name: 'WorkflowLogs',
|
||||||
mixins: [MixinInfo]
|
mixins: [MixinInfo]
|
||||||
|
26
src/components/ADempiere/ContentLoader/index.vue
Normal file
26
src/components/ADempiere/ContentLoader/index.vue
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<script>
|
||||||
|
import VueContentLoading from 'vue-content-loading'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ContentLoader',
|
||||||
|
components: {
|
||||||
|
VueContentLoading
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
width: {
|
||||||
|
type: Number,
|
||||||
|
default: 300
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: Number,
|
||||||
|
default: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<vue-content-loading :width="width" :height="height">
|
||||||
|
<rect cx="50" cy="20" :width="width" :height="height" />
|
||||||
|
</vue-content-loading>
|
||||||
|
</template>
|
@ -2,7 +2,7 @@
|
|||||||
<div class="container-submenu container-context-menu">
|
<div class="container-submenu container-context-menu">
|
||||||
<el-menu
|
<el-menu
|
||||||
ref="contextMenu"
|
ref="contextMenu"
|
||||||
v-shortkey="{ f2: ['f2'], f3: ['f3'], f5: ['f5'], f3:['ctrl', 'd'] }"
|
v-shortkey="shorcutKey"
|
||||||
:default-active="activeMenu"
|
:default-active="activeMenu"
|
||||||
:router="false"
|
:router="false"
|
||||||
class="el-menu-demo"
|
class="el-menu-demo"
|
||||||
@ -23,7 +23,7 @@
|
|||||||
{{ $t('components.contextMenuRelations') }}
|
{{ $t('components.contextMenuRelations') }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-submenu v-if="actions !== undefined && actions.length" class="el-menu-item" index="actions" @click.native="runAction(actions[0])">
|
<el-submenu v-if="!isEmptyValue(actions)" class="el-menu-item" index="actions" @click.native="runAction(actions[0])">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
{{ $t('components.contextMenuActions') }}
|
{{ $t('components.contextMenuActions') }}
|
||||||
</template>
|
</template>
|
||||||
@ -112,7 +112,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { contextMixin } from '@/components/ADempiere/ContextMenu/contextMenuMixin'
|
import contextMixin from './contextMenuMixin.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ContextMenuDesktop',
|
name: 'ContextMenuDesktop',
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { showNotification, showMessage } from '@/utils/ADempiere/notification'
|
import { showNotification } from '@/utils/ADempiere/notification.js'
|
||||||
import Item from './items'
|
import Item from './items'
|
||||||
import { convertFieldListToShareLink, recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
import { convertFieldListToShareLink, recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { supportedTypes, exportFileFromJson } from '@/utils/ADempiere/exportUtil'
|
import { supportedTypes, exportFileFromJson } from '@/utils/ADempiere/exportUtil.js'
|
||||||
import ROUTES from '@/utils/ADempiere/zoomWindow'
|
import ROUTES from '@/utils/ADempiere/zoomWindow'
|
||||||
|
|
||||||
export const contextMixin = {
|
export default {
|
||||||
|
name: 'MixinContextMenu',
|
||||||
components: {
|
components: {
|
||||||
Item
|
Item
|
||||||
},
|
},
|
||||||
@ -192,6 +193,14 @@ export const contextMixin = {
|
|||||||
},
|
},
|
||||||
isManageDataRecords() {
|
isManageDataRecords() {
|
||||||
return ['browser', 'window'].includes(this.panelType)
|
return ['browser', 'window'].includes(this.panelType)
|
||||||
|
},
|
||||||
|
shorcutKey() {
|
||||||
|
return {
|
||||||
|
defaultValues: ['f2'],
|
||||||
|
deleteRecord: ['f3'],
|
||||||
|
deleteRecord2: ['ctrl', 'd'],
|
||||||
|
refreshData: ['f5']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -229,11 +238,10 @@ export const contextMixin = {
|
|||||||
this.getReferences()
|
this.getReferences()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showMessage,
|
|
||||||
showNotification,
|
showNotification,
|
||||||
actionContextMenu(event) {
|
actionContextMenu(event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'f2':
|
case 'defaultValues':
|
||||||
this.$store.dispatch('setDefaultValues', {
|
this.$store.dispatch('setDefaultValues', {
|
||||||
parentUuid: this.parentUuid,
|
parentUuid: this.parentUuid,
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
@ -242,14 +250,15 @@ export const contextMixin = {
|
|||||||
isNewRecord: true
|
isNewRecord: true
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'f3':
|
case 'deleteRecord':
|
||||||
|
case 'deleteRecord2':
|
||||||
this.$store.dispatch('deleteEntity', {
|
this.$store.dispatch('deleteEntity', {
|
||||||
parentUuid: this.parentUuid,
|
parentUuid: this.parentUuid,
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
recordUuid: this.recordUuid
|
recordUuid: this.recordUuid
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'f5':
|
case 'refreshData':
|
||||||
this.refreshData()
|
this.refreshData()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -271,7 +280,7 @@ export const contextMixin = {
|
|||||||
fieldsList: this.getterFieldList
|
fieldsList: this.getterFieldList
|
||||||
})
|
})
|
||||||
if (fieldsEmpty.length) {
|
if (fieldsEmpty.length) {
|
||||||
this.showMessage({
|
this.$message({
|
||||||
message: this.$t('notifications.mandatoryFieldMissing') + fieldsEmpty,
|
message: this.$t('notifications.mandatoryFieldMissing') + fieldsEmpty,
|
||||||
type: 'info'
|
type: 'info'
|
||||||
})
|
})
|
||||||
@ -328,7 +337,11 @@ export const contextMixin = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
formatJson(filterVal, jsonData) {
|
formatJson(filterVal, jsonData) {
|
||||||
return jsonData.map(v => filterVal.map(j => v[j]))
|
return jsonData.map(row => {
|
||||||
|
return filterVal.map(column => {
|
||||||
|
return row[column]
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
generateContextMenu() {
|
generateContextMenu() {
|
||||||
this.metadataMenu = this.getterContextMenu
|
this.metadataMenu = this.getterContextMenu
|
||||||
@ -392,7 +405,7 @@ export const contextMixin = {
|
|||||||
},
|
},
|
||||||
showModal(action) {
|
showModal(action) {
|
||||||
// TODO: Refactor and remove redundant dispatchs
|
// TODO: Refactor and remove redundant dispatchs
|
||||||
if (action.type === 'process') {
|
if (['process'].includes(action.type)) {
|
||||||
// Add context from view open in process to opening
|
// Add context from view open in process to opening
|
||||||
if (action.parentUuidAssociated || action.containerUuidAssociated) {
|
if (action.parentUuidAssociated || action.containerUuidAssociated) {
|
||||||
const attributes = this.$store.getters.getValuesView({
|
const attributes = this.$store.getters.getValuesView({
|
||||||
@ -431,6 +444,8 @@ export const contextMixin = {
|
|||||||
query: {
|
query: {
|
||||||
...this.getOldRouteOfWindow.query
|
...this.getOldRouteOfWindow.query
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Context Menu Mixin: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch(action.action, {
|
this.$store.dispatch(action.action, {
|
||||||
@ -575,9 +590,11 @@ export const contextMixin = {
|
|||||||
// windowUuid: this.parentUuid,
|
// windowUuid: this.parentUuid,
|
||||||
tabParent: 0
|
tabParent: 0
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Context Menu Mixin: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.showMessage({
|
this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: this.$t('notifications.noRoleAccess')
|
message: this.$t('notifications.noRoleAccess')
|
||||||
})
|
})
|
||||||
@ -639,6 +656,7 @@ export const contextMixin = {
|
|||||||
this.$message({
|
this.$message({
|
||||||
message: message,
|
message: message,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
showClose: true,
|
||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -649,40 +667,29 @@ export const contextMixin = {
|
|||||||
action: this.getReportDefinition.output.printFormatUuid,
|
action: this.getReportDefinition.output.printFormatUuid,
|
||||||
tabParent: ROUTES.PRINT_FORMAT_SETUP_WINDOW.tabParent
|
tabParent: ROUTES.PRINT_FORMAT_SETUP_WINDOW.tabParent
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Context Menu Mixin: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
validatePrivateAccess({ isLocked, tableName, recordId }) {
|
validatePrivateAccess({ isLocked, tableName, recordId }) {
|
||||||
if (this.isPersonalLock) {
|
if (this.isPersonalLock) {
|
||||||
|
let isHiddenLock = false
|
||||||
if (isLocked) {
|
if (isLocked) {
|
||||||
this.actions = this.actions.map(actionItem => {
|
isHiddenLock = true
|
||||||
if (actionItem.action === 'unlockRecord') {
|
|
||||||
return {
|
|
||||||
...actionItem,
|
|
||||||
hidden: false,
|
|
||||||
tableName,
|
|
||||||
recordId
|
|
||||||
}
|
}
|
||||||
} else if (actionItem.action === 'lockRecord') {
|
|
||||||
return {
|
|
||||||
...actionItem,
|
|
||||||
hidden: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return actionItem
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.actions = this.actions.map(actionItem => {
|
this.actions = this.actions.map(actionItem => {
|
||||||
if (actionItem.action === 'lockRecord') {
|
if (actionItem.action === 'lockRecord') {
|
||||||
return {
|
return {
|
||||||
...actionItem,
|
...actionItem,
|
||||||
hidden: false,
|
hidden: isHiddenLock,
|
||||||
tableName,
|
tableName,
|
||||||
recordId
|
recordId
|
||||||
}
|
}
|
||||||
} else if (actionItem.action === 'unlockRecord') {
|
} else if (actionItem.action === 'unlockRecord') {
|
||||||
return {
|
return {
|
||||||
...actionItem,
|
...actionItem,
|
||||||
hidden: true
|
hidden: !isHiddenLock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return actionItem
|
return actionItem
|
||||||
@ -690,5 +697,4 @@ export const contextMixin = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<right-menu>
|
<right-menu>
|
||||||
<el-menu
|
<el-menu
|
||||||
ref="contextMenu"
|
ref="contextMenu"
|
||||||
v-shortkey="{ f2: ['f2'], f3: ['f3'], f5: ['f5'], f3:['ctrl', 'd'] }"
|
v-shortkey="shorcutKey"
|
||||||
:default-active="activeMenu"
|
:default-active="activeMenu"
|
||||||
:router="false"
|
:router="false"
|
||||||
class="el-menu-demo"
|
class="el-menu-demo"
|
||||||
@ -119,7 +119,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { contextMixin } from '@/components/ADempiere/ContextMenu/contextMenuMixin'
|
import contextMixin from './contextMenuMixin.js'
|
||||||
import RightMenu from '@/components/RightPanel/menu'
|
import RightMenu from '@/components/RightPanel/menu'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -130,13 +130,13 @@ export default {
|
|||||||
mixins: [contextMixin],
|
mixins: [contextMixin],
|
||||||
computed: {
|
computed: {
|
||||||
isPanelTypeMobile() {
|
isPanelTypeMobile() {
|
||||||
if (this.$route.meta.type === 'process' || this.$route.meta.type === 'report') {
|
if (['process', 'report'].includes(this.$route.meta.type)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
iconDefault() {
|
iconDefault() {
|
||||||
if (this.$route.meta.type === 'process') {
|
if (this.isPanelTypeMobile) {
|
||||||
return 'component'
|
return 'component'
|
||||||
}
|
}
|
||||||
return 'skill'
|
return 'skill'
|
||||||
@ -144,6 +144,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.svg-icon {
|
.svg-icon {
|
||||||
width: 1em;
|
width: 1em;
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:metadata="scope"
|
:metadata="scope"
|
||||||
:placeholder="$t('table.dataTable.search')"
|
:placeholder="$t('table.dataTable.search')"
|
||||||
/>
|
>
|
||||||
|
<svg-icon slot="prefix" icon-class="search" />
|
||||||
|
</el-input>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<span>{{ row.name }}</span>
|
<span>{{ row.name }}</span>
|
||||||
@ -26,36 +28,22 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPendingDocumentsFromServer } from '@/api/ADempiere/dashboard/dashboard'
|
import { getPendingDocumentsFromServer } from '@/api/ADempiere/dashboard/dashboard'
|
||||||
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
import mixinDashboard from '@/components/ADempiere/Dashboard/mixinDashboard.js'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PendingDocuments',
|
name: 'PendingDocuments',
|
||||||
props: {
|
mixins: [mixinDashboard],
|
||||||
metadata: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
documents: [],
|
documents: []
|
||||||
unsubscribe: () => {},
|
|
||||||
search: ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cachedViews() {
|
|
||||||
return this.$store.getters.cachedViews
|
|
||||||
},
|
|
||||||
dataResult() {
|
dataResult() {
|
||||||
if (this.search.length) {
|
if (this.search.length) {
|
||||||
return this.filterResult(this.search)
|
return this.filterResult(this.search)
|
||||||
}
|
}
|
||||||
return this.documents
|
return this.documents
|
||||||
},
|
|
||||||
permissionRoutes() {
|
|
||||||
return this.$store.getters.permission_routes
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -67,7 +55,6 @@ export default {
|
|||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showMessage,
|
|
||||||
getPendingDocuments() {
|
getPendingDocuments() {
|
||||||
const userUuid = this.$store.getters['user/getUserUuid']
|
const userUuid = this.$store.getters['user/getUserUuid']
|
||||||
const roleUuid = this.$store.getters.getRoleUuid
|
const roleUuid = this.$store.getters.getRoleUuid
|
||||||
@ -97,37 +84,39 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClick(row) {
|
handleClick(row) {
|
||||||
const viewSearch = recursiveTreeSearch({
|
const viewSearch = this.recursiveTreeSearch({
|
||||||
treeData: this.permissionRoutes,
|
treeData: this.permissionRoutes,
|
||||||
attributeValue: row.windowUuid,
|
attributeValue: row.windowUuid,
|
||||||
attributeName: 'meta',
|
attributeName: 'meta',
|
||||||
secondAttribute: 'uuid',
|
secondAttribute: 'uuid',
|
||||||
attributeChilds: 'children'
|
attributeChilds: 'children'
|
||||||
})
|
})
|
||||||
|
|
||||||
if (viewSearch) {
|
if (viewSearch) {
|
||||||
|
let tabParent
|
||||||
|
if (row.action === 'window') {
|
||||||
|
tabParent = 0
|
||||||
|
}
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: viewSearch.name,
|
name: viewSearch.name,
|
||||||
params: {
|
params: {
|
||||||
...row.criteria
|
...row.criteria
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
action: 'criteria'
|
action: 'criteria',
|
||||||
|
tabParent
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Dashboard/docstatus Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.showMessage({
|
this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: this.$t('notifications.noRoleAccess')
|
message: this.$t('notifications.noRoleAccess')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// conditions for the registration amount (operador: row.criteria.whereClause)
|
// 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, '')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
75
src/components/ADempiere/Dashboard/mixinDashboard.js
Normal file
75
src/components/ADempiere/Dashboard/mixinDashboard.js
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MixinDashboard',
|
||||||
|
props: {
|
||||||
|
metadata: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
search: '',
|
||||||
|
unsubscribe: () => {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
permissionRoutes() {
|
||||||
|
return this.$store.getters.permission_routes
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
recursiveTreeSearch,
|
||||||
|
handleClick(row) {
|
||||||
|
const viewSearch = this.recursiveTreeSearch({
|
||||||
|
treeData: this.permissionRoutes,
|
||||||
|
attributeValue: row.windowUuid,
|
||||||
|
attributeName: 'meta',
|
||||||
|
secondAttribute: 'uuid',
|
||||||
|
attributeChilds: 'children'
|
||||||
|
})
|
||||||
|
|
||||||
|
if (viewSearch) {
|
||||||
|
let recordUuid
|
||||||
|
if (!this.isEmptyValue(row.uuidRecord)) {
|
||||||
|
recordUuid = row.uuidRecord
|
||||||
|
}
|
||||||
|
let tabParent
|
||||||
|
if (row.action === 'window') {
|
||||||
|
tabParent = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$router.push({
|
||||||
|
name: viewSearch.name,
|
||||||
|
query: {
|
||||||
|
action: recordUuid,
|
||||||
|
tabParent
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Dashboard ${this.name}: ${error.name}, ${error.message}`)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: this.$t('notifications.noRoleAccess')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// conditions for the registration amount (operador: row.criteria.whereClause)
|
||||||
|
},
|
||||||
|
filterResult(search) {
|
||||||
|
const searchFilter = this.ignoreAccent(search.toLowerCase())
|
||||||
|
return this.documents.filter(item => {
|
||||||
|
return this.ignoreAccent(item.name)
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchFilter)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
ignoreAccent(s) {
|
||||||
|
if (!s) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return s.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,9 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:metadata="scope"
|
:metadata="scope"
|
||||||
:placeholder="$t('table.dataTable.search')"
|
:placeholder="$t('table.dataTable.search')"
|
||||||
/>
|
>
|
||||||
|
<svg-icon slot="prefix" icon-class="search" />
|
||||||
|
</el-input>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<span>{{ row.displayName }}</span>
|
<span>{{ row.displayName }}</span>
|
||||||
@ -35,45 +37,27 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getRecentItems as getRecentItemsFromServer } from '@/api/ADempiere/dashboard/dashboard'
|
import { getRecentItems as getRecentItemsFromServer } from '@/api/ADempiere/dashboard/dashboard'
|
||||||
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
|
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
|
||||||
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
import mixinDashboard from '@/components/ADempiere/Dashboard/mixinDashboard.js'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RecentItems',
|
name: 'RecentItems',
|
||||||
props: {
|
mixins: [mixinDashboard],
|
||||||
metadata: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
recentItems: [],
|
recentItems: [],
|
||||||
unsubscribe: () => {},
|
isLoaded: true
|
||||||
isLoaded: true,
|
|
||||||
search: '',
|
|
||||||
accentRegexp: /[\u0300-\u036f]/g
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getterRecentItems() {
|
|
||||||
return this.$store.getters.getRecentItems
|
|
||||||
},
|
|
||||||
cachedViews() {
|
|
||||||
return this.$store.getters.cachedViews
|
|
||||||
},
|
|
||||||
dataResult() {
|
dataResult() {
|
||||||
if (this.search.length) {
|
if (this.search.length) {
|
||||||
return this.filterResult(this.search)
|
return this.filterResult(this.search)
|
||||||
}
|
}
|
||||||
return this.recentItems
|
return this.recentItems
|
||||||
},
|
|
||||||
permissionRoutes() {
|
|
||||||
return this.$store.getters.permission_routes
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getRecentItems({ pageToken: undefined, pageSize: undefined })
|
this.getRecentItems({})
|
||||||
|
|
||||||
this.unsubscribe = this.subscribeChanges()
|
this.unsubscribe = this.subscribeChanges()
|
||||||
},
|
},
|
||||||
@ -81,10 +65,6 @@ export default {
|
|||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showMessage,
|
|
||||||
checkOpened(uuid) {
|
|
||||||
return this.cachedViews.includes(uuid)
|
|
||||||
},
|
|
||||||
getRecentItems({ pageToken, pageSize }) {
|
getRecentItems({ pageToken, pageSize }) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
getRecentItemsFromServer({ pageToken, pageSize })
|
getRecentItemsFromServer({ pageToken, pageSize })
|
||||||
@ -111,39 +91,6 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClick(row) {
|
|
||||||
const viewSearch = recursiveTreeSearch({
|
|
||||||
treeData: this.permissionRoutes,
|
|
||||||
attributeValue: row.referenceUuid,
|
|
||||||
attributeName: 'meta',
|
|
||||||
secondAttribute: 'uuid',
|
|
||||||
attributeChilds: 'children'
|
|
||||||
})
|
|
||||||
|
|
||||||
if (viewSearch) {
|
|
||||||
let recordUuid
|
|
||||||
if (!this.isEmptyValue(row.uuidRecord)) {
|
|
||||||
recordUuid = row.uuidRecord
|
|
||||||
}
|
|
||||||
let tabParent
|
|
||||||
if (row.action === 'window') {
|
|
||||||
tabParent = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$router.push({
|
|
||||||
name: viewSearch.name,
|
|
||||||
query: {
|
|
||||||
action: recordUuid,
|
|
||||||
tabParent
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.showMessage({
|
|
||||||
type: 'error',
|
|
||||||
message: this.$t('notifications.noRoleAccess')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
subscribeChanges() {
|
subscribeChanges() {
|
||||||
return this.$store.subscribe((mutation, state) => {
|
return this.$store.subscribe((mutation, state) => {
|
||||||
if (mutation.type === 'notifyDashboardRefresh') {
|
if (mutation.type === 'notifyDashboardRefresh') {
|
||||||
@ -151,13 +98,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
filterResult(search) {
|
|
||||||
return this.recentItems.filter(item => this.ignoreAccent(item.displayName).toLowerCase().includes(this.ignoreAccent(search.toLowerCase())))
|
|
||||||
},
|
|
||||||
ignoreAccent(s) {
|
|
||||||
if (!s) { return '' }
|
|
||||||
return s.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
|
||||||
},
|
|
||||||
translateDate(value) {
|
translateDate(value) {
|
||||||
return this.$d(new Date(value), 'long', this.language)
|
return this.$d(new Date(value), 'long', this.language)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:metadata="scope"
|
:metadata="scope"
|
||||||
:placeholder="$t('table.dataTable.search')"
|
:placeholder="$t('table.dataTable.search')"
|
||||||
/>
|
>
|
||||||
|
<svg-icon slot="prefix" icon-class="search" />
|
||||||
|
</el-input>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<span>{{ row.name }}</span>
|
<span>{{ row.name }}</span>
|
||||||
@ -24,10 +26,24 @@
|
|||||||
<br>
|
<br>
|
||||||
<el-button-group class="actions-buttons">
|
<el-button-group class="actions-buttons">
|
||||||
<el-tooltip :content="$t('quickAccess.newRecord')" placement="top">
|
<el-tooltip :content="$t('quickAccess.newRecord')" placement="top">
|
||||||
<el-button v-if="row.action === 'window'" size="mini" circle @click.stop="windowAction(row, 'create-new')"><i class="el-icon-circle-plus-outline" /></el-button>
|
<el-button
|
||||||
|
v-if="row.action === 'window'"
|
||||||
|
size="mini"
|
||||||
|
circle
|
||||||
|
@click.stop="windowAction(row, 'create-new')"
|
||||||
|
>
|
||||||
|
<i class="el-icon-circle-plus-outline" />
|
||||||
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip :content="$t('quickAccess.listRecords')" placement="top">
|
<el-tooltip :content="$t('quickAccess.listRecords')" placement="top">
|
||||||
<el-button v-if="row.action === 'window'" size="mini" circle @click.stop="windowAction(row, 'listRecords')"><i class="el-icon-search" /></el-button>
|
<el-button
|
||||||
|
v-if="row.action === 'window'"
|
||||||
|
size="mini"
|
||||||
|
circle
|
||||||
|
@click.stop="windowAction(row, 'listRecords')"
|
||||||
|
>
|
||||||
|
<i class="el-icon-search" />
|
||||||
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</template>
|
</template>
|
||||||
@ -38,40 +54,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getFavoritesFromServer } from '@/api/ADempiere/dashboard/dashboard'
|
import { getFavoritesFromServer } from '@/api/ADempiere/dashboard/dashboard.js'
|
||||||
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
|
import { convertAction } from '@/utils/ADempiere/dictionaryUtils.js'
|
||||||
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
import mixinDashboard from '@/components/ADempiere/Dashboard/mixinDashboard.js'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Favorites',
|
name: 'Favorites',
|
||||||
props: {
|
mixins: [mixinDashboard],
|
||||||
metadata: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
favorites: [],
|
favorites: [],
|
||||||
unsubscribe: () => {},
|
isLoaded: true
|
||||||
isLoaded: true,
|
|
||||||
search: '',
|
|
||||||
accentRegexp: /[\u0300-\u036f]/g
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cachedViews() {
|
|
||||||
return this.$store.getters.cachedViews
|
|
||||||
},
|
|
||||||
dataResult() {
|
dataResult() {
|
||||||
if (this.search.length) {
|
if (this.search.length) {
|
||||||
return this.filterResult(this.search)
|
return this.filterResult(this.search)
|
||||||
}
|
}
|
||||||
return this.favorites
|
return this.favorites
|
||||||
},
|
|
||||||
permissionRoutes() {
|
|
||||||
return this.$store.getters.permission_routes
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -83,7 +84,6 @@ export default {
|
|||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showMessage,
|
|
||||||
getFavoritesList() {
|
getFavoritesList() {
|
||||||
const userUuid = this.$store.getters['user/getUserUuid']
|
const userUuid = this.$store.getters['user/getUserUuid']
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
@ -115,51 +115,8 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClick(row) {
|
|
||||||
const viewSearch = recursiveTreeSearch({
|
|
||||||
treeData: this.permissionRoutes,
|
|
||||||
attributeValue: row.referenceUuid,
|
|
||||||
attributeName: 'meta',
|
|
||||||
secondAttribute: 'uuid',
|
|
||||||
attributeChilds: 'children'
|
|
||||||
})
|
|
||||||
|
|
||||||
if (viewSearch) {
|
|
||||||
let recordUuid
|
|
||||||
if (!this.isEmptyValue(row.uuidRecord)) {
|
|
||||||
recordUuid = row.uuidRecord
|
|
||||||
}
|
|
||||||
let tabParent
|
|
||||||
if (row.action === 'window') {
|
|
||||||
tabParent = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$router.push({
|
|
||||||
name: viewSearch.name,
|
|
||||||
query: {
|
|
||||||
action: recordUuid,
|
|
||||||
tabParent
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.showMessage({
|
|
||||||
type: 'error',
|
|
||||||
message: this.$t('notifications.noRoleAccess')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
filterResult(search) {
|
|
||||||
return this.favorites.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, '')
|
|
||||||
},
|
|
||||||
translateDate(value) {
|
|
||||||
return this.$d(new Date(value), 'long', this.language)
|
|
||||||
},
|
|
||||||
windowAction(row, param) {
|
windowAction(row, param) {
|
||||||
const viewSearch = recursiveTreeSearch({
|
const viewSearch = this.recursiveTreeSearch({
|
||||||
treeData: this.permissionRoutes,
|
treeData: this.permissionRoutes,
|
||||||
attributeValue: row.referenceUuid,
|
attributeValue: row.referenceUuid,
|
||||||
attributeName: 'meta',
|
attributeName: 'meta',
|
||||||
@ -174,9 +131,11 @@ export default {
|
|||||||
action: param,
|
action: param,
|
||||||
tabParent: 0
|
tabParent: 0
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Dashboard/userfavorites Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.showMessage({
|
this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: this.$t('notifications.noRoleAccess')
|
message: this.$t('notifications.noRoleAccess')
|
||||||
})
|
})
|
||||||
|
@ -249,6 +249,7 @@ import TableContextMenu from '@/components/ADempiere/DataTable/menu/tableContext
|
|||||||
import TableMainMenu from '@/components/ADempiere/DataTable/menu'
|
import TableMainMenu from '@/components/ADempiere/DataTable/menu'
|
||||||
import IconElement from '@/components/ADempiere/IconElement'
|
import IconElement from '@/components/ADempiere/IconElement'
|
||||||
import { formatField } from '@/utils/ADempiere/valueFormat'
|
import { formatField } from '@/utils/ADempiere/valueFormat'
|
||||||
|
import { typeValue } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import MainPanel from '@/components/ADempiere/Panel'
|
import MainPanel from '@/components/ADempiere/Panel'
|
||||||
import { sortFields } from '@/utils/ADempiere/dictionaryUtils'
|
import { sortFields } from '@/utils/ADempiere/dictionaryUtils'
|
||||||
import { FIELDS_DECIMALS, FIELDS_QUANTITY, FIELDS_READ_ONLY_FORM } from '@/utils/ADempiere/references'
|
import { FIELDS_DECIMALS, FIELDS_QUANTITY, FIELDS_READ_ONLY_FORM } from '@/utils/ADempiere/references'
|
||||||
@ -620,7 +621,7 @@ export default {
|
|||||||
return row[field.columnName] ? this.$t('components.switchActiveText') : this.$t('components.switchInactiveText')
|
return row[field.columnName] ? this.$t('components.switchActiveText') : this.$t('components.switchInactiveText')
|
||||||
} else if (field.componentPath === 'FieldDate' || field.componentPath === 'FieldTime') {
|
} else if (field.componentPath === 'FieldDate' || field.componentPath === 'FieldTime') {
|
||||||
let cell = row[field.columnName]
|
let cell = row[field.columnName]
|
||||||
if (Object.prototype.toString.call(cell) === '[object Date]') {
|
if (typeValue(cell) === 'DATE') {
|
||||||
cell = cell.getTime()
|
cell = cell.getTime()
|
||||||
}
|
}
|
||||||
// replace number timestamp value for date
|
// replace number timestamp value for date
|
||||||
@ -1234,7 +1235,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
/deep/ .el-input__inner {
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@ -1259,7 +1260,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
/deep/ .el-input__inner {
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
v-for="(process, key) in processMenu"
|
v-for="(process, key) in processMenu"
|
||||||
:key="key"
|
:key="key"
|
||||||
:disabled="process.type === 'application' ? false : Boolean(getDataSelection.length < 1)"
|
:disabled="process.type === 'application' ? false : Boolean(getDataSelection.length < 1)"
|
||||||
index="process"
|
:index="'process' + key"
|
||||||
@click="process.type === 'application' ? sortTab(process) : showModalTable(process)"
|
@click="process.type === 'application' ? sortTab(process) : showModalTable(process)"
|
||||||
>
|
>
|
||||||
{{ process.name }}
|
{{ process.name }}
|
||||||
@ -83,7 +83,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/menuTableMixin'
|
import menuTableMixin from './menuTableMixin.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TableMainMenu',
|
name: 'TableMainMenu',
|
||||||
@ -97,20 +97,20 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.el-menu--vertical .nest-menu .el-submenu>.el-submenu__title:hover, .el-menu--vertical .el-menu-item:hover {
|
.el-menu--vertical .nest-menu .el-submenu>.el-submenu__title:hover, .el-menu--vertical .el-menu-item:hover {
|
||||||
background-color: #74bcff94 !important;
|
background-color: #74bcff94 !important;
|
||||||
background: #74bcff94 !important;
|
background: #74bcff94 !important;
|
||||||
}
|
}
|
||||||
.el-menu--collapse {
|
.el-menu--collapse {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
.el-menu-item:hover {
|
.el-menu-item:hover {
|
||||||
background-color: #ffffff !important
|
background-color: #ffffff !important
|
||||||
}
|
}
|
||||||
.hover {
|
.hover {
|
||||||
background-color: initial !important;
|
background-color: initial !important;
|
||||||
}
|
}
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
height: 56px;
|
height: 56px;
|
||||||
line-height: 56px;
|
line-height: 56px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -124,5 +124,5 @@ export default {
|
|||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { supportedTypes, exportFileFromJson, exportFileZip } from '@/utils/ADempiere/exportUtil'
|
import { supportedTypes, exportFileFromJson, exportFileZip } from '@/utils/ADempiere/exportUtil.js'
|
||||||
import { showNotification } from '@/utils/ADempiere/notification'
|
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
|
||||||
import { FIELDS_QUANTITY } from '@/utils/ADempiere/references'
|
import { FIELDS_QUANTITY } from '@/utils/ADempiere/references'
|
||||||
|
|
||||||
export const menuTableMixin = {
|
export default {
|
||||||
|
name: 'MixinMenuTable',
|
||||||
props: {
|
props: {
|
||||||
parentUuid: {
|
parentUuid: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -155,7 +155,6 @@ export const menuTableMixin = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showNotification,
|
|
||||||
sortTab(actionSequence) {
|
sortTab(actionSequence) {
|
||||||
// TODO: Refactor and remove redundant dispatchs
|
// TODO: Refactor and remove redundant dispatchs
|
||||||
this.$store.dispatch('setShowDialog', {
|
this.$store.dispatch('setShowDialog', {
|
||||||
@ -260,6 +259,7 @@ export const menuTableMixin = {
|
|||||||
})
|
})
|
||||||
this.$message({
|
this.$message({
|
||||||
message: this.$t('notifications.mandatoryFieldMissing') + fieldsEmpty,
|
message: this.$t('notifications.mandatoryFieldMissing') + fieldsEmpty,
|
||||||
|
showClose: true,
|
||||||
type: 'info'
|
type: 'info'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -305,18 +305,22 @@ export const menuTableMixin = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
formatJson(filterVal, jsonData) {
|
formatJson(filterVal, jsonData) {
|
||||||
return jsonData.map(rowData => filterVal.map(j => rowData[j]))
|
return jsonData.map(row => {
|
||||||
|
return filterVal.map(column => {
|
||||||
|
return row[column]
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
zoomRecord() {
|
zoomRecord() {
|
||||||
const browserMetadata = this.$store.getters.getBrowser(this.$route.meta.uuid)
|
const browserMetadata = this.$store.getters.getBrowser(this.$route.meta.uuid)
|
||||||
const { elementName } = browserMetadata.fieldList.find(field => field.columnName === browserMetadata.keyColumn)
|
const { elementName } = browserMetadata.fieldList.find(field => field.columnName === browserMetadata.keyColumn)
|
||||||
const records = []
|
const records = []
|
||||||
this.getDataSelection.forEach(record => {
|
this.getDataSelection.forEach(recordItem => {
|
||||||
if (isNaN(record[browserMetadata.keyColumn])) {
|
let record = recordItem[browserMetadata.keyColumn]
|
||||||
records.push(record[browserMetadata.keyColumn])
|
if (!isNaN(record)) {
|
||||||
} else {
|
record = Number(record)
|
||||||
records.push(Number(record[browserMetadata.keyColumn]))
|
|
||||||
}
|
}
|
||||||
|
records.push(record)
|
||||||
})
|
})
|
||||||
|
|
||||||
const viewSearch = recursiveTreeSearch({
|
const viewSearch = recursiveTreeSearch({
|
||||||
@ -333,6 +337,8 @@ export const menuTableMixin = {
|
|||||||
action: 'advancedQuery',
|
action: 'advancedQuery',
|
||||||
[elementName]: records
|
[elementName]: records
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Table Menu Mixin: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/menuTableMixin'
|
import menuTableMixin from './menuTableMixin.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TableContextMenu',
|
name: 'TableContextMenu',
|
||||||
|
@ -96,9 +96,6 @@ export default {
|
|||||||
},
|
},
|
||||||
getterDataRecordsAndSelection() {
|
getterDataRecordsAndSelection() {
|
||||||
return this.$store.getters.getDataRecordAndSelection(this.containerUuid)
|
return this.$store.getters.getDataRecordAndSelection(this.containerUuid)
|
||||||
},
|
|
||||||
getDataSelection() {
|
|
||||||
return this.getterDataRecordsAndSelection.selection
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -140,9 +137,11 @@ export default {
|
|||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: this.$route.name,
|
name: this.$route.name,
|
||||||
query: {
|
query: {
|
||||||
action: this.windowRecordSelected.UUID,
|
...this.$route.query,
|
||||||
...this.$route.query
|
action: this.windowRecordSelected.UUID
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`${this.name} Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
this.closeDialog()
|
this.closeDialog()
|
||||||
} else if (action !== undefined) {
|
} else if (action !== undefined) {
|
||||||
|
@ -77,26 +77,26 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
redirect(item) {
|
redirect(item) {
|
||||||
|
let tabParent
|
||||||
if (item.meta && item.meta.type === 'window') {
|
if (item.meta && item.meta.type === 'window') {
|
||||||
|
tabParent = 0
|
||||||
|
}
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: item.name,
|
name: item.name,
|
||||||
params: {
|
|
||||||
childs: item.children
|
|
||||||
},
|
|
||||||
query: {
|
query: {
|
||||||
tabParent: 0
|
...this.$router.query,
|
||||||
}
|
tabParent
|
||||||
})
|
},
|
||||||
} else {
|
|
||||||
this.$router.push({
|
|
||||||
name: item.name,
|
|
||||||
params: {
|
params: {
|
||||||
|
...this.$router.params,
|
||||||
childs: item.children
|
childs: item.children
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`${this.name} Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
257
src/components/ADempiere/Field/FieldAutocomplete.vue
Normal file
257
src/components/ADempiere/Field/FieldAutocomplete.vue
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
<template>
|
||||||
|
<el-autocomplete
|
||||||
|
v-model="displayedValue"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:fetch-suggestions="localSearch"
|
||||||
|
clearable
|
||||||
|
value-key="name"
|
||||||
|
style="width: 100%;"
|
||||||
|
popper-class="custom-field-bpartner-info"
|
||||||
|
@focus="isFocus = true"
|
||||||
|
@blur="isFocus = false"
|
||||||
|
>
|
||||||
|
<template slot="suffix">
|
||||||
|
<i
|
||||||
|
class="el-icon-arrow-down el-input__icon"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-autocomplete>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
|
||||||
|
import { convertBooleanToString } from '@/utils/ADempiere/valueFormat.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'FieldAutocomplete',
|
||||||
|
mixins: [fieldMixin],
|
||||||
|
data() {
|
||||||
|
// label with '' value is assumed to be undefined non-existent
|
||||||
|
const label = ' '
|
||||||
|
const blankOption = {
|
||||||
|
label,
|
||||||
|
id: undefined,
|
||||||
|
uuid: undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
controlDisplayed: this.displayedValue,
|
||||||
|
isFocus: false,
|
||||||
|
isLoading: false,
|
||||||
|
optionsList: [blankOption],
|
||||||
|
blankValues: [null, undefined, -1],
|
||||||
|
blankOption,
|
||||||
|
timeOut: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isPanelWindow() {
|
||||||
|
return this.metadata.panelType === 'window'
|
||||||
|
},
|
||||||
|
isMobile() {
|
||||||
|
return this.$store.state.app.device === 'mobile'
|
||||||
|
},
|
||||||
|
isSelectMultiple() {
|
||||||
|
return ['IN', 'NOT_IN'].includes(this.metadata.operator) && this.metadata.isAdvancedQuery
|
||||||
|
},
|
||||||
|
cssClassStyle() {
|
||||||
|
let styleClass = this.metadata.cssClassName + ' custom-field-select'
|
||||||
|
if (this.isSelectMultiple) {
|
||||||
|
styleClass += ' custom-field-select-multiple'
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
|
},
|
||||||
|
placeholder() {
|
||||||
|
if (this.isFocus) {
|
||||||
|
return this.displayedValue
|
||||||
|
}
|
||||||
|
return this.$t('quickAccess.searchWithEnter')
|
||||||
|
},
|
||||||
|
getterLookupList() {
|
||||||
|
if (this.isEmptyValue(this.metadata.reference.query) ||
|
||||||
|
!this.metadata.displayed) {
|
||||||
|
return [this.blankOption]
|
||||||
|
}
|
||||||
|
return this.$store.getters.getLookupList({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
query: this.metadata.reference.query,
|
||||||
|
tableName: this.metadata.reference.tableName
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getterLookupAll() {
|
||||||
|
const allOptions = this.$store.getters.getLookupAll({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
query: this.metadata.reference.query,
|
||||||
|
directQuery: this.metadata.reference.directQuery,
|
||||||
|
tableName: this.metadata.reference.tableName,
|
||||||
|
value: this.value
|
||||||
|
})
|
||||||
|
|
||||||
|
// sets the value to blank when the lookupList or lookupItem have no
|
||||||
|
// values, or if only lookupItem does have a value
|
||||||
|
if (this.isEmptyValue(allOptions) || (allOptions.length &&
|
||||||
|
(!this.blankValues.includes(allOptions[0].id)))) {
|
||||||
|
allOptions.unshift(this.blankOption)
|
||||||
|
}
|
||||||
|
return allOptions
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
get() {
|
||||||
|
const value = this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
columnName: this.metadata.columnName
|
||||||
|
})
|
||||||
|
if (this.isEmptyValue(value)) {
|
||||||
|
/* eslint-disable */
|
||||||
|
this.displayedValue = undefined
|
||||||
|
/* eslint-disable */
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
let label = this.findLabel(value)
|
||||||
|
if (!label) {
|
||||||
|
label = this.displayedValue
|
||||||
|
/* eslint-disable */
|
||||||
|
this.optionsList.push({
|
||||||
|
// TODO: Add uuid
|
||||||
|
id: value,
|
||||||
|
label
|
||||||
|
})
|
||||||
|
/* eslint-disable */
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
columnName: this.metadata.columnName,
|
||||||
|
value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
displayedValue: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
// DisplayColumn_'ColumnName'
|
||||||
|
columnName: this.metadata.displayColumnName
|
||||||
|
})
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
// DisplayColumn_'ColumnName'
|
||||||
|
columnName: this.metadata.displayColumnName,
|
||||||
|
value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.changeBlankOption()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
parseValue(value) {
|
||||||
|
if (typeof value === 'boolean') {
|
||||||
|
// value ? 'Y' : 'N'
|
||||||
|
value = convertBooleanToString(value)
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
changeBlankOption() {
|
||||||
|
if (Number(this.metadata.defaultValue) === -1) {
|
||||||
|
this.blankOption.id = -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setNewDisplayedValue() {
|
||||||
|
this.isFocus = true
|
||||||
|
const displayValue = this.displayedValue
|
||||||
|
if (this.controlDisplayed !== displayValue) {
|
||||||
|
this.controlDisplayed = displayValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
localSearch(stringToMatch, callBack) {
|
||||||
|
if (this.isEmptyValue(stringToMatch)) {
|
||||||
|
// not show list
|
||||||
|
callBack([])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const recordsList = this.getterLookupList
|
||||||
|
let results = recordsList
|
||||||
|
if (stringToMatch || true) {
|
||||||
|
const parsedValue = stringToMatch.toLowerCase().trim()
|
||||||
|
results = recordsList.filter(rowBPartner => {
|
||||||
|
// columns: id, uuid, label
|
||||||
|
for (const columnBPartner in rowBPartner) {
|
||||||
|
const valueToCompare = String(rowBPartner[columnBPartner]).toLowerCase()
|
||||||
|
|
||||||
|
if (valueToCompare.includes(parsedValue)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
// Remote search
|
||||||
|
if (this.isEmptyValue(results)) {
|
||||||
|
clearTimeout(this.timeOut)
|
||||||
|
|
||||||
|
this.timeOut = setTimeout(() => {
|
||||||
|
this.remoteSearch(stringToMatch)
|
||||||
|
.then(remoteResponse => {
|
||||||
|
callBack(remoteResponse)
|
||||||
|
})
|
||||||
|
}, 2000)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// call callback function to return suggestions
|
||||||
|
callBack(results)
|
||||||
|
},
|
||||||
|
remoteSearch(searchValue) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const message = {
|
||||||
|
message: 'Sin resultados coincidentes con la busqueda',
|
||||||
|
type: 'info',
|
||||||
|
showClose: true
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$store.dispatch('getLookupListFromServer', {
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
tableName: this.metadata.reference.tableName,
|
||||||
|
query: this.metadata.reference.query,
|
||||||
|
isAddBlankValue: true,
|
||||||
|
blankValue: this.blankOption.id,
|
||||||
|
valuesList: searchValue
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
const recordsList = this.getterLookupAll
|
||||||
|
if (this.isEmptyValue(recordsList)) {
|
||||||
|
this.$message(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(recordsList)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(error.message)
|
||||||
|
|
||||||
|
this.$message(message)
|
||||||
|
resolve([])
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -28,7 +28,11 @@ export default {
|
|||||||
mixins: [fieldMixin],
|
mixins: [fieldMixin],
|
||||||
computed: {
|
computed: {
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName + ' image-uploader'
|
let styleClass = ' image-uploader '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -112,7 +112,11 @@ export default {
|
|||||||
return picker
|
return picker
|
||||||
},
|
},
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName + ' custom-field-date'
|
let styleClass = ' custom-field-date '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Parse the date format to be compatible with element-ui
|
* Parse the date format to be compatible with element-ui
|
||||||
@ -150,6 +154,7 @@ export default {
|
|||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
let value = this.$store.getters.getValueOfField({
|
let value = this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName
|
columnName: this.metadata.columnName
|
||||||
})
|
})
|
||||||
@ -158,6 +163,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const valueTo = this.$store.getters.getValueOfField({
|
const valueTo = this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnNameTo
|
columnName: this.metadata.columnNameTo
|
||||||
})
|
})
|
||||||
|
@ -21,7 +21,11 @@ export default {
|
|||||||
mixins: [fieldMixin],
|
mixins: [fieldMixin],
|
||||||
computed: {
|
computed: {
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName + ' custom-field-image'
|
let styleClass = ' custom-field-image '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
94
src/components/ADempiere/Field/FieldLocation/fieldsList.js
Normal file
94
src/components/ADempiere/Field/FieldLocation/fieldsList.js
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
const fieldBase = {
|
||||||
|
tableName: 'C_Location',
|
||||||
|
isFromDictionary: true,
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
index: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'C_Location_ID',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
isDisplayed: false,
|
||||||
|
index: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'C_Country_ID',
|
||||||
|
overwriteDefinition: {
|
||||||
|
isActiveLogics: true, // enable logics
|
||||||
|
defaultValue: '@#C_Country_ID@',
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'CO',
|
||||||
|
index: 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'C_Region_ID',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'R',
|
||||||
|
index: 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'C_City_ID',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'C',
|
||||||
|
index: 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'Address1',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'A1',
|
||||||
|
index: 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'Address2',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'A2',
|
||||||
|
index: 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'Address3',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'A3',
|
||||||
|
index: 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'Address4',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'A4',
|
||||||
|
index: 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...fieldBase,
|
||||||
|
columnName: 'Postal',
|
||||||
|
overwriteDefinition: {
|
||||||
|
size: 24,
|
||||||
|
sequenceFields: 'P',
|
||||||
|
index: 9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
111
src/components/ADempiere/Field/FieldLocation/index.vue
Normal file
111
src/components/ADempiere/Field/FieldLocation/index.vue
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-popover
|
||||||
|
ref="locationAddress"
|
||||||
|
v-model="isShowedLocationForm"
|
||||||
|
:placement="popoverPlacement"
|
||||||
|
width="300"
|
||||||
|
trigger="manual"
|
||||||
|
>
|
||||||
|
<location-address-form
|
||||||
|
v-if="isShowedLocationForm"
|
||||||
|
:values="localValues"
|
||||||
|
:parent-metadata="metadata"
|
||||||
|
/>
|
||||||
|
</el-popover>
|
||||||
|
<el-input
|
||||||
|
v-model="displayedValue"
|
||||||
|
readonly
|
||||||
|
@focus="setShowedLocationForm(true)"
|
||||||
|
>
|
||||||
|
<i slot="prefix" class="el-icon-location-information el-input__icon" />
|
||||||
|
</el-input>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
|
||||||
|
import mixinLocation from './mixinLocation.js'
|
||||||
|
import LocationAddressForm from './locationAddressForm'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'FieldLocation',
|
||||||
|
components: {
|
||||||
|
LocationAddressForm
|
||||||
|
},
|
||||||
|
mixins: [
|
||||||
|
fieldMixin,
|
||||||
|
mixinLocation
|
||||||
|
],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
localValues: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
displayedValue: {
|
||||||
|
get() {
|
||||||
|
/**
|
||||||
|
* TODO: Add DisplayColumn (to locator's and location's fields) in entities
|
||||||
|
* list response, to set value or empty value in fieldValue state when
|
||||||
|
* change records with dataTable.
|
||||||
|
*/
|
||||||
|
if (this.isEmptyValue(this.value)) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
// DisplayColumn_'ColumnName'
|
||||||
|
columnName: this.metadata.displayColumnName
|
||||||
|
})
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
// DisplayColumn_'ColumnName'
|
||||||
|
columnName: this.metadata.displayColumnName,
|
||||||
|
value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
popoverPlacement() {
|
||||||
|
return this.metadata.popoverPlacement || 'top'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (!this.metadata.isAdvancedQuery) {
|
||||||
|
this.getLocation()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getLocation() {
|
||||||
|
if (!this.isEmptyValue(this.displayedValue)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = this.value
|
||||||
|
if (this.isEmptyValue(value)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.requestGetLocationAddress({
|
||||||
|
id: value
|
||||||
|
})
|
||||||
|
.then(responseLocation => {
|
||||||
|
const { values } = responseLocation
|
||||||
|
|
||||||
|
this.localValues = values
|
||||||
|
|
||||||
|
// TODO: Get Display_ColumnName from server request
|
||||||
|
this.displayedValue = this.getDisplayedValue(values) || value
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(`Get Location Address, Field Location - Error ${error.code}: ${error.message}.`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,359 @@
|
|||||||
|
<template>
|
||||||
|
<div class="wrapper">
|
||||||
|
<el-form
|
||||||
|
v-shortkey="{ closeForm: ['esc'] }"
|
||||||
|
label-position="top"
|
||||||
|
size="small"
|
||||||
|
class="location-address"
|
||||||
|
@shortkey.native="keyAction"
|
||||||
|
>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<template v-if="isLoaded">
|
||||||
|
<field
|
||||||
|
v-for="(field) in fieldsListLocation"
|
||||||
|
:key="field.columnName"
|
||||||
|
:metadata-field="field"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
key="form-loading"
|
||||||
|
v-loading="!isLoaded"
|
||||||
|
:element-loading-text="$t('notifications.loading')"
|
||||||
|
element-loading-spinner="el-icon-loading"
|
||||||
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
||||||
|
style="min-height: calc(50vh - 84px)"
|
||||||
|
class="loading-panel"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-col :span="24">
|
||||||
|
<samp style="float: right; padding-right: 10px;">
|
||||||
|
<el-button
|
||||||
|
:disabled="!isLoaded"
|
||||||
|
type="primary"
|
||||||
|
class="custom-button-address-location"
|
||||||
|
icon="el-icon-check"
|
||||||
|
@click="sendValuesToServer"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
class="custom-button-address-location"
|
||||||
|
icon="el-icon-close"
|
||||||
|
@click="setShowedLocationForm(false)"
|
||||||
|
/>
|
||||||
|
</samp>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
||||||
|
import mixinLocation from './mixinLocation.js'
|
||||||
|
import fieldsList from './fieldsList.js'
|
||||||
|
import {
|
||||||
|
requestCreateLocationAddress,
|
||||||
|
requestUpdateLocationAddress
|
||||||
|
} from '@/api/ADempiere/field/location.js'
|
||||||
|
import { showNotification } from '@/utils/ADempiere/notification.js'
|
||||||
|
import { getSequenceAsList } from '@/utils/ADempiere/location'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Add sequence fields by country selected
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: 'LocationAdressFrom',
|
||||||
|
mixins: [
|
||||||
|
formMixin,
|
||||||
|
mixinLocation
|
||||||
|
],
|
||||||
|
props: {
|
||||||
|
metadata: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
// TODO: Add container uuid parent
|
||||||
|
uuid: 'Location-Address-Create',
|
||||||
|
containerUuid: 'Location-Address-Create'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parentMetadata: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
// TODO: Not working props
|
||||||
|
values: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fieldsList,
|
||||||
|
isCustomForm: true,
|
||||||
|
request: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
fieldsListLocation() {
|
||||||
|
if (!this.isEmptyValue(this.$store.getters.getFieldLocation)) {
|
||||||
|
return this.$store.getters.getFieldLocation
|
||||||
|
}
|
||||||
|
return this.fieldsList
|
||||||
|
},
|
||||||
|
locationId() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.parentMetadata.parentUuid,
|
||||||
|
containerUuid: this.parentMetadata.containerUuid,
|
||||||
|
columnName: this.parentMetadata.columnName
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.unsubscribe = this.subscribeChanges()
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getLocation()
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.unsubscribe()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
keyAction(event) {
|
||||||
|
if (event.srcKey === 'closeForm') {
|
||||||
|
this.toggleShowedLocationForm()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sortSequence(itemA, itemB) {
|
||||||
|
return itemA.index - itemB.index
|
||||||
|
},
|
||||||
|
subscribeChanges() {
|
||||||
|
return this.$store.subscribe((mutation, state) => {
|
||||||
|
const withOutColumnNames = ['C_Country_ID', 'DisplayColumn_C_Country_ID', 'C_Location_ID']
|
||||||
|
|
||||||
|
if (mutation.type === 'updateValueOfField' &&
|
||||||
|
mutation.payload.containerUuid === this.metadata.containerUuid) {
|
||||||
|
if (mutation.payload.columnName === 'C_Country_ID') {
|
||||||
|
const values = []
|
||||||
|
// Get country definition to sequence fields and displayed value
|
||||||
|
if (mutation.value !== this.currentCountryDefinition.id) {
|
||||||
|
this.getCountryDefinition({
|
||||||
|
id: mutation.payload.value
|
||||||
|
})
|
||||||
|
.then(responseCountry => {
|
||||||
|
const newSequence = getSequenceAsList(responseCountry.captureSequence)
|
||||||
|
const newFieldsList = this.fieldsList.map(item => {
|
||||||
|
if (newSequence.includes(item.sequenceFields)) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
isDisplayed: true,
|
||||||
|
index: newSequence.indexOf(item.sequenceFields)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
isDisplayed: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$store.dispatch('changeSequence', newFieldsList.sort(this.sortSequence))
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.$message({
|
||||||
|
message: error.message,
|
||||||
|
isShowClose: true,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
console.warn(`Error getting Country Definition: ${error.message}. Code: ${error.code}.`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldsList.forEach(item => {
|
||||||
|
if (!withOutColumnNames.includes(item.columnName)) {
|
||||||
|
values.push({
|
||||||
|
columnName: item.columnName,
|
||||||
|
value: undefined
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.setValues({
|
||||||
|
values,
|
||||||
|
withOutColumnNames
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
setParentValues(values) {
|
||||||
|
const {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
columnName, // 'C_Location_ID' by default
|
||||||
|
displayColumnName
|
||||||
|
} = this.parentMetadata
|
||||||
|
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
columnName,
|
||||||
|
value: values[columnName]
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
// DisplayColumn_'ColumnName'
|
||||||
|
columnName: displayColumnName,
|
||||||
|
value: this.getDisplayedValue(values)
|
||||||
|
})
|
||||||
|
|
||||||
|
// active update record to server
|
||||||
|
this.$store.dispatch('notifyFieldChange', {
|
||||||
|
containerUuid,
|
||||||
|
field: this.parentMetadata
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sendValuesToServer() {
|
||||||
|
const fieldsNotReady = this.$store.getters.getFieldListEmptyMandatory({
|
||||||
|
containerUuid: this.containerUuid
|
||||||
|
})
|
||||||
|
if (!this.isEmptyValue(fieldsNotReady)) {
|
||||||
|
showNotification({
|
||||||
|
type: 'warning',
|
||||||
|
title: this.$t('notifications.emptyValues'),
|
||||||
|
name: '<b>' + fieldsNotReady + '.</b> ',
|
||||||
|
message: this.$t('notifications.fieldMandatory'),
|
||||||
|
isRedirect: false
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const locationId = this.locationId
|
||||||
|
|
||||||
|
const attributes = this.$store.getters.getValuesView({
|
||||||
|
containerUuid: this.containerUuid
|
||||||
|
})
|
||||||
|
const attributesToServer = attributes.filter(attributeItem => {
|
||||||
|
const { columnName } = attributeItem
|
||||||
|
if (columnName.includes('DisplayColumn_')) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (columnName === 'C_Location_ID') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateLocation = (responseLocation) => {
|
||||||
|
const { values } = responseLocation
|
||||||
|
|
||||||
|
// set form values
|
||||||
|
this.setValues({
|
||||||
|
values
|
||||||
|
})
|
||||||
|
|
||||||
|
// set field parent values
|
||||||
|
this.setParentValues(values)
|
||||||
|
this.setShowedLocationForm(false)
|
||||||
|
|
||||||
|
// set context values to parent continer
|
||||||
|
if (this.parentMetadata.isSendParentValues) {
|
||||||
|
this.$store.dispatch('updateValuesOfContainer', {
|
||||||
|
parentUuid: this.parentMetadata.parentUuid,
|
||||||
|
containerUuid: this.parentMetadata.containerUuid,
|
||||||
|
attributes
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isEmptyValue(locationId) || locationId === 0) {
|
||||||
|
requestCreateLocationAddress({
|
||||||
|
attributes: attributesToServer
|
||||||
|
})
|
||||||
|
.then(updateLocation)
|
||||||
|
.catch(error => {
|
||||||
|
this.$message({
|
||||||
|
message: error.message,
|
||||||
|
isShowClose: true,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
console.warn(`Error create Location Address: ${error.message}. Code: ${error.code}.`)
|
||||||
|
})
|
||||||
|
// break to only create
|
||||||
|
return
|
||||||
|
}
|
||||||
|
requestUpdateLocationAddress({
|
||||||
|
id: locationId,
|
||||||
|
attributes: attributesToServer
|
||||||
|
})
|
||||||
|
.then(updateLocation)
|
||||||
|
.catch(error => {
|
||||||
|
this.$message({
|
||||||
|
message: error.message,
|
||||||
|
isShowClose: true,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
console.warn(`Error update Location Address: ${error.message}. Code: ${error.code}.`)
|
||||||
|
})
|
||||||
|
this.$store.dispatch('changeSequence', fieldsList)
|
||||||
|
},
|
||||||
|
getLocation() {
|
||||||
|
if (this.request > 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.isEmptyValue(this.values)) {
|
||||||
|
this.setValues({
|
||||||
|
values: this.values
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = this.locationId
|
||||||
|
if (this.isEmptyValue(id)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.requestGetLocationAddress({
|
||||||
|
id
|
||||||
|
})
|
||||||
|
.then(responseLocation => {
|
||||||
|
const { values } = responseLocation
|
||||||
|
|
||||||
|
this.setValues({
|
||||||
|
values
|
||||||
|
})
|
||||||
|
this.request++
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(`Get Location Address, Form Location - Error ${error.code}: ${error.message}.`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.location-address {
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-button-address-location {
|
||||||
|
float: right;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss">
|
||||||
|
.location-address {
|
||||||
|
.el-form-item--small .el-form-item__label {
|
||||||
|
line-height: 22px !important;
|
||||||
|
}
|
||||||
|
.el-form-item--small.el-form-item {
|
||||||
|
margin-bottom: 5px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,53 @@
|
|||||||
|
import { getCountryDefinition } from '@/api/ADempiere/system-core.js'
|
||||||
|
import { requestGetLocationAddress } from '@/api/ADempiere/field/location.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MixinLocationField',
|
||||||
|
computed: {
|
||||||
|
currentCountryDefinition() {
|
||||||
|
return this.$store.getters['user/getCountry']
|
||||||
|
},
|
||||||
|
isShowedLocationForm: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.getIsShowedLocation
|
||||||
|
},
|
||||||
|
set() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
requestGetLocationAddress,
|
||||||
|
getCountryDefinition,
|
||||||
|
toggleShowedLocationForm() {
|
||||||
|
this.$store.commit('setShowedLocation', !this.isShowedLocationForm)
|
||||||
|
},
|
||||||
|
setShowedLocationForm(isShow) {
|
||||||
|
this.$store.commit('setShowedLocation', isShow)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* TODO: Add support with sequence to displayed
|
||||||
|
* @param {object} entityValues
|
||||||
|
*/
|
||||||
|
getDisplayedValue(entityValues) {
|
||||||
|
let value = ''
|
||||||
|
|
||||||
|
if (!this.isEmptyValue(entityValues)) {
|
||||||
|
if (!this.isEmptyValue(entityValues.Address1)) {
|
||||||
|
value = entityValues.Address1
|
||||||
|
}
|
||||||
|
if (!this.isEmptyValue(entityValues.City)) {
|
||||||
|
value += ', ' + entityValues.City
|
||||||
|
}
|
||||||
|
if (!this.isEmptyValue(entityValues.RegionName)) {
|
||||||
|
value += ', ' + entityValues.RegionName
|
||||||
|
}
|
||||||
|
if (!this.isEmptyValue(entityValues.Postal)) {
|
||||||
|
value += ', ' + entityValues.Postal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@
|
|||||||
>
|
>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-if="isFocus"
|
v-if="isFocus"
|
||||||
|
key="number-input-focus"
|
||||||
:ref="metadata.columnName"
|
:ref="metadata.columnName"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
type="number"
|
type="number"
|
||||||
@ -19,6 +20,7 @@
|
|||||||
:controls="isShowControls"
|
:controls="isShowControls"
|
||||||
:controls-position="controlsPosition"
|
:controls-position="controlsPosition"
|
||||||
:class="cssClassStyle"
|
:class="cssClassStyle"
|
||||||
|
autofocus
|
||||||
@change="preHandleChange"
|
@change="preHandleChange"
|
||||||
@blur="customFocusLost"
|
@blur="customFocusLost"
|
||||||
@focus="focusGained"
|
@focus="focusGained"
|
||||||
@ -27,16 +29,15 @@
|
|||||||
/>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-else
|
v-else
|
||||||
|
key="number-displayed-blur"
|
||||||
:ref="metadata.columnName"
|
:ref="metadata.columnName"
|
||||||
v-model="displayedValue"
|
v-model="displayedValue"
|
||||||
:placeholder="metadata.help"
|
:placeholder="metadata.help"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:class="cssClassStyle"
|
:class="cssClassStyle"
|
||||||
readonly
|
readonly
|
||||||
@blur="customFocusLost"
|
style="text-align-last: end !important"
|
||||||
@focus="customFocusGained"
|
@focus="customFocusGained"
|
||||||
@keydown.native="keyPressed"
|
|
||||||
@keyup.native="keyReleased"
|
|
||||||
/>
|
/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
@ -60,7 +61,11 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName + ' custom-field-number'
|
let styleClass = ' custom-field-number '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
},
|
},
|
||||||
maxValue() {
|
maxValue() {
|
||||||
if (this.isEmptyValue(this.metadata.valueMax)) {
|
if (this.isEmptyValue(this.metadata.valueMax)) {
|
||||||
@ -144,17 +149,6 @@ export default {
|
|||||||
return this.$store.getters['user/getCurrency']
|
return this.$store.getters['user/getCurrency']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
isFocus(value) {
|
|
||||||
if (value) {
|
|
||||||
// focus into input number
|
|
||||||
this.$nextTick()
|
|
||||||
.then(() => {
|
|
||||||
this.$refs[this.metadata.columnName].$el.children[2].firstElementChild.focus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
parseValue(value) {
|
parseValue(value) {
|
||||||
if (this.isEmptyValue(value)) {
|
if (this.isEmptyValue(value)) {
|
||||||
@ -165,6 +159,10 @@ export default {
|
|||||||
customFocusGained(event) {
|
customFocusGained(event) {
|
||||||
this.isFocus = true
|
this.isFocus = true
|
||||||
// this.focusGained(event)
|
// this.focusGained(event)
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs[this.metadata.columnName].focus()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
customFocusLost(event) {
|
customFocusLost(event) {
|
||||||
this.isFocus = false
|
this.isFocus = false
|
||||||
@ -230,12 +228,4 @@ export default {
|
|||||||
.el-input-number, .el-input {
|
.el-input-number, .el-input {
|
||||||
width: 100% !important; /* ADempiere Custom */
|
width: 100% !important; /* ADempiere Custom */
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Align text in right input **/
|
|
||||||
.custom-field-number {
|
|
||||||
text-align: right !important;
|
|
||||||
input, .el-input__inner {
|
|
||||||
text-align: right !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
:filterable="!isMobile"
|
:filterable="!isMobile"
|
||||||
:placeholder="metadata.help"
|
:placeholder="metadata.help"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
value-key="key"
|
value-key="id"
|
||||||
:class="cssClassStyle"
|
:class="cssClassStyle"
|
||||||
clearable
|
clearable
|
||||||
:multiple="isSelectMultiple"
|
:multiple="isSelectMultiple"
|
||||||
@ -19,7 +19,7 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="(option, key) in optionsList"
|
v-for="(option, key) in optionsList"
|
||||||
:key="key"
|
:key="key"
|
||||||
:value="option.key"
|
:value="option.id"
|
||||||
:label="option.label"
|
:label="option.label"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
|
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
|
||||||
import { convertBooleanToString } from '@/utils/ADempiere/valueUtils.js'
|
import { convertBooleanToString } from '@/utils/ADempiere/valueFormat.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component is a lookup type field, use as a replacement for fields:
|
* This component is a lookup type field, use as a replacement for fields:
|
||||||
@ -45,18 +45,17 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
// label with '' value is assumed to be undefined non-existent
|
// label with '' value is assumed to be undefined non-existent
|
||||||
const label = ' '
|
const label = ' '
|
||||||
|
const blankOption = {
|
||||||
|
label,
|
||||||
|
id: undefined,
|
||||||
|
uuid: undefined
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
optionsList: [{
|
optionsList: [blankOption],
|
||||||
label,
|
|
||||||
key: undefined
|
|
||||||
}],
|
|
||||||
blankValues: [null, undefined, -1],
|
blankValues: [null, undefined, -1],
|
||||||
blankOption: {
|
blankOption
|
||||||
label,
|
|
||||||
key: undefined
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -70,9 +69,12 @@ export default {
|
|||||||
return ['IN', 'NOT_IN'].includes(this.metadata.operator) && this.metadata.isAdvancedQuery
|
return ['IN', 'NOT_IN'].includes(this.metadata.operator) && this.metadata.isAdvancedQuery
|
||||||
},
|
},
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
let styleClass = this.metadata.cssClassName + ' custom-field-select'
|
let styleClass = ' custom-field-select '
|
||||||
if (this.isSelectMultiple) {
|
if (this.isSelectMultiple) {
|
||||||
styleClass += ' custom-field-select-multiple'
|
styleClass += ' custom-field-select-multiple '
|
||||||
|
}
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
}
|
}
|
||||||
return styleClass
|
return styleClass
|
||||||
},
|
},
|
||||||
@ -101,7 +103,7 @@ export default {
|
|||||||
// sets the value to blank when the lookupList or lookupItem have no
|
// sets the value to blank when the lookupList or lookupItem have no
|
||||||
// values, or if only lookupItem does have a value
|
// values, or if only lookupItem does have a value
|
||||||
if (this.isEmptyValue(allOptions) || (allOptions.length &&
|
if (this.isEmptyValue(allOptions) || (allOptions.length &&
|
||||||
(!this.blankValues.includes(allOptions[0].key)))) {
|
(!this.blankValues.includes(allOptions[0].id)))) {
|
||||||
allOptions.unshift(this.blankOption)
|
allOptions.unshift(this.blankOption)
|
||||||
}
|
}
|
||||||
return allOptions
|
return allOptions
|
||||||
@ -113,19 +115,33 @@ export default {
|
|||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName
|
columnName: this.metadata.columnName
|
||||||
})
|
})
|
||||||
let label = this.findLabel(value)
|
if (this.isEmptyValue(value)) {
|
||||||
if (!label) {
|
/* eslint-disable */
|
||||||
label = this.displayColumn
|
this.displayedValue = undefined
|
||||||
|
this.uuidValue = undefined
|
||||||
|
/* eslint-disable */
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
const option = this.findOption(value)
|
||||||
|
if (!option.label) {
|
||||||
|
const label = this.displayedValue
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
this.optionsList.push({
|
this.optionsList.push({
|
||||||
key: value,
|
// TODO: Add uuid
|
||||||
|
id: value,
|
||||||
label
|
label
|
||||||
})
|
})
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
}
|
}
|
||||||
|
|
||||||
return value
|
return value
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
|
const option = this.findOption(value)
|
||||||
|
// always update uuid
|
||||||
|
this.uuidValue = option.uuid
|
||||||
|
|
||||||
this.$store.commit('updateValueOfField', {
|
this.$store.commit('updateValueOfField', {
|
||||||
parentUuid: this.metadata.parentUuid,
|
parentUuid: this.metadata.parentUuid,
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
@ -134,7 +150,26 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
displayColumn: {
|
uuidValue: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
// 'ColumnName'_UUID
|
||||||
|
columnName: this.metadata.columnName + '_UUID',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
// 'ColumnName'_UUID
|
||||||
|
columnName: this.metadata.columnName + '_UUID',
|
||||||
|
value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
displayedValue: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.getters.getValueOfField({
|
return this.$store.getters.getValueOfField({
|
||||||
parentUuid: this.metadata.parentUuid,
|
parentUuid: this.metadata.parentUuid,
|
||||||
@ -156,61 +191,25 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isSelectMultiple(isMultiple) {
|
isSelectMultiple(isMultiple) {
|
||||||
|
let value = this.value
|
||||||
if (isMultiple) {
|
if (isMultiple) {
|
||||||
const valueInArray = []
|
const valueInArray = []
|
||||||
if (!this.isEmptyValue(this.value)) {
|
if (!this.isEmptyValue(value)) {
|
||||||
valueInArray.push(this.value)
|
valueInArray.push(value)
|
||||||
}
|
}
|
||||||
this.value = valueInArray
|
value = valueInArray
|
||||||
} else {
|
} else {
|
||||||
if (Array.isArray(this.value)) {
|
if (Array.isArray(value)) {
|
||||||
if (this.value.length) {
|
if (value.length) {
|
||||||
// set first value
|
// set first value
|
||||||
this.value = this.value[0]
|
value = value[0]
|
||||||
} else {
|
} else {
|
||||||
this.value = this.blankOption.key
|
value = this.blankOption.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
/*
|
|
||||||
'metadata.value'(value) {
|
|
||||||
if (!this.metadata.inTable) {
|
|
||||||
value = this.parseValue(value)
|
|
||||||
|
|
||||||
if (this.metadata.displayed) {
|
|
||||||
if (!this.optionsList.some(option => option.key === value) &&
|
|
||||||
!this.isEmptyValue(this.metadata.displayColumn)) {
|
|
||||||
this.optionsList.push({
|
|
||||||
key: value,
|
|
||||||
label: this.metadata.displayColumn
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.findLabel(value) &&
|
|
||||||
this.metadata.displayed &&
|
|
||||||
this.isEmptyValue(this.metadata.displayColumn)) {
|
|
||||||
value = undefined
|
|
||||||
}
|
|
||||||
this.value = value
|
this.value = value
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'metadata.displayColumn'(value) {
|
|
||||||
if (this.metadata.displayed) {
|
|
||||||
if (!this.isEmptyValue(this.value)) {
|
|
||||||
if (!this.isEmptyValue(value)) {
|
|
||||||
// verify if exists to add
|
|
||||||
if (!this.findLabel(this.value)) {
|
|
||||||
this.optionsList.push({
|
|
||||||
key: this.value,
|
|
||||||
label: value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
'metadata.displayed'(value) {
|
'metadata.displayed'(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
// if is field showed, search into store all options to list
|
// if is field showed, search into store all options to list
|
||||||
@ -226,14 +225,17 @@ export default {
|
|||||||
this.optionsList = this.getterLookupAll
|
this.optionsList = this.getterLookupAll
|
||||||
const value = this.value
|
const value = this.value
|
||||||
if (!this.isEmptyValue(value) && !this.metadata.isAdvancedQuery) {
|
if (!this.isEmptyValue(value) && !this.metadata.isAdvancedQuery) {
|
||||||
const label = this.findLabel(value)
|
const option = this.findOption(value)
|
||||||
if (label) {
|
if (option.label) {
|
||||||
this.displayColumn = label
|
this.displayedValue = option.label
|
||||||
|
this.uuidValue = option.uuid
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: Property displayColumn is @deprecated
|
||||||
if (!this.isEmptyValue(this.metadata.displayColumn)) {
|
if (!this.isEmptyValue(this.metadata.displayColumn)) {
|
||||||
// verify if exists to add
|
// verify if exists to add
|
||||||
this.optionsList.push({
|
this.optionsList.push({
|
||||||
key: value,
|
id: value,
|
||||||
|
// TODO: Add uuid
|
||||||
label: this.metadata.displayColumn
|
label: this.metadata.displayColumn
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -257,19 +259,34 @@ export default {
|
|||||||
},
|
},
|
||||||
changeBlankOption() {
|
changeBlankOption() {
|
||||||
if (Number(this.metadata.defaultValue) === -1) {
|
if (Number(this.metadata.defaultValue) === -1) {
|
||||||
this.blankOption.key = -1
|
this.blankOption.id = -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
preHandleChange(value) {
|
preHandleChange(value) {
|
||||||
const label = this.findLabel(this.value)
|
const label = this.findLabel(this.value)
|
||||||
this.displayColumn = label
|
this.displayedValue = label
|
||||||
this.handleFieldChange({
|
this.handleFieldChange({
|
||||||
value,
|
value,
|
||||||
label
|
label
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
findOption(value) {
|
||||||
|
const option = this.optionsList.find(item => item.id === value)
|
||||||
|
if (option && option.label) {
|
||||||
|
return option
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
label: undefined,
|
||||||
|
value: undefined,
|
||||||
|
uuid: undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* TODO: Verify used
|
||||||
|
* @deprecated use findOption
|
||||||
|
*/
|
||||||
findLabel(value) {
|
findLabel(value) {
|
||||||
const selected = this.optionsList.find(item => item.key === value)
|
const selected = this.optionsList.find(item => item.id === value)
|
||||||
if (selected) {
|
if (selected) {
|
||||||
return selected.label
|
return selected.label
|
||||||
}
|
}
|
||||||
@ -289,7 +306,8 @@ export default {
|
|||||||
value: this.value
|
value: this.value
|
||||||
})
|
})
|
||||||
.then(responseLookupItem => {
|
.then(responseLookupItem => {
|
||||||
this.displayColumn = responseLookupItem.label
|
this.displayedValue = responseLookupItem.label
|
||||||
|
this.uuidValue = responseLookupItem.uuid
|
||||||
this.optionsList = this.getterLookupAll
|
this.optionsList = this.getterLookupAll
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@ -301,7 +319,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
getDataLookupList(isShowList) {
|
getDataLookupList(isShowList) {
|
||||||
if (isShowList) {
|
if (isShowList) {
|
||||||
// TODO: Evaluate if length = 1 and this element key = blankOption
|
// TODO: Evaluate if length = 1 and this element id = blankOption
|
||||||
const list = this.getterLookupList
|
const list = this.getterLookupList
|
||||||
if (this.isEmptyValue(list) || (list.length === 1 && this.blankValues.includes(list[0]))) {
|
if (this.isEmptyValue(list) || (list.length === 1 && this.blankValues.includes(list[0]))) {
|
||||||
this.remoteMethod()
|
this.remoteMethod()
|
||||||
@ -315,8 +333,9 @@ export default {
|
|||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
tableName: this.metadata.reference.tableName,
|
tableName: this.metadata.reference.tableName,
|
||||||
query: this.metadata.reference.query,
|
query: this.metadata.reference.query,
|
||||||
|
// valuesList: this.value
|
||||||
isAddBlankValue: true,
|
isAddBlankValue: true,
|
||||||
blankValue: this.blankOption.key
|
blankValue: this.blankOption.id
|
||||||
})
|
})
|
||||||
.then(responseLookupList => {
|
.then(responseLookupList => {
|
||||||
if (!this.isEmptyValue(responseLookupList)) {
|
if (!this.isEmptyValue(responseLookupList)) {
|
||||||
@ -345,7 +364,7 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// set empty value
|
// set empty value
|
||||||
this.value = this.blankOption.key
|
this.value = this.blankOption.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,14 @@
|
|||||||
:maxlength="maxLength"
|
:maxlength="maxLength"
|
||||||
:show-password="Boolean(metadata.isEncrypted)"
|
:show-password="Boolean(metadata.isEncrypted)"
|
||||||
:autofocus="metadata.inTable"
|
:autofocus="metadata.inTable"
|
||||||
|
:size="inputSize"
|
||||||
@change="preHandleChange"
|
@change="preHandleChange"
|
||||||
@blur="focusLost"
|
@blur="focusLost"
|
||||||
@focus="focusGained"
|
@focus="focusGained"
|
||||||
@keydown.native="keyPressed"
|
@keydown.native="keyPressed"
|
||||||
@keyup.native="keyReleased"
|
@keyup.native="keyReleased"
|
||||||
@keyup.native.enter="actionKeyPerformed"
|
@keyup.native.enter="actionKeyPerformed"
|
||||||
|
@submit="false"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -49,6 +51,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
cssClassStyle() {
|
||||||
|
let styleClass = ' custom-field-text '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
|
},
|
||||||
// Only used when input type='TextArea'
|
// Only used when input type='TextArea'
|
||||||
rows() {
|
rows() {
|
||||||
if (this.metadata.inTable) {
|
if (this.metadata.inTable) {
|
||||||
@ -68,6 +77,12 @@ export default {
|
|||||||
}
|
}
|
||||||
return typeInput
|
return typeInput
|
||||||
},
|
},
|
||||||
|
inputSize() {
|
||||||
|
if (this.isEmptyValue(this.metadata.inputSize)) {
|
||||||
|
return 'medium'
|
||||||
|
}
|
||||||
|
return this.metadata.inputSize
|
||||||
|
},
|
||||||
maxLength() {
|
maxLength() {
|
||||||
if (!this.isEmptyValue(this.metadata.fieldLength) && this.metadata.fieldLength > 0) {
|
if (!this.isEmptyValue(this.metadata.fieldLength) && this.metadata.fieldLength > 0) {
|
||||||
return Number(this.metadata.fieldLength)
|
return Number(this.metadata.fieldLength)
|
||||||
@ -77,3 +92,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.custom-field-text {
|
||||||
|
max-height: 34px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -40,9 +40,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
let styleClass = this.metadata.cssClassName
|
let styleClass = ' custom-field-text-long '
|
||||||
if (this.isDisabled) {
|
if (this.isDisabled) {
|
||||||
styleClass += ' custom-field-text-long-disable'
|
styleClass += ' custom-field-text-long-disable '
|
||||||
|
}
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
}
|
}
|
||||||
return styleClass
|
return styleClass
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,11 @@ export default {
|
|||||||
return -Infinity
|
return -Infinity
|
||||||
},
|
},
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName + ' custom-field-time'
|
let styleClass = ' custom-field-time '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -35,7 +35,11 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName + ' custom-field-yes-no'
|
let styleClass = ' custom-field-yes-no '
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass += this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -118,7 +118,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
preHandleChange(value) {
|
preHandleChange(value) {
|
||||||
if (this.clean) {
|
if (this.isEmptyValue(value)) {
|
||||||
this.$store.dispatch('setchatText', value)
|
this.$store.dispatch('setchatText', value)
|
||||||
.then(responseComment => {
|
.then(responseComment => {
|
||||||
this.$store.dispatch('setMarkDown', false)
|
this.$store.dispatch('setMarkDown', false)
|
||||||
|
@ -38,17 +38,20 @@
|
|||||||
v-if="isDocuemntStatus"
|
v-if="isDocuemntStatus"
|
||||||
:field="fieldAttributes"
|
:field="fieldAttributes"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<translated
|
<translated
|
||||||
v-if="field.isTranslatedField"
|
v-if="field.isTranslatedField"
|
||||||
:field-attributes="fieldAttributes"
|
:field-attributes="fieldAttributes"
|
||||||
:record-uuid="field.recordUuid"
|
:record-uuid="field.recordUuid"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<calculator
|
<calculator
|
||||||
v-if="field.isNumericField && !field.isReadOnlyFromLogic"
|
v-if="field.isNumericField && !field.isReadOnlyFromLogic"
|
||||||
:field-attributes="fieldAttributes"
|
:field-attributes="fieldAttributes"
|
||||||
:field-value="field.value"
|
:field-value="field.value"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<component
|
<component
|
||||||
:is="componentRender"
|
:is="componentRender"
|
||||||
:ref="field.columnName"
|
:ref="field.columnName"
|
||||||
@ -130,6 +133,9 @@ export default {
|
|||||||
|
|
||||||
let field
|
let field
|
||||||
switch (this.field.componentPath) {
|
switch (this.field.componentPath) {
|
||||||
|
case 'FieldAutocomplete':
|
||||||
|
field = () => import('@/components/ADempiere/Field/FieldAutocomplete')
|
||||||
|
break
|
||||||
case 'FieldBinary':
|
case 'FieldBinary':
|
||||||
field = () => import('@/components/ADempiere/Field/FieldBinary')
|
field = () => import('@/components/ADempiere/Field/FieldBinary')
|
||||||
break
|
break
|
||||||
@ -145,6 +151,9 @@ export default {
|
|||||||
case 'FieldImage':
|
case 'FieldImage':
|
||||||
field = () => import('@/components/ADempiere/Field/FieldImage')
|
field = () => import('@/components/ADempiere/Field/FieldImage')
|
||||||
break
|
break
|
||||||
|
case 'FieldLocation':
|
||||||
|
field = () => import('@/components/ADempiere/Field/FieldLocation')
|
||||||
|
break
|
||||||
case 'FieldLocator':
|
case 'FieldLocator':
|
||||||
field = () => import('@/components/ADempiere/Field/FieldLocator')
|
field = () => import('@/components/ADempiere/Field/FieldLocator')
|
||||||
break
|
break
|
||||||
@ -187,7 +196,8 @@ export default {
|
|||||||
if (this.isAdvancedQuery) {
|
if (this.isAdvancedQuery) {
|
||||||
return this.field.isShowedFromUser
|
return this.field.isShowedFromUser
|
||||||
}
|
}
|
||||||
return fieldIsDisplayed(this.field) && (this.isMandatory || this.field.isShowedFromUser || this.inTable)
|
return fieldIsDisplayed(this.field) &&
|
||||||
|
(this.isMandatory || this.field.isShowedFromUser || this.inTable)
|
||||||
},
|
},
|
||||||
isMandatory() {
|
isMandatory() {
|
||||||
if (this.isAdvancedQuery) {
|
if (this.isAdvancedQuery) {
|
||||||
@ -235,7 +245,7 @@ export default {
|
|||||||
return this.field.isReadOnlyFromLogic
|
return this.field.isReadOnlyFromLogic
|
||||||
}
|
}
|
||||||
// other type of panels (process/report)
|
// other type of panels (process/report)
|
||||||
return isUpdateableAllFields
|
return Boolean(isUpdateableAllFields)
|
||||||
},
|
},
|
||||||
isFieldOnly() {
|
isFieldOnly() {
|
||||||
if (this.inTable || this.field.isFieldOnly) {
|
if (this.inTable || this.field.isFieldOnly) {
|
||||||
@ -338,11 +348,11 @@ export default {
|
|||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
isContextInfo() {
|
isContextInfo() {
|
||||||
if (!this.isAdvancedQuery) {
|
if (this.field.panelType !== 'window') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return (this.field.contextInfo && this.field.contextInfo.isActive) ||
|
return Boolean(this.field.contextInfo && this.field.contextInfo.isActive) ||
|
||||||
(this.field.reference && this.field.reference.windowsList.length)
|
Boolean(this.field.reference && this.field.reference.windowsList.length)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -28,11 +28,16 @@ export default {
|
|||||||
return Boolean(this.metadata.readonly || this.metadata.disabled)
|
return Boolean(this.metadata.readonly || this.metadata.disabled)
|
||||||
},
|
},
|
||||||
cssClassStyle() {
|
cssClassStyle() {
|
||||||
return this.metadata.cssClassName
|
let styleClass = ''
|
||||||
|
if (!this.isEmptyValue(this.metadata.cssClassName)) {
|
||||||
|
styleClass = this.metadata.cssClassName
|
||||||
|
}
|
||||||
|
return styleClass
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.getters.getValueOfField({
|
return this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName
|
columnName: this.metadata.columnName
|
||||||
})
|
})
|
||||||
@ -63,18 +68,6 @@ export default {
|
|||||||
this.requestFocus()
|
this.requestFocus()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
// valueModel(value) {
|
|
||||||
// if (this.metadata.inTable) {
|
|
||||||
// this.value = this.parseValue(value)
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// 'metadata.value'(value) {
|
|
||||||
// if (!this.metadata.inTable) {
|
|
||||||
// this.value = this.parseValue(value)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Parse the value to a new value if required for element-ui component
|
* Parse the value to a new value if required for element-ui component
|
||||||
@ -177,6 +170,11 @@ export default {
|
|||||||
|
|
||||||
// if is custom field, set custom handle change value
|
// if is custom field, set custom handle change value
|
||||||
if (this.metadata.isCustomField) {
|
if (this.metadata.isCustomField) {
|
||||||
|
if (this.metadata.isActiveLogics) {
|
||||||
|
this.$store.dispatch('changeDependentFieldsList', {
|
||||||
|
field: this.metadata
|
||||||
|
})
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$store.dispatch('notifyFieldChange', {
|
this.$store.dispatch('notifyFieldChange', {
|
||||||
|
@ -3,10 +3,12 @@ export default {
|
|||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
const value = this.$store.getters.getValueOfField({
|
const value = this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName
|
columnName: this.metadata.columnName
|
||||||
})
|
})
|
||||||
const valueTo = this.$store.getters.getValueOfField({
|
const valueTo = this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.metadata.parentUuid,
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName
|
columnName: this.metadata.columnName
|
||||||
})
|
})
|
||||||
|
@ -34,8 +34,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FieldContextInfo',
|
name: 'FieldContextInfo',
|
||||||
@ -65,7 +64,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showMessage,
|
|
||||||
redirect({ window }) {
|
redirect({ window }) {
|
||||||
const viewSearch = recursiveTreeSearch({
|
const viewSearch = recursiveTreeSearch({
|
||||||
treeData: this.permissionRoutes,
|
treeData: this.permissionRoutes,
|
||||||
@ -83,10 +81,13 @@ export default {
|
|||||||
tabParent: 0,
|
tabParent: 0,
|
||||||
[this.fieldAttributes.columnName]: this.value
|
[this.fieldAttributes.columnName]: this.value
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`${this.name} Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.showMessage({
|
this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
showClose: true,
|
||||||
message: this.$t('notifications.noRoleAccess')
|
message: this.$t('notifications.noRoleAccess')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,74 +1,14 @@
|
|||||||
import { TEXT } from '@/utils/ADempiere/references'
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
// Product Code
|
// Product Code
|
||||||
{
|
{
|
||||||
elementColumnName: 'ProductValue',
|
elementColumnName: 'ProductValue',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
size: 24,
|
size: 12,
|
||||||
sequence: 10,
|
sequence: 10,
|
||||||
cssClassName: 'price-inquiry',
|
cssClassName: 'price-inquiry',
|
||||||
|
inputSize: 'large',
|
||||||
handleActionKeyPerformed: true
|
handleActionKeyPerformed: true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// Product Name
|
|
||||||
{
|
|
||||||
elementColumnName: 'ProductName',
|
|
||||||
isFromDictionary: true,
|
|
||||||
overwriteDefinition: {
|
|
||||||
size: 24,
|
|
||||||
sequence: 20,
|
|
||||||
isReadOnly: true,
|
|
||||||
cssClassName: 'price-inquiry'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Product Description
|
|
||||||
{
|
|
||||||
elementColumnName: 'ProductDescription',
|
|
||||||
isFromDictionary: true,
|
|
||||||
overwriteDefinition: {
|
|
||||||
size: 24,
|
|
||||||
sequence: 30,
|
|
||||||
displayType: TEXT.id,
|
|
||||||
isReadOnly: true,
|
|
||||||
cssClassName: 'price-inquiry'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Price List
|
|
||||||
{
|
|
||||||
elementColumnName: 'PriceList',
|
|
||||||
isFromDictionary: true,
|
|
||||||
overwriteDefinition: {
|
|
||||||
size: 16,
|
|
||||||
sequence: 40,
|
|
||||||
isReadOnly: true,
|
|
||||||
cssClassName: 'price-inquiry',
|
|
||||||
help: '0.00'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Tax Amount
|
|
||||||
{
|
|
||||||
elementColumnName: 'TaxAmt',
|
|
||||||
isFromDictionary: true,
|
|
||||||
overwriteDefinition: {
|
|
||||||
size: 8,
|
|
||||||
sequence: 50,
|
|
||||||
isReadOnly: true,
|
|
||||||
cssClassName: 'price-inquiry',
|
|
||||||
help: '0.00'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Total
|
|
||||||
{
|
|
||||||
elementColumnName: 'GrandTotal',
|
|
||||||
isFromDictionary: true,
|
|
||||||
overwriteDefinition: {
|
|
||||||
size: 24,
|
|
||||||
sequence: 60,
|
|
||||||
isReadOnly: true,
|
|
||||||
cssClassName: 'price-inquiry',
|
|
||||||
help: '0.00'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,20 +1,66 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div
|
||||||
<el-form
|
|
||||||
v-if="isLoaded"
|
v-if="isLoaded"
|
||||||
|
style="height: 100% !important;"
|
||||||
|
@click="focusProductValue"
|
||||||
|
>
|
||||||
|
<el-container style="height: 100% !important;">
|
||||||
|
<img
|
||||||
|
fit="contain"
|
||||||
|
:src="valuesImage.length > 1 ? valuesImage.value : getDefaultImage()"
|
||||||
|
class="background-price-checking"
|
||||||
|
>
|
||||||
|
<el-main>
|
||||||
|
<div class="inquiry-form">
|
||||||
|
<el-form
|
||||||
key="form-loaded"
|
key="form-loaded"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
label-width="200px"
|
label-width="10px"
|
||||||
|
@submit.native.prevent="notSubmitForm"
|
||||||
>
|
>
|
||||||
<el-row>
|
|
||||||
<field
|
<field
|
||||||
v-for="(field) in fieldsList"
|
v-for="(field) in fieldsList"
|
||||||
|
ref="ProductValue"
|
||||||
:key="field.columnName"
|
:key="field.columnName"
|
||||||
:metadata-field="field"
|
:metadata-field="field"
|
||||||
:v-model="field.value"
|
:v-model="field.value"
|
||||||
|
class="product-value"
|
||||||
/>
|
/>
|
||||||
</el-row>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div class="inquiry-product">
|
||||||
|
<el-row v-if="!isEmptyValue(productPrice)" :gutter="20">
|
||||||
|
<el-col style="padding-left: 0px; padding-right: 0%;">
|
||||||
|
<div class="product-description">
|
||||||
|
{{ productPrice.productName }} {{ productPrice.productDescription }}
|
||||||
|
</div>
|
||||||
|
<br><br><br>
|
||||||
|
|
||||||
|
<div class="product-price-base">
|
||||||
|
Precio Base
|
||||||
|
<span class="amount">
|
||||||
|
{{ formatPrice(productPrice.priceBase, productPrice.currency.iSOCode) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<br><br><br>
|
||||||
|
|
||||||
|
<div class="product-tax">
|
||||||
|
{{ productPrice.taxName }}
|
||||||
|
<span class="amount">
|
||||||
|
{{ formatPrice(productPrice.taxAmt, productPrice.currency.iSOCode) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<br><br><br>
|
||||||
|
|
||||||
|
<div class="product-price amount">
|
||||||
|
{{ formatPrice(productPrice.grandTotal, productPrice.currency.iSOCode) }}
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
key="form-loading"
|
key="form-loading"
|
||||||
@ -24,20 +70,30 @@
|
|||||||
element-loading-background="rgba(255, 255, 255, 0.8)"
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
||||||
class="loading-panel"
|
class="loading-panel"
|
||||||
/>
|
/>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import formMixin from '@/components/ADempiere/Form/formMixin'
|
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
||||||
import fieldsList from './fieldsList.js'
|
import fieldsList from './fieldsList.js'
|
||||||
import { getProductPrice } from '@/api/ADempiere/form/price-checking'
|
import { getProductPrice } from '@/api/ADempiere/form/price-checking.js'
|
||||||
|
import { formatPercent, formatPrice } from '@/utils/ADempiere/valueFormat.js'
|
||||||
|
import { getResource } from '@/api/ADempiere/persistence.js'
|
||||||
|
import { mergeByteArray, buildImageFromArray } from '@/utils/ADempiere/resource.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PriceInquiry',
|
name: 'PriceChecking',
|
||||||
mixins: [formMixin],
|
mixins: [formMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fieldsList,
|
fieldsList,
|
||||||
|
productPrice: {},
|
||||||
|
resource: {},
|
||||||
|
valuesImage: [{
|
||||||
|
identifier: 'undefined',
|
||||||
|
value: 'price-checking-background',
|
||||||
|
isLoaded: true
|
||||||
|
}],
|
||||||
unsubscribe: () => {}
|
unsubscribe: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -48,57 +104,204 @@ export default {
|
|||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
buildImageFromArray,
|
||||||
|
getDefaultImage() {
|
||||||
|
return require('@/image/ADempiere/priceChecking/price-checking-background.png')
|
||||||
|
},
|
||||||
|
getImage(resource) {
|
||||||
|
let isImage
|
||||||
|
if (resource) {
|
||||||
|
if (resource.image) {
|
||||||
|
if (!this.valuesImage.some(item => item.identifier === resource.image)) {
|
||||||
|
this.valuesImage.push({
|
||||||
|
identifier: resource.image,
|
||||||
|
value: '',
|
||||||
|
isLoaded: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (this.resource[resource.image]) {
|
||||||
|
this.valuesImage.map(item => {
|
||||||
|
if (item.identifier === resource.image) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
value: this.buildImageFromArray(resource, this.resource[resource.image]),
|
||||||
|
isLoaded: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
} else { // Reload
|
||||||
|
if (!this.valuesImage.some(item => item.identifier === resource.image)) {
|
||||||
|
this.valuesImage.push({
|
||||||
|
identifier: resource.image,
|
||||||
|
value: '',
|
||||||
|
isLoaded: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let result = new Uint8Array()
|
||||||
|
const callBack = {}
|
||||||
|
callBack.onData = (response) => {
|
||||||
|
result = mergeByteArray(result, response.getData())
|
||||||
|
}
|
||||||
|
callBack.onStatus = (status) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
callBack.onEnd = (end) => {
|
||||||
|
this.resource[resource.image] = result
|
||||||
|
this.valuesImage.map(item => {
|
||||||
|
if (item.identifier === resource.image) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
value: this.buildImageFromArray(resource, this.resource[isImage]),
|
||||||
|
isLoaded: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getResource({
|
||||||
|
resourceUuid: '1816f354-a868-4f4f-9a83-b0eb98cf1d05'
|
||||||
|
},
|
||||||
|
callBack)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusProductValue() {
|
||||||
|
this.$refs.ProductValue[0].$children[0].$children[0].$children[1].$children[0].focus()
|
||||||
|
},
|
||||||
|
formatPercent,
|
||||||
|
formatPrice,
|
||||||
subscribeChanges() {
|
subscribeChanges() {
|
||||||
return this.$store.subscribe((mutation, state) => {
|
return this.$store.subscribe((mutation, state) => {
|
||||||
if (mutation.type === 'addActionKeyPerformed' && mutation.payload.columnName === 'ProductValue') {
|
if (mutation.type === 'addActionKeyPerformed' && mutation.payload.columnName === 'ProductValue') {
|
||||||
// cleans all values except column name 'ProductValue'
|
// cleans all values except column name 'ProductValue'
|
||||||
this.setValues({ withOutColumnNames: ['ProductValue'] })
|
|
||||||
getProductPrice({
|
getProductPrice({
|
||||||
searchValue: mutation.payload.value
|
searchValue: mutation.payload.value
|
||||||
})
|
})
|
||||||
.then(productPrice => {
|
.then(productPrice => {
|
||||||
const { product, taxRate } = productPrice
|
const { product, taxRate, priceStd: priceBase } = productPrice
|
||||||
|
const { rate } = taxRate
|
||||||
|
|
||||||
const values = {
|
this.productPrice = {
|
||||||
ProductName: product.name,
|
productName: product.name,
|
||||||
ProductDescription: product.description,
|
productDescription: product.description,
|
||||||
PriceList: productPrice.priceList,
|
priceBase,
|
||||||
TaxAmt: this.getTaxAmount(productPrice.priceList, taxRate.rate),
|
priceStd: productPrice.priceStd,
|
||||||
GrandTotal: this.getGrandTotal(productPrice.priceList, taxRate.rate)
|
priceList: productPrice.priceList,
|
||||||
|
priceLimit: productPrice.priceLimit,
|
||||||
|
taxRate: rate,
|
||||||
|
image: product.imageURL,
|
||||||
|
taxName: taxRate.name,
|
||||||
|
taxIndicator: taxRate.taxIndicator,
|
||||||
|
taxAmt: this.getTaxAmount(priceBase, rate),
|
||||||
|
grandTotal: this.getGrandTotal(priceBase, rate),
|
||||||
|
currency: productPrice.currency
|
||||||
}
|
}
|
||||||
|
|
||||||
// set new values except column name 'ProductValue'
|
|
||||||
this.setValues({ values, withOutColumnNames: ['ProductValue'] })
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: error.message
|
message: error.message
|
||||||
})
|
})
|
||||||
|
this.productPrice = {}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.$store.commit('updateValueOfField', {
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
columnName: 'ProductValue',
|
||||||
|
value: ''
|
||||||
|
})
|
||||||
|
this.getImage(this.productPrice)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getTaxAmount(priceList, taxRate) {
|
getTaxAmount(basePrice, taxRate) {
|
||||||
if (this.isEmptyValue(priceList) || this.isEmptyValue(taxRate)) {
|
if (this.isEmptyValue(basePrice) || this.isEmptyValue(taxRate)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return (priceList * taxRate) / 100
|
return (basePrice * taxRate) / 100
|
||||||
},
|
},
|
||||||
getGrandTotal(priceList, taxRate) {
|
getGrandTotal(basePrice, taxRate) {
|
||||||
if (this.isEmptyValue(priceList)) {
|
if (this.isEmptyValue(basePrice)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return priceList + this.getTaxAmount(priceList, taxRate)
|
return basePrice + this.getTaxAmount(basePrice, taxRate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.background-price-checking {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
float: inherit;
|
||||||
|
// color: white;
|
||||||
|
// opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-description {
|
||||||
|
color: #32363a;
|
||||||
|
font-size: 25px;
|
||||||
|
float: right;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
}
|
||||||
|
.product-price-base, .product-tax {
|
||||||
|
font-size: 35px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.product-price {
|
||||||
|
padding-top: 15px;
|
||||||
|
font-size: 50px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inquiry-form {
|
||||||
|
position: absolute;
|
||||||
|
right: 5%;
|
||||||
|
width: 100%;
|
||||||
|
top: 10%;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
.inquiry-product {
|
||||||
|
position: absolute;
|
||||||
|
right: 5%;
|
||||||
|
width: 100%;
|
||||||
|
top: 33%;
|
||||||
|
.amount {
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.price-inquiry {
|
.price-inquiry {
|
||||||
input {
|
input {
|
||||||
color: #606266 !important;
|
color: #606266 !important;
|
||||||
font-size: 200% !important;
|
font-size: 100% !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.product-value {
|
||||||
|
float: right;
|
||||||
|
padding-right: 0% !important;
|
||||||
|
z-index: 0;
|
||||||
|
.el-form-item__label {
|
||||||
|
font-size: 15px !important;
|
||||||
|
color: #000 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-aside {
|
||||||
|
background: white;
|
||||||
|
width: 60%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 10px !important;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 0px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,25 +4,38 @@ import { createFieldFromDefinition, createFieldFromDictionary } from '@/utils/AD
|
|||||||
export default {
|
export default {
|
||||||
name: 'FormMixn',
|
name: 'FormMixn',
|
||||||
components: {
|
components: {
|
||||||
Field
|
Field,
|
||||||
|
FieldDefinition: Field
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
metadata: {
|
metadata: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
default: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
let containerUuid = this.$route.meta.uuid
|
||||||
|
if (!this.isEmptyValue(this.metadata)) {
|
||||||
|
containerUuid = this.metadata.containerUuid
|
||||||
|
if (this.isEmptyValue(containerUuid)) {
|
||||||
|
containerUuid = this.metadata.uuid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
formUuid: this.$route.meta.uuid,
|
||||||
|
containerUuid,
|
||||||
fieldsList: [],
|
fieldsList: [],
|
||||||
panelMetadata: {},
|
panelMetadata: {},
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
|
isCustomForm: false,
|
||||||
|
unsubscribe: () => {},
|
||||||
panelType: 'form'
|
panelType: 'form'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getterPanel() {
|
getterPanel() {
|
||||||
return this.$store.getters.getPanel(this.metadata.containerUuid)
|
return this.$store.getters.getPanel(this.containerUuid)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -31,16 +44,26 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
createFieldFromDefinition,
|
createFieldFromDefinition,
|
||||||
createFieldFromDictionary,
|
createFieldFromDictionary,
|
||||||
|
/**
|
||||||
|
* Using forms and events with the enter key prevents the page from reloading
|
||||||
|
* with @submit.native.prevent="notSubmitForm" in el-form component
|
||||||
|
*/
|
||||||
|
notSubmitForm(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
return false
|
||||||
|
},
|
||||||
async getPanel() {
|
async getPanel() {
|
||||||
const panel = this.getterPanel
|
const panel = this.getterPanel
|
||||||
if (panel) {
|
if (!this.isEmptyValue(panel)) {
|
||||||
this.fieldsList = panel.fieldList
|
this.fieldsList = panel.fieldList
|
||||||
this.isLoaded = true
|
this.isLoaded = true
|
||||||
|
this.panelMetadata = panel
|
||||||
} else {
|
} else {
|
||||||
await this.generateFieldsList()
|
await this.generateFieldsList()
|
||||||
this.$store.dispatch('addPanel', {
|
this.$store.dispatch('addPanel', {
|
||||||
...this.metadata,
|
...this.metadata,
|
||||||
uuid: this.metadata.containerUuid,
|
isCustomForm: this.isCustomForm,
|
||||||
|
uuid: this.containerUuid,
|
||||||
panelType: this.panelType,
|
panelType: this.panelType,
|
||||||
fieldList: this.fieldsList
|
fieldList: this.fieldsList
|
||||||
})
|
})
|
||||||
@ -48,16 +71,21 @@ export default {
|
|||||||
this.fieldsList = responsePanel.fieldList
|
this.fieldsList = responsePanel.fieldList
|
||||||
|
|
||||||
this.$store.dispatch('changeFormAttribute', {
|
this.$store.dispatch('changeFormAttribute', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
attributeName: 'fieldList',
|
attributeName: 'fieldList',
|
||||||
attributeValue: this.fieldsList
|
attributeValue: this.fieldsList
|
||||||
})
|
})
|
||||||
|
this.panelMetadata = responsePanel
|
||||||
|
this.runAfterLoadPanel()
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.isLoaded = true
|
this.isLoaded = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
runAfterLoadPanel() {
|
||||||
|
// some actions after load form panel
|
||||||
|
},
|
||||||
generateFieldsList() {
|
generateFieldsList() {
|
||||||
let sequence = 0
|
let sequence = 0
|
||||||
const incrementSequence = (newValue) => {
|
const incrementSequence = (newValue) => {
|
||||||
@ -68,9 +96,10 @@ export default {
|
|||||||
return sequence
|
return sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.metadata) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const additionalAttributes = {
|
const additionalAttributes = {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
isEvaluateValueChanges: false,
|
isEvaluateValueChanges: false,
|
||||||
panelType: this.panelType
|
panelType: this.panelType
|
||||||
}
|
}
|
||||||
@ -135,6 +164,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// Set value for one field from panel
|
// Set value for one field from panel
|
||||||
// use example: setValue('ProductName', 'Patio Fun')
|
// use example: setValue('ProductName', 'Patio Fun')
|
||||||
@ -150,9 +180,9 @@ export default {
|
|||||||
// Use example: setValues(values)
|
// Use example: setValues(values)
|
||||||
setValues({ values = {}, withOutColumnNames = [] }) {
|
setValues({ values = {}, withOutColumnNames = [] }) {
|
||||||
this.$store.dispatch('notifyPanelChange', {
|
this.$store.dispatch('notifyPanelChange', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
panelType: this.metadata.panelType,
|
panelType: this.metadata.panelType,
|
||||||
newValues: values,
|
attributes: values,
|
||||||
withOutColumnNames,
|
withOutColumnNames,
|
||||||
isChangedAllValues: true
|
isChangedAllValues: true
|
||||||
})
|
})
|
||||||
@ -161,7 +191,7 @@ export default {
|
|||||||
this.$store.dispatch('addAction', {
|
this.$store.dispatch('addAction', {
|
||||||
name: action.name,
|
name: action.name,
|
||||||
action: action.action,
|
action: action.action,
|
||||||
containerUuid: this.metadata.containerUuid
|
containerUuid: this.containerUuid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
/deep/ .el-input__inner {
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@ -93,7 +93,7 @@ export default {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
|
|
||||||
/deep/ .el-input__inner {
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@ -117,7 +117,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
/deep/ .el-input__inner {
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@ -136,7 +136,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
/deep/ .el-input__inner {
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
75
src/components/ADempiere/Pagination/index.vue
Normal file
75
src/components/ADempiere/Pagination/index.vue
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<el-footer style="height: 30px;">
|
||||||
|
<div style="float: right;">
|
||||||
|
<el-pagination
|
||||||
|
:current-page="currentPage"
|
||||||
|
small
|
||||||
|
layout="slot, total, prev, pager, next"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleChangePage"
|
||||||
|
>
|
||||||
|
<template v-slot>
|
||||||
|
<span v-if="isSelection">
|
||||||
|
{{ $t('table.dataTable.selected') }}: {{ selection }} / <!-- show total records -->
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
</el-footer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'CustomPagination',
|
||||||
|
props: {
|
||||||
|
parentUuid: {
|
||||||
|
type: String,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
containerUuid: {
|
||||||
|
type: String,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
panelType: {
|
||||||
|
type: String,
|
||||||
|
default: 'window'
|
||||||
|
},
|
||||||
|
currentPage: {
|
||||||
|
type: Number,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
selection: {
|
||||||
|
type: Number,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
pageSize: {
|
||||||
|
type: Number,
|
||||||
|
default: 50
|
||||||
|
},
|
||||||
|
total: {
|
||||||
|
type: Number,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
|
handleChangePage: {
|
||||||
|
type: Function,
|
||||||
|
default: (pageNumber) => {
|
||||||
|
this.$store.dispatch('setPageNumber', {
|
||||||
|
parentUuid: this.parentUuid,
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
pageNumber,
|
||||||
|
panelType: this.panelType
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isSelection() {
|
||||||
|
if (this.isEmptyValue(this.selection)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -121,7 +121,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mainPanelMixin } from '@/components/ADempiere/Panel/mainPanelMixin.js'
|
import mainPanelMixin from './mainPanelMixin.js'
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -4,7 +4,7 @@ import { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils.js'
|
|||||||
import { parsedValueComponent } from '@/utils/ADempiere/valueUtils.js'
|
import { parsedValueComponent } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { convertObjectToKeyValue } from '@/utils/ADempiere/valueFormat.js'
|
import { convertObjectToKeyValue } from '@/utils/ADempiere/valueFormat.js'
|
||||||
|
|
||||||
export const mainPanelMixin = {
|
export default {
|
||||||
name: 'MainPanelMixin',
|
name: 'MainPanelMixin',
|
||||||
components: {
|
components: {
|
||||||
FieldDefinition,
|
FieldDefinition,
|
||||||
@ -461,6 +461,10 @@ export const mainPanelMixin = {
|
|||||||
|
|
||||||
return groupsList
|
return groupsList
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Set title in tag view
|
||||||
|
* @param {string} actionValue
|
||||||
|
*/
|
||||||
setTagsViewTitle(actionValue) {
|
setTagsViewTitle(actionValue) {
|
||||||
if (actionValue !== 'create-new' && !this.isEmptyValue(actionValue) && this.panelMetadata.isDocument && this.getterDataStore.isLoaded) {
|
if (actionValue !== 'create-new' && !this.isEmptyValue(actionValue) && this.panelMetadata.isDocument && this.getterDataStore.isLoaded) {
|
||||||
this.$store.dispatch('listWorkflows', this.metadata.tableName)
|
this.$store.dispatch('listWorkflows', this.metadata.tableName)
|
||||||
@ -476,11 +480,17 @@ export const mainPanelMixin = {
|
|||||||
} else {
|
} else {
|
||||||
const { identifierColumns } = this.panelMetadata
|
const { identifierColumns } = this.panelMetadata
|
||||||
if (!this.isEmptyValue(identifierColumns)) {
|
if (!this.isEmptyValue(identifierColumns)) {
|
||||||
if (this.dataRecords[identifierColumns[0]]) {
|
const keyName = identifierColumns[0].columnName
|
||||||
this.tagTitle.action = this.dataRecords[identifierColumns[0]]
|
if (this.dataRecords[keyName]) {
|
||||||
|
this.tagTitle.action = this.dataRecords[keyName]
|
||||||
} else {
|
} else {
|
||||||
const field = this.fieldList.find(fieldItem => fieldItem.isIdentifier)
|
const field = this.fieldList.find(fieldItem => fieldItem.isIdentifier)
|
||||||
this.tagTitle.action = field.value
|
const value = this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.parentUuid,
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
columnName: field.columnName
|
||||||
|
})
|
||||||
|
this.tagTitle.action = value
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.tagTitle.action = this.$t('tagsView.seeRecord')
|
this.tagTitle.action = this.$t('tagsView.seeRecord')
|
||||||
@ -509,12 +519,15 @@ export const mainPanelMixin = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentRecord = this.getterDataStore.record.find(record => record.UUID === uuidRecord) || {}
|
||||||
|
this.dataRecords = currentRecord
|
||||||
|
this.$store.dispatch('currentRecord', currentRecord)
|
||||||
|
|
||||||
this.setTagsViewTitle(uuidRecord)
|
this.setTagsViewTitle(uuidRecord)
|
||||||
if (this.$route.query && this.$route.query.action === 'create-new') {
|
if (this.$route.query && this.$route.query.action === 'create-new') {
|
||||||
this.setFocus()
|
this.setFocus()
|
||||||
}
|
}
|
||||||
const currentRecord = this.getterDataStore.record.find(record => record.UUID === uuidRecord)
|
|
||||||
this.$store.dispatch('currentRecord', currentRecord)
|
|
||||||
},
|
},
|
||||||
async setFocus() {
|
async setFocus() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mainPanelMixin } from '@/components/ADempiere/Panel/mainPanelMixin'
|
import mainPanelMixin from './mainPanelMixin.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MainPanelMobile',
|
name: 'MainPanelMobile',
|
||||||
|
@ -25,8 +25,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { tabMixin } from '@/components/ADempiere/Tab/tabMixin'
|
import tabMixin from './tabMixin.js'
|
||||||
import MainPanel from '@/components/ADempiere/Panel'
|
import MainPanel from '@/components/ADempiere/Panel'
|
||||||
|
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TabParent',
|
name: 'TabParent',
|
||||||
@ -72,7 +73,10 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
...this.$route.params
|
...this.$route.params
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Tab Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$route.meta.tabUuid = this.tabUuid
|
this.$route.meta.tabUuid = this.tabUuid
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -88,6 +92,18 @@ export default {
|
|||||||
window: this.windowMetadata
|
window: this.windowMetadata
|
||||||
})
|
})
|
||||||
this.$route.meta.tabUuid = this.tabUuid
|
this.$route.meta.tabUuid = this.tabUuid
|
||||||
|
},
|
||||||
|
handleBeforeLeave(activeName) {
|
||||||
|
const tabIndex = parseInt(activeName, 10)
|
||||||
|
const metadataTab = this.tabsList.find(tab => tab.tabParentIndex === tabIndex)
|
||||||
|
if (!this.isEmptyValue(metadataTab.whereClause) && metadataTab.whereClause.includes('@')) {
|
||||||
|
metadataTab.whereClause = parseContext({
|
||||||
|
parentUuid: metadataTab.parentUuid,
|
||||||
|
containerUuid: metadataTab.uuid,
|
||||||
|
value: metadataTab.whereClause,
|
||||||
|
isBooleanToString: true
|
||||||
|
}).value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { tabMixin } from '@/components/ADempiere/Tab/tabMixin'
|
import tabMixin from './tabMixin.js'
|
||||||
import DataTable from '@/components/ADempiere/DataTable'
|
import DataTable from '@/components/ADempiere/DataTable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -76,6 +76,8 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
...this.$route.params
|
...this.$route.params
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`${this.name} Component: ${error.name}, ${error.message}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
export default {
|
||||||
|
name: 'MixinTab',
|
||||||
export const tabMixin = {
|
|
||||||
props: {
|
props: {
|
||||||
windowUuid: {
|
windowUuid: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -46,17 +45,6 @@ export const tabMixin = {
|
|||||||
if (this.tabUuid !== tabHTML.$attrs.tabuuid) {
|
if (this.tabUuid !== tabHTML.$attrs.tabuuid) {
|
||||||
this.tabUuid = tabHTML.$attrs.tabuuid
|
this.tabUuid = tabHTML.$attrs.tabuuid
|
||||||
}
|
}
|
||||||
},
|
|
||||||
handleBeforeLeave(activeName) {
|
|
||||||
const metadataTab = this.tabsList.find(tab => tab.index === parseInt(activeName, 10))
|
|
||||||
if (!this.isEmptyValue(metadataTab.whereClause) && metadataTab.whereClause.includes('@')) {
|
|
||||||
metadataTab.whereClause = parseContext({
|
|
||||||
parentUuid: metadataTab.parentUuid,
|
|
||||||
containerUuid: metadataTab.uuid,
|
|
||||||
value: metadataTab.whereClause,
|
|
||||||
isBooleanToString: true
|
|
||||||
}).value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,18 @@
|
|||||||
<el-step
|
<el-step
|
||||||
v-for="(node, index) in listDocumentStatus"
|
v-for="(node, index) in listDocumentStatus"
|
||||||
:key="index"
|
:key="index"
|
||||||
:icon="index < getActive ? 'el-icon-finished' : ( index === getActive ? 'el-icon-s-flag' : 'el-icon-d-arrow-right')"
|
:icon="index < getActive ? 'el-icon-finished' : (index === getActive ? 'el-icon-s-flag' : 'el-icon-d-arrow-right')"
|
||||||
>
|
>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<el-popover
|
<el-popover
|
||||||
v-if="index === getActive"
|
v-if="index === getActive"
|
||||||
|
index="popver-active"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
width="400"
|
width="400"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
>
|
>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="valueActionDocument"
|
v-model="value"
|
||||||
@change="documentActionChange"
|
@change="documentActionChange"
|
||||||
@visible-change="listActionDocument"
|
@visible-change="listActionDocument"
|
||||||
>
|
>
|
||||||
@ -24,27 +25,41 @@
|
|||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<el-tag
|
<el-tag
|
||||||
v-if="isEmptyValue(valueActionDocument)"
|
v-if="!isEmptyValue(value)"
|
||||||
:type="tagStatus(getValueStatus)"
|
index="tag-with-value"
|
||||||
|
:type="tagStatus(value)"
|
||||||
>
|
>
|
||||||
{{ getValue.displayColumn }}
|
{{ displayedValue }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag
|
<el-tag
|
||||||
v-else
|
v-else
|
||||||
:type="tagStatus(valueActionDocument)"
|
index="tag-without-value"
|
||||||
|
:type="tagStatus(value)"
|
||||||
>
|
>
|
||||||
{{ labelDocumentActions }}
|
{{ infoDocumentAction.name }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<p v-if="isEmptyValue(descriptionDocumentActions)"> {{ getValue.description }} </p>
|
|
||||||
<p v-else> {{ descriptionDocumentActions }} </p>
|
<p v-if="!isEmptyValue(infoDocumentAction.description)" index="with-description">
|
||||||
<el-link slot="reference" :autofocus="true" :underline="false" class="title"> {{ node.name }} </el-link>
|
{{ infoDocumentAction.description }}
|
||||||
|
</p>
|
||||||
|
<p v-else index="without-description">
|
||||||
|
{{ fieldDocStatus.description }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<el-link slot="reference" :autofocus="true" :underline="false" class="title">
|
||||||
|
{{ node.name }}
|
||||||
|
</el-link>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<span v-else> {{ node.name }} </span>
|
<span v-else index="node-name">
|
||||||
|
{{ node.name }}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-step>
|
</el-step>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkflowStatusBar',
|
name: 'WorkflowStatusBar',
|
||||||
@ -67,103 +82,83 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
// TODO: See 'DocAction'
|
||||||
|
const columnName = 'DocStatus'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentKey: 100,
|
currentKey: 100,
|
||||||
typeAction: 0,
|
typeAction: 0,
|
||||||
chatNote: '',
|
chatNote: '',
|
||||||
documentStatusesList: [],
|
columnName,
|
||||||
valueActionDocument: ''
|
displayColumnName: `DisplayColumn_${columnName}`,
|
||||||
|
documentStatusesList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getPanelRight() {
|
value: {
|
||||||
return this.$store.getters.getPanelRight
|
get() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
parentUuid: this.parentUuid,
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
columnName: this.columnName
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getterPanel() {
|
set(value) {
|
||||||
return this.$store.getters.getPanel(this.containerUuid)
|
this.$store.commit('updateValueOfField', {
|
||||||
|
parentUuid: this.parentUuid,
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
columnName: this.columnName,
|
||||||
|
value
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getValueStatus() {
|
displayedValue() {
|
||||||
const panel = this.getterPanel
|
return this.$store.getters.getValueOfField({
|
||||||
var status
|
parentUuid: this.parentUuid,
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
// DisplayColumn_'ColumnName'
|
||||||
|
columnName: this.displayColumnName
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fieldDocStatus() {
|
||||||
|
const panel = this.$store.getters.getPanel(this.containerUuid)
|
||||||
if (!this.isEmptyValue(panel)) {
|
if (!this.isEmptyValue(panel)) {
|
||||||
status = panel.fieldList.find(field => {
|
const field = panel.fieldList.find(fieldItem => {
|
||||||
if (field.columnName === 'DocStatus') {
|
return fieldItem.columnName === this.columnName
|
||||||
|
})
|
||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
})
|
return undefined
|
||||||
}
|
|
||||||
if (!this.isEmptyValue(status)) {
|
|
||||||
return status.value
|
|
||||||
}
|
|
||||||
return 'CL'
|
|
||||||
},
|
|
||||||
getValue() {
|
|
||||||
if (!this.isEmptyValue(this.getterPanel)) {
|
|
||||||
var value = this.getterPanel.fieldList.find(field => {
|
|
||||||
if (field.columnName === 'DocStatus') {
|
|
||||||
return field
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
return 'CL'
|
|
||||||
},
|
},
|
||||||
getActive() {
|
getActive() {
|
||||||
const active = this.listDocumentStatus.findIndex(index => index.value === this.getValueStatus)
|
const valueStatus = this.value
|
||||||
return active
|
return this.listDocumentStatus.findIndex(index => index.value === valueStatus)
|
||||||
},
|
|
||||||
gettersNodeList() {
|
|
||||||
var node = this.$store.getters.getNodeWorkflow
|
|
||||||
if (!this.isEmptyValue(node.workflowsList)) {
|
|
||||||
return node.workflowsList[0].workflowNodesList
|
|
||||||
}
|
|
||||||
return node.workflowsList
|
|
||||||
},
|
},
|
||||||
listDocumentStatus() {
|
listDocumentStatus() {
|
||||||
return this.$store.getters.getListDocumentStatus.documentActionsList
|
return this.$store.getters.getListDocumentStatus.documentActionsList
|
||||||
},
|
},
|
||||||
typeStatus() {
|
|
||||||
if (this.getValueStatus === 'VO') {
|
|
||||||
return 'error'
|
|
||||||
} else {
|
|
||||||
return 'success'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
documentActions() {
|
documentActions() {
|
||||||
return this.$store.getters.getListDocumentActions
|
return this.$store.getters.getListDocumentActions
|
||||||
},
|
},
|
||||||
listDocumentActions() {
|
listDocumentActions() {
|
||||||
|
// TODO: Add current value in disabled
|
||||||
return this.documentActions.documentActionsList
|
return this.documentActions.documentActionsList
|
||||||
},
|
},
|
||||||
labelDocumentActions() {
|
infoDocumentAction() {
|
||||||
|
const value = this.value
|
||||||
const found = this.listDocumentActions.find(element => {
|
const found = this.listDocumentActions.find(element => {
|
||||||
if (element.value === this.valueActionDocument) {
|
return element.value === value
|
||||||
return element
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (this.isEmptyValue(found)) {
|
if (this.isEmptyValue(found)) {
|
||||||
return this.valueActionDocument
|
return value
|
||||||
}
|
}
|
||||||
return found.name
|
return found
|
||||||
},
|
|
||||||
descriptionDocumentActions() {
|
|
||||||
const found = this.listDocumentActions.find(element => {
|
|
||||||
if (element.value === this.valueActionDocument) {
|
|
||||||
return element
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (this.isEmptyValue(found)) {
|
|
||||||
return this.valueActionDocument
|
|
||||||
}
|
|
||||||
return found.description
|
|
||||||
},
|
},
|
||||||
processOrderUuid() {
|
processOrderUuid() {
|
||||||
return this.$store.getters.getOrders
|
return this.$store.getters.getOrders
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.gettersNodeList
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
listActionDocument(isShowList) {
|
listActionDocument(isShowList) {
|
||||||
if (isShowList) {
|
if (isShowList) {
|
||||||
@ -197,14 +192,14 @@ export default {
|
|||||||
// recordUuid: this.$route.query.action,
|
// recordUuid: this.$route.query.action,
|
||||||
// parametersList: [{
|
// parametersList: [{
|
||||||
// columnName: 'DocAction',
|
// columnName: 'DocAction',
|
||||||
// value: this.valueActionDocument
|
// value: this.value
|
||||||
// }],
|
// }],
|
||||||
// isActionDocument: true,
|
// isActionDocument: true,
|
||||||
// parentUuid: this.parentUuid,
|
// parentUuid: this.parentUuid,
|
||||||
// panelType: this.panelType,
|
// panelType: this.panelType,
|
||||||
// containerUuid: this.containerUuid// determinate if get table name and record id (window) or selection (browser)
|
// containerUuid: this.containerUuid// determinate if get table name and record id (window) or selection (browser)
|
||||||
// })
|
// })
|
||||||
// this.valueActionDocument = ''
|
// this.value = ''
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +212,6 @@ export default {
|
|||||||
color: #000000;
|
color: #000000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.scroll-window-log-change {
|
.scroll-window-log-change {
|
||||||
max-height: 74vh !important;
|
max-height: 74vh !important;
|
||||||
|
@ -48,14 +48,18 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.drag-select >>> .sortable-ghost {
|
.drag-select {
|
||||||
|
::v-deep {
|
||||||
|
.sortable-ghost {
|
||||||
opacity: .8;
|
opacity: .8;
|
||||||
color: #fff!important;
|
color: #fff !important;
|
||||||
background: #42b983!important;
|
background: #42b983 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drag-select >>> .el-tag {
|
.el-tag {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -202,7 +202,8 @@ export default {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
/deep/ .el-input__inner {
|
|
||||||
|
::v-deep .el-input__inner {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
@ -54,19 +54,24 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.json-editor{
|
.json-editor {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
|
||||||
.json-editor >>> .CodeMirror {
|
::v-deep {
|
||||||
|
.CodeMirror {
|
||||||
height: auto;
|
height: auto;
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
}
|
}
|
||||||
.json-editor >>> .CodeMirror-scroll{
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
}
|
}
|
||||||
.json-editor >>> .cm-s-rubyblue span.cm-string {
|
|
||||||
|
.cm-s-rubyblue span.cm-string {
|
||||||
color: #F08047;
|
color: #F08047;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -104,7 +104,7 @@ export default {
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.editor-slide-upload {
|
.editor-slide-upload {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
/deep/ .el-upload--picture-card {
|
::v-deep .el-upload--picture-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,28 +220,37 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.tinymce-container {
|
.tinymce-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
}
|
}
|
||||||
.tinymce-container>>>.mce-fullscreen {
|
|
||||||
|
.tinymce-container {
|
||||||
|
::v-deep {
|
||||||
|
.mce-fullscreen {
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tinymce-textarea {
|
.tinymce-textarea {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-custom-btn-container {
|
.editor-custom-btn-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 4px;
|
right: 4px;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
/*z-index: 2005;*/
|
/*z-index: 2005;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.fullscreen .editor-custom-btn-container {
|
.fullscreen .editor-custom-btn-container {
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-upload-btn {
|
.editor-upload-btn {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
||||||
export default {
|
function checkPermission(el, binding) {
|
||||||
inserted(el, binding, vnode) {
|
|
||||||
const { value } = binding
|
const { value } = binding
|
||||||
const roles = store.getters && store.getters.roles
|
const roles = store.getters && store.getters.roles
|
||||||
|
|
||||||
if (value && value instanceof Array && value.length > 0) {
|
if (value && value instanceof Array) {
|
||||||
|
if (value.length > 0) {
|
||||||
const permissionRoles = value
|
const permissionRoles = value
|
||||||
|
|
||||||
const hasPermission = roles.some(role => {
|
const hasPermission = roles.some(role => {
|
||||||
@ -15,8 +15,17 @@ export default {
|
|||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
el.parentNode && el.parentNode.removeChild(el)
|
el.parentNode && el.parentNode.removeChild(el)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`need roles! Like v-permission="['admin','editor']"`)
|
throw new Error(`need roles! Like v-permission="['admin','editor']"`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
inserted(el, binding) {
|
||||||
|
checkPermission(el, binding)
|
||||||
|
},
|
||||||
|
update(el, binding) {
|
||||||
|
checkPermission(el, binding)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
src/image/ADempiere/priceChecking/price-checking-background.png
Normal file
BIN
src/image/ADempiere/priceChecking/price-checking-background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 394 KiB |
@ -35,6 +35,7 @@ export default {
|
|||||||
processError: 'Was not executed',
|
processError: 'Was not executed',
|
||||||
//
|
//
|
||||||
emptyValues: 'Parameter(s) empty value',
|
emptyValues: 'Parameter(s) empty value',
|
||||||
|
fieldCannotBeEmpty: 'The field value cannot be empty.',
|
||||||
fieldMandatory: 'The field is mandatory',
|
fieldMandatory: 'The field is mandatory',
|
||||||
requestError: 'Error executing the request',
|
requestError: 'Error executing the request',
|
||||||
successChangeRole: 'The role has been changed',
|
successChangeRole: 'The role has been changed',
|
||||||
@ -322,6 +323,75 @@ export default {
|
|||||||
},
|
},
|
||||||
quickAccess: {
|
quickAccess: {
|
||||||
newRecord: 'Quick Access to Create New Record',
|
newRecord: 'Quick Access to Create New Record',
|
||||||
listRecords: 'Quick Access to List All Records'
|
listRecords: 'Quick Access to List All Records',
|
||||||
|
searchWithEnter: 'Press enter to search'
|
||||||
|
},
|
||||||
|
businessPartner: {
|
||||||
|
notFound: 'Business partner not found.'
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
pos: {
|
||||||
|
title: 'POS',
|
||||||
|
optionsPoinSales: {
|
||||||
|
title: 'Quick Point of Sales Options',
|
||||||
|
salesOrder: {
|
||||||
|
title: 'Sale Order',
|
||||||
|
newOrder: 'New Order',
|
||||||
|
ordersHistory: 'Orders History',
|
||||||
|
generateImmediateInvoice: 'Generate Immediate Invoice',
|
||||||
|
completePreparedOrder: 'Complete Prepared Order',
|
||||||
|
cancelSaleTransaction: 'Cancel Sale Transaction',
|
||||||
|
createPos: 'Create Point of Sale Withdrawal',
|
||||||
|
toPrint: 'To Print'
|
||||||
|
},
|
||||||
|
cashManagement: {
|
||||||
|
title: 'Cash Management',
|
||||||
|
cashOpening: 'Cash Opening',
|
||||||
|
cashwithdrawal: 'Cash withdrawa',
|
||||||
|
closeBox: 'Close the box'
|
||||||
|
},
|
||||||
|
generalOptions: {
|
||||||
|
title: 'General Options',
|
||||||
|
changePos: 'Change Point of Sale',
|
||||||
|
listProducts: 'Change Point of Sale'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tableProduct: {
|
||||||
|
product: 'Product',
|
||||||
|
quantity: 'Quantity',
|
||||||
|
options: 'Options',
|
||||||
|
editQuantities: 'Edit Quantities',
|
||||||
|
remove: 'Remove'
|
||||||
|
},
|
||||||
|
product: {
|
||||||
|
productInformation: 'Product information',
|
||||||
|
code: 'Code',
|
||||||
|
name: 'Name',
|
||||||
|
description: 'Description',
|
||||||
|
price: 'Price',
|
||||||
|
taxRate: 'Tax Rate',
|
||||||
|
quantityAvailable: 'Quantity Avalible'
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
order: 'Order',
|
||||||
|
seller: 'Seller',
|
||||||
|
date: 'Date',
|
||||||
|
subTotal: 'Sub-Total',
|
||||||
|
type: 'Type',
|
||||||
|
discount: 'Descuento',
|
||||||
|
tax: 'Tax',
|
||||||
|
total: 'Total',
|
||||||
|
itemQuantity: 'Item Quantity',
|
||||||
|
numberLines: 'Number of Lines',
|
||||||
|
pointSale: 'Point of Sale',
|
||||||
|
collect: 'Collect'
|
||||||
|
},
|
||||||
|
collect: {
|
||||||
|
orderTotal: 'Order Total',
|
||||||
|
pending: 'Pending',
|
||||||
|
payment: 'Payment',
|
||||||
|
change: 'Change'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ export default {
|
|||||||
processError: 'No fue ejecutado',
|
processError: 'No fue ejecutado',
|
||||||
//
|
//
|
||||||
emptyValues: 'Parametro(s) con valores vacios',
|
emptyValues: 'Parametro(s) con valores vacios',
|
||||||
|
fieldCannotBeEmpty: 'El valor del campo no puede estar vacío.',
|
||||||
fieldMandatory: 'El campo es obligatorio',
|
fieldMandatory: 'El campo es obligatorio',
|
||||||
requestError: 'Error al ejecutar la petición',
|
requestError: 'Error al ejecutar la petición',
|
||||||
successChangeRole: 'El rol se ha cambiado',
|
successChangeRole: 'El rol se ha cambiado',
|
||||||
@ -238,7 +239,7 @@ export default {
|
|||||||
currentRole: 'Rol actual',
|
currentRole: 'Rol actual',
|
||||||
clientName: 'Nombre del cliente',
|
clientName: 'Nombre del cliente',
|
||||||
description: 'Descripción',
|
description: 'Descripción',
|
||||||
changeRole: 'Cambiar rol',
|
changeRole: 'Cambiar Rol',
|
||||||
changeLanguage: 'Cambiar idioma',
|
changeLanguage: 'Cambiar idioma',
|
||||||
changeLanguagePlaceholder: 'Elija un idioma'
|
changeLanguagePlaceholder: 'Elija un idioma'
|
||||||
},
|
},
|
||||||
@ -297,6 +298,75 @@ export default {
|
|||||||
},
|
},
|
||||||
quickAccess: {
|
quickAccess: {
|
||||||
newRecord: 'Acceso Rápido para Crear Registro Nuevo',
|
newRecord: 'Acceso Rápido para Crear Registro Nuevo',
|
||||||
listRecords: 'Acceso Rápido para Listar los Registros'
|
listRecords: 'Acceso Rápido para Listar los Registros',
|
||||||
|
searchWithEnter: 'Pulse enter para realizar la busqueda'
|
||||||
|
},
|
||||||
|
businessPartner: {
|
||||||
|
notFound: 'Socio de negocio no encontrado.'
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
pos: {
|
||||||
|
title: 'Punto de Venta',
|
||||||
|
optionsPoinSales: {
|
||||||
|
title: 'Opciones Rápidas del Punto de Ventas',
|
||||||
|
salesOrder: {
|
||||||
|
title: 'Orden de Venta',
|
||||||
|
newOrder: 'Nueva Orden',
|
||||||
|
ordersHistory: 'Histórico de Órdenes ',
|
||||||
|
generateImmediateInvoice: 'Generar Factura Inmediata',
|
||||||
|
completePreparedOrder: 'Completar Orden Preparada',
|
||||||
|
cancelSaleTransaction: 'Anular Transacción de Venta',
|
||||||
|
createPos: 'Crear Retiro de Punto de Venta',
|
||||||
|
toPrint: 'Imprimir'
|
||||||
|
},
|
||||||
|
cashManagement: {
|
||||||
|
title: 'Gestión de Caja',
|
||||||
|
cashOpening: 'Apertura de Caja',
|
||||||
|
cashwithdrawal: 'Retiro de Efectivo',
|
||||||
|
closeBox: 'Cierre de Caja'
|
||||||
|
},
|
||||||
|
generalOptions: {
|
||||||
|
title: 'Opciones Generales',
|
||||||
|
changePos: 'Cambiar Punto de Venta',
|
||||||
|
listProducts: 'Lista de Productos y Precios'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tableProduct: {
|
||||||
|
product: 'Producto',
|
||||||
|
quantity: 'Cantidad',
|
||||||
|
options: 'Opciones',
|
||||||
|
editQuantities: 'Editar Cantidades',
|
||||||
|
remove: 'Eliminar'
|
||||||
|
},
|
||||||
|
product: {
|
||||||
|
productInformation: 'Información de Producto',
|
||||||
|
code: 'Código',
|
||||||
|
name: 'Nombre',
|
||||||
|
description: 'Descripción',
|
||||||
|
price: 'Precio',
|
||||||
|
taxRate: 'Tasa de Impuesto',
|
||||||
|
quantityAvailable: 'Cantidad Disponible'
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
order: 'Orden',
|
||||||
|
seller: 'Vendedor',
|
||||||
|
date: 'Date',
|
||||||
|
subTotal: 'Sub-Total',
|
||||||
|
type: 'Tipo',
|
||||||
|
discount: 'Descuento',
|
||||||
|
tax: 'Impuesto',
|
||||||
|
total: 'Total',
|
||||||
|
itemQuantity: 'Cantidad de Árticulo',
|
||||||
|
numberLines: 'Cantidad de Lineas',
|
||||||
|
pointSale: 'Punto de Venta',
|
||||||
|
collect: 'Cobrar'
|
||||||
|
},
|
||||||
|
collect: {
|
||||||
|
orderTotal: 'Total de Orden',
|
||||||
|
pending: 'Pendiente',
|
||||||
|
payment: 'Pago',
|
||||||
|
change: 'Cambio'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,11 @@ export default {
|
|||||||
},
|
},
|
||||||
async logout() {
|
async logout() {
|
||||||
await this.$store.dispatch('user/logout')
|
await this.$store.dispatch('user/logout')
|
||||||
this.$router.push({ path: '/login', query: { redirect: this.$route.fullPath }})
|
this.$router.push({
|
||||||
|
path: '/login'
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(error)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handleClick() {
|
handleClick() {
|
||||||
this.$router.push({ name: 'Profile' })
|
this.$router.push({ name: 'Profile' })
|
||||||
|
@ -17,8 +17,12 @@ export default {
|
|||||||
const vnodes = []
|
const vnodes = []
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
|
if (icon.includes('el-icon')) {
|
||||||
|
vnodes.push(<i class={[icon, 'sub-el-icon']} />)
|
||||||
|
} else {
|
||||||
vnodes.push(<svg-icon icon-class={icon}/>)
|
vnodes.push(<svg-icon icon-class={icon}/>)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
vnodes.push(<span slot='title'>{(title)}</span>)
|
vnodes.push(<span slot='title'>{(title)}</span>)
|
||||||
@ -27,3 +31,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.sub-el-icon {
|
||||||
|
color: currentColor;
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -94,7 +94,7 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
/deep/ {
|
::v-deep {
|
||||||
.el-scrollbar__bar {
|
.el-scrollbar__bar {
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,13 @@
|
|||||||
ref="tag"
|
ref="tag"
|
||||||
:key="tag.path"
|
:key="tag.path"
|
||||||
:class="isActive(tag)?'active':''"
|
:class="isActive(tag)?'active':''"
|
||||||
:to="{ name: tag.name, path: tag.path, query: tag.query, fullPath: tag.fullPath, params: tag.params }"
|
:to="{
|
||||||
|
name: tag.name,
|
||||||
|
path: tag.path,
|
||||||
|
query: tag.query,
|
||||||
|
fullPath: tag.fullPath,
|
||||||
|
params: tag.params
|
||||||
|
}"
|
||||||
tag="span"
|
tag="span"
|
||||||
class="tags-view-item"
|
class="tags-view-item"
|
||||||
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
|
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
|
||||||
|
@ -25,7 +25,7 @@ import nestedRouter from './modules/nested'
|
|||||||
* meta : {
|
* meta : {
|
||||||
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
||||||
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
||||||
icon: 'svg-name' the icon show in the sidebar
|
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
|
||||||
noCache: true if set true, the page will no be cached(default is false)
|
noCache: true if set true, the page will no be cached(default is false)
|
||||||
affix: true if set true, the tag will affix in the tags-view
|
affix: true if set true, the tag will affix in the tags-view
|
||||||
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
||||||
@ -223,7 +223,7 @@ export const asyncRoutes = [
|
|||||||
name: 'Example',
|
name: 'Example',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'example',
|
title: 'example',
|
||||||
icon: 'example'
|
icon: 'el-icon-s-help'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { getMenu } from '@/api/user'
|
import { getMenu } from '@/api/user'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
|
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
/* Layout */
|
/* Layout */
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout'
|
||||||
|
import { isEmptyValue } from '@adempiere/grpc-core-client'
|
||||||
|
|
||||||
const staticRoutes = [
|
const staticRoutes = [
|
||||||
{
|
{
|
||||||
@ -71,22 +73,22 @@ const staticRoutes = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// Get Menu from server
|
// Get Menu from server
|
||||||
export function loadMainMenu() {
|
export function loadMainMenu(organizationId = 0) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
organizationId = isEmptyValue(store.getters['user/getOrganization']) ? 0 : store.getters['user/getOrganization'].id
|
||||||
getMenu(getToken()).then(menuResponse => {
|
getMenu(getToken()).then(menuResponse => {
|
||||||
const asyncRoutesMap = []
|
const asyncRoutesMap = []
|
||||||
menuResponse.childsList.forEach(menuElement => {
|
menuResponse.childsList.forEach(menuElement => {
|
||||||
const optionMenu = getRouteFromMenuItem(menuElement)
|
const optionMenu = getRouteFromMenuItem(menuElement, organizationId)
|
||||||
if (menuElement.isSummary) {
|
if (menuElement.isSummary) {
|
||||||
menuElement.childsList.forEach(menu => {
|
menuElement.childsList.forEach(menu => {
|
||||||
const childsSumaryConverted = getChildFromAction(menu, 0)
|
const childsSumaryConverted = getChildFromAction({ menu, index: 0, organizationId })
|
||||||
|
|
||||||
optionMenu.children.push(childsSumaryConverted)
|
optionMenu.children.push(childsSumaryConverted)
|
||||||
optionMenu.children[0].meta.childs.push(childsSumaryConverted)
|
optionMenu.children[0].meta.childs.push(childsSumaryConverted)
|
||||||
optionMenu.meta.childs.push(childsSumaryConverted)
|
optionMenu.meta.childs.push(childsSumaryConverted)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const childsConverted = getChildFromAction(menuElement)
|
const childsConverted = getChildFromAction({ menu: menuElement, index: undefined, organizationId })
|
||||||
|
|
||||||
optionMenu.children.push(childsConverted)
|
optionMenu.children.push(childsConverted)
|
||||||
optionMenu.meta.childs.push(childsConverted)
|
optionMenu.meta.childs.push(childsConverted)
|
||||||
@ -101,16 +103,17 @@ export function loadMainMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Only Child
|
// Get Only Child
|
||||||
function getChildFromAction(menu, index) {
|
function getChildFromAction({ menu, index, organizationId }) {
|
||||||
const action = menu.action
|
const action = menu.action
|
||||||
const actionAttributes = convertAction(action)
|
const actionAttributes = convertAction(action)
|
||||||
|
const clientId = store.getters['user/getRole'].clientId
|
||||||
let routeIdentifier = actionAttributes.name + '/' + menu.id
|
let routeIdentifier = actionAttributes.name + '/' + menu.id
|
||||||
if (menu.isSummary) {
|
if (menu.isSummary) {
|
||||||
routeIdentifier = '/' + menu.id
|
routeIdentifier = '/' + menu.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
path: routeIdentifier,
|
path: '/' + clientId + '/' + organizationId + '/' + routeIdentifier,
|
||||||
component: actionAttributes.component,
|
component: actionAttributes.component,
|
||||||
name: menu.uuid,
|
name: menu.uuid,
|
||||||
hidden: index > 0,
|
hidden: index > 0,
|
||||||
@ -136,7 +139,7 @@ function getChildFromAction(menu, index) {
|
|||||||
if (actionAttributes.isIndex || actionAttributes.name === 'summary') {
|
if (actionAttributes.isIndex || actionAttributes.name === 'summary') {
|
||||||
option['children'] = []
|
option['children'] = []
|
||||||
menu.childsList.forEach(child => {
|
menu.childsList.forEach(child => {
|
||||||
const menuConverted = getChildFromAction(child, 1)
|
const menuConverted = getChildFromAction({ menu: child, index: 1, organizationId })
|
||||||
option.children.push(menuConverted)
|
option.children.push(menuConverted)
|
||||||
option.meta.childs.push(menuConverted)
|
option.meta.childs.push(menuConverted)
|
||||||
})
|
})
|
||||||
@ -145,11 +148,12 @@ function getChildFromAction(menu, index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert menu item from server to Route
|
// Convert menu item from server to Route
|
||||||
function getRouteFromMenuItem(menu) {
|
function getRouteFromMenuItem(menu, organizationId) {
|
||||||
const action = menu.action
|
const action = menu.action
|
||||||
const actionAttributes = convertAction(action)
|
const actionAttributes = convertAction(action)
|
||||||
|
const clientId = store.getters['user/getRole'].clientId
|
||||||
const optionMenu = {
|
const optionMenu = {
|
||||||
path: '/' + menu.id,
|
path: '/' + clientId + '/' + organizationId + '/' + menu.id,
|
||||||
redirect: '/' + menu.id + '/index',
|
redirect: '/' + menu.id + '/index',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
name: menu.uuid,
|
name: menu.uuid,
|
||||||
|
@ -118,7 +118,6 @@ const browserControl = {
|
|||||||
// datatables attributes
|
// datatables attributes
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
isSelected: false,
|
|
||||||
isReadOnlyFromRow: false
|
isReadOnlyFromRow: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -9,9 +9,11 @@ import {
|
|||||||
unlockPrivateAccessFromServer
|
unlockPrivateAccessFromServer
|
||||||
} from '@/api/ADempiere/private-access'
|
} from '@/api/ADempiere/private-access'
|
||||||
import {
|
import {
|
||||||
isEmptyValue,
|
extractPagingToken,
|
||||||
convertArrayPairsToObject
|
isEmptyValue
|
||||||
} from '@/utils/ADempiere/valueUtils.js'
|
} from '@/utils/ADempiere/valueUtils.js'
|
||||||
|
import { convertArrayKeyValueObject } from '@/utils/ADempiere/valueFormat.js'
|
||||||
|
import { typeValue } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
import { showMessage } from '@/utils/ADempiere/notification'
|
||||||
import { TABLE, TABLE_DIRECT } from '@/utils/ADempiere/references'
|
import { TABLE, TABLE_DIRECT } from '@/utils/ADempiere/references'
|
||||||
@ -210,14 +212,14 @@ const data = {
|
|||||||
// TODO: Evaluate if is field is read only and FieldSelect
|
// TODO: Evaluate if is field is read only and FieldSelect
|
||||||
.filter(itemField => {
|
.filter(itemField => {
|
||||||
return itemField.componentPath === 'FieldSelect' ||
|
return itemField.componentPath === 'FieldSelect' ||
|
||||||
String(values[itemField.columnName]) === '[object Object]' ||
|
typeValue(values[itemField.columnName]) === 'OBJECT' ||
|
||||||
itemField.isSQLValue
|
itemField.isSQLValue
|
||||||
})
|
})
|
||||||
.map(async itemField => {
|
.map(async itemField => {
|
||||||
const { columnName, componentPath } = itemField
|
const { columnName, componentPath } = itemField
|
||||||
let valueGetDisplayColumn = values[columnName]
|
let valueGetDisplayColumn = values[columnName]
|
||||||
|
|
||||||
if (String(values[columnName]) === '[object Object]') {
|
if (typeValue(values[columnName]) === 'OBJECT') {
|
||||||
if (componentPath === 'FieldSelect') {
|
if (componentPath === 'FieldSelect') {
|
||||||
values[columnName] = ' '
|
values[columnName] = ' '
|
||||||
values[itemField.displayColumnName] = ' '
|
values[itemField.displayColumnName] = ' '
|
||||||
@ -248,7 +250,7 @@ const data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmptyValue(valueGetDisplayColumn) &&
|
if (!isEmptyValue(valueGetDisplayColumn) &&
|
||||||
String(valueGetDisplayColumn) === '[object Object]' &&
|
typeValue(valueGetDisplayColumn) === 'OBJECT' &&
|
||||||
valueGetDisplayColumn.isSQL) {
|
valueGetDisplayColumn.isSQL) {
|
||||||
// get value from Query
|
// get value from Query
|
||||||
valueGetDisplayColumn = await dispatch('getValueBySQL', {
|
valueGetDisplayColumn = await dispatch('getValueBySQL', {
|
||||||
@ -532,14 +534,10 @@ const data = {
|
|||||||
const recordsList = dataResponse.recordsList.map(itemRecord => {
|
const recordsList = dataResponse.recordsList.map(itemRecord => {
|
||||||
const values = itemRecord.values
|
const values = itemRecord.values
|
||||||
|
|
||||||
// datatables attributes
|
let isEdit = false
|
||||||
values.isNew = false
|
|
||||||
values.isEdit = false
|
|
||||||
values.isSelected = false
|
|
||||||
values.isReadOnlyFromRow = false
|
|
||||||
if (isAddDefaultValues) {
|
if (isAddDefaultValues) {
|
||||||
if (inEdited.find(itemEdit => itemEdit.UUID === values.UUID)) {
|
if (inEdited.find(itemEdit => itemEdit.UUID === values.UUID)) {
|
||||||
values.isEdit = true
|
isEdit = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +545,11 @@ const data = {
|
|||||||
// server (empty fields are not brought from the server)
|
// server (empty fields are not brought from the server)
|
||||||
return {
|
return {
|
||||||
...defaultValues,
|
...defaultValues,
|
||||||
...values
|
...values,
|
||||||
|
// datatables attributes
|
||||||
|
isNew: false,
|
||||||
|
isEdit,
|
||||||
|
isReadOnlyFromRow: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -556,10 +558,7 @@ const data = {
|
|||||||
if (isEmptyValue(token)) {
|
if (isEmptyValue(token)) {
|
||||||
token = dataStore.nextPageToken
|
token = dataStore.nextPageToken
|
||||||
} else {
|
} else {
|
||||||
token = token.slice(0, -2)
|
token = extractPagingToken(token)
|
||||||
if (token.substr(-1, 1) === '-') {
|
|
||||||
token = token.slice(0, -1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isShowNotification) {
|
if (isShowNotification) {
|
||||||
let searchMessage = 'searchWithOutRecords'
|
let searchMessage = 'searchWithOutRecords'
|
||||||
@ -579,7 +578,7 @@ const data = {
|
|||||||
selection: dataStore.selection,
|
selection: dataStore.selection,
|
||||||
recordCount: dataResponse.recordCount,
|
recordCount: dataResponse.recordCount,
|
||||||
nextPageToken: token,
|
nextPageToken: token,
|
||||||
originalNextPageToken: originalNextPageToken,
|
originalNextPageToken,
|
||||||
isAddRecord,
|
isAddRecord,
|
||||||
pageNumber: dataStore.pageNumber,
|
pageNumber: dataStore.pageNumber,
|
||||||
tableName,
|
tableName,
|
||||||
@ -670,7 +669,7 @@ const data = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (Array.isArray(values)) {
|
if (Array.isArray(values)) {
|
||||||
values = convertArrayPairsToObject({
|
values = convertArrayKeyValueObject({
|
||||||
arrayToConvert: values
|
arrayToConvert: values
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -702,7 +701,7 @@ const data = {
|
|||||||
displayColumn,
|
displayColumn,
|
||||||
withOutColumnNames = []
|
withOutColumnNames = []
|
||||||
}) {
|
}) {
|
||||||
dispatch('setContext', {
|
dispatch('setPreferenceContext', {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName,
|
columnName,
|
||||||
@ -985,7 +984,7 @@ const data = {
|
|||||||
*/
|
*/
|
||||||
getSelectionToServer: (state, getters, rootState, rootGetters) => ({ containerUuid, selection = [] }) => {
|
getSelectionToServer: (state, getters, rootState, rootGetters) => ({ containerUuid, selection = [] }) => {
|
||||||
const selectionToServer = []
|
const selectionToServer = []
|
||||||
const withOut = ['isEdit', 'isSelected', 'isSendToServer']
|
const withOut = ['isEdit', 'isSendToServer']
|
||||||
|
|
||||||
if (selection.length <= 0) {
|
if (selection.length <= 0) {
|
||||||
selection = getters.getDataRecordSelection(containerUuid)
|
selection = getters.getDataRecordSelection(containerUuid)
|
||||||
|
@ -3,7 +3,9 @@ import { getField as getFieldFromDictionary } from '@/api/ADempiere/dictionary'
|
|||||||
const initStateLookup = {
|
const initStateLookup = {
|
||||||
referenceList: [],
|
referenceList: [],
|
||||||
fieldList: [],
|
fieldList: [],
|
||||||
validationRuleList: []
|
validationRuleList: [],
|
||||||
|
fieldListLocation: [],
|
||||||
|
isShowedLocation: false
|
||||||
}
|
}
|
||||||
|
|
||||||
const field = {
|
const field = {
|
||||||
@ -20,11 +22,17 @@ const field = {
|
|||||||
},
|
},
|
||||||
resetStateLookup(state) {
|
resetStateLookup(state) {
|
||||||
state = initStateLookup
|
state = initStateLookup
|
||||||
|
},
|
||||||
|
setShowedLocation(state, isShowed) {
|
||||||
|
state.isShowedLocation = isShowed
|
||||||
|
},
|
||||||
|
setfieldListLocation(state, fieldListLocation) {
|
||||||
|
state.fieldListLocation = fieldListLocation
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
// Get Reference from Server based on criteria
|
// Get Reference from Server based on criteria
|
||||||
getFieldFromServer({ commit, rootGetters }, {
|
getFieldFromServer({ commit }, {
|
||||||
fieldUuid,
|
fieldUuid,
|
||||||
columnUuid,
|
columnUuid,
|
||||||
elementUuid,
|
elementUuid,
|
||||||
@ -52,35 +60,41 @@ const field = {
|
|||||||
fieldResponse.tableName = tableName
|
fieldResponse.tableName = tableName
|
||||||
fieldResponse.columnName = columnName
|
fieldResponse.columnName = columnName
|
||||||
}
|
}
|
||||||
commit('addField', {
|
|
||||||
fieldResponse
|
commit('addField', fieldResponse)
|
||||||
})
|
|
||||||
return fieldResponse
|
return fieldResponse
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Get Field, Select Base - Error ${error.code}: ${error.message}.`)
|
console.warn(`Get Field - Error ${error.code}: ${error.message}.`)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
changeSequence({ commit }, params) {
|
||||||
|
commit('setfieldListLocation', params)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
getIsShowedLocation: (state) => {
|
||||||
|
return state.isShowedLocation
|
||||||
|
},
|
||||||
getFieldFromUuid: (state) => (uuid) => {
|
getFieldFromUuid: (state) => (uuid) => {
|
||||||
return state.fieldList.find(fieldItem => {
|
return state.fieldList.find(fieldItem => {
|
||||||
return fieldItem.fieldResponse.uuid === uuid
|
return fieldItem.uuid === uuid
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getFieldFromColumnUuid: (state) => (columnUuid) => {
|
getFieldFromColumnUuid: (state) => (columnUuid) => {
|
||||||
return state.fieldList.find(fieldItem => {
|
return state.fieldList.find(fieldItem => {
|
||||||
return fieldItem.fieldResponse.columnUuid === columnUuid
|
return fieldItem.columnUuid === columnUuid
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getFieldFromElementUuid: (state) => (elementUuid) => {
|
getFieldFromElementUuid: (state) => (elementUuid) => {
|
||||||
return state.fieldList.find(fieldItem => {
|
return state.fieldList.find(fieldItem => {
|
||||||
return fieldItem.fieldResponse.elementUuid === elementUuid
|
return fieldItem.elementUuid === elementUuid
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getFieldFromElementColumnName: (state) => (elementColumnName) => {
|
getFieldFromElementColumnName: (state) => (elementColumnName) => {
|
||||||
return state.fieldList.find(fieldItem => {
|
return state.fieldList.find(fieldItem => {
|
||||||
return fieldItem.fieldResponse.elementColumnName === elementColumnName
|
return fieldItem.elementColumnName === elementColumnName
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getFieldFromTableNameAndColumnName: (state) => ({
|
getFieldFromTableNameAndColumnName: (state) => ({
|
||||||
@ -88,8 +102,11 @@ const field = {
|
|||||||
columnName
|
columnName
|
||||||
}) => {
|
}) => {
|
||||||
return state.fieldList.find(fieldItem => {
|
return state.fieldList.find(fieldItem => {
|
||||||
return fieldItem.fieldResponse.tableName === tableName && fieldItem.fieldResponse.columnName === columnName
|
return fieldItem.tableName === tableName && fieldItem.columnName === columnName
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
getFieldLocation: (state) => {
|
||||||
|
return state.fieldListLocation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,19 +14,41 @@ const value = {
|
|||||||
field: {}
|
field: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateValueOfField(state, payload) {
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} parentUuid
|
||||||
|
* @param {string} containerUuid
|
||||||
|
* @param {string} columnName
|
||||||
|
* @param {mixed} value
|
||||||
|
* @param {boolean} isOverWriteParent // overwite parent context values
|
||||||
|
*/
|
||||||
|
updateValueOfField(state, {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
columnName,
|
||||||
|
value,
|
||||||
|
isOverWriteParent = true
|
||||||
|
}) {
|
||||||
// Only Parent
|
// Only Parent
|
||||||
if (payload.parentUuid) {
|
if (parentUuid) {
|
||||||
const keyParent = payload.parentUuid + '_' + payload.columnName
|
const keyParent = parentUuid + '_' + columnName
|
||||||
if (payload.value !== state.field[keyParent]) {
|
const valueParent = state.field[keyParent]
|
||||||
Vue.set(state.field, keyParent, payload.value)
|
if (value !== valueParent) {
|
||||||
|
if (isOverWriteParent) {
|
||||||
|
Vue.set(state.field, keyParent, value)
|
||||||
|
} else {
|
||||||
|
if (isEmptyValue(value)) {
|
||||||
|
// tab child no replace parent context with empty
|
||||||
|
Vue.set(state.field, keyParent, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only Container
|
// Only Container
|
||||||
if (payload.containerUuid) {
|
if (containerUuid) {
|
||||||
const keyContainer = payload.containerUuid + '_' + payload.columnName
|
const keyContainer = containerUuid + '_' + columnName
|
||||||
if (payload.value !== state.field[keyContainer]) {
|
if (value !== state.field[keyContainer]) {
|
||||||
Vue.set(state.field, keyContainer, payload.value)
|
Vue.set(state.field, keyContainer, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -65,16 +87,26 @@ const value = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getValueOfField: (state) => ({ containerUuid, columnName }) => {
|
getValueOfField: (state) => ({
|
||||||
return state.field[containerUuid + '_' + columnName]
|
parentUuid,
|
||||||
},
|
containerUuid,
|
||||||
getValueOfContainer: (state) => ({ parentUuid, containerUuid, columnName }) => {
|
columnName
|
||||||
|
}) => {
|
||||||
|
let key = ''
|
||||||
|
let value
|
||||||
|
if (containerUuid) {
|
||||||
// get in tab level
|
// get in tab level
|
||||||
let value = state.field[containerUuid + '_' + columnName]
|
key += containerUuid + '_'
|
||||||
if (isEmptyValue(value) && parentUuid) {
|
}
|
||||||
|
key += columnName
|
||||||
|
value = state.field[key]
|
||||||
|
|
||||||
|
if (parentUuid && isEmptyValue(value)) {
|
||||||
// get in window level
|
// get in window level
|
||||||
|
key = parentUuid + '_' + columnName
|
||||||
value = state.field[parentUuid + '_' + columnName]
|
value = state.field[parentUuid + '_' + columnName]
|
||||||
}
|
}
|
||||||
|
|
||||||
return value
|
return value
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -87,9 +119,9 @@ const value = {
|
|||||||
getValuesView: (state) => ({
|
getValuesView: (state) => ({
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
|
isOnlyColumns = true,
|
||||||
format = 'array'
|
format = 'array'
|
||||||
}) => {
|
}) => {
|
||||||
console.log(parentUuid, containerUuid)
|
|
||||||
// generate context with parent uuid or container uuid associated
|
// generate context with parent uuid or container uuid associated
|
||||||
const contextAllContainers = {}
|
const contextAllContainers = {}
|
||||||
Object.keys(state.field).forEach(key => {
|
Object.keys(state.field).forEach(key => {
|
||||||
@ -102,26 +134,15 @@ const value = {
|
|||||||
const objectValues = {}
|
const objectValues = {}
|
||||||
const pairsValues = Object.keys(contextAllContainers).map(key => {
|
const pairsValues = Object.keys(contextAllContainers).map(key => {
|
||||||
const value = contextAllContainers[key]
|
const value = contextAllContainers[key]
|
||||||
if (isEmptyValue(value)) {
|
if (isOnlyColumns) {
|
||||||
return
|
key = key
|
||||||
}
|
|
||||||
let columnName
|
|
||||||
if (parentUuid) {
|
|
||||||
if (!key.includes(containerUuid)) {
|
|
||||||
columnName = key
|
|
||||||
.replace(`${parentUuid}_`, '')
|
.replace(`${parentUuid}_`, '')
|
||||||
.replace(`${containerUuid}_`, '')
|
.replace(`${containerUuid}_`, '')
|
||||||
// set window parent context
|
|
||||||
objectValues[columnName] = value
|
|
||||||
}
|
|
||||||
// next if is tab context
|
|
||||||
return {
|
|
||||||
columnName,
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// TODO: Verify if overwrite key with empty value
|
||||||
|
const columnName = key
|
||||||
|
|
||||||
// set container context (smart browser, process/report, form)
|
// set container context (smart browser, process/report, form)
|
||||||
columnName = key.replace(`${containerUuid}_`, '')
|
|
||||||
objectValues[columnName] = value
|
objectValues[columnName] = value
|
||||||
return {
|
return {
|
||||||
columnName,
|
columnName,
|
||||||
|
@ -20,10 +20,17 @@ const form = {
|
|||||||
if (payload.attributeNameControl) {
|
if (payload.attributeNameControl) {
|
||||||
value = payload.form[payload.attributeNameControl]
|
value = payload.form[payload.attributeNameControl]
|
||||||
}
|
}
|
||||||
|
if (isEmptyValue(payload.attributeName)) {
|
||||||
payload.form[payload.attributeName] = value
|
payload.form[payload.attributeName] = value
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
addForm({ commit, getters }, metadataForm) {
|
||||||
|
if (!getters.getForm(metadataForm.uuid)) {
|
||||||
|
commit('addForm', metadataForm)
|
||||||
|
}
|
||||||
|
},
|
||||||
getFormFromServer({ commit, dispatch }, {
|
getFormFromServer({ commit, dispatch }, {
|
||||||
id,
|
id,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
|
@ -64,7 +64,8 @@ const lookup = {
|
|||||||
const label = lookupItemResponse.values.DisplayColumn
|
const label = lookupItemResponse.values.DisplayColumn
|
||||||
const option = {
|
const option = {
|
||||||
label: isEmptyValue(label) ? ' ' : label,
|
label: isEmptyValue(label) ? ' ' : label,
|
||||||
key: value // lookupItemResponse.values.KeyColumn
|
uuid: lookupItemResponse.uuid,
|
||||||
|
id: value // lookupItemResponse.values.KeyColumn
|
||||||
}
|
}
|
||||||
|
|
||||||
commit('addLoockupItem', {
|
commit('addLoockupItem', {
|
||||||
@ -121,21 +122,23 @@ const lookup = {
|
|||||||
const list = []
|
const list = []
|
||||||
lookupListResponse.recordsList.forEach(itemLookup => {
|
lookupListResponse.recordsList.forEach(itemLookup => {
|
||||||
const {
|
const {
|
||||||
KeyColumn: key,
|
KeyColumn: id,
|
||||||
DisplayColumn: label
|
DisplayColumn: label
|
||||||
} = itemLookup.values
|
} = itemLookup.values
|
||||||
|
|
||||||
if (!isEmptyValue(key)) {
|
if (!isEmptyValue(id)) {
|
||||||
list.push({
|
list.push({
|
||||||
label,
|
label,
|
||||||
key
|
id,
|
||||||
|
uuid: itemLookup.uuid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (isAddBlankValue) {
|
if (isAddBlankValue) {
|
||||||
list.unshift({
|
list.unshift({
|
||||||
label: ' ',
|
label: ' ',
|
||||||
key: blankValue
|
id: blankValue,
|
||||||
|
uuid: undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
commit('addLoockupList', {
|
commit('addLoockupList', {
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
// - Window: Just need storage tab and fields
|
// - Window: Just need storage tab and fields
|
||||||
// - Process & Report: Always save a panel and parameters
|
// - Process & Report: Always save a panel and parameters
|
||||||
// - Smart Browser: Can have a search panel, table panel and process panel
|
// - Smart Browser: Can have a search panel, table panel and process panel
|
||||||
import { isEmptyValue, parsedValueComponent } from '@/utils/ADempiere/valueUtils.js'
|
import {
|
||||||
|
isEmptyValue,
|
||||||
|
parsedValueComponent,
|
||||||
|
typeValue
|
||||||
|
} from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { convertObjectToKeyValue } from '@/utils/ADempiere/valueFormat.js'
|
import { convertObjectToKeyValue } from '@/utils/ADempiere/valueFormat.js'
|
||||||
import evaluator, { getContext, parseContext, specialColumns } from '@/utils/ADempiere/contextUtils.js'
|
import evaluator, { getContext, parseContext, specialColumns } from '@/utils/ADempiere/contextUtils.js'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification.js'
|
import { showMessage } from '@/utils/ADempiere/notification.js'
|
||||||
@ -25,7 +29,7 @@ const panel = {
|
|||||||
payload.panel = payload.newPanel
|
payload.panel = payload.newPanel
|
||||||
},
|
},
|
||||||
changeFieldLogic(state, payload) {
|
changeFieldLogic(state, payload) {
|
||||||
if (payload.isDisplayedFromLogic !== undefined && payload.isDisplayedFromLogic !== null) {
|
if (!isEmptyValue(payload.isDisplayedFromLogic)) {
|
||||||
payload.field.isDisplayedFromLogic = Boolean(payload.isDisplayedFromLogic)
|
payload.field.isDisplayedFromLogic = Boolean(payload.isDisplayedFromLogic)
|
||||||
}
|
}
|
||||||
payload.field.isMandatoryFromLogic = Boolean(payload.isMandatoryFromLogic)
|
payload.field.isMandatoryFromLogic = Boolean(payload.isMandatoryFromLogic)
|
||||||
@ -57,7 +61,12 @@ const panel = {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addPanel({ commit, dispatch, getters }, params) {
|
addPanel({ commit, dispatch, getters }, params) {
|
||||||
const { panelType, uuid: containerUuid } = params
|
const {
|
||||||
|
panelType,
|
||||||
|
// isParentTab,
|
||||||
|
// parentUuid,
|
||||||
|
uuid: containerUuid
|
||||||
|
} = params
|
||||||
let keyColumn = ''
|
let keyColumn = ''
|
||||||
let selectionColumn = []
|
let selectionColumn = []
|
||||||
let identifierColumns = []
|
let identifierColumns = []
|
||||||
@ -86,13 +95,16 @@ const panel = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For all
|
// For all
|
||||||
if (['browser', 'process', 'report', 'form', 'table'].includes(panelType) || (panelType === 'window' && params.isParentTab)) {
|
if (['browser', 'process', 'report', 'form', 'table'].includes(panelType) ||
|
||||||
dispatch('setContext', {
|
(panelType === 'window' && params.isParentTab)) {
|
||||||
parentUuid: params.parentUuid,
|
// TODO: Verity with updateValueOfField, setContext, setPreferenceContext
|
||||||
containerUuid,
|
// commit('updateValueOfField', {
|
||||||
columnName: itemField.columnName,
|
// parentUuid,
|
||||||
value: itemField.value
|
// containerUuid,
|
||||||
})
|
// // isOverWriteParent: Boolean(isParentTab),
|
||||||
|
// columnName: itemField.columnName,
|
||||||
|
// value: itemField.value
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
// Get dependent fields
|
// Get dependent fields
|
||||||
if (!isEmptyValue(itemField.parentFieldsList) && itemField.isActive) {
|
if (!isEmptyValue(itemField.parentFieldsList) && itemField.isActive) {
|
||||||
@ -138,13 +150,17 @@ const panel = {
|
|||||||
|
|
||||||
commit('addPanel', params)
|
commit('addPanel', params)
|
||||||
|
|
||||||
if (!['form', 'table'].includes(panelType)) {
|
if (!['table'].includes(panelType)) {
|
||||||
dispatch('setDefaultValues', {
|
dispatch('setDefaultValues', {
|
||||||
parentUuid: params.parentUuid,
|
parentUuid: params.parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
|
// isOverWriteParent: Boolean(isParentTab),
|
||||||
panelType
|
panelType
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (params.isCustomForm) {
|
||||||
|
dispatch('addForm', params)
|
||||||
|
}
|
||||||
|
|
||||||
return params
|
return params
|
||||||
},
|
},
|
||||||
@ -317,6 +333,7 @@ const panel = {
|
|||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
panelType = 'window',
|
panelType = 'window',
|
||||||
|
isOverWriteParent = true,
|
||||||
isNewRecord = false
|
isNewRecord = false
|
||||||
}) {
|
}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
@ -346,6 +363,8 @@ const panel = {
|
|||||||
...oldRoute.query,
|
...oldRoute.query,
|
||||||
action: 'create-new'
|
action: 'create-new'
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.info(`Panel Store: ${error.message}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
showMessage({
|
showMessage({
|
||||||
@ -381,6 +400,7 @@ const panel = {
|
|||||||
dispatch('updateValuesOfContainer', {
|
dispatch('updateValuesOfContainer', {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
|
isOverWriteParent,
|
||||||
attributes: defaultAttributes
|
attributes: defaultAttributes
|
||||||
})
|
})
|
||||||
// .then(() => {
|
// .then(() => {
|
||||||
@ -421,11 +441,16 @@ const panel = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// Change all values of panel and dispatch actions for each field
|
// Change all values of panel and dispatch actions for each field
|
||||||
notifyPanelChange({ commit }, {
|
notifyPanelChange({ commit, dispatch }, {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
attributes = []
|
attributes = []
|
||||||
}) {
|
}) {
|
||||||
|
if (typeValue(attributes) === 'OBJECT') {
|
||||||
|
attributes = convertObjectToKeyValue({
|
||||||
|
object: attributes
|
||||||
|
})
|
||||||
|
}
|
||||||
// Update field
|
// Update field
|
||||||
commit('updateValuesOfContainer', {
|
commit('updateValuesOfContainer', {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
@ -517,6 +542,10 @@ const panel = {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
dispatch('setIsloadContext', {
|
||||||
|
containerUuid
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Handle all trigger for a field:
|
* Handle all trigger for a field:
|
||||||
@ -539,6 +568,7 @@ const panel = {
|
|||||||
field = fieldsList.find(fieldItem => fieldItem.columnName === columnName)
|
field = fieldsList.find(fieldItem => fieldItem.columnName === columnName)
|
||||||
}
|
}
|
||||||
const value = getters.getValueOfField({
|
const value = getters.getValueOfField({
|
||||||
|
parentUuid: field.parentUuid,
|
||||||
containerUuid: field.containerUuid,
|
containerUuid: field.containerUuid,
|
||||||
columnName: field.columnName
|
columnName: field.columnName
|
||||||
})
|
})
|
||||||
@ -596,6 +626,11 @@ const panel = {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Change dependent fields (default value, logics displayed, mandatory and read only)
|
||||||
|
* @param {object} field, definition and attributes
|
||||||
|
* TODO: Not working with fields generated on lookupFactory
|
||||||
|
*/
|
||||||
changeDependentFieldsList({ commit, dispatch, getters }, {
|
changeDependentFieldsList({ commit, dispatch, getters }, {
|
||||||
field
|
field
|
||||||
}) {
|
}) {
|
||||||
@ -669,7 +704,7 @@ const panel = {
|
|||||||
columnName: fieldDependent.columnName,
|
columnName: fieldDependent.columnName,
|
||||||
value: newValue
|
value: newValue
|
||||||
})
|
})
|
||||||
//
|
|
||||||
// dispatch('notifyFieldChange', {
|
// dispatch('notifyFieldChange', {
|
||||||
// parentUuid,
|
// parentUuid,
|
||||||
// containerUuid,
|
// containerUuid,
|
||||||
@ -841,6 +876,7 @@ const panel = {
|
|||||||
// all optionals (not mandatory) fields
|
// all optionals (not mandatory) fields
|
||||||
fieldsList.forEach(fieldItem => {
|
fieldsList.forEach(fieldItem => {
|
||||||
const value = getters.getValueOfField({
|
const value = getters.getValueOfField({
|
||||||
|
parentUuid: fieldItem.parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: fieldItem.columnName
|
columnName: fieldItem.columnName
|
||||||
})
|
})
|
||||||
@ -1023,7 +1059,7 @@ const panel = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (String(valueToReturn) === '[object Object]') {
|
if (typeValue(valueToReturn) === 'OBJECT') {
|
||||||
if (!valueToReturn.isSQL) {
|
if (!valueToReturn.isSQL) {
|
||||||
valueToReturn = valueToReturn.value
|
valueToReturn = valueToReturn.value
|
||||||
}
|
}
|
||||||
@ -1066,7 +1102,7 @@ const panel = {
|
|||||||
isSQL: isSQLTo
|
isSQL: isSQLTo
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// TODO: Check with typeValue function
|
||||||
if (typeof valueTo === 'object') {
|
if (typeof valueTo === 'object') {
|
||||||
valueTo = {
|
valueTo = {
|
||||||
...valueTo,
|
...valueTo,
|
||||||
@ -1074,7 +1110,7 @@ const panel = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (String(valueTo) === '[object Object]') {
|
if (typeValue(valueTo) === 'OBJECT') {
|
||||||
if (!valueTo.isSQL) {
|
if (!valueTo.isSQL) {
|
||||||
valueTo = valueTo.value
|
valueTo = valueTo.value
|
||||||
}
|
}
|
||||||
@ -1251,12 +1287,14 @@ const panel = {
|
|||||||
|
|
||||||
// from field value
|
// from field value
|
||||||
const value = rootGetters.getValueOfField({
|
const value = rootGetters.getValueOfField({
|
||||||
|
parentUuid: fieldItem.parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName
|
columnName
|
||||||
})
|
})
|
||||||
let valueTo
|
let valueTo
|
||||||
if (fieldItem.isRange && fieldItem.componentPath !== 'FieldNumber') {
|
if (fieldItem.isRange && fieldItem.componentPath !== 'FieldNumber') {
|
||||||
valueTo = rootGetters.getValueOfField({
|
valueTo = rootGetters.getValueOfField({
|
||||||
|
parentUuid: fieldItem.parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: fieldItem.columnNameTo
|
columnName: fieldItem.columnNameTo
|
||||||
})
|
})
|
||||||
@ -1281,6 +1319,7 @@ const panel = {
|
|||||||
valueTo = row[parameterItem.columnNameTo]
|
valueTo = row[parameterItem.columnNameTo]
|
||||||
} else {
|
} else {
|
||||||
value = rootGetters.getValueOfField({
|
value = rootGetters.getValueOfField({
|
||||||
|
parentUuid: parameterItem.parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: columnName
|
columnName: columnName
|
||||||
})
|
})
|
||||||
@ -1315,6 +1354,7 @@ const panel = {
|
|||||||
// manage as Array = [value, valueTo]
|
// manage as Array = [value, valueTo]
|
||||||
if (isRange && parameterItem.componentPath !== 'FieldNumber') {
|
if (isRange && parameterItem.componentPath !== 'FieldNumber') {
|
||||||
valueTo = rootGetters.getValueOfField({
|
valueTo = rootGetters.getValueOfField({
|
||||||
|
parentUuid: parameterItem.parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: parameterItem.columnNameTo
|
columnName: parameterItem.columnNameTo
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
// Delete when get global context and account context
|
// Delete when get global context and account context
|
||||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
|
import { isEmptyValue, typeValue } from '@/utils/ADempiere/valueUtils.js'
|
||||||
|
|
||||||
const preference = {
|
const preference = {
|
||||||
state: {
|
state: {
|
||||||
@ -14,7 +14,7 @@ const preference = {
|
|||||||
* @param {string} payload.columnName
|
* @param {string} payload.columnName
|
||||||
* @param {mixed} payload.value
|
* @param {mixed} payload.value
|
||||||
*/
|
*/
|
||||||
setContext(state, payload) {
|
setPreferenceContext(state, payload) {
|
||||||
let key = ''
|
let key = ''
|
||||||
if (payload.parentUuid) {
|
if (payload.parentUuid) {
|
||||||
key += payload.parentUuid + '|'
|
key += payload.parentUuid + '|'
|
||||||
@ -51,8 +51,8 @@ const preference = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setContext({ commit }, objectValue) {
|
setPreferenceContext({ commit }, objectValue) {
|
||||||
commit('setContext', objectValue)
|
commit('setPreferenceContext', objectValue)
|
||||||
},
|
},
|
||||||
setMultiplePreference({ dispatch }, {
|
setMultiplePreference({ dispatch }, {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
@ -60,7 +60,7 @@ const preference = {
|
|||||||
values
|
values
|
||||||
}) {
|
}) {
|
||||||
let actionToDispatch = 'setMultiplePreferenceObject'
|
let actionToDispatch = 'setMultiplePreferenceObject'
|
||||||
if (Object.prototype.toString.call(values) === '[object Map]') {
|
if (typeValue(values) === 'MAP') {
|
||||||
actionToDispatch = 'setMultiplePreferenceMap'
|
actionToDispatch = 'setMultiplePreferenceMap'
|
||||||
}
|
}
|
||||||
return dispatch(actionToDispatch, {
|
return dispatch(actionToDispatch, {
|
||||||
@ -77,7 +77,7 @@ const preference = {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (!isEmptyValue(containerUuid) || !isEmptyValue(parentUuid)) {
|
if (!isEmptyValue(containerUuid) || !isEmptyValue(parentUuid)) {
|
||||||
Object.keys(values).forEach(key => {
|
Object.keys(values).forEach(key => {
|
||||||
commit('setContext', {
|
commit('setPreferenceContext', {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: key,
|
columnName: key,
|
||||||
@ -99,7 +99,7 @@ const preference = {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (!isEmptyValue(containerUuid) || !isEmptyValue(parentUuid)) {
|
if (!isEmptyValue(containerUuid) || !isEmptyValue(parentUuid)) {
|
||||||
values.forEach((value, key) => {
|
values.forEach((value, key) => {
|
||||||
commit('setContext', {
|
commit('setPreferenceContext', {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: key,
|
columnName: key,
|
||||||
|
@ -29,7 +29,13 @@ const initStateUtils = {
|
|||||||
isLoaded: false
|
isLoaded: false
|
||||||
},
|
},
|
||||||
panelRight: '',
|
panelRight: '',
|
||||||
currentRecord: {}
|
currentRecord: {},
|
||||||
|
showOrder: false,
|
||||||
|
showTitleFrom: false,
|
||||||
|
showPanelRightPos: false,
|
||||||
|
showCollectionPos: false,
|
||||||
|
splitWidthRight: 3,
|
||||||
|
splitWidthLeft: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
const utils = {
|
const utils = {
|
||||||
@ -101,6 +107,24 @@ const utils = {
|
|||||||
},
|
},
|
||||||
setCurrentRecor(state, payload) {
|
setCurrentRecor(state, payload) {
|
||||||
state.currentRecord = payload
|
state.currentRecord = payload
|
||||||
|
},
|
||||||
|
setShowOrder(state, showOrder) {
|
||||||
|
state.showOrder = showOrder
|
||||||
|
},
|
||||||
|
setShowTitleFrom(state, showTitleFrom) {
|
||||||
|
state.showTitleFrom = showTitleFrom
|
||||||
|
},
|
||||||
|
setShowPanelRightPos(state, showPanelRightPos) {
|
||||||
|
state.showPanelRightPos = showPanelRightPos
|
||||||
|
},
|
||||||
|
setShowCollectionPos(state, showCollectionPos) {
|
||||||
|
state.showCollectionPos = showCollectionPos
|
||||||
|
},
|
||||||
|
setSplitWidthRight(state, splitWidthRight) {
|
||||||
|
state.splitWidthRight = splitWidthRight
|
||||||
|
},
|
||||||
|
setSplitWidthLeft(state, splitWidthLeft) {
|
||||||
|
state.splitWidthLeft = splitWidthLeft
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -167,6 +191,24 @@ const utils = {
|
|||||||
},
|
},
|
||||||
currentRecord({ commit }, record) {
|
currentRecord({ commit }, record) {
|
||||||
commit('setCurrentRecor', record)
|
commit('setCurrentRecor', record)
|
||||||
|
},
|
||||||
|
showOrder({ commit }, isOrder) {
|
||||||
|
commit('setShowOrder', isOrder)
|
||||||
|
},
|
||||||
|
showTitleFrom({ commit }, isTitleFrom) {
|
||||||
|
commit('setShowTitleFrom', isTitleFrom)
|
||||||
|
},
|
||||||
|
showPanelRightPos({ commit }, isPanelRight) {
|
||||||
|
commit('setShowPanelRightPos', isPanelRight)
|
||||||
|
},
|
||||||
|
showCollectionPos({ commit }, isCollection) {
|
||||||
|
commit('setShowCollectionPos', isCollection)
|
||||||
|
},
|
||||||
|
changeWidthRight({ commit }, newWidthRight) {
|
||||||
|
commit('setSplitWidthRight', newWidthRight)
|
||||||
|
},
|
||||||
|
changeWidthLeft({ commit }, newWidthLeft) {
|
||||||
|
commit('setSplitWidthLeft', newWidthLeft)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
@ -242,6 +284,24 @@ const utils = {
|
|||||||
},
|
},
|
||||||
getCurrentRecord: (state) => {
|
getCurrentRecord: (state) => {
|
||||||
return state.currentRecord
|
return state.currentRecord
|
||||||
|
},
|
||||||
|
getShowPanelLeft: (state) => {
|
||||||
|
return state.showOrder
|
||||||
|
},
|
||||||
|
getShowTitleFrom: (state) => {
|
||||||
|
return state.showTitleFrom
|
||||||
|
},
|
||||||
|
getShowPanelRightPos: (state) => {
|
||||||
|
return state.showPanelRightPos
|
||||||
|
},
|
||||||
|
getShowCollectionPos: (state) => {
|
||||||
|
return state.showCollectionPos
|
||||||
|
},
|
||||||
|
getWidthRight: (state) => {
|
||||||
|
return state.splitWidthRight
|
||||||
|
},
|
||||||
|
getWidthLeft: (state) => {
|
||||||
|
return state.splitWidthLeft
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
rollbackEntity
|
rollbackEntity
|
||||||
} from '@/api/ADempiere/persistence'
|
} from '@/api/ADempiere/persistence'
|
||||||
import { getReferencesList } from '@/api/ADempiere/values'
|
import { getReferencesList } from '@/api/ADempiere/values'
|
||||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
|
import { isEmptyValue, typeValue } from '@/utils/ADempiere/valueUtils.js'
|
||||||
import { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils'
|
import { fieldIsDisplayed } from '@/utils/ADempiere/dictionaryUtils'
|
||||||
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
import { showMessage } from '@/utils/ADempiere/notification'
|
||||||
@ -72,8 +72,9 @@ const windowControl = {
|
|||||||
value
|
value
|
||||||
}) {
|
}) {
|
||||||
// get value from store
|
// get value from store
|
||||||
if (!value) {
|
if (isEmptyValue(value)) {
|
||||||
value = getters.getValueOfField({
|
value = getters.getValueOfField({
|
||||||
|
parentUuid: field.parentUuid,
|
||||||
containerUuid: field.containerUuid,
|
containerUuid: field.containerUuid,
|
||||||
columnName: field.columnName
|
columnName: field.columnName
|
||||||
})
|
})
|
||||||
@ -157,6 +158,7 @@ const windowControl = {
|
|||||||
}) {
|
}) {
|
||||||
// get value from store
|
// get value from store
|
||||||
const value = getters.getValueOfField({
|
const value = getters.getValueOfField({
|
||||||
|
parentUuid: field.parentUuid,
|
||||||
containerUuid: field.containerUuid,
|
containerUuid: field.containerUuid,
|
||||||
columnName: field.columnName
|
columnName: field.columnName
|
||||||
})
|
})
|
||||||
@ -175,7 +177,7 @@ const windowControl = {
|
|||||||
value: sqlStatement,
|
value: sqlStatement,
|
||||||
isSQL
|
isSQL
|
||||||
}).value
|
}).value
|
||||||
if (isSQL && String(sqlStatement) === '[object Object]') {
|
if (isSQL && typeValue(sqlStatement) === 'OBJECT') {
|
||||||
sqlStatement = sqlStatement.query
|
sqlStatement = sqlStatement.query
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,9 @@ const window = {
|
|||||||
const tabsListChildren = []
|
const tabsListChildren = []
|
||||||
|
|
||||||
const tabsSequence = []
|
const tabsSequence = []
|
||||||
|
// indexes related to visualization
|
||||||
|
let tabParentIndex = 0
|
||||||
|
let tabChildrenIndex = 0
|
||||||
// TODO Add source tab on the server for tabs Translation and Sort
|
// TODO Add source tab on the server for tabs Translation and Sort
|
||||||
const tabs = responseWindow.tabsList.filter(itemTab => {
|
const tabs = responseWindow.tabsList.filter(itemTab => {
|
||||||
if (itemTab.isSortTab) {
|
if (itemTab.isSortTab) {
|
||||||
@ -103,7 +106,7 @@ const window = {
|
|||||||
isAssociatedTabSequence: false, // show modal with order tab
|
isAssociatedTabSequence: false, // show modal with order tab
|
||||||
isShowedRecordNavigation: !(tabItem.isSingleRow),
|
isShowedRecordNavigation: !(tabItem.isSingleRow),
|
||||||
isLoadFieldsList: false,
|
isLoadFieldsList: false,
|
||||||
index
|
index // this index is not related to the index in which the tabs are displayed
|
||||||
}
|
}
|
||||||
delete tab.processesList
|
delete tab.processesList
|
||||||
|
|
||||||
@ -213,10 +216,14 @@ const window = {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (tab.isParentTab) {
|
if (tab.isParentTab) {
|
||||||
|
tab.tabParentIndex = tabParentIndex
|
||||||
|
tabParentIndex++
|
||||||
tabsListParent.push(tab)
|
tabsListParent.push(tab)
|
||||||
return tab
|
return tab
|
||||||
}
|
}
|
||||||
if (!tab.isSortTab) {
|
if (!tab.isSortTab) {
|
||||||
|
tab.tabChildrenIndex = tabChildrenIndex
|
||||||
|
tabChildrenIndex++
|
||||||
tabsListChildren.push(tab)
|
tabsListChildren.push(tab)
|
||||||
}
|
}
|
||||||
return tab
|
return tab
|
||||||
|
@ -14,9 +14,9 @@ const mutations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
generateRoutes({ commit }) {
|
generateRoutes({ commit }, organizationId) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
loadMainMenu().then(menuResponse => {
|
loadMainMenu(organizationId).then(menuResponse => {
|
||||||
commit('SET_ROUTES', menuResponse)
|
commit('SET_ROUTES', menuResponse)
|
||||||
resolve(menuResponse)
|
resolve(menuResponse)
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import variables from '@/styles/element-variables.scss'
|
import variables from '@/styles/element-variables.scss'
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
|
|
||||||
const { showSettings, tagsView, fixedHeader, sidebarLogo, supportPinyinSearch } = defaultSettings
|
const { showSettings, tagsView, fixedHeader, sidebarLogo, supportPinyinSearch, showContextMenu } = defaultSettings
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
theme: variables.theme,
|
theme: variables.theme,
|
||||||
@ -9,7 +9,8 @@ const state = {
|
|||||||
tagsView,
|
tagsView,
|
||||||
fixedHeader,
|
fixedHeader,
|
||||||
sidebarLogo,
|
sidebarLogo,
|
||||||
supportPinyinSearch
|
supportPinyinSearch,
|
||||||
|
showContextMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
@ -23,7 +23,7 @@ import router, { resetRouter } from '@/router'
|
|||||||
import { showMessage } from '@/utils/ADempiere/notification'
|
import { showMessage } from '@/utils/ADempiere/notification'
|
||||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
|
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
|
||||||
import { convertDateFormat } from '@/utils/ADempiere/valueFormat'
|
import { convertDateFormat } from '@/utils/ADempiere/valueFormat'
|
||||||
import language, { getLanguage } from '@/lang'
|
import language from '@/lang'
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
token: getToken(),
|
token: getToken(),
|
||||||
@ -116,19 +116,22 @@ const actions = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCountryFormServer({ commit }, {
|
getCountryFormServer({ commit }, {
|
||||||
countryId,
|
id,
|
||||||
countryUuid
|
uuid
|
||||||
}) {
|
}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
getCountryDefinition({
|
getCountryDefinition({
|
||||||
countryId,
|
id,
|
||||||
countryUuid
|
uuid
|
||||||
})
|
})
|
||||||
.then(responseCountry => {
|
.then(responseCountry => {
|
||||||
commit('setCountry', responseCountry)
|
commit('setCountry', responseCountry)
|
||||||
|
|
||||||
resolve(responseCountry)
|
resolve(responseCountry)
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(`Error getting Country Definition: ${error.message}. Code: ${error.code}.`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// user login
|
// user login
|
||||||
@ -162,9 +165,8 @@ const actions = {
|
|||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getSessionInfo(sessionUuid)
|
getSessionInfo(sessionUuid)
|
||||||
.then(responseGetInfo => {
|
.then(async responseGetInfo => {
|
||||||
const { role } = responseGetInfo
|
const { role } = responseGetInfo
|
||||||
|
|
||||||
commit('setIsSession', true)
|
commit('setIsSession', true)
|
||||||
commit('setSessionInfo', {
|
commit('setSessionInfo', {
|
||||||
id: responseGetInfo.id,
|
id: responseGetInfo.id,
|
||||||
@ -196,10 +198,9 @@ const actions = {
|
|||||||
commit('SET_ROLE', role)
|
commit('SET_ROLE', role)
|
||||||
setCurrentRole(role.uuid)
|
setCurrentRole(role.uuid)
|
||||||
|
|
||||||
|
await dispatch('getOrganizationsList', role.uuid)
|
||||||
resolve(sessionResponse)
|
resolve(sessionResponse)
|
||||||
|
|
||||||
dispatch('getOrganizationsList', role.uuid)
|
|
||||||
|
|
||||||
const countryId = parseInt(
|
const countryId = parseInt(
|
||||||
responseGetInfo.defaultContextMap.get('#C_Country_ID'),
|
responseGetInfo.defaultContextMap.get('#C_Country_ID'),
|
||||||
10
|
10
|
||||||
@ -209,7 +210,7 @@ const actions = {
|
|||||||
} else {
|
} else {
|
||||||
// get country and currency
|
// get country and currency
|
||||||
dispatch('getCountryFormServer', {
|
dispatch('getCountryFormServer', {
|
||||||
countryId
|
id: countryId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,10 +279,12 @@ const actions = {
|
|||||||
},
|
},
|
||||||
// user logout
|
// user logout
|
||||||
logout({ commit, state, dispatch }) {
|
logout({ commit, state, dispatch }) {
|
||||||
|
const token = state.token
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logout(state.token).then(() => {
|
|
||||||
commit('SET_TOKEN', '')
|
commit('SET_TOKEN', '')
|
||||||
commit('SET_ROLES', [])
|
commit('SET_ROLES', [])
|
||||||
|
removeToken()
|
||||||
|
|
||||||
commit('setIsSession', false)
|
commit('setIsSession', false)
|
||||||
dispatch('resetStateBusinessData', null, {
|
dispatch('resetStateBusinessData', null, {
|
||||||
root: true
|
root: true
|
||||||
@ -290,18 +293,16 @@ const actions = {
|
|||||||
root: true
|
root: true
|
||||||
})
|
})
|
||||||
|
|
||||||
dispatch('tagsView/delAllViews', null, { root: true })
|
|
||||||
removeToken()
|
|
||||||
removeCurrentRole()
|
|
||||||
resetRouter()
|
|
||||||
|
|
||||||
// reset visited views and cached views
|
// reset visited views and cached views
|
||||||
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
||||||
dispatch('tagsView/delAllViews', null, { root: true })
|
dispatch('tagsView/delAllViews', null, { root: true })
|
||||||
|
|
||||||
|
removeCurrentRole()
|
||||||
|
resetRouter()
|
||||||
|
logout(token).catch(error => {
|
||||||
|
console.warn(error)
|
||||||
|
}).finally(() => {
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(error => {
|
|
||||||
reject(error)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -318,11 +319,14 @@ const actions = {
|
|||||||
if (isEmptyValue(roleUuid)) {
|
if (isEmptyValue(roleUuid)) {
|
||||||
roleUuid = getCurrentRole()
|
roleUuid = getCurrentRole()
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOrganizationsList({ roleUuid })
|
return getOrganizationsList({ roleUuid })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('SET_ORGANIZATIONS_LIST', response.organizationsList)
|
commit('SET_ORGANIZATIONS_LIST', response.organizationsList)
|
||||||
let organization = response.organizationsList.find(item => item.uuid === getCurrentOrganization())
|
let organization = response.organizationsList.find(item => {
|
||||||
|
if (item.uuid === getCurrentOrganization()) {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
})
|
||||||
if (isEmptyValue(organization)) {
|
if (isEmptyValue(organization)) {
|
||||||
organization = response.organizationsList[0]
|
organization = response.organizationsList[0]
|
||||||
}
|
}
|
||||||
@ -340,19 +344,57 @@ const actions = {
|
|||||||
console.warn(`Error ${error.code} getting Organizations list: ${error.message}.`)
|
console.warn(`Error ${error.code} getting Organizations list: ${error.message}.`)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
changeOrganization({ dispatch }, {
|
changeOrganization({ commit, dispatch, getters }, {
|
||||||
organizationUuid
|
organizationUuid,
|
||||||
|
organizationId,
|
||||||
|
isCloseAllViews = true
|
||||||
}) {
|
}) {
|
||||||
setCurrentOrganization(organizationUuid)
|
setCurrentOrganization(organizationUuid)
|
||||||
|
const organization = getters.getOrganizations.find(org => org.uuid === organizationUuid)
|
||||||
|
commit('SET_ORGANIZATION', organization)
|
||||||
|
|
||||||
dispatch('getWarehousesList', organizationUuid)
|
dispatch('getWarehousesList', organizationUuid)
|
||||||
|
|
||||||
|
// TODO: Check if there are no tagViews in the new routes to close them, and
|
||||||
|
// if they exist, reload with the new route using name (uuid)
|
||||||
|
const route = router.app._route
|
||||||
|
const selectedTag = {
|
||||||
|
fullPath: route.fullPath,
|
||||||
|
hash: route.hash,
|
||||||
|
matched: route.matched,
|
||||||
|
meta: route.meta,
|
||||||
|
name: route.name,
|
||||||
|
params: route.params,
|
||||||
|
path: route.path,
|
||||||
|
query: route.query,
|
||||||
|
title: route.meta.title
|
||||||
|
}
|
||||||
|
|
||||||
|
let actionToDispatch = 'tagsView/delOthersViews'
|
||||||
|
if (isCloseAllViews) {
|
||||||
|
actionToDispatch = 'tagsView/delAllViews'
|
||||||
|
}
|
||||||
|
dispatch(actionToDispatch, selectedTag, { root: true })
|
||||||
|
|
||||||
|
resetRouter()
|
||||||
|
dispatch('permission/generateRoutes', organizationId, {
|
||||||
|
root: true
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
router.addRoutes(response)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getWarehousesList({ commit }, organizationUuid) {
|
getWarehousesList({ commit }, organizationUuid) {
|
||||||
if (isEmptyValue(organizationUuid)) {
|
if (isEmptyValue(organizationUuid)) {
|
||||||
organizationUuid = getCurrentOrganization()
|
organizationUuid = getCurrentOrganization()
|
||||||
}
|
}
|
||||||
return getWarehousesList({ organizationUuid })
|
|
||||||
|
return getWarehousesList({
|
||||||
|
organizationUuid
|
||||||
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('SET_WAREHOUSES_LIST', response.warehousesList)
|
commit('SET_WAREHOUSES_LIST', response.warehousesList)
|
||||||
|
|
||||||
let warehouse = response.warehousesList.find(item => item.uuid === getCurrentWarehouse())
|
let warehouse = response.warehousesList.find(item => item.uuid === getCurrentWarehouse())
|
||||||
if (isEmptyValue(warehouse)) {
|
if (isEmptyValue(warehouse)) {
|
||||||
warehouse = response.warehousesList[0]
|
warehouse = response.warehousesList[0]
|
||||||
@ -409,6 +451,7 @@ const actions = {
|
|||||||
})
|
})
|
||||||
.then(changeRoleResponse => {
|
.then(changeRoleResponse => {
|
||||||
const { role } = changeRoleResponse
|
const { role } = changeRoleResponse
|
||||||
|
|
||||||
commit('SET_ROLE', role)
|
commit('SET_ROLE', role)
|
||||||
setCurrentRole(role.uuid)
|
setCurrentRole(role.uuid)
|
||||||
commit('SET_TOKEN', changeRoleResponse.uuid)
|
commit('SET_TOKEN', changeRoleResponse.uuid)
|
||||||
@ -466,14 +509,14 @@ const getters = {
|
|||||||
}
|
}
|
||||||
return currency
|
return currency
|
||||||
},
|
},
|
||||||
getCountryLanguage(state) {
|
getCountryLanguage: (state) => {
|
||||||
return state.country.language.replace('_', '-')
|
return state.country.language.replace('_', '-')
|
||||||
},
|
},
|
||||||
getLanguagesList: (state) => {
|
getLanguagesList: (state) => {
|
||||||
return state.languagesList
|
return state.languagesList
|
||||||
},
|
},
|
||||||
getCurrentLanguageDefinition: (state) => {
|
getCurrentLanguageDefinition: (state) => {
|
||||||
return state.languagesList.find(definition => definition.languageISO === getLanguage())
|
return state.languagesList.find(definition => definition.language === state.country.language)
|
||||||
},
|
},
|
||||||
getRoles: (state) => {
|
getRoles: (state) => {
|
||||||
return state.rolesList
|
return state.rolesList
|
||||||
|
@ -57,6 +57,11 @@
|
|||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-el-icon {
|
||||||
|
margin-right: 12px;
|
||||||
|
margin-left: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
.el-menu {
|
.el-menu {
|
||||||
border: none;
|
border: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -109,6 +114,10 @@
|
|||||||
.svg-icon {
|
.svg-icon {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-el-icon {
|
||||||
|
margin-left: 19px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +131,10 @@
|
|||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-el-icon {
|
||||||
|
margin-left: 19px;
|
||||||
|
}
|
||||||
|
|
||||||
.el-submenu__icon-arrow {
|
.el-submenu__icon-arrow {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -182,6 +195,10 @@
|
|||||||
.svg-icon {
|
.svg-icon {
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
|
.sub-el-icon {
|
||||||
|
margin-right: 12px;
|
||||||
|
margin-left: -2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nest-menu .el-submenu>.el-submenu__title,
|
.nest-menu .el-submenu>.el-submenu__title,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user