diff --git a/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue b/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue index bd7a08a8e..aee932914 100644 --- a/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue +++ b/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue @@ -25,6 +25,7 @@ const { success, date2Thai, pathRegistryEmp, + onSearchDataTable, } = mixin; const id = ref(route.params.id.toString()); @@ -44,6 +45,7 @@ const editId = ref(""); //id ที่ต้องการแก้ไ //Table Main const rows = ref([]); //รายการใบอนุญาตประกอบวิชาชีพ +const rowsMain = ref([]); //รายการใบอนุญาตประกอบวิชาชีพ const keyword = ref(""); //คำค้นหา const columns = ref([ { @@ -118,6 +120,8 @@ const pagination = ref({ //Table ประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ const historyRows = ref([]); //รายการประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ +const historyRowsMain = ref([]); //รายการประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ + const historyKeyword = ref(""); //คำค้นหาประวัติแก้ไข const historyColumns = ref([ { @@ -224,9 +228,7 @@ const profesLicenseData = reactive({ profileId: id.value, }); -/** - * ยืนยันการบันทึกข้อมูล - */ +/** ยืนยันการบันทึกข้อมูล*/ function onSubmit() { dialogConfirm( $q, @@ -238,31 +240,26 @@ function onSubmit() { ); } -/** - * ปิด form ข้อมูลใบอนุญาตประกอบวิชาชีพ - */ +/** ปิด form ข้อมูลใบอนุญาตประกอบวิชาชีพ*/ function closeDialog() { dialog.value = false; } -/** - * ปิด popup ประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ - */ +/** ปิด popup ประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ*/ function closeHistoryDialog() { historyDialog.value = false; historyRows.value = []; historyKeyword.value = ""; } -/** - * fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ - */ +/** fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ*/ async function fetchData(id: string) { showLoader(); await http .get(config.API.profileNewCertificateByProfileId(id, empType.value)) .then(async (res) => { rows.value = await res.data.result; + rowsMain.value = await res.data.result; }) .catch((err) => { messageError($q, err); @@ -272,9 +269,7 @@ async function fetchData(id: string) { }); } -/** - * เคลียร์ form ข้อมูลใบอนุญาตประกอบวิชาชีพ - */ +/** เคลียร์ form ข้อมูลใบอนุญาตประกอบวิชาชีพ*/ function clearForm() { profesLicenseData.expireDate = null; profesLicenseData.issueDate = new Date(); @@ -349,15 +344,14 @@ function editData(idData: string) { }); } -/** - * fetch ข้อมูลประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ - */ +/** fetch ข้อมูลประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ*/ function fetchHistoryData(id: string) { showLoader(); http .get(config.API.profileNewCertificateHisByCertificateId(id, empType.value)) .then(async (res) => { historyRows.value = res.data.result; + historyRowsMain.value = res.data.result; }) .catch((err) => { messageError($q, err); @@ -367,6 +361,22 @@ function fetchHistoryData(id: string) { }); } +function serchDataTable() { + rows.value = onSearchDataTable( + keyword.value, + rowsMain.value, + columns.value ? columns.value : [] + ); +} + +function serchDataTableHistory() { + historyRows.value = onSearchDataTable( + historyKeyword.value, + historyRowsMain.value, + historyColumns.value ? historyColumns.value : [] + ); +} + /** * ทำงานเมื่อ Components ถูกเรียกใช้งาน */ @@ -394,7 +404,13 @@ onMounted(() => { > - + @@ -456,7 +472,6 @@ onMounted(() => { bordered :paging="true" dense - :filter="keyword.trim()" v-model:pagination="pagination" :rows-per-page-options="[20, 50, 100]" class="custom-header-table" @@ -730,6 +745,7 @@ onMounted(() => { bg-color="white" v-model="historyKeyword" label="ค้นหา" + @keydown.enter.pervent="serchDataTableHistory" >