From 6a50b6965f3e53c3057f9f1bc6d550037c6fb075 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 10 Dec 2024 12:11:19 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20filter?= =?UTF-8?q?=20KPI=20Devalopment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tab/Dialog/DialogGovernment.vue | 51 +++++++++++++++++-- .../components/Tab/Topic/01_Indicator.vue | 2 - src/modules/14_KPI/views/mainDetail.vue | 43 ++++++++++------ .../15_development/components/Record.vue | 35 +++++++++---- 4 files changed, 100 insertions(+), 31 deletions(-) diff --git a/src/modules/14_KPI/components/Tab/Dialog/DialogGovernment.vue b/src/modules/14_KPI/components/Tab/Dialog/DialogGovernment.vue index ae5e58658..17334a6fc 100644 --- a/src/modules/14_KPI/components/Tab/Dialog/DialogGovernment.vue +++ b/src/modules/14_KPI/components/Tab/Dialog/DialogGovernment.vue @@ -20,11 +20,13 @@ const { findPosMasterNoOld, findOrgNameOld, date2Thai, + onSearchDataTable, } = mixin; const modal = defineModel("modal", { required: true }); const filterKeyword = ref(""); const rows = ref([]); +const rowsMain = ref([]); //หัวตาราง const columns = ref([ @@ -210,6 +212,7 @@ function getData() { .then((res) => { const data = res.data.result; rows.value = data; + rowsMain.value = data; }) .catch((e) => { messageError($q, e); @@ -218,12 +221,24 @@ function getData() { hideLoader(); }); } + +function serchDataTable() { + rows.value = onSearchDataTable( + filterKeyword.value, + rowsMain.value, + columns.value ? columns.value : [] + ); +} + watch( () => modal.value, (n) => { if (n == true) { getData(); - } else rows.value = []; + } else { + rows.value = []; + rowsMain.value = []; + } } ); @@ -233,13 +248,43 @@ watch( -
+
+
+ +
+ + + + + +
+
+
([ ]); const kpiUserPlannedId = ref(""); -const filterKeyword = ref(""); const modal = ref(false); const isStatusEdit = ref(false); const modalEvaluate = ref(false); @@ -257,7 +256,6 @@ watch( ref="table" :columns="columns" :rows="rows" - :filter="filterKeyword" row-key="id" flat bordered diff --git a/src/modules/14_KPI/views/mainDetail.vue b/src/modules/14_KPI/views/mainDetail.vue index 02c163acf..2177cd727 100644 --- a/src/modules/14_KPI/views/mainDetail.vue +++ b/src/modules/14_KPI/views/mainDetail.vue @@ -20,7 +20,14 @@ interface ListMain { const profileId = ref(""); const $q = useQuasar(); const mixin = useCounterMixin(); -const { messageError, findOrgName, showLoader, hideLoader, date2Thai } = mixin; +const { + messageError, + findOrgName, + showLoader, + hideLoader, + date2Thai, + onSearchDataTable, +} = mixin; const mode = ref($q.screen.gt.xs); const profileImg = ref(""); @@ -41,6 +48,7 @@ const sizeImg = ref(""); /** Table */ const rows = ref([]); +const rowsMain = ref([]); const filter = ref(""); const columns = ref([ { @@ -150,6 +158,7 @@ async function getList(id: string) { .then(async (res) => { const data = await res.data.result; rows.value = data; + rowsMain.value = data; }) .catch((e) => { messageError($q, e); @@ -208,6 +217,14 @@ function onDetail(id: string) { router.push(`/probation/detail/${profileId.value}/${id}`); } +function serchDataTable() { + rows.value = onSearchDataTable( + filter.value, + rowsMain.value, + columns.value ? columns.value : [] + ); +} + onMounted(async () => { await getMain(); }); @@ -225,6 +242,11 @@ onMounted(async () => { @click="router.go(-1)" /> รายละเอียดงานที่ได้รับมอบหมาย + {{ + formData.firstName + ? `${formData.prefix}${formData.firstName} ${formData.lastName}` + : "" + }}
@@ -236,6 +258,7 @@ onMounted(async () => { : "-" }}
+
@@ -324,31 +347,21 @@ onMounted(async () => {
+
{ outlined emit-value map-options - options-dense option-value="name" style="min-width: 140px" @@ -378,7 +390,6 @@ onMounted(async () => { :rows="rows" :columns="columns" :grid="!$q.screen.gt.xs" - :filter="filter.trim()" :rows-per-page-options="[10, 25, 50, 100]" :visible-columns="visibleColumns" :virtual-scroll-sticky-size-start="48" diff --git a/src/modules/15_development/components/Record.vue b/src/modules/15_development/components/Record.vue index 726d6e0fb..77a2a4a8e 100644 --- a/src/modules/15_development/components/Record.vue +++ b/src/modules/15_development/components/Record.vue @@ -9,7 +9,7 @@ import type { QTableProps } from "quasar"; import type { ResRecord } from "@/modules/15_development/interface/response/Main"; const $q = useQuasar(); -const { date2Thai } = useCounterMixin(); +const { date2Thai, onSearchDataTable } = useCounterMixin(); //prosp const isProfile = defineModel("isProfile", { required: true }); @@ -18,6 +18,8 @@ const listPerson = defineModel("listPerson", { required: true }); //ข้อมุล Table const keyword = ref(""); const rows = ref([]); +const rowsMain = ref([]); + // baseColumns const baseColumns = ref([ { @@ -67,6 +69,11 @@ const baseColumns = ref([ label: "ชื่อ-นามสกุล", sortable: true, field: "fullName", + format(val, row) { + return row.firstName + ? `${row.prefix}${row.firstName} ${row.lastName}` + : "-"; + }, headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -239,6 +246,15 @@ function fetchDataProject() { rows.value = listPerson.value.filter( (e: ResRecord) => e.isProfile === isProfile.value ); + rowsMain.value = rows.value; +} + +function serchDataTable() { + rows.value = onSearchDataTable( + keyword.value, + rowsMain.value, + columns.value ? columns.value : [] + ); } /** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */ @@ -250,7 +266,14 @@ onMounted(() => {