From 249311668c3f60f45c51b8f0857cb376cc117cea Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 18 Jul 2024 15:37:08 +0700 Subject: [PATCH] =?UTF-8?q?filter=20=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84?= =?UTF-8?q?=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87=E0=B9=80=E0=B8=89?= =?UTF-8?q?=E0=B8=9E=E0=B8=B2=E0=B8=B0=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B8=AD=E0=B8=A2=E0=B8=B9=E0=B9=88=E0=B9=83?= =?UTF-8?q?=E0=B8=99=E0=B8=A7=E0=B8=B4=E0=B8=99=E0=B8=B1=E0=B8=A2=E0=B9=81?= =?UTF-8?q?=E0=B8=A5=E0=B8=B0=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/10_order/views/Main.vue | 61 +++++++++++++++---- .../components/9_Order/MainPage.vue | 27 +++++--- 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/modules/10_order/views/Main.vue b/src/modules/10_order/views/Main.vue index 7a4dc48ae..ca84372ee 100644 --- a/src/modules/10_order/views/Main.vue +++ b/src/modules/10_order/views/Main.vue @@ -18,6 +18,35 @@ const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError, date2Thai } = mixin; const DataStore = useOrderPlacementDataStore(); +const commandCodes = ref([ + "C-PM-01", + "C-PM-02", + "C-PM-03", + "C-PM-04", + "C-PM-05", + "C-PM-06", + "C-PM-07", + "C-PM-08", + "C-PM-09", + "C-PM-10", + "C-PM-11", + "C-PM-12", + "C-PM-13", + "C-PM-14", + "C-PM-15", + "C-PM-16", + "C-PM-17", + "C-PM-18", + "C-PM-21", + "C-PM-22", + "C-PM-23", + "C-PM-24", + "C-PM-38", + "C-PM-39", + "C-PM-40", + "C-PM-41", +]); + const pagination = ref({ descending: true, page: 1, @@ -112,14 +141,6 @@ const columns = ref([ }, ]); -onMounted(async () => { - await OriginalDataFetch(); - fiscalYearFilter(); - searchFilterTable(); - OrderStatusFilter(); - OrderTypeFilter(); -}); - // ข้อมูลตาราง const rows = ref([]); let OriginalData = ref([]); @@ -129,8 +150,8 @@ const OriginalDataFetch = async () => { showLoader(); await http .get(config.API.listOrder()) - .then((res: any) => { - rows.value = res.data.result.map((e: any) => ({ + .then(async (res: any) => { + let data = await res.data.result.map((e: any) => ({ orderId: e.orderId, Order: e.orderName, OrderNum: @@ -144,6 +165,10 @@ const OriginalDataFetch = async () => { OrderType: e.orderTypeName, orderTypeValue: e.orderTypeValue, })); + + const typeid = OrderTypeOption.value.map((e) => e.id); + + rows.value = data.filter((e: any) => typeid.includes(e.orderTypeValue)); // rows.value = data; }) .catch((e: any) => { messageError($q, e); @@ -213,11 +238,15 @@ const OrderTypeFilter = async () => { .get(config.API.typeOrder()) .then((res) => { const response = res.data.result; + const filterRes = response.filter((e: any) => + commandCodes.value.includes(e.commandCode) + ); + OrderTypeOption.value = [{ id: "", name: "ทั้งหมด" }]; - OrderTypeOption.value.push(...response); + OrderTypeOption.value.push(...filterRes); OrderTypeFilter1.value = [{ id: "", name: "ทั้งหมด" }]; - OrderTypeFilter1.value.push(...response); + OrderTypeFilter1.value.push(...filterRes); }) .catch((e) => { messageError($q, e); @@ -310,6 +339,14 @@ const paginationLabel = (start: string, end: string, total: string) => { if (paging.value == true) return " " + start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total; }; + +onMounted(async () => { + await OrderTypeFilter(); + await OriginalDataFetch(); + fiscalYearFilter(); + searchFilterTable(); + OrderStatusFilter(); +});