1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 07:04:21 +08:00
Yamel Senih 1c133bc87c
Feature/#source code improve reorder implementation (#466)
* Improve source code and define structure for api
Note that currently does not exist a way for spared api and search from 
backend or push, this pull request want reorder use of api by 
functionality or tool:
- All inside ADempiere folder is dedicated for adempiere functionality
- ADempiere/dashboard: use this path for add your api resource for all 
related with dashboard, note that already exist a file named 
dashboard.js with standard dashboard for ADempiere, if you want to add a 
new dashboard just create a new file <dashboard name>.js for gest info 
from backend
- ADempiere/form: used for all form, for now exist the first 
implementation named price-checking.js that matched with 
components/ADempiere/form/PriceChecking, if you want to add a new form 
just add a new file here
- ADempiere/browser.js: browser is a native functionality for Smart 
Browser tool, just add here all functions related for browser
- ADempiere/private-access.js: just handle private access, will be used 
for add role table access and record access (nice to have)
- ADempiere/process.js: related with all action for process and get 
information from server like getProcessLog and others
- ADempiere/report.js: get info like getReportOutput from parameters 
used for window report and change print formats
- ADempiere/rule.js: for now is used for dispatch callouts from server 
but will be implemented for run rules directly for client on languages 
like javascript, kotlin and groovy
- ADempiere/system-core.js: just get generic functions like 
getWarehouseList and organization, also can be used for get langages and 
other infor from server
- ADempiere/values.js: get info like lookup list, default values and 
other values like systen configurator
- ADempiere/window.js: all functions related to window like record log, 
workflow log and other infor that can be used for container
- ADempiere/persistence.js: handle standard CRUD for all entities and 
implement functions like getTranslation from entity

* Improve source code and define structure for api
Note that currently does not exist a way for spared api and search from 
backend or push, this pull request want reorder use of api by 
functionality or tool:
- All inside ADempiere folder is dedicated for adempiere functionality
- ADempiere/dashboard: use this path for add your api resource for all 
related with dashboard, note that already exist a file named 
dashboard.js with standard dashboard for ADempiere, if you want to add a 
new dashboard just create a new file <dashboard name>.js for gest info 
from backend
- ADempiere/form: used for all form, for now exist the first 
implementation named price-checking.js that matched with 
components/ADempiere/form/PriceChecking, if you want to add a new form 
just add a new file here
- ADempiere/browser.js: browser is a native functionality for Smart 
Browser tool, just add here all functions related for browser
- ADempiere/private-access.js: just handle private access, will be used 
for add role table access and record access (nice to have)
- ADempiere/process.js: related with all action for process and get 
information from server like getProcessLog and others
- ADempiere/report.js: get info like getReportOutput from parameters 
used for window report and change print formats
- ADempiere/rule.js: for now is used for dispatch callouts from server 
but will be implemented for run rules directly for client on languages 
like javascript, kotlin and groovy
- ADempiere/system-core.js: just get generic functions like 
getWarehouseList and organization, also can be used for get langages and 
other infor from server
- ADempiere/values.js: get info like lookup list, default values and 
other values like systen configurator
- ADempiere/window.js: all functions related to window like record log, 
workflow log and other infor that can be used for container
- ADempiere/persistence.js: handle standard CRUD for all entities and 
implement functions like getTranslation from entity
2020-04-28 01:39:27 -04:00

83 lines
2.0 KiB
JavaScript

import { getLanguage } from '@/lang/index'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
// Get Instance for connection
function Instance() {
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/**
* Request a Lookup data from Reference
* The main attributes that function hope are:
* @param {string} tableName
* @param {string} directQuery
* @param {string|number} value
*/
export function getLookup({
tableName,
directQuery,
value
}) {
return Instance.call(this).requestLookupFromReference({
tableName,
directQuery,
value
})
}
/**
* Request a Lookup list data from Reference
* The main attributes that function hope are:
* @param {string} tableName
* @param {string} query
*/
export function getLookupList({
tableName,
query,
pageToken,
pageSize
}) {
return Instance.call(this).requestListLookupFromReference({
tableName,
query,
pageToken,
pageSize
})
}
/**
* Reference List from Window
* @param {string} tableName
* @param {string} windowUuid
* @param {string} recordUuid
* @param {number} recordId
*/
export function getReferencesList({ windowUuid, tableName, recordId, recordUuid, pageToken, pageSize }) {
return Instance.call(this).requestListReferences({
windowUuid,
tableName,
recordId,
recordUuid,
pageToken,
pageSize
})
}
// Get default value for a field
export function getDefaultValueFromServer(query) {
return Instance.call(this).requestGetDefaultValue(query)
}
// Get context information for a window, tab or field
export function getContextInfoValueFromServer({ uuid, query }) {
return Instance.call(this).requestGetContextInfoValue({ uuid, query })
}