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>
</div>
</div>
<q-table
<d-table
ref="table"
flat
bordered
@ -189,52 +189,11 @@ function resetFilter() {
<template #body="props">
<slot v-bind="props" name="columns"></slot>
</template>
</q-table>
</d-table>
</template>
<style lang="scss">
.icon-color {
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>

View file

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

View file

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

View file

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

View file

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

View file

@ -34,6 +34,7 @@ const {
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
} = mixin;
const filter = ref<string>(""); //search data table
const initialPagination = ref<Pagination>({
@ -140,7 +141,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
async function fetchData() {
async function fetchData(actionType?: string) {
showLoader();
await http
.get(config.API.periodExamType("all"))
@ -225,6 +226,9 @@ async function fetchData() {
})
.finally(() => {
hideLoader();
if (actionType == "delete") {
success($q, "ลบข้อมูลสำเร็จ");
}
});
}
@ -232,41 +236,24 @@ function clickEdit(col: ResponsePeriodExam) {
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() {
router.push({ name: "qualifyPeriodAdd" });
}
async function deleteData(id: string) {
showLoader();
await http
.delete(config.API.periodExamId(id))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
await fetchData();
});
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.periodExamId(id))
.then((res) => {})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(async () => {
await fetchData("delete");
});
});
}
/**
@ -357,7 +344,7 @@ onMounted(async () => {
flat
round
color="red"
@click="clickDelete(props.row.id)"
@click="deleteData(props.row.id)"
icon="mdi-delete"
>
<q-tooltip>ลบขอม</q-tooltip>

View file

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

View file

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