mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
feat: Add grpc core client 1.0.7 (#502)
* feat: Add grpc-Core-Client v1.0.7. * fix: isEmptyValue not defined * change isEmptyValue.
This commit is contained in:
parent
635363a8e5
commit
9496d0937d
@ -45,6 +45,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adempiere/grpc-access-client": "^1.2.1",
|
"@adempiere/grpc-access-client": "^1.2.1",
|
||||||
|
"@adempiere/grpc-core-client": "^1.0.7",
|
||||||
"@adempiere/grpc-data-client": "^2.3.6",
|
"@adempiere/grpc-data-client": "^2.3.6",
|
||||||
"@adempiere/grpc-dictionary-client": "^1.4.2",
|
"@adempiere/grpc-dictionary-client": "^1.4.2",
|
||||||
"@adempiere/grpc-enrollment-client": "^1.1.0",
|
"@adempiere/grpc-enrollment-client": "^1.1.0",
|
||||||
@ -87,7 +88,6 @@
|
|||||||
"xlsx": "0.15.6"
|
"xlsx": "0.15.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@adempiere/grpc-core-client": "^1.0.4",
|
|
||||||
"@babel/core": "7.9.0",
|
"@babel/core": "7.9.0",
|
||||||
"@babel/register": "7.9.0",
|
"@babel/register": "7.9.0",
|
||||||
"@vue/cli-plugin-babel": "4.3.1",
|
"@vue/cli-plugin-babel": "4.3.1",
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
// Get Instance for connection System Core
|
||||||
|
export const SystemCoreInstance = () => {
|
||||||
|
const SystemCore = require('@adempiere/grpc-core-client')
|
||||||
|
const { BUSINESS_DATA_ADDRESS } = require('@/api/ADempiere/constants')
|
||||||
|
const { getLanguage } = require('@/lang/index')
|
||||||
|
const { getToken, getCurrentOrganization, getCurrentWarehouse } = require('@/utils/auth')
|
||||||
|
|
||||||
|
return new SystemCore({
|
||||||
|
host: BUSINESS_DATA_ADDRESS,
|
||||||
|
sessionUuid: getToken(),
|
||||||
|
organizationUuid: getCurrentOrganization(),
|
||||||
|
warehouseUuid: getCurrentWarehouse(),
|
||||||
|
language: getLanguage() || 'en_US'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Instance for connection Access (or Security)
|
// Instance for connection Access (or Security)
|
||||||
export const AccessInstance = () => {
|
export const AccessInstance = () => {
|
||||||
const Access = require('@adempiere/grpc-access-client')
|
const Access = require('@adempiere/grpc-access-client')
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
// Get Instance for connection
|
// Get Instance for connection
|
||||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
import { BusinessDataInstance as Instance, SystemCoreInstance } from '@/api/ADempiere/instances.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if value is empty. Deep-checks arrays and objects
|
||||||
|
* Note: isEmpty([]) == true, isEmpty({}) == true, isEmpty([{0:false},"",0]) == true, isEmpty({0:1}) == false
|
||||||
|
* @param {boolean|array|object|number|string|date|map|set|function} value
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isEmptyValue(value) {
|
||||||
|
const { isEmptyValue } = require('@adempiere/grpc-core-client/src/convertValues.js')
|
||||||
|
|
||||||
|
return isEmptyValue(value)
|
||||||
|
}
|
||||||
|
|
||||||
// Get Organization list from role
|
// Get Organization list from role
|
||||||
export function getOrganizationsList({
|
export function getOrganizationsList({
|
||||||
@ -33,7 +45,7 @@ export function getWarehousesList({
|
|||||||
|
|
||||||
// Get Country definition from server using id or uuid for record
|
// Get Country definition from server using id or uuid for record
|
||||||
export function getCountryDefinition({ countryUuid, countryId }) {
|
export function getCountryDefinition({ countryUuid, countryId }) {
|
||||||
return Instance.call(this).requestGetCountry({
|
return SystemCoreInstance.call(this).requestGetCountry({
|
||||||
countryUuid,
|
countryUuid,
|
||||||
countryId
|
countryId
|
||||||
})
|
})
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
isEmptyValue,
|
|
||||||
zeroPad,
|
zeroPad,
|
||||||
tagStatus,
|
tagStatus,
|
||||||
calculationValue,
|
calculationValue,
|
||||||
clearVariables
|
clearVariables
|
||||||
} from '@/utils/ADempiere/valueUtils.js'
|
} from '@/utils/ADempiere/valueUtils.js'
|
||||||
|
|
||||||
|
export { isEmptyValue } from '@/api/ADempiere/system-core.js'
|
||||||
|
@ -2,29 +2,14 @@ import { TABLE, TABLE_DIRECT } from '@/utils/ADempiere/references'
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if value is empty. Deep-checks arrays and objects
|
* Checks if value is empty. Deep-checks arrays and objects
|
||||||
* Note: isEmpty([]) == true, isEmpty({}) == true,
|
* Note: isEmpty([]) == true, isEmpty({}) == true, isEmpty([{0:false},"",0]) == true, isEmpty({0:1}) == false
|
||||||
* isEmpty([{0: false}, "", 0]) == true, isEmpty({0: 1}) == false
|
* @param {boolean|array|object|number|string|date|map|set|function} value
|
||||||
* @param {boolean|array|object|number|string} value
|
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isEmptyValue(value) {
|
export function isEmptyValue(value) {
|
||||||
if (value === undefined || value == null) {
|
const { isEmptyValue } = require('@/api/ADempiere/system-core')
|
||||||
return true
|
|
||||||
} else if (String(value).trim() === '-1') {
|
|
||||||
return true
|
|
||||||
} else if (typeof value === 'string') {
|
|
||||||
return Boolean(!value.trim().length)
|
|
||||||
} else if (typeof value === 'function' || typeof value === 'number' || typeof value === 'boolean' || Object.prototype.toString.call(value) === '[object Date]') {
|
|
||||||
return false
|
|
||||||
} else if (Object.prototype.toString.call(value) === '[object Map]' || Object.prototype.toString.call(value) === '[object Set]') {
|
|
||||||
return Boolean(!value.size)
|
|
||||||
} else if (Array.isArray(value)) {
|
|
||||||
return Boolean(!value.length)
|
|
||||||
} else if (typeof value === 'object') {
|
|
||||||
return Boolean(!Object.keys(value).length)
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return isEmptyValue(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function typeValue(value) {
|
export function typeValue(value) {
|
||||||
@ -330,7 +315,7 @@ export function parsedValueComponent({
|
|||||||
value = value ? 'Y' : 'N'
|
value = value ? 'Y' : 'N'
|
||||||
}
|
}
|
||||||
// Table (18) or Table Direct (19)
|
// Table (18) or Table Direct (19)
|
||||||
if (displayType === TABLE.id || (displayType === TABLE_DIRECT.id && isIdentifier)) {
|
if (displayType === TABLE_DIRECT.id || (displayType === TABLE.id && isIdentifier)) {
|
||||||
if (!isEmptyValue(value)) {
|
if (!isEmptyValue(value)) {
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user