mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +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:
parent
496bbda915
commit
3479b6f8c4
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
// Get Instance for connection
|
// Get Instance for connection
|
||||||
import { request } from '@/utils/ADempiere/request'
|
import { request } from '@/utils/ADempiere/request'
|
||||||
|
|
||||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
|
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,12 +30,10 @@ export function requestLookup({
|
|||||||
directQuery,
|
directQuery,
|
||||||
value
|
value
|
||||||
}) {
|
}) {
|
||||||
let filters = []
|
const filters = [{
|
||||||
if (!isEmptyValue(value)) {
|
value
|
||||||
filters = [{
|
}]
|
||||||
value
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
return request({
|
return request({
|
||||||
url: '/user-interface/window/lookup-item',
|
url: '/user-interface/window/lookup-item',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -337,11 +337,14 @@ export default {
|
|||||||
value: this.value
|
value: this.value
|
||||||
})
|
})
|
||||||
.then(responseLookupItem => {
|
.then(responseLookupItem => {
|
||||||
this.displayedValue = responseLookupItem.label
|
// with value response update local component list
|
||||||
this.uuidValue = responseLookupItem.uuid
|
if (!this.isEmptyValue(responseLookupItem)) {
|
||||||
this.$nextTick(() => {
|
this.displayedValue = responseLookupItem.label
|
||||||
this.optionsList = this.getterLookupAll
|
this.uuidValue = responseLookupItem.uuid
|
||||||
})
|
this.$nextTick(() => {
|
||||||
|
this.optionsList = this.getterLookupAll
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
@ -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 { requestLookup, requestLookupList } from '@/api/ADempiere/window.js'
|
||||||
import { getToken as getSession } from '@/utils/auth'
|
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'
|
import { parseContext } from '@/utils/ADempiere/contextUtils'
|
||||||
|
|
||||||
const initStateLookup = {
|
const initStateLookup = {
|
||||||
@ -54,9 +70,7 @@ const lookup = {
|
|||||||
isBooleanToString: true
|
isBooleanToString: true
|
||||||
}).value
|
}).value
|
||||||
}
|
}
|
||||||
if (parsedDirectQuery.includes('?')) {
|
|
||||||
parsedDirectQuery = directQuery.replace('?', value)
|
|
||||||
}
|
|
||||||
return requestLookup({
|
return requestLookup({
|
||||||
tableName,
|
tableName,
|
||||||
directQuery: parsedDirectQuery,
|
directQuery: parsedDirectQuery,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user