forked from adempiere/adempiere-vue
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
Product
info field filter by groups. (PanJiaChen#2037)
* feat: `Product` info field filter by groups. * improve search and set a record.
- Loading branch information
1 parent
329bab2
commit aebedb2
Showing
15 changed files
with
718 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
.../FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/productCategoryField.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<!-- | ||
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution | ||
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com | ||
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt | ||
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/>. | ||
--> | ||
|
||
<template> | ||
<el-form-item | ||
:label="$t('field.product.productCategory')" | ||
> | ||
<el-select | ||
v-model="currentValue" | ||
filterable | ||
remote | ||
:remote-method="remoteSearch" | ||
@visible-change="loadProductCategories" | ||
> | ||
<empty-option-select | ||
:current-value="currentValue" | ||
:is-allows-zero="false" | ||
/> | ||
<el-option | ||
v-for="(option, key) in optionsList" | ||
:key="key" | ||
:value="option.values.KeyColumn" | ||
:label="option.values.DisplayColumn" | ||
/> | ||
</el-select> | ||
</el-form-item> | ||
</template> | ||
|
||
<script> | ||
import { computed, defineComponent, ref } from '@vue/composition-api' | ||
|
||
import store from '@/store' | ||
|
||
// API Request Methods | ||
import { requestListProductCategories } from '@/api/ADempiere/field/search/product.ts' | ||
|
||
// Components and Mixins | ||
import EmptyOptionSelect from '@/components/ADempiere/FieldDefinition/FieldSelect/emptyOptionSelect.vue' | ||
|
||
export default defineComponent({ | ||
name: 'ProductCategoryField', | ||
|
||
components: { | ||
EmptyOptionSelect | ||
}, | ||
|
||
props: { | ||
uuidForm: { | ||
required: true, | ||
type: String | ||
}, | ||
parentUuid: { | ||
type: String, | ||
default: undefined | ||
}, | ||
containerUuid: { | ||
required: true, | ||
type: String | ||
} | ||
}, | ||
|
||
setup(props) { | ||
const ATTRIBUTE_KEY = 'product_category_id' | ||
|
||
const optionsList = ref([]) | ||
|
||
const currentValue = computed({ | ||
set(newValue) { | ||
store.commit('setProductSearchFieldQueryFilterByAttribute', { | ||
containerUuid: props.uuidForm, | ||
attributeKey: ATTRIBUTE_KEY, | ||
value: newValue | ||
}) | ||
}, | ||
get() { | ||
return store.getters.getProductSearchFieldQueryFilterByAttribute({ | ||
containerUuid: props.uuidForm, | ||
attributeKey: ATTRIBUTE_KEY | ||
}) | ||
} | ||
}) | ||
|
||
function loadProductCategories(isShowList) { | ||
if (!isShowList) { | ||
return | ||
} | ||
requestListProductCategories({ | ||
pageSize: 100 | ||
}) | ||
.then(response => { | ||
optionsList.value = response.records | ||
}) | ||
} | ||
|
||
function remoteSearch(searchValue) { | ||
requestListProductCategories({ | ||
searchValue, | ||
pageSize: 100 | ||
}) | ||
.then(response => { | ||
optionsList.value = response.records | ||
}) | ||
} | ||
|
||
return { | ||
optionsList, | ||
// | ||
currentValue, | ||
// | ||
loadProductCategories, | ||
remoteSearch | ||
} | ||
} | ||
}) | ||
</script> |
Oops, something went wrong.