fix: แก้เพิ่ม สินค้าในงานสินค้ามาไม่หมด

This commit is contained in:
Net 2024-06-27 09:41:39 +07:00
parent a2817e2ef4
commit e5859474be

View file

@ -139,6 +139,7 @@ const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
const productGroup = ref<ProductGroup[]>(); const productGroup = ref<ProductGroup[]>();
const productType = ref<ProductGroup[]>(); const productType = ref<ProductGroup[]>();
const product = ref<(ProductList & { type: 'product' })[]>(); const product = ref<(ProductList & { type: 'product' })[]>();
const productIsAdd = ref<(ProductList & { type: 'product' })[]>();
const service = ref<(Service & { type: 'service' })[]>(); const service = ref<(Service & { type: 'service' })[]>();
const resultSearchProduct = ref<ProductList[]>(); const resultSearchProduct = ref<ProductList[]>();
const productAndService = ref<ServiceAndProduct[]>([]); const productAndService = ref<ServiceAndProduct[]>([]);
@ -366,6 +367,27 @@ async function fetchListGroups() {
} }
} }
async function fetchListOfProductIsAdd(productTypeId: string) {
const res = await fetchListProduct({
status:
currentStatus.value === 'INACTIVE'
? 'INACTIVE'
: currentStatus.value === 'ACTIVE'
? 'ACTIVE'
: undefined,
productTypeId,
});
if (res) {
productIsAdd.value = res.result.map((v) => {
return {
...v,
type: 'product',
};
});
}
}
async function fetchListOfProduct(productTypeId: string) { async function fetchListOfProduct(productTypeId: string) {
const res = await fetchListProduct({ const res = await fetchListProduct({
page: currentPageProduct.value, page: currentPageProduct.value,
@ -1839,7 +1861,7 @@ watch(currentPageService, async () => {
:class="`${$q.screen.gt.sm ? 'col-3 ' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`" :class="`${$q.screen.gt.sm ? 'col-3 ' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
v-for="i in (!!inputSearchProductAndService v-for="i in (!!inputSearchProductAndService
? resultSearchProduct ? resultSearchProduct
: product : productIsAdd
)?.filter((i) => { )?.filter((i) => {
if (i.status === 'INACTIVE') { if (i.status === 'INACTIVE') {
return false; return false;
@ -2081,7 +2103,7 @@ watch(currentPageService, async () => {
dense dense
@addProduct=" @addProduct="
async (index) => { async (index) => {
await fetchListOfProduct(currentIdType); await fetchListOfProductIsAdd(currentIdType);
currentWorkIndex = index; currentWorkIndex = index;
dialogTotalProduct = true; dialogTotalProduct = true;
} }