1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

fix: Get lookup item (#887)

* fix: Get lookup item.

* fix import

* fix lookup string value.

* change valuesList to value

* replace value with filters.

* remove unused imports.

Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
Edwin Betancourt 2021-05-31 10:13:37 -04:00 committed by GitHub
parent 496bbda915
commit 3479b6f8c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 16 deletions

View File

@ -16,7 +16,6 @@
// Get Instance for connection
import { request } from '@/utils/ADempiere/request'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
/**
@ -31,12 +30,10 @@ export function requestLookup({
directQuery,
value
}) {
let filters = []
if (!isEmptyValue(value)) {
filters = [{
value
}]
}
const filters = [{
value
}]
return request({
url: '/user-interface/window/lookup-item',
method: 'get',

View File

@ -337,11 +337,14 @@ export default {
value: this.value
})
.then(responseLookupItem => {
this.displayedValue = responseLookupItem.label
this.uuidValue = responseLookupItem.uuid
this.$nextTick(() => {
this.optionsList = this.getterLookupAll
})
// with value response update local component list
if (!this.isEmptyValue(responseLookupItem)) {
this.displayedValue = responseLookupItem.label
this.uuidValue = responseLookupItem.uuid
this.$nextTick(() => {
this.optionsList = this.getterLookupAll
})
}
})
.finally(() => {
this.isLoading = false

View File

@ -1,6 +1,22 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { requestLookup, requestLookupList } from '@/api/ADempiere/window.js'
import { getToken as getSession } from '@/utils/auth'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { parseContext } from '@/utils/ADempiere/contextUtils'
const initStateLookup = {
@ -54,9 +70,7 @@ const lookup = {
isBooleanToString: true
}).value
}
if (parsedDirectQuery.includes('?')) {
parsedDirectQuery = directQuery.replace('?', value)
}
return requestLookup({
tableName,
directQuery: parsedDirectQuery,