diff --git a/src/modules/03_recruiting/components/Table.vue b/src/modules/03_recruiting/components/Table.vue
index 9f5b10543..ab22dbae1 100644
--- a/src/modules/03_recruiting/components/Table.vue
+++ b/src/modules/03_recruiting/components/Table.vue
@@ -165,7 +165,7 @@ function resetFilter() {
-
-
+
diff --git a/src/modules/03_recruiting/views/01_compete/Period.vue b/src/modules/03_recruiting/views/01_compete/Period.vue
index 4d6a37981..9d417f1af 100644
--- a/src/modules/03_recruiting/views/01_compete/Period.vue
+++ b/src/modules/03_recruiting/views/01_compete/Period.vue
@@ -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();
+ });
+ });
}
/** ไปหน้าเพิ่มรอบสอบแข่งขัน */
diff --git a/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue b/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue
index 75fe25a8f..1c928bf31 100644
--- a/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue
+++ b/src/modules/03_recruiting/views/01_compete/PeriodAdd.vue
@@ -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);
}
}
diff --git a/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue b/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue
index 3a987724b..1bfaa7718 100644
--- a/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue
+++ b/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue
@@ -32,6 +32,7 @@ const {
hideLoader,
date2Thai,
onSearchDataTable,
+ dialogRemove,
} = mixin;
const name = ref("");
@@ -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(() => {});
+ });
}
/** ไปหน้าเพิ่มข้อมูล */
diff --git a/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue b/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue
index 97de2e2f6..183eb9ef0 100644
--- a/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue
+++ b/src/modules/03_recruiting/views/02_qualify/DisablePeriodAdd.vue
@@ -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);
}
}
diff --git a/src/modules/03_recruiting/views/02_qualify/Period.vue b/src/modules/03_recruiting/views/02_qualify/Period.vue
index 13b58326d..f3a1a85b4 100644
--- a/src/modules/03_recruiting/views/02_qualify/Period.vue
+++ b/src/modules/03_recruiting/views/02_qualify/Period.vue
@@ -34,6 +34,7 @@ const {
showLoader,
hideLoader,
onSearchDataTable,
+ dialogRemove,
} = mixin;
const filter = ref(""); //search data table
const initialPagination = ref({
@@ -140,7 +141,7 @@ const columns = ref([
},
]);
-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"
>
ลบข้อมูล
diff --git a/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue b/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue
index c2490bc33..f1495cd85 100644
--- a/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue
+++ b/src/modules/03_recruiting/views/02_qualify/PeriodAdd.vue
@@ -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(() => {});
}
/**
diff --git a/src/modules/03_recruiting/views/02_qualify/manageDetail.vue b/src/modules/03_recruiting/views/02_qualify/manageDetail.vue
index 8617672c3..ec1e9ae0e 100644
--- a/src/modules/03_recruiting/views/02_qualify/manageDetail.vue
+++ b/src/modules/03_recruiting/views/02_qualify/manageDetail.vue
@@ -216,9 +216,11 @@ const total = ref(0);
const maxPage = ref(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
}`
}}