feat: ค้นหา ของ Product type
This commit is contained in:
parent
b1302f05f9
commit
c7cce35db7
1 changed files with 14 additions and 7 deletions
|
|
@ -13,11 +13,7 @@ import TooltipComponent from 'components/TooltipComponent.vue';
|
|||
import { dialog } from 'src/stores/utils';
|
||||
|
||||
import useProductServiceStore from 'src/stores/product-service';
|
||||
import {
|
||||
Product,
|
||||
ProductCreate,
|
||||
ProductUpdate,
|
||||
} from 'src/stores/product-service/types';
|
||||
import { Product, ProductCreate } from 'src/stores/product-service/types';
|
||||
|
||||
const productServiceStore = useProductServiceStore();
|
||||
|
||||
|
|
@ -79,7 +75,7 @@ const formData = ref<ProductCreate>({
|
|||
const currentId = ref<string>('');
|
||||
const currentIdType = ref<string>('');
|
||||
const resultSearchGroup = ref<Product[]>();
|
||||
const resultSearchType = ref<Product[]>();
|
||||
const resultSearchType = ref<(Product & { productGroupId: string })[]>();
|
||||
|
||||
async function searchGroup() {
|
||||
const resultList = await fetchListProductService({
|
||||
|
|
@ -110,6 +106,17 @@ async function fetchListGroups() {
|
|||
}
|
||||
}
|
||||
|
||||
async function searchType() {
|
||||
const res = await await fetchListProductServiceType({
|
||||
query: inputSearch.value,
|
||||
productGroupId: currentId.value,
|
||||
});
|
||||
|
||||
if (res) {
|
||||
resultSearchType.value = res;
|
||||
}
|
||||
}
|
||||
|
||||
async function submitType() {
|
||||
if (drawerInfo.value) {
|
||||
await editProductServiceType(currentIdType.value, {
|
||||
|
|
@ -339,7 +346,7 @@ watch(productMode, () => (inputSearch.value = ''));
|
|||
productMode === 'group'
|
||||
? searchGroup()
|
||||
: productMode === 'type'
|
||||
? console.log('type')
|
||||
? searchType()
|
||||
: ''
|
||||
"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue