ปรับ filte Table ข้อมูลทะเบียนประวัติ
This commit is contained in:
parent
7ab17d378f
commit
2b36b70715
26 changed files with 841 additions and 682 deletions
|
|
@ -28,11 +28,10 @@ const {
|
|||
hideLoader,
|
||||
success,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
/** props*/
|
||||
const isLeave = defineModel<boolean>("isLeave", {
|
||||
required: true,
|
||||
});
|
||||
|
|
@ -73,7 +72,9 @@ const reasonSameDateRef = ref<object | null>(null);
|
|||
//ประวัติแก้ไขข้อมูลราชการ
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const modalHistory = ref<boolean>(false); //แสดง popup ประวัติแก้ไขข้อมูลราชการ;
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //ข้อมูลรายการประวัติแก้ไขข้อมูลราชการ
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]);
|
||||
const rowsHistoryMain = ref<RequestItemsHistoryObject[]>([]); //ข้อมูลรายการประวัติแก้ไขข้อมูลราชการ
|
||||
//ข้อมูลรายการประวัติแก้ไขข้อมูลราชการ
|
||||
const visibleColumnsHistory = ref<String[]>([
|
||||
"dateAppoint",
|
||||
"dateStart",
|
||||
|
|
@ -142,9 +143,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
/**
|
||||
* เปิด dialog *
|
||||
*/
|
||||
/** เปิด dialog */
|
||||
function openDialogEdit() {
|
||||
modalEdit.value = true;
|
||||
containDate.value = formMain.containDate ? formMain.containDate : null;
|
||||
|
|
@ -154,18 +153,14 @@ function openDialogEdit() {
|
|||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* เปิด dialog ประวัติแก้ไขข้อมูลราชการ
|
||||
*/
|
||||
/** เปิด dialog ประวัติแก้ไขข้อมูลราชการ*/
|
||||
function openDialogHistory() {
|
||||
modalHistory.value = true;
|
||||
filterKeyword.value = "";
|
||||
getDataHistory();
|
||||
}
|
||||
|
||||
/**
|
||||
* ปิด dialog
|
||||
*/
|
||||
/** ปิด dialog*/
|
||||
function closeDialog() {
|
||||
modalEdit.value = false;
|
||||
containDate.value = null;
|
||||
|
|
@ -173,9 +168,7 @@ function closeDialog() {
|
|||
reasonSameDate.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* function ยืนยันการบันทึกข้อมูลราชการ
|
||||
*/
|
||||
/** function ยืนยันการบันทึกข้อมูลราชการ*/
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
|
|
@ -206,16 +199,13 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดึงข้อมูลราชการ
|
||||
*/
|
||||
/** ดึงข้อมูลราชการ*/
|
||||
async function getData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewGovernmentById(profileId.value, empType.value))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
console.log(data);
|
||||
|
||||
formMain.ocId = data.org ?? "-"; //สังกัด
|
||||
formMain.positionId = data.position ?? "-"; //ตำแหน่ง
|
||||
|
|
@ -244,9 +234,7 @@ async function getData() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดึงข้อมูลประวัติ
|
||||
*/
|
||||
/** ดึงข้อมูลประวัติ */
|
||||
async function getDataHistory() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -279,6 +267,7 @@ async function getDataHistory() {
|
|||
lastUpdateFullName: e.lastUpdateFullName,
|
||||
});
|
||||
});
|
||||
rowsHistoryMain.value = rowsHistory.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -288,9 +277,16 @@ async function getDataHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
/** ฟังก์ค้นหาข้อมูลรายการประวัติข้อมูลราชการ */
|
||||
function serchDataTableHistory() {
|
||||
rowsHistory.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsHistoryMain.value,
|
||||
columnsHistory.value ? columnsHistory.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
||||
onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
|
|
@ -656,7 +652,7 @@ onMounted(() => {
|
|||
tittle="ประวัติแก้ไขข้อมูลราชการ"
|
||||
:close="() => (modalHistory = !modalHistory)"
|
||||
/>
|
||||
<q-separator color="grey-4" />
|
||||
<q-separator />
|
||||
|
||||
<q-card-section style="max-height: 50vh" class="scroll">
|
||||
<div class="row q-pb-sm q-gutter-x-sm">
|
||||
|
|
@ -668,8 +664,7 @@ onMounted(() => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
class="col-2"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTableHistory"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -697,8 +692,6 @@ onMounted(() => {
|
|||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:filter="filterKeyword.trim()"
|
||||
:visible-columns="visibleColumnsHistory"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
@ -711,7 +704,6 @@ onMounted(() => {
|
|||
>
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<q-th auto-width></q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const {
|
|||
messageError,
|
||||
success,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
const profileId = ref<string>(
|
||||
|
|
@ -36,9 +37,7 @@ const profileId = ref<string>(
|
|||
);
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
/** props*/
|
||||
const isLeave = defineModel<boolean>("isLeave", {
|
||||
required: true,
|
||||
});
|
||||
|
|
@ -55,6 +54,7 @@ const disciplineData = reactive<RequestItemsObject>({
|
|||
});
|
||||
|
||||
const rows = ref<RequestItemsObject[]>([]); //รายการวินัย
|
||||
const rowsMain = ref<RequestItemsObject[]>([]); //รายการวินัย
|
||||
const mode = ref<string>("table"); //การแสดงผล Table card
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
|
|
@ -206,9 +206,7 @@ function filterSelector(val: string, update: Function, refData: string) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ปิด dialog ข้อมูลวินัย
|
||||
*/
|
||||
/** ปิด dialog ข้อมูลวินัย*/
|
||||
function closeDialog() {
|
||||
modal.value = false;
|
||||
edit.value = false;
|
||||
|
|
@ -220,15 +218,14 @@ function closeDialog() {
|
|||
disciplineData.refCommandDate = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* เปิด dialog ข้อมูลวินัย
|
||||
*/
|
||||
/** เปิด dialog ข้อมูลวินัย*/
|
||||
function openDialogAdd() {
|
||||
modal.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลรายการวินัย
|
||||
* @param id id Profile
|
||||
*/
|
||||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
|
|
@ -236,6 +233,7 @@ async function fetchData(id: string) {
|
|||
.get(config.API.profileNewDisciplineByProfileId(id, empType.value))
|
||||
.then((res) => {
|
||||
rows.value = res.data.result;
|
||||
rowsMain.value = res.data.result;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -245,9 +243,7 @@ async function fetchData(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* funciton เพิ่มช้อมูลวินัย
|
||||
*/
|
||||
/** funciton เพิ่มช้อมูลวินัย*/
|
||||
function addData() {
|
||||
showLoader();
|
||||
const body = {
|
||||
|
|
@ -278,6 +274,7 @@ function addData() {
|
|||
|
||||
/**
|
||||
* funciton บันทึกแก่ไขช้อมูลวินัย
|
||||
* @param idData id ที่ต้องการแก้ไข
|
||||
*/
|
||||
function editData(idData: string) {
|
||||
showLoader();
|
||||
|
|
@ -327,9 +324,7 @@ function openDialogHistory(idOrder: string) {
|
|||
id.value = idOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* function ยืนยันการบันทึกข้อมูล
|
||||
*/
|
||||
/** function ยืนยันการบันทึกข้อมูล*/
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -341,9 +336,16 @@ function onSubmit() {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
/** ฟังก์ค้นหาข้อมูลรายการวินัย */
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
||||
onMounted(() => {
|
||||
fetchData(profileId.value);
|
||||
});
|
||||
|
|
@ -369,7 +371,7 @@ onMounted(() => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -432,7 +434,6 @@ onMounted(() => {
|
|||
:columns="columns"
|
||||
:rows="rows"
|
||||
:paging="true"
|
||||
:filter="filterKeyword.trim()"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,14 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
|
||||
mixin;
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
date2Thai,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
/**
|
||||
* props
|
||||
|
|
@ -24,12 +30,10 @@ const modal = defineModel<boolean>("modal", { required: true }); //แสดง
|
|||
const id = defineModel<string>("id", { required: true }); //id วินัยที่ต้องการดูประวัติแก้ไขวินัย
|
||||
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const rows = ref<RequestItemsObject[]>([]); //รายการประวัติแก้ไขวินัย
|
||||
const rowsMain = ref<RequestItemsObject[]>([]); //รายการประวัติแก้ไขวินัย
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "date",
|
||||
|
|
@ -140,9 +144,7 @@ const historyPagination = ref({
|
|||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลประวัติการแก่ไขข้อมูลวินัย
|
||||
*/
|
||||
/** fetch ข้อมูลประวัติการแก่ไขข้อมูลวินัย*/
|
||||
async function getHistory() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -164,6 +166,7 @@ async function getHistory() {
|
|||
e.refCommandDate == null ? null : new Date(e.refCommandDate),
|
||||
});
|
||||
});
|
||||
rowsMain.value = rows.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -173,9 +176,17 @@ async function getHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ฟังก์ค้นหาข้อมูลรายการวินัย */
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* ถ้า modal เป็น true เรียก getHistory เพิ่อดึงข้อมูลประวัติการแก้ไขวินัย
|
||||
*/
|
||||
watch(modal, (status) => {
|
||||
|
|
@ -207,7 +218,7 @@ watch(modal, (status) => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -238,7 +249,6 @@ watch(modal, (status) => {
|
|||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
v-model:pagination="historyPagination"
|
||||
:filter="filterKeyword.trim()"
|
||||
>
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ import type {
|
|||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_LeaveHistory.vue";
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
/**props*/
|
||||
const isLeave = defineModel<boolean>("isLeave", {
|
||||
required: true,
|
||||
});
|
||||
|
|
@ -41,6 +39,7 @@ const {
|
|||
date2Thai,
|
||||
dateToISO,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
const profileId = ref<string>(
|
||||
|
|
@ -83,6 +82,7 @@ const statLeaveOptionFilter = ref<DataOption[]>([
|
|||
|
||||
//Table
|
||||
const rows = ref<DetailData[]>([]);
|
||||
const rowsMain = ref<DetailData[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -112,6 +112,9 @@ const columns = ref<QTableProps["columns"]>([
|
|||
label: "วัน เดือน ปี ที่ลา",
|
||||
sortable: true,
|
||||
field: "dateLeave",
|
||||
format(val, row) {
|
||||
return dateThaiRange([row.dateStartLeave, row.dateEndLeave]);
|
||||
},
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
|
|
@ -134,6 +137,9 @@ const columns = ref<QTableProps["columns"]>([
|
|||
label: "สถานะ",
|
||||
sortable: true,
|
||||
field: "status",
|
||||
format(val, row) {
|
||||
return statusLeave(val);
|
||||
},
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
|
|
@ -184,9 +190,7 @@ const clickEditRowType = () => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* function เปิด dialog ข้อมูลการลา
|
||||
*/
|
||||
/** function เปิด dialog ข้อมูลการลา*/
|
||||
function openDialogAdd() {
|
||||
modal.value = true;
|
||||
edit.value = false;
|
||||
|
|
@ -239,6 +243,7 @@ function clickTotal() {
|
|||
|
||||
/**
|
||||
* function เปิด dialog แก้ไขข้อมูลการลา
|
||||
* @param props ข้อมูลที่ต้องการแก้ไข
|
||||
*/
|
||||
function openDialogEdit(props: DetailData) {
|
||||
edit.value = true;
|
||||
|
|
@ -271,9 +276,7 @@ function openDialogEdit(props: DetailData) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ปิด dialog ข้อมูลการลา
|
||||
*/
|
||||
/** ปิด dialog ข้อมูลการลา*/
|
||||
function closeDialog() {
|
||||
modal.value = false;
|
||||
edit.value = false;
|
||||
|
|
@ -330,16 +333,14 @@ function dateThaiRange(val: [Date, Date]) {
|
|||
|
||||
/**
|
||||
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลที่เลือก
|
||||
* @param row ข้อมูล row ที่ดูประวัติการแก้ไข
|
||||
* @param id id รายการ
|
||||
*/
|
||||
function openDialogHistory(idOrder: string) {
|
||||
modalHistory.value = true;
|
||||
id.value = idOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* function ยืนยันการบันทึกข้อมูล
|
||||
*/
|
||||
/** function ยืนยันการบันทึกข้อมูล*/
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
if (edit.value == false) {
|
||||
|
|
@ -350,9 +351,7 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* บันทึกเพิ่มข้อมูล
|
||||
*/
|
||||
/** บันทึกเพิ่มข้อมูล*/
|
||||
function saveData() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -381,9 +380,7 @@ function saveData() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* บันทึกแก้ไขข้อมูล
|
||||
*/
|
||||
/** บันทึกแก้ไขข้อมูล*/
|
||||
async function editData() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -410,9 +407,7 @@ async function editData() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลรายการลา
|
||||
*/
|
||||
/** function fetch ข้อมูลรายการลา*/
|
||||
async function getData() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -430,6 +425,7 @@ async function getData() {
|
|||
reason: item.reason,
|
||||
typeLeaveId: item.leaveTypeId,
|
||||
}));
|
||||
rowsMain.value = rows.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -439,6 +435,15 @@ async function getData() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ฟังก์ค้นหาข้อมูลรายการวินัย */
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
|
|
@ -467,7 +472,7 @@ onMounted(() => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -532,7 +537,6 @@ onMounted(() => {
|
|||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filterKeyword.trim()"
|
||||
>
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
@ -573,14 +577,7 @@ onMounted(() => {
|
|||
<div v-if="col.name === 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'dateLeave'">
|
||||
{{
|
||||
dateThaiRange([props.row.dateStartLeave, props.row.dateEndLeave])
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'status'">
|
||||
{{ statusLeave(col.value) }}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -21,13 +21,21 @@ const id = defineModel<string>("id", { required: true });
|
|||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
|
||||
mixin;
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
date2Thai,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const filterKeyword = ref<string>("");
|
||||
const rows = ref<DetailData[]>([]); //data history
|
||||
const rowsMain = ref<DetailData[]>([]); //data history
|
||||
|
||||
const formFilter = reactive<FormFilter>({
|
||||
page: 1,
|
||||
pageSize: 12,
|
||||
|
|
@ -71,6 +79,9 @@ const columns = ref<QTableProps["columns"]>([
|
|||
sortable: true,
|
||||
field: "dateLeave",
|
||||
headerStyle: "font-size: 14px",
|
||||
format(val, row) {
|
||||
return dateThaiRange([row.dateStartLeave, row.dateEndLeave]);
|
||||
},
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
|
|
@ -94,6 +105,9 @@ const columns = ref<QTableProps["columns"]>([
|
|||
field: "status",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
format(val, row) {
|
||||
return statusLeave(val);
|
||||
},
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
|
|
@ -149,9 +163,7 @@ const historyPagination = ref({
|
|||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลประวัติการแก้ไขการลา
|
||||
*/
|
||||
/** function fetch ข้อมูลประวัติการแก้ไขการลา */
|
||||
async function getHistory() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -176,6 +188,7 @@ async function getHistory() {
|
|||
: "",
|
||||
});
|
||||
});
|
||||
rowsMain.value = rows.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -217,9 +230,17 @@ function statusLeave(val: string) {
|
|||
}
|
||||
}
|
||||
|
||||
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขการลา */
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* ถ้า modal เป็น true เรียก getHistory เพิ่อดึงข้อมูลประวัติการแก้ไข
|
||||
*/
|
||||
watch(modal, (status) => {
|
||||
|
|
@ -250,7 +271,7 @@ watch(modal, (status) => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -281,7 +302,6 @@ watch(modal, (status) => {
|
|||
v-model:pagination="historyPagination"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filterKeyword.trim()"
|
||||
>
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
@ -301,17 +321,7 @@ watch(modal, (status) => {
|
|||
1
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'dateLeave'">
|
||||
{{
|
||||
dateThaiRange([
|
||||
props.row.dateStartLeave,
|
||||
props.row.dateEndLeave,
|
||||
])
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'status'">
|
||||
{{ statusLeave(col.value) }}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const {
|
|||
hideLoader,
|
||||
success,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
const profileId = ref<string>(
|
||||
|
|
@ -32,9 +33,7 @@ const profileId = ref<string>(
|
|||
);
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
/** props*/
|
||||
const isLeave = defineModel<boolean>("isLeave", {
|
||||
required: true,
|
||||
});
|
||||
|
|
@ -56,6 +55,7 @@ const dutyData = reactive<RequestItemsObject>({
|
|||
const mode = ref<string>("table"); //การแสดงผล Table card
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const rows = ref<RequestItemsObject[]>([]); //รายการปฏิบัติราชการพิเศษ
|
||||
const rowsMain = ref<RequestItemsObject[]>([]); //รายการปฏิบัติราชการพิเศษ
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "dateStart",
|
||||
|
|
@ -179,15 +179,14 @@ function closeDialog() {
|
|||
dutyData.refCommandDate = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลรายการพิเศษ
|
||||
*/
|
||||
/** fetch ข้อมูลรายการพิเศษ*/
|
||||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewDutyByProfileId(id, empType.value))
|
||||
.then(async (res) => {
|
||||
rows.value = await res.data.result;
|
||||
rowsMain.value = await res.data.result;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -197,9 +196,7 @@ async function fetchData(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* functoin บันทึกการเพิ่มข้อมูล
|
||||
*/
|
||||
/** functoin บันทึกการเพิ่มข้อมูล*/
|
||||
function addData() {
|
||||
showLoader();
|
||||
const body = {
|
||||
|
|
@ -227,9 +224,7 @@ function addData() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* functoin บันทึกการแก้ไขข้อมูล
|
||||
*/
|
||||
/** functoin บันทึกการแก้ไขข้อมูล*/
|
||||
function editData(idData: string) {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -250,9 +245,7 @@ function editData(idData: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ยืนยันการบันทึกข้อมูล
|
||||
*/
|
||||
/** ยืนยันการบันทึกข้อมูล*/
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -264,9 +257,15 @@ function onSubmit() {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/** ทำงานเมื่อ Components ถูกเรียกใช้งา*/
|
||||
onMounted(() => {
|
||||
fetchData(profileId.value);
|
||||
});
|
||||
|
|
@ -292,7 +291,7 @@ onMounted(() => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -356,7 +355,6 @@ onMounted(() => {
|
|||
:paging="true"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filterKeyword.trim()"
|
||||
v-model:pagination="pagination"
|
||||
>
|
||||
>
|
||||
|
|
|
|||
|
|
@ -16,13 +16,20 @@ const id = defineModel<string>("id", { required: true });
|
|||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
|
||||
mixin;
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
date2Thai,
|
||||
pathRegistryEmp,
|
||||
onSearchDataTable,
|
||||
} = mixin;
|
||||
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const rows = ref<ResponseObject[]>([]); //data history
|
||||
const rowsMain = ref<ResponseObject[]>([]); //data history
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "dateStart",
|
||||
|
|
@ -132,9 +139,7 @@ const historyPagination = ref({
|
|||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลประวติการแก้ไขข้อมูล
|
||||
*/
|
||||
/** function fetch ข้อมูลประวติการแก้ไขข้อมูล*/
|
||||
function getHistory() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -158,6 +163,7 @@ function getHistory() {
|
|||
lastUpdatedAt: e.lastUpdatedAt,
|
||||
});
|
||||
});
|
||||
rowsMain.value = rows.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -167,9 +173,16 @@ function getHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* ถ้า modal เป็น true เรียก getHistory เพิ่อดึงข้อมูลประวัติการแก้ไข
|
||||
*/
|
||||
watch(modal, (status) => {
|
||||
|
|
@ -189,6 +202,7 @@ watch(modal, (status) => {
|
|||
tittle="ประวัติแก้ไขปฏิบัติราชการพิเศษ"
|
||||
:close="() => ((modal = false), (rows = []))"
|
||||
/>
|
||||
<q-separator />
|
||||
<q-card-section style="max-height: 60vh" class="scroll">
|
||||
<div class="row q-gutter-sm q-mb-sm">
|
||||
<q-space />
|
||||
|
|
@ -199,7 +213,7 @@ watch(modal, (status) => {
|
|||
ref="filterRef"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -230,7 +244,6 @@ watch(modal, (status) => {
|
|||
v-model:pagination="historyPagination"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filterKeyword.trim()"
|
||||
>
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue