loading สรรหา

This commit is contained in:
setthawutttty 2025-07-07 15:18:37 +07:00
parent ee4428aac2
commit 360caae2e1
8 changed files with 98 additions and 156 deletions

View file

@ -165,7 +165,7 @@ function resetFilter() {
</q-select> </q-select>
</div> </div>
</div> </div>
<q-table <d-table
ref="table" ref="table"
flat flat
bordered bordered
@ -189,52 +189,11 @@ function resetFilter() {
<template #body="props"> <template #body="props">
<slot v-bind="props" name="columns"></slot> <slot v-bind="props" name="columns"></slot>
</template> </template>
</q-table> </d-table>
</template> </template>
<style lang="scss"> <style lang="scss">
.icon-color { .icon-color {
color: #4154b3; color: #4154b3;
} }
.custom-table2 {
max-height: 64vh;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
}
.q-table td:nth-of-type(2) {
z-index: 3 !important;
}
.q-table th:nth-of-type(2),
.q-table td:nth-of-type(2) {
position: sticky;
left: 0;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
}
</style> </style>

View file

@ -30,6 +30,7 @@ const {
hideLoader, hideLoader,
messageError, messageError,
onSearchDataTable, onSearchDataTable,
dialogRemove,
} = mixin; } = mixin;
const router = useRouter(); const router = useRouter();
@ -174,7 +175,7 @@ function textDate(value: Date) {
} }
/** ดึงข้อมูล รอบสอบแข่งขัน */ /** ดึงข้อมูล รอบสอบแข่งขัน */
async function fetchData() { async function fetchData(actionType?: string) {
showLoader(); showLoader();
await http await http
.get(config.API.getCandidates) .get(config.API.getCandidates)
@ -199,6 +200,9 @@ async function fetchData() {
}) })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
if (actionType == "delete") {
success($q, "ลบข้อมูลการสอบสำเร็จ");
}
}); });
} }
@ -325,32 +329,18 @@ async function clickHistory(id: string) {
* @param id รอบสอบเเขงข * @param id รอบสอบเเขงข
*/ */
function clickDelete(id: string) { function clickDelete(id: string) {
$q.dialog({ dialogRemove($q, async () => {
title: "ยืนยันการลบข้อมูล", showLoader();
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?", await http
cancel: { .delete(config.API.deleteCandidates(id))
flat: true, .then(async (res) => {
color: "negative", await fetchData("delete");
}, })
persistent: true, .catch((e) => {
}) messageError($q, e);
.onOk(async () => { hideLoader();
showLoader(); });
await http });
.delete(config.API.deleteCandidates(id))
.then((res) => {
success($q, "ลบข้อมูลการสอบสำเร็จ");
fetchData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
})
.onCancel(() => {})
.onDismiss(() => {});
} }
/** ไปหน้าเพิ่มรอบสอบแข่งขัน */ /** ไปหน้าเพิ่มรอบสอบแข่งขัน */

View file

@ -143,11 +143,15 @@ async function uploadDocData() {
}) })
.finally(async () => { .finally(async () => {
hideLoader(); hideLoader();
clickBack(); setTimeout(async () => {
await clickBack();
}, 1200);
}); });
} else { } else {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
clickBack(); setTimeout(async () => {
await clickBack();
}, 1200);
} }
} }

View file

@ -32,6 +32,7 @@ const {
hideLoader, hideLoader,
date2Thai, date2Thai,
onSearchDataTable, onSearchDataTable,
dialogRemove,
} = mixin; } = mixin;
const name = ref<string>(""); const name = ref<string>("");
@ -212,7 +213,7 @@ function textDate(value: Date) {
} }
/** ดึง list ข้อมูล */ /** ดึง list ข้อมูล */
async function fetchData() { async function fetchData(actionType?: string) {
showLoader(); showLoader();
await http await http
.get(config.API.getDisableCandidates) .get(config.API.getDisableCandidates)
@ -237,6 +238,9 @@ async function fetchData() {
}) })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
if (actionType == "delete") {
success($q, "ลบข้อมูลการสอบสำเร็จ");
}
}); });
} }
@ -302,32 +306,19 @@ async function clickHistory(id: string) {
/** ลบ รอบการคัดเลือก */ /** ลบ รอบการคัดเลือก */
function clickDelete(id: string) { function clickDelete(id: string) {
$q.dialog({ dialogRemove($q, async () => {
title: "ยืนยันการลบข้อมูล", showLoader();
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?", await http
cancel: { .delete(config.API.deleteDisableCandidates(id))
flat: true, .then((res) => {
color: "negative", fetchData("delete");
}, })
persistent: true, .catch((e) => {
}) messageError($q, e);
.onOk(async () => { hideLoader();
showLoader(); })
await http .finally(() => {});
.delete(config.API.deleteDisableCandidates(id)) });
.then((res) => {
success($q, "ลบข้อมูลการสอบสำเร็จ");
fetchData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
})
.onCancel(() => {})
.onDismiss(() => {});
} }
/** ไปหน้าเพิ่มข้อมูล */ /** ไปหน้าเพิ่มข้อมูล */

View file

@ -170,10 +170,12 @@ async function addData() {
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
id.value = data; id.value = data;
success($q, "บันทึกรอบการสอบคนพิการสำเร็จ");
await uploadImgData(); await uploadImgData();
await uploadDocData(); await uploadDocData();
clickBack(); success($q, "บันทึกรอบการสอบคนพิการสำเร็จ");
setTimeout(() => {
clickBack();
}, 1200);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -195,7 +197,6 @@ async function editData(id: string) {
success($q, "แก้ไขรอบการสอบคนพิการสำเร็จ"); success($q, "แก้ไขรอบการสอบคนพิการสำเร็จ");
await uploadImgData(); await uploadImgData();
await uploadDocData(); await uploadDocData();
clickBack();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -324,9 +325,14 @@ async function uploadDocData() {
}) })
.finally(async () => { .finally(async () => {
hideLoader(); hideLoader();
setTimeout(() => {
clickBack();
}, 1200);
}); });
} else { } else {
clickBack(); setTimeout(() => {
clickBack();
}, 1200);
} }
} }

View file

@ -34,6 +34,7 @@ const {
showLoader, showLoader,
hideLoader, hideLoader,
onSearchDataTable, onSearchDataTable,
dialogRemove,
} = mixin; } = mixin;
const filter = ref<string>(""); //search data table const filter = ref<string>(""); //search data table
const initialPagination = ref<Pagination>({ const initialPagination = ref<Pagination>({
@ -140,7 +141,7 @@ const columns = ref<QTableProps["columns"]>([
}, },
]); ]);
async function fetchData() { async function fetchData(actionType?: string) {
showLoader(); showLoader();
await http await http
.get(config.API.periodExamType("all")) .get(config.API.periodExamType("all"))
@ -225,6 +226,9 @@ async function fetchData() {
}) })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
if (actionType == "delete") {
success($q, "ลบข้อมูลสำเร็จ");
}
}); });
} }
@ -232,41 +236,24 @@ function clickEdit(col: ResponsePeriodExam) {
router.push(`/qualify/period/${col.id}`); router.push(`/qualify/period/${col.id}`);
} }
function clickDelete(id: string) {
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
await deleteData(id);
})
.onCancel(() => {})
.onDismiss(() => {});
}
function clickAdd() { function clickAdd() {
router.push({ name: "qualifyPeriodAdd" }); router.push({ name: "qualifyPeriodAdd" });
} }
async function deleteData(id: string) { async function deleteData(id: string) {
showLoader(); dialogRemove($q, async () => {
await http showLoader();
.delete(config.API.periodExamId(id)) await http
.then((res) => { .delete(config.API.periodExamId(id))
success($q, "ลบข้อมูลสำเร็จ"); .then((res) => {})
}) .catch((e) => {
.catch((e) => { messageError($q, e);
messageError($q, e); hideLoader();
}) })
.finally(async () => { .finally(async () => {
hideLoader(); await fetchData("delete");
await fetchData(); });
}); });
} }
/** /**
@ -357,7 +344,7 @@ onMounted(async () => {
flat flat
round round
color="red" color="red"
@click="clickDelete(props.row.id)" @click="deleteData(props.row.id)"
icon="mdi-delete" icon="mdi-delete"
> >
<q-tooltip>ลบขอม</q-tooltip> <q-tooltip>ลบขอม</q-tooltip>

View file

@ -36,7 +36,7 @@ const route = useRoute();
const { const {
date2Thai, date2Thai,
success, success,
messageError, messageError,
showLoader, showLoader,
hideLoader, hideLoader,
@ -465,19 +465,22 @@ async function addData() {
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
id.value = data; id.value = data;
success($q, "บันทึกรอบคัดเลือกสำเร็จ");
await uploadImgData(); await uploadImgData();
await uploadDocData(); await uploadDocData();
await uploadBarCodes(); await uploadBarCodes();
await uploadQrCodes(); await uploadQrCodes();
await clickBack(); hideLoader();
success($q, "บันทึกรอบคัดเลือกสำเร็จ");
setTimeout(async () => {
await clickBack();
}, 1200);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
})
.finally(async () => {
hideLoader(); hideLoader();
}); })
.finally(async () => {});
} }
/** /**
@ -493,15 +496,18 @@ async function editData(id: string) {
await uploadDocData(); await uploadDocData();
await uploadBarCodes(); await uploadBarCodes();
await uploadQrCodes(); await uploadQrCodes();
hideLoader();
success($q, "แก้ไขรอบคัดเลือกสำเร็จ"); success($q, "แก้ไขรอบคัดเลือกสำเร็จ");
await clickBack(); setTimeout(async () => {
await clickBack();
}, 1200);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader(); hideLoader();
}); })
.finally(() => {});
} }
/** /**

View file

@ -216,9 +216,11 @@ const total = ref<number>(0);
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
async function fetchDataCom() { async function fetchDataCom() {
showLoader();
await fetchDataSummary(); await fetchDataSummary();
await fetchPeriodExam(); await fetchPeriodExam();
await fetchData(); await fetchData();
hideLoader();
} }
/** เปลี่ยน page */ /** เปลี่ยน page */
@ -269,13 +271,13 @@ async function fetchData(loading: boolean = true) {
}); });
}); });
} }
loading ?? hideLoader();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
hideLoader();
}) })
.finally(() => { .finally(() => {});
loading ?? hideLoader();
});
} }
/** ดึงข้อมูล สอบคัดเลือก */ /** ดึงข้อมูล สอบคัดเลือก */
@ -293,10 +295,9 @@ async function fetchPeriodExam() {
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader(); hideLoader();
}); })
.finally(() => {});
} }
/** /**
@ -320,10 +321,9 @@ async function fetchDataSummary() {
}) })
.catch((e) => { .catch((e) => {
dataNum.value = []; dataNum.value = [];
})
.finally(() => {
hideLoader(); hideLoader();
}); })
.finally(() => {});
} }
/** /**
@ -395,9 +395,8 @@ onMounted(async () => {
class="q-mr-sm" class="q-mr-sm"
@click="router.go(-1)" @click="router.go(-1)"
/> />
{{ name }}
{{ {{
`ครั้งที่${round == null ? "" : round}/${ `${name} ${round == null ? "" : 'ครั้งที่'+round+'/'}${
yearly == null ? "" : yearly + 543 yearly == null ? "" : yearly + 543
}` }`
}} }}