clone code
This commit is contained in:
parent
c9597d1e38
commit
d57bcd1719
362 changed files with 104804 additions and 0 deletions
421
src/modules/03_recruiting/views/01_compete/Detail.vue
Normal file
421
src/modules/03_recruiting/views/01_compete/Detail.vue
Normal file
|
|
@ -0,0 +1,421 @@
|
|||
<!-- page:detail page สรรหา -->
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
@click="router.go(-1)"
|
||||
/>
|
||||
รายชื่อผู้สมัครสอบรอบ {{ name }} ครั้งที่ {{ round }}/{{ year }}
|
||||
<q-space />
|
||||
<q-btn class="bg-teal-1" icon="mdi-download" round color="primary" flat>
|
||||
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 100px">
|
||||
<q-item clickable v-close-popup @click="downloadExam()">
|
||||
<q-item-section class="text-blue">ส่งออกข้อมูลผู้มีสิทธิ์สอบ</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadPassExam()">
|
||||
<q-item-section class="text-primary"
|
||||
>ส่งออกข้อมูลผู้สอบผ่านภาค ก.</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadPassResultExam()">
|
||||
<q-item-section class="text-amber-9"
|
||||
>ส่งออกข้อมูลผู้สอบแข่งขันได้</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 row q-mt-sm q-pt-sm q-pa-md">
|
||||
<div class="col-12">
|
||||
<Table
|
||||
:count="count"
|
||||
:pass="pass"
|
||||
:notpass="notpass"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
:filter="filter"
|
||||
:visible-columns="visibleColumns"
|
||||
v-model:inputfilter="filter"
|
||||
v-model:inputvisible="visibleColumns"
|
||||
:nornmalData="false"
|
||||
:conclude="true"
|
||||
>
|
||||
<template #columns="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="clickDetail(props.row.examID)"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'fullname'">
|
||||
<div class="row col-12 items-center">
|
||||
<img
|
||||
:src="props.row.avatar"
|
||||
class="q-mr-sm col-4"
|
||||
style="width: 28px; height: 28px; border-radius: 50%"
|
||||
/>
|
||||
<div class="col-4">
|
||||
<div class="text-weight-medium">
|
||||
{{ props.row.fullname }}
|
||||
</div>
|
||||
<div class="text-weight-light">
|
||||
{{ props.row.citizenId }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="col.name == 'c1'">
|
||||
<q-checkbox disable v-model="props.row.c1" />
|
||||
</div>
|
||||
<div v-else-if="col.name == 'c2'">
|
||||
<q-checkbox disable v-model="props.row.c2" />
|
||||
</div>
|
||||
<div v-else-if="col.name == 'c3'">
|
||||
<q-checkbox disable v-model="props.row.c3" />
|
||||
</div>
|
||||
<div v-else-if="col.name == 'c4'">
|
||||
<q-checkbox disable v-model="props.row.c4" />
|
||||
</div>
|
||||
<div v-else-if="col.name == 'c5'">
|
||||
<q-checkbox disable v-model="props.row.c5" />
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type { QTableProps } from "quasar";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import type { RecruitDetailResponse } from "@/modules/03_recruiting/interface/response/Period";
|
||||
import Table from "@/modules/03_recruiting/components/Table.vue";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
const dataStore = useDataStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { loaderPage } = dataStore;
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError } = mixin;
|
||||
const year = ref<string>("");
|
||||
const round = ref<string>("");
|
||||
const name = ref<string>("");
|
||||
const count = ref<number>(0);
|
||||
const pass = ref<number>(0);
|
||||
const notpass = ref<number>(0);
|
||||
const rows = ref<any>([]);
|
||||
const importId = ref<string>(route.params.id as string); // Period Import Id
|
||||
const filter = ref<string>(""); //search data table
|
||||
const visibleColumns = ref<String[]>([
|
||||
"examID",
|
||||
"profileID",
|
||||
"fullName",
|
||||
"dateOfBirth",
|
||||
"gender",
|
||||
"position_name",
|
||||
"university",
|
||||
"degree",
|
||||
"major",
|
||||
"certificateIssueDate",
|
||||
"certificateNo",
|
||||
"examAttribute",
|
||||
"examScore",
|
||||
"examResult",
|
||||
"applyDate",
|
||||
]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "examID",
|
||||
align: "left",
|
||||
label: "เลขประจำตัวสอบ",
|
||||
sortable: true,
|
||||
field: "examID",
|
||||
headerStyle: "font-size: 14px; min-width: 20px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "profileID",
|
||||
align: "left",
|
||||
label: "เลขประจำตัวประชาชน",
|
||||
sortable: true,
|
||||
field: "profileID",
|
||||
headerStyle: "font-size: 14px; min-width: 20px",
|
||||
style: "font-size: 14px; ",
|
||||
},
|
||||
{
|
||||
name: "fullName",
|
||||
align: "left",
|
||||
label: "ชื่อ-สกุล",
|
||||
sortable: true,
|
||||
field: "personName",
|
||||
headerStyle: "font-size: 14px; min-width: 250px",
|
||||
style: "font-size: 14px; ",
|
||||
},
|
||||
{
|
||||
name: "dateOfBirth",
|
||||
align: "left",
|
||||
label: "วัน เดือน ปีเกิด",
|
||||
sortable: true,
|
||||
field: "dateOfBirth",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "gender",
|
||||
align: "left",
|
||||
label: "เพศ",
|
||||
sortable: true,
|
||||
field: "gender",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "position_name",
|
||||
align: "left",
|
||||
label: "ตำแหน่งที่สมัคร",
|
||||
sortable: true,
|
||||
field: "position_name",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "university",
|
||||
align: "left",
|
||||
label: "สถานศึกษา",
|
||||
sortable: true,
|
||||
field: "university",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "degree",
|
||||
align: "left",
|
||||
label: "วุฒิการศึกษา",
|
||||
sortable: true,
|
||||
field: "degree",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "major",
|
||||
align: "left",
|
||||
label: "สาขาวิชาเอก",
|
||||
sortable: true,
|
||||
field: "major",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "certificateNo",
|
||||
align: "left",
|
||||
label: "เลขที่ใบประกอบวิชาชีพ",
|
||||
sortable: true,
|
||||
field: "certificateNo",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "certificateIssueDate",
|
||||
align: "left",
|
||||
label: "วันที่ได้รับใบประกอบวิชาชีพฯ",
|
||||
sortable: true,
|
||||
field: "certificateIssueDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examAttribute",
|
||||
align: "left",
|
||||
label: "สถานะการคัดกรองคุณสมบัติ",
|
||||
sortable: true,
|
||||
field: "examAttribute",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examScore",
|
||||
align: "right",
|
||||
label: "คะแนนรวม",
|
||||
sortable: true,
|
||||
field: "examScore",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examResult",
|
||||
align: "left",
|
||||
label: "ผลการสอบ",
|
||||
sortable: true,
|
||||
field: "examResult",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "applyDate",
|
||||
align: "left",
|
||||
label: "วันที่สมัครสอบ",
|
||||
sortable: true,
|
||||
field: "applyDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
await fetchData();
|
||||
});
|
||||
|
||||
const clickDetail = (examID: string) => {
|
||||
router.push(`/compete/import/${importId.value}/${examID}`);
|
||||
};
|
||||
|
||||
const downloadExam = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.exportExam(importId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายชื่อผู้มีสิทธิ์สอบ.xlsx`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const downloadPassExam = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.exportPassExam(importId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายชื่อสอบผ่านภาค_ก.xlsx`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const downloadPassResultExam = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.exportPassResultExam(importId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายชื่อสอบแข่งขันได้.xlsx`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.post(config.API.getExamResultById(importId.value), {
|
||||
examAttribute: "",
|
||||
examResult: "",
|
||||
})
|
||||
.then((res) => {
|
||||
var header = res.data.result.header;
|
||||
count.value = header.count;
|
||||
pass.value = header.pass;
|
||||
notpass.value = header.notpass;
|
||||
const data = res.data.result.data;
|
||||
let result: RecruitDetailResponse[] = [];
|
||||
if (data.length > 0) {
|
||||
data.map((r: RecruitDetailResponse) => {
|
||||
r.personName = `${r.prefix}${r.fullName}`;
|
||||
result.push(r);
|
||||
});
|
||||
}
|
||||
rows.value = result;
|
||||
name.value = result[0].exam_name as string;
|
||||
round.value = result[0].exam_order as string;
|
||||
year.value = result[0].score_year as string;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
340
src/modules/03_recruiting/views/01_compete/DetailEx.vue
Normal file
340
src/modules/03_recruiting/views/01_compete/DetailEx.vue
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
<!-- page:detail page สรรหา -->
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
@click="router.go(-1)"
|
||||
/>
|
||||
รายละเอียดของผู้สมัครสอบ {{ examID }} : {{ prefix }}{{ fullname }}
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 row q-mt-sm q-pa-md">
|
||||
<div class="row q-col-gutter-md col-12">
|
||||
<div class="col-xs-12 col-sm-12 col-md-6">
|
||||
<q-card bordered flat class="col-12 q-pa-md">
|
||||
<div class="col-12 q-col-gutter-sm row items-center">
|
||||
<div class="col-12 text-weight-bold">ข้อมูลทั่วไป</div>
|
||||
<div class="col-6 text-grey-7" v-if="profile_id !== null">
|
||||
เลขประจำตัวประชาชน
|
||||
</div>
|
||||
<div class="col-6 text-black" v-if="profile_id !== null">
|
||||
{{ profile_id }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="prefix !== null">คำนำหน้านาม</div>
|
||||
<div class="col-6 text-black" v-if="prefix !== null">
|
||||
{{ prefix }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="fullname !== null">ชื่อ-นามสกุล</div>
|
||||
<div class="col-6 text-black" v-if="fullname !== null">
|
||||
{{ fullname }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="birthdate !== null">
|
||||
วัน/เดือน/ปี เกิด
|
||||
</div>
|
||||
<div class="col-6 text-black" v-if="birthdate !== null">
|
||||
{{ birthdate }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="gender !== null">เพศ</div>
|
||||
<div class="col-6 text-black" v-if="gender !== null">
|
||||
{{ gender }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="position_name !== null">
|
||||
ตำแหน่งที่สมัคร
|
||||
</div>
|
||||
<div class="col-6 text-black" v-if="position_name !== null">
|
||||
{{ position_name }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="university !== null">สถานศึกษา</div>
|
||||
<div class="col-6 text-black" v-if="university !== null">
|
||||
{{ university }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="degree !== null">วุฒิการศึกษา</div>
|
||||
<div class="col-6 text-black" v-if="degree !== null">
|
||||
{{ degree }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="major !== null">สาขาวิชาเอก</div>
|
||||
<div class="col-6 text-black" v-if="major !== null">
|
||||
{{ major }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="major !== null">
|
||||
จำนวนครั้งที่สมัครสอบ
|
||||
</div>
|
||||
<div class="col-6 text-black" v-if="major !== null">
|
||||
{{ examCount }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="cert_issuedate !== null">
|
||||
ใบอนุญาตประกอบวิชาชีพ วัน เดือน ปีที่ได้รับ
|
||||
</div>
|
||||
<div class="col-6 text-black" v-if="cert_issuedate !== null">
|
||||
{{ cert_issuedate }}
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-grey-7" v-if="examAttribute !== null">
|
||||
สถานะการคัดกรองคุณสมบัติ
|
||||
</div>
|
||||
<div class="col-6 text-black" v-if="examAttribute !== null">
|
||||
{{ examAttribute }}
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-6">
|
||||
<q-card
|
||||
bordered
|
||||
flat
|
||||
class="col-xs-12 col-sm-12 col-md-6 q-px-md q-py-sm full-height"
|
||||
>
|
||||
<div class="col-12 row q-col-gutter-sm">
|
||||
<div class="col-12 text-weight-bold row items-center">
|
||||
ผลการสอบ
|
||||
<q-space />
|
||||
<q-btn
|
||||
color="primary"
|
||||
flat
|
||||
round
|
||||
icon="mdi-download"
|
||||
v-if="examResultinscore === 'ผ่าน'"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 100px">
|
||||
<q-item clickable v-close-popup @click="downloadScore()">
|
||||
<q-item-section class="text-primary"
|
||||
>ดาวน์โหลดผลคะแนน</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadCertificate()">
|
||||
<q-item-section class="text-blue"
|
||||
>ดาวน์โหลดเอกสารรับรอง</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-else
|
||||
color="blue"
|
||||
flat
|
||||
round
|
||||
icon="mdi-download"
|
||||
@click="downloadScore()"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดผลคะแนน</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<div class="row items-center q-gutter-y-sm col-12">
|
||||
<div class="col-xs-4 col-sm-5 text-weight-medium text-grey-7">ประเภท</div>
|
||||
<div class="col-xs-3 col-sm-2 text-primary text-weight-bold">คะแนนเต็ม</div>
|
||||
<div class="col-xs-3 col-sm-2 text-primary text-weight-bold">
|
||||
คะแนนที่ได้
|
||||
</div>
|
||||
<div class="col-xs-2 col-sm-2 text-primary text-weight-bold"></div>
|
||||
|
||||
<div class="col-xs-4 col-sm-5 text-grey-7">ภาค ก</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreAFull }}
|
||||
</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreA }}
|
||||
</div>
|
||||
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
|
||||
|
||||
<div class="col-xs-4 col-sm-5 text-grey-7">ภาค ข</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreBFull }}
|
||||
</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreB }}
|
||||
</div>
|
||||
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
|
||||
|
||||
<div class="col-xs-4 col-sm-5 text-grey-7">ภาค ค</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreCFull }}
|
||||
</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreC }}
|
||||
</div>
|
||||
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
|
||||
|
||||
<div class="col-xs-4 col-sm-5 text-grey-7">รวมทั้งหมด</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreSumFull }}
|
||||
</div>
|
||||
<div class="col-xs-3 col-sm-2 q-pr-xs">
|
||||
{{ scoreSum }}
|
||||
</div>
|
||||
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
|
||||
|
||||
<div class="col-xs-4 col-sm-5 text-weight-bold q-pt-sm">ผลการสอบ</div>
|
||||
<div class="col-xs-8 col-sm-6 q-pr-xs text-weight-bold text-subtitle1">
|
||||
<span
|
||||
:class="examResultinscore != 'ผ่าน' ? 'text-red' : 'text-positive'"
|
||||
>{{ examResultinscore }}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-5 text-grey-7">ลำดับที่สอบได้</div>
|
||||
<div class="col-xs-6 col-sm-7 q-pr-xs">
|
||||
{{ number }}
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-5 text-grey-7">วันหมดอายุบัญชีสอบแข่งขัน</div>
|
||||
<div class="col-xs-6 col-sm-7 q-pr-xs">
|
||||
{{ score_expired }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
const dataStore = useDataStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { loaderPage } = dataStore;
|
||||
const profile_id = ref<string>("");
|
||||
const birthdate = ref<string>("");
|
||||
const gender = ref<string>("");
|
||||
const university = ref<string>("");
|
||||
const position_name = ref<string>("");
|
||||
const degree = ref<string>("");
|
||||
const major = ref<string>("");
|
||||
const cert_issuedate = ref<string>("");
|
||||
const examAttribute = ref<string>("");
|
||||
const examResultinscore = ref<string>("");
|
||||
const scoreAFull = ref<string>("");
|
||||
const scoreA = ref<string>("");
|
||||
const scoreBFull = ref<string>("");
|
||||
const scoreB = ref<string>("");
|
||||
const scoreCFull = ref<string>("");
|
||||
const scoreC = ref<string>("");
|
||||
const scoreSumFull = ref<string>("");
|
||||
const scoreSum = ref<string>("");
|
||||
const examCount = ref<string>("");
|
||||
const number = ref<string>("");
|
||||
const score_expired = ref<string>("");
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError } = mixin;
|
||||
const examID = ref<string>("62150001");
|
||||
const prefix = ref<string>("นาย");
|
||||
const fullname = ref<string>("เกียรติศักดิ์ บัณฑิต");
|
||||
const importId = ref<string>(route.params.id as string); // Period Import Id
|
||||
const examId = ref<string>(route.params.examId as string); // เลขประจำตัวสอบ
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchData();
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getExamDetail(importId.value, examId.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
|
||||
profile_id.value = data.profileID;
|
||||
examID.value = data.examID;
|
||||
prefix.value = data.prefix;
|
||||
fullname.value = data.fullName;
|
||||
birthdate.value = data.dateOfBirth;
|
||||
gender.value = data.gender;
|
||||
degree.value = data.degree;
|
||||
major.value = data.major;
|
||||
university.value = data.university;
|
||||
position_name.value = data.positionName;
|
||||
cert_issuedate.value = data.certificateIssueDate;
|
||||
examAttribute.value = data.examAttribute;
|
||||
number.value = data.number;
|
||||
examCount.value = data.examCount;
|
||||
score_expired.value = data.scoreExpire;
|
||||
if (data.scoreResult != null) {
|
||||
scoreAFull.value = data.scoreResult.scoreAFull;
|
||||
scoreA.value = data.scoreResult.scoreA;
|
||||
scoreBFull.value = data.scoreResult.scoreBFull;
|
||||
scoreB.value = data.scoreResult.scoreB;
|
||||
scoreCFull.value = data.scoreResult.scoreCFull;
|
||||
scoreC.value = data.scoreResult.scoreC;
|
||||
scoreSumFull.value = data.scoreResult.scoreSumFull;
|
||||
scoreSum.value = data.scoreResult.scoreSum;
|
||||
examResultinscore.value = data.scoreResult.examResult;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const downloadScore = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.downloadScoreReport(importId.value, examId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `ผลคะแนน_${examId.value}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const downloadCertificate = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.downloadExamReport(importId.value, examId.value, 2), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `เอกสารรับรอง_${examId.value}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
213
src/modules/03_recruiting/views/01_compete/ImportData.vue
Normal file
213
src/modules/03_recruiting/views/01_compete/ImportData.vue
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
<!-- page:main page สรรหา -->
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการนำเข้าข้อมูลผู้สมัครสอบแข่งขัน
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
|
||||
<div>
|
||||
<Table
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
:filter="filter"
|
||||
:visible-columns="visibleColumns"
|
||||
v-model:inputfilter="filter"
|
||||
v-model:inputvisible="visibleColumns"
|
||||
:nornmalData="false"
|
||||
>
|
||||
<template #columns="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name == 'no'" @click="clickEdit(props.row.year)">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div
|
||||
v-else-if="col.name == 'name'"
|
||||
class="table_ellipsis2"
|
||||
@click="clickEdit(props.row.year)"
|
||||
>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'file'">
|
||||
<q-btn
|
||||
size="13px"
|
||||
flat
|
||||
class="bg-blue-1 q-ml-xs"
|
||||
color="blue"
|
||||
v-if="col.value == null || file == false"
|
||||
>
|
||||
<q-icon
|
||||
name="mdi-file-excel-outline"
|
||||
size="20px"
|
||||
class="q-mr-sm"
|
||||
/>
|
||||
นำเข้าไฟล์
|
||||
<q-tooltip>นำเข้าไฟล์ excel</q-tooltip>
|
||||
</q-btn>
|
||||
<div v-else>
|
||||
<q-chip
|
||||
removable
|
||||
color="grey-2"
|
||||
text-color="grey-9"
|
||||
:label="col.value"
|
||||
size="14px"
|
||||
square
|
||||
icon-remove="mdi-close"
|
||||
v-model="file"
|
||||
@remove="remove"
|
||||
>
|
||||
<q-tooltip>{{ col.value }}</q-tooltip>
|
||||
</q-chip>
|
||||
<q-btn
|
||||
size="14px"
|
||||
flat
|
||||
dense
|
||||
color="positive"
|
||||
icon="mdi-content-save-settings-outline"
|
||||
>
|
||||
<q-tooltip>บันทึกคะแนนสอบ</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else @click="clickEdit(props.row.year)">
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type { QTableProps } from "quasar";
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import Table from "@/modules/03_recruiting/components/Table.vue";
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
const router = useRouter();
|
||||
const file = ref<boolean>(true);
|
||||
const filter = ref<string>(""); //search data table
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"year",
|
||||
"name",
|
||||
"startDate",
|
||||
"endDate",
|
||||
"file",
|
||||
]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "no",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "year",
|
||||
align: "left",
|
||||
label: "ปีงบประมาณ",
|
||||
sortable: true,
|
||||
field: "year",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อระยะเวลาการสอบแข่งขัน",
|
||||
sortable: true,
|
||||
field: "name",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "doc",
|
||||
align: "left",
|
||||
label: "เอกสารประกอบ",
|
||||
sortable: true,
|
||||
field: "doc",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "startDate",
|
||||
align: "left",
|
||||
label: "วันที่เริ่มต้น",
|
||||
sortable: true,
|
||||
field: "startDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "endDate",
|
||||
align: "left",
|
||||
label: "วันที่สิ้นสุด",
|
||||
sortable: true,
|
||||
field: "endDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "file",
|
||||
align: "left",
|
||||
label: "เอกสารข้อมูลผู้สอบ",
|
||||
sortable: true,
|
||||
field: "file",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const rows = ref<any>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchData();
|
||||
});
|
||||
|
||||
const fetchData = () => {};
|
||||
|
||||
const clickEdit = (id: string) => {
|
||||
router.push(`/compete/import/${id}`);
|
||||
};
|
||||
|
||||
const remove = () => {
|
||||
$q.dialog({
|
||||
title: "ยืนยันการลบเอกสารข้อมูล",
|
||||
message: "ต้องการลบเอกสารนี้ใช่หรือไม่?",
|
||||
cancel: {
|
||||
flat: true,
|
||||
color: "negative",
|
||||
},
|
||||
persistent: true,
|
||||
})
|
||||
.onOk(() => {
|
||||
file.value = false;
|
||||
})
|
||||
.onCancel(() => {
|
||||
file.value = true;
|
||||
})
|
||||
.onDismiss(() => {});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
767
src/modules/03_recruiting/views/01_compete/Period.vue
Normal file
767
src/modules/03_recruiting/views/01_compete/Period.vue
Normal file
|
|
@ -0,0 +1,767 @@
|
|||
<!-- page:จัดการรอบการสอบ สรรหา -->
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
จัดการข้อมูลผู้สมัครสอบแข่งขัน
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
|
||||
<div>
|
||||
<Table
|
||||
style="max-height: 80vh"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
:filter="filter"
|
||||
:visible-columns="visibleColumns"
|
||||
v-model:inputfilter="filter"
|
||||
v-model:inputvisible="visibleColumns"
|
||||
:pagination="initialPagination"
|
||||
:nornmalData="true"
|
||||
:add="clickAdd"
|
||||
:paging="true"
|
||||
:titleText="''"
|
||||
>
|
||||
<template #columns="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="clickDetail(props.row.id)"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'name'" class="table_ellipsis2">
|
||||
{{ col.value }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'year'" class="table_ellipsis2">
|
||||
{{ col.value + 543 }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'scoreCount'" class="table_ellipsis2">
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
round
|
||||
color="green"
|
||||
@click.stop.prevent="clickEdit(props.row.id)"
|
||||
v-if="col.value == null"
|
||||
>
|
||||
<q-icon name="mdi-file-excel-outline" size="20px" />
|
||||
<!-- นำเข้าไฟล์ผลการสอบ -->
|
||||
<q-tooltip>นำเข้าไฟล์ผลการสอบ</q-tooltip>
|
||||
</q-btn>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="green"
|
||||
@click.stop.prevent="clickEdit(props.row.id)"
|
||||
icon="mdi-file-excel-outline"
|
||||
>
|
||||
<q-tooltip>นำเข้าไฟล์ผลการสอบอีกครั้ง</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="indigo"
|
||||
@click.stop.prevent="clickPassExam(props.row.id)"
|
||||
icon="mdi-clipboard-arrow-down"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดรายชื่อผู้สอบแข่งขันได้</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="col.name == 'examCount'" class="table_ellipsis2">
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
color="green"
|
||||
round
|
||||
@click.stop.prevent="clickUpload(props.row.id)"
|
||||
v-if="col.value == null || col.value == '0'"
|
||||
>
|
||||
<q-icon name="mdi-file-excel-outline" size="20px" />
|
||||
<q-tooltip>นำเข้าไฟล์ผู้สมัครสอบ</q-tooltip>
|
||||
</q-btn>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="green"
|
||||
@click.stop.prevent="clickUpload(props.row.id)"
|
||||
icon="mdi-file-excel-outline"
|
||||
>
|
||||
<q-tooltip>นำเข้าไฟล์ผู้สมัครสอบอีกครั้ง</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="indigo"
|
||||
@click.stop.prevent="clickCandidateList(props.row.id)"
|
||||
icon="mdi-clipboard-arrow-down"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td>
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
@click="clickEditPeriod(props.row.id)"
|
||||
icon="mdi-pencil-outline"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
@click="clickDelete(props.row.id)"
|
||||
icon="mdi-delete"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-btn
|
||||
color="info"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
size="12px"
|
||||
icon="mdi-history"
|
||||
@click="clickHistory(props.row.id)"
|
||||
>
|
||||
<q-tooltip>แสดงประวัติการทำงาน</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
<HistoryTable
|
||||
:rows="rowsHistory"
|
||||
:columns="columnsHistory"
|
||||
:visible-columns="visibleColumnsHistory"
|
||||
v-model:modal="modalHistory"
|
||||
v-model:inputvisible="visibleColumnsHistory"
|
||||
v-model:tittle="tittleHistory"
|
||||
>
|
||||
<template #columns="props">
|
||||
<q-tr :props="props">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name == 'isActive'" class="">
|
||||
<q-icon
|
||||
v-if="col.value == false"
|
||||
name="mdi-close"
|
||||
color="red"
|
||||
class="text-h5"
|
||||
/>
|
||||
<q-icon v-else name="mdi-check" color="positive" class="text-h5" />
|
||||
</div>
|
||||
<div v-else-if="col.name == 'createdAt'" class="">
|
||||
{{ textDate(col.value) }}
|
||||
</div>
|
||||
|
||||
<div v-else class="">
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</HistoryTable>
|
||||
|
||||
<!-- popup Edit window-->
|
||||
<q-dialog v-model="modalAdd" persistent>
|
||||
<q-card style="width: 600px">
|
||||
<q-form ref="myForm">
|
||||
<DialogHeader :tittle="textTittle" :close="clickClose" />
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="col-12 row items-center q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="name"
|
||||
label="ชื่อการสอบแข่งขัน"
|
||||
dense
|
||||
autogrow
|
||||
lazy-rules
|
||||
autofocus
|
||||
hide-bottom-space
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="order"
|
||||
label="ครั้งที่"
|
||||
dense
|
||||
autogrow
|
||||
lazy-rules
|
||||
autofocus
|
||||
hide-bottom-space
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="year"
|
||||
label="ปีงบประมาณ"
|
||||
dense
|
||||
autogrow
|
||||
lazy-rules
|
||||
autofocus
|
||||
hide-bottom-space
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-file
|
||||
v-model="files"
|
||||
dense
|
||||
label="เลือกไฟล์รายชื่อผู้สมัครสอบแข่งขัน"
|
||||
outlined
|
||||
use-chips
|
||||
multiple
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" />
|
||||
</template>
|
||||
</q-file>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions class="text-primary q-py-sm">
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="public"
|
||||
@click="checkSave"
|
||||
icon="mdi-content-save-outline"
|
||||
>
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog v-model="modalScore" persistent>
|
||||
<q-card style="width: 600px">
|
||||
<q-form ref="myFormScore">
|
||||
<DialogHeader :tittle="textTittleScore" :close="clickCloseScore" />
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="col-12 row items-center q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-file
|
||||
v-model="files_score"
|
||||
dense
|
||||
label="เลือกไฟล์ผลการสอบแข่งขัน"
|
||||
outlined
|
||||
use-chips
|
||||
multiple
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" />
|
||||
</template>
|
||||
</q-file>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions class="text-primary q-py-sm">
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="public"
|
||||
@click="checkSaveScore"
|
||||
icon="mdi-content-save-outline"
|
||||
>
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog v-model="modalCandidate" persistent>
|
||||
<q-card style="width: 600px">
|
||||
<q-form ref="myFormScore">
|
||||
<DialogHeader :tittle="textTittleCandidate" :close="clickCloseCandidate" />
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="col-12 row items-center q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-file
|
||||
v-model="files_candidate"
|
||||
dense
|
||||
label="เลือกไฟล์ผู้สมัครสอบแข่งขัน"
|
||||
outlined
|
||||
use-chips
|
||||
multiple
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" />
|
||||
</template>
|
||||
</q-file>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions class="text-primary q-py-sm">
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="public"
|
||||
@click="checkSaveCandidate"
|
||||
icon="mdi-content-save-outline"
|
||||
>
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type { QTableProps } from "quasar";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type {
|
||||
ResponseRecruitPeriod,
|
||||
ResponseHistoryObject,
|
||||
} from "@/modules/03_recruiting/interface/response/Period";
|
||||
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
||||
import Table from "@/modules/03_recruiting/components/Table.vue";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import HistoryTable from "@/components/TableHistory.vue";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const router = useRouter();
|
||||
const name = ref<string>("");
|
||||
const year = ref<number>(new Date().getFullYear() + 543);
|
||||
const order = ref<number>(1);
|
||||
const mixin = useCounterMixin();
|
||||
const { success, dateToISO, dateText } = mixin;
|
||||
const files = ref<any>(null);
|
||||
const files_score = ref<any>(null);
|
||||
const files_candidate = ref<any>(null);
|
||||
const modalAdd = ref<boolean>(false);
|
||||
const modalScore = ref<boolean>(false);
|
||||
const modalCandidate = ref<boolean>(false);
|
||||
const selected_row_id = ref<string>("");
|
||||
const rowsHistory = ref<ResponseHistoryObject[]>([]); //select data history
|
||||
const tittleHistory = ref<string>("ประวัติการนำเข้าข้อมูล"); //
|
||||
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||
const modalError = ref<boolean>(false); // modal สำหรับแจ้งเตือนerror
|
||||
const modalErrorTittle = ref<string>(""); // tittle modal error
|
||||
const modalErrorDetail = ref<string>(""); // detail modal error
|
||||
const statusCode = ref<number>();
|
||||
const filter = ref<string>(""); //search data table
|
||||
const textTittle = ref<string>("");
|
||||
const { messageError } = mixin;
|
||||
const textTittleScore = ref<string>("");
|
||||
const textTittleCandidate = ref<string>("");
|
||||
const rows = ref<any>([]);
|
||||
const initialPagination = ref<Pagination>({
|
||||
rowsPerPage: 0,
|
||||
});
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"name",
|
||||
"order",
|
||||
"year",
|
||||
"examCount",
|
||||
"scoreCount",
|
||||
]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "no",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "รอบการสอบแข่งขัน",
|
||||
sortable: true,
|
||||
field: "name",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "order",
|
||||
align: "left",
|
||||
label: "ครั้งที่",
|
||||
sortable: true,
|
||||
field: "order",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "year",
|
||||
align: "left",
|
||||
label: "ปีงบประมาณ",
|
||||
sortable: true,
|
||||
field: "year",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "examCount",
|
||||
label: "จำนวนผู้สอบทั้งหมด",
|
||||
align: "right",
|
||||
field: "examCount",
|
||||
sortable: true,
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "scoreCount",
|
||||
label: "จำนวนที่บันทึกผลสอบ",
|
||||
align: "right",
|
||||
field: "scoreCount",
|
||||
sortable: true,
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
const columnsHistory = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "description",
|
||||
align: "left",
|
||||
label: "รายละเอียด",
|
||||
sortable: true,
|
||||
field: "description",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "createdAt",
|
||||
align: "center",
|
||||
label: "วันที่ดำเนินการ",
|
||||
sortable: true,
|
||||
field: "createdAt",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "createdFullName",
|
||||
align: "left",
|
||||
label: "ผู้ดำเนินการ",
|
||||
sortable: true,
|
||||
field: "createdFullName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: "base",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
const visibleColumnsHistory = ref<String[]>([
|
||||
"description",
|
||||
"createdAt",
|
||||
"createdFullName",
|
||||
]);
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
await fetchData();
|
||||
});
|
||||
|
||||
/**
|
||||
* ฟังก์ชันแปลง date เป็นภาษาไทย
|
||||
* @param value วันที่ type datetime ที่จะแปลงเป็นไทย
|
||||
*/
|
||||
const textDate = (value: Date) => {
|
||||
return dateText(value);
|
||||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getCandidates)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let result: ResponseRecruitPeriod[] = [];
|
||||
if (data.length > 0) {
|
||||
data.map((r: ResponseRecruitPeriod) => {
|
||||
if (r.score != null) {
|
||||
r.scoreCount = r.score.scoreCount;
|
||||
r.scoreImportDate = r.score.importDate;
|
||||
}
|
||||
result.push(r);
|
||||
});
|
||||
}
|
||||
|
||||
rows.value = result;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const clickPassExam = (id: string) => {
|
||||
window.open(config.API.exportPassExamList(id));
|
||||
};
|
||||
|
||||
const clickCandidateList = (id: string) => {
|
||||
window.open(config.API.exportCandidateList(id));
|
||||
};
|
||||
|
||||
const clickDetail = (id: string) => {
|
||||
router.push(`/compete/import/${id}`);
|
||||
};
|
||||
|
||||
const clickEdit = async (id: string) => {
|
||||
modalScore.value = true;
|
||||
textTittleScore.value = "นำเข้าผลการสอบแข่งขัน";
|
||||
selected_row_id.value = id;
|
||||
};
|
||||
|
||||
const clickUpload = async (id: string) => {
|
||||
modalCandidate.value = true;
|
||||
textTittleCandidate.value = "นำเข้าผู้สมัครสอบแข่งขัน";
|
||||
selected_row_id.value = id;
|
||||
};
|
||||
|
||||
const clickEditPeriod = (id: string) => {
|
||||
router.push(`/compete/period/${id}`);
|
||||
};
|
||||
|
||||
const clickHistory = async (id: string) => {
|
||||
modalHistory.value = true;
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getImportHistory(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
rowsHistory.value = [];
|
||||
if (data.length > 0) {
|
||||
data.map((i: ResponseHistoryObject) => {
|
||||
rowsHistory.value.push({
|
||||
createdAt: i.createdAt,
|
||||
createdFullName: i.createdFullName,
|
||||
createdUserId: i.createdUserId,
|
||||
id: i.id,
|
||||
isActive: i.isActive,
|
||||
lastUpdateFullName: i.lastUpdateFullName,
|
||||
lastUpdateUserId: i.lastUpdateUserId,
|
||||
lastUpdatedAt: i.lastUpdatedAt,
|
||||
description: i.description,
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
modalError.value = true;
|
||||
modalErrorTittle.value = "ไม่พบประวัติการเผยแพร่";
|
||||
modalErrorDetail.value = e.response.data.message;
|
||||
statusCode.value = e.response.data.status;
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const clickDelete = (id: string) => {
|
||||
$q.dialog({
|
||||
title: "ยืนยันการลบข้อมูล",
|
||||
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
|
||||
cancel: {
|
||||
flat: true,
|
||||
color: "negative",
|
||||
},
|
||||
persistent: true,
|
||||
})
|
||||
.onOk(async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.delete(config.API.deleteCandidates(id))
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลการสอบสำเร็จ");
|
||||
fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
})
|
||||
.onCancel(() => {})
|
||||
.onDismiss(() => {});
|
||||
};
|
||||
|
||||
const clickAdd = () => {
|
||||
router.push({ name: "competePeriodAdd" });
|
||||
};
|
||||
|
||||
const clickClose = async () => {
|
||||
modalAdd.value = false;
|
||||
await fetchData();
|
||||
};
|
||||
|
||||
const clickCloseScore = async () => {
|
||||
modalScore.value = false;
|
||||
await fetchData();
|
||||
};
|
||||
|
||||
const clickCloseCandidate = async () => {
|
||||
modalCandidate.value = false;
|
||||
await fetchData();
|
||||
};
|
||||
|
||||
const checkSaveCandidate = async () => {
|
||||
const fd = new FormData();
|
||||
fd.append("attachment", files_candidate.value[0]);
|
||||
loaderPage(true);
|
||||
await http
|
||||
.post(config.API.uploadCandidates(selected_row_id.value), fd)
|
||||
.then((res) => {
|
||||
success($q, "นำเข้าข้อมูลผู้สมัครสอบสำเร็จ");
|
||||
modalCandidate.value = false;
|
||||
selected_row_id.value = "";
|
||||
fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const checkSaveScore = async () => {
|
||||
const fd = new FormData();
|
||||
fd.append("attachment", files_score.value[0]);
|
||||
loaderPage(true);
|
||||
await http
|
||||
.post(config.API.saveScores(selected_row_id.value), fd)
|
||||
.then((res) => {
|
||||
success($q, "นำเข้าข้อมูลผลการสอบสำเร็จ");
|
||||
modalScore.value = false;
|
||||
selected_row_id.value = "";
|
||||
fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const checkSave = async () => {
|
||||
const fd = new FormData();
|
||||
fd.append("attachment", files.value[0]);
|
||||
fd.append("year", year.value.toString());
|
||||
fd.append("order", order.value.toString());
|
||||
fd.append("name", name.value);
|
||||
loaderPage(true);
|
||||
await http
|
||||
.post(config.API.saveCandidates, fd)
|
||||
.then((res) => {
|
||||
success($q, "นำเข้าข้อมูลผู้สมัครสอบแข่งขันสำเร็จ");
|
||||
modalAdd.value = false;
|
||||
fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
987
src/modules/03_recruiting/views/01_compete/PeriodAdd.vue
Normal file
987
src/modules/03_recruiting/views/01_compete/PeriodAdd.vue
Normal file
|
|
@ -0,0 +1,987 @@
|
|||
<!-- page:จัดการรอบการสอบแข่งขัน สรรหา -->
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
@click="clickBack"
|
||||
/>
|
||||
{{ edit ? "แก้ไขข้อมูลการสอบแข่งขัน" : "เพิ่มข้อมูลการสอบแข่งขัน" }}
|
||||
</div>
|
||||
<q-card flat bordered class="col-12">
|
||||
<q-form ref="myForm">
|
||||
<q-card-section class="q-pa-md">
|
||||
<div class="col-xs-12 col-sm-8"></div>
|
||||
<div class="col-12 row items-center q-col-gutter-x-sm">
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="name"
|
||||
label="ชื่อรอบการสอบแข่งขัน/ชื่อประกาศ"
|
||||
dense
|
||||
lazy-rules
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกชื่อรอบการสอบแข่งขัน/ชื่อประกาศ'}`]"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4 col-md-1" v-if="announcementExam">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="round"
|
||||
type="number"
|
||||
label="รอบการสอบ(ครั้ง)"
|
||||
dense
|
||||
lazy-rules
|
||||
:rules="[(val) => val > 0 || `${'กรุณากรอกรอบการสอบให้ถูกต้อง'}`]"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4 col-md-1" v-if="announcementExam">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="yearly"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:modelValue="updateYear"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
:model-value="yearly + 543"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกปีงบประมาณ'}`]"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4 col-md-2" v-if="announcementExam">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="fee"
|
||||
type="number"
|
||||
label="ค่าธรรมเนียม"
|
||||
dense
|
||||
lazy-rules
|
||||
input-class="text-right"
|
||||
:rules="[(val) => val >= 0 || `${'กรุณากรอกค่าธรรมเนียมให้ถูกต้อง'}`]"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3" v-if="announcementExam">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateExam"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker q-mb-md"
|
||||
:model-value="date2Thai(dateExam)"
|
||||
:label="`${'วันที่สอบ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateAnnouncement"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
range
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker q-mb-md"
|
||||
:model-value="dateThaiRange(dateAnnouncement)"
|
||||
:label="`${'วันที่ประกาศ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3" v-if="announcementExam">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateRegister"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
range
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker q-mb-md"
|
||||
:model-value="dateThaiRange(dateRegister)"
|
||||
:label="`${'วันที่สมัคร'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3" v-if="announcementExam">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="datePayment"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
range
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker q-mb-md"
|
||||
:model-value="dateThaiRange(datePayment)"
|
||||
:label="`${'วันที่ชำระเงิน'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-3 col-md-3" v-if="announcementExam">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateAnnounce"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker q-mb-md"
|
||||
:model-value="date2Thai(dateAnnounce)"
|
||||
:label="`${'วันประกาศผลสอบ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-separator size="5px" color="grey-2" />
|
||||
</div>
|
||||
|
||||
<div class="row col-12 items-top q-col-gutter-x-sm">
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<div class="text-bold text-subtitle2 q-pb-sm">รูปภาพประกอบ</div>
|
||||
<div class="row justify-center row col-12">
|
||||
<q-uploader
|
||||
color="gray"
|
||||
type="file"
|
||||
flat
|
||||
ref="uploader"
|
||||
class="full-width"
|
||||
text-color="dark"
|
||||
:max-size="10000000"
|
||||
accept=".jpg,.png,.pdf,.csv,.doc"
|
||||
bordered
|
||||
label="[ไฟล์ jpg,png,pdf,csv,doc ขนาดไม่เกิน 10MB]"
|
||||
multiple
|
||||
@added="fileUploadImg"
|
||||
@removed="fileRemoveImg"
|
||||
>
|
||||
<template v-slot:header="scope">
|
||||
<div class="row no-wrap items-center q-pa-sm q-gutter-xs text-white">
|
||||
<q-btn
|
||||
v-if="scope.queuedFiles.length > 0"
|
||||
icon="clear_all"
|
||||
@click="scope.removeQueuedFiles"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-tooltip>ลบทั้งหมด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="scope.uploadedFiles.length > 0"
|
||||
icon="done_all"
|
||||
@click="scope.removeUploadedFiles"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-tooltip>ลบไฟล์ที่อัปโหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-spinner v-if="scope.isUploading" class="q-uploader__spinner" />
|
||||
<div class="col">
|
||||
<div class="q-uploader__title">
|
||||
{{ "[ไฟล์ jpg,png,pdf,csv,doc ขนาดไม่เกิน 10MB]" }}
|
||||
</div>
|
||||
<div class="q-uploader__subtitle">
|
||||
{{ scope.uploadSizeLabel }}
|
||||
/
|
||||
{{ scope.uploadProgressLabel }}
|
||||
</div>
|
||||
</div>
|
||||
<q-btn
|
||||
v-if="scope.canAddFiles"
|
||||
type="a"
|
||||
icon="add_box"
|
||||
@click="scope.pickFiles"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-uploader-add-trigger />
|
||||
<q-tooltip>เลือกไฟล์</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="scope.isUploading"
|
||||
icon="clear"
|
||||
@click="scope.abort"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-tooltip>ยกเลิกการอัปโหลด</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</template>
|
||||
</q-uploader>
|
||||
</div>
|
||||
<q-card
|
||||
bordered
|
||||
flat
|
||||
class="full-width q-my-md"
|
||||
v-if="fileImgs.length != 0"
|
||||
>
|
||||
<q-list separator>
|
||||
<q-item v-for="file in fileImgs" :key="file.id" class="q-my-xs">
|
||||
<q-item-section>
|
||||
<q-item-label class="full-width ellipsis">
|
||||
{{ file.fileName }}
|
||||
</q-item-label>
|
||||
|
||||
<q-item-label caption>
|
||||
สถานะ: {{ file.fileType }} /
|
||||
{{ file.fileSize }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section top side>
|
||||
<div class="q-gutter-sm">
|
||||
<q-btn
|
||||
size="12px"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
color="blue"
|
||||
icon="mdi-download-outline"
|
||||
@click="downloadData(file.detail)"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
size="12px"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
color="red"
|
||||
icon="mdi-delete-outline"
|
||||
v-if="edit"
|
||||
@click="deleteImgData(file.id)"
|
||||
>
|
||||
<q-tooltip>ลบไฟล์</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<div class="text-bold text-subtitle2 q-pb-sm">เอกสารประกอบ</div>
|
||||
<div class="row justify-center row col-12">
|
||||
<q-uploader
|
||||
color="gray"
|
||||
type="file"
|
||||
flat
|
||||
ref="uploader"
|
||||
class="full-width"
|
||||
text-color="dark"
|
||||
:max-size="10000000"
|
||||
accept=".jpg,.png,.pdf,.csv,.doc"
|
||||
bordered
|
||||
label="[ไฟล์ jpg,png,pdf,csv,doc ขนาดไม่เกิน 10MB]"
|
||||
multiple
|
||||
@added="fileUploadDoc"
|
||||
@removed="fileRemoveDoc"
|
||||
>
|
||||
<template v-slot:header="scope">
|
||||
<div class="row no-wrap items-center q-pa-sm q-gutter-xs text-white">
|
||||
<q-btn
|
||||
v-if="scope.queuedFiles.length > 0"
|
||||
icon="clear_all"
|
||||
@click="scope.removeQueuedFiles"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-tooltip>ลบทั้งหมด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="scope.uploadedFiles.length > 0"
|
||||
icon="done_all"
|
||||
@click="scope.removeUploadedFiles"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-tooltip>ลบไฟล์ที่อัปโหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-spinner v-if="scope.isUploading" class="q-uploader__spinner" />
|
||||
<div class="col">
|
||||
<div class="q-uploader__title">
|
||||
{{ "[ไฟล์ jpg,png,pdf,csv,doc ขนาดไม่เกิน 10MB]" }}
|
||||
</div>
|
||||
<div class="q-uploader__subtitle">
|
||||
{{ scope.uploadSizeLabel }}
|
||||
/
|
||||
{{ scope.uploadProgressLabel }}
|
||||
</div>
|
||||
</div>
|
||||
<q-btn
|
||||
v-if="scope.canAddFiles"
|
||||
type="a"
|
||||
icon="add_box"
|
||||
@click="scope.pickFiles"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-uploader-add-trigger />
|
||||
<q-tooltip>เลือกไฟล์</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="scope.isUploading"
|
||||
icon="clear"
|
||||
@click="scope.abort"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
>
|
||||
<q-tooltip>ยกเลิกการอัปโหลด</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</template>
|
||||
</q-uploader>
|
||||
</div>
|
||||
<q-card
|
||||
bordered
|
||||
flat
|
||||
class="full-width q-my-md"
|
||||
v-if="fileDocs.length != 0"
|
||||
>
|
||||
<q-list separator>
|
||||
<q-item v-for="file in fileDocs" :key="file.id" class="q-my-xs">
|
||||
<q-item-section>
|
||||
<q-item-label class="full-width ellipsis">
|
||||
{{ file.fileName }}
|
||||
</q-item-label>
|
||||
|
||||
<q-item-label caption>
|
||||
สถานะ: {{ file.fileType }} /
|
||||
{{ file.fileSize }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section top side>
|
||||
<div class="q-gutter-sm">
|
||||
<q-btn
|
||||
size="12px"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
color="blue"
|
||||
icon="mdi-download-outline"
|
||||
@click="downloadData(file.detail)"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
size="12px"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
color="red"
|
||||
icon="mdi-delete-outline"
|
||||
v-if="edit"
|
||||
@click="deleteDocData(file.id)"
|
||||
>
|
||||
<q-tooltip>ลบไฟล์</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-separator size="5px" color="grey-2" class="q-my-lg" />
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="text-bold text-subtitle2 q-pb-sm q-pt-md">รายละเอียด</div>
|
||||
<q-editor
|
||||
v-model="editor"
|
||||
:dense="$q.screen.lt.md"
|
||||
toolbar-text-color="blue-grey-10"
|
||||
toolbar-bg="blue-grey-2"
|
||||
toolbar-toggle-color="blue-grey-8"
|
||||
class="editor"
|
||||
:toolbar="[
|
||||
['left', 'center', 'right', 'justify'],
|
||||
['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
|
||||
['token', 'hr', 'link', 'custom_btn'],
|
||||
['print', 'fullscreen'],
|
||||
[
|
||||
{
|
||||
label: $q.lang.editor.formatting,
|
||||
icon: $q.iconSet.editor.formatting,
|
||||
list: 'no-icons',
|
||||
options: ['p', 'h1', 'h2', 'h3'],
|
||||
},
|
||||
{
|
||||
label: $q.lang.editor.defaultFont,
|
||||
icon: $q.iconSet.editor.font,
|
||||
fixedIcon: true,
|
||||
list: 'no-icons',
|
||||
options: [
|
||||
'default_font',
|
||||
'arial',
|
||||
'arial_black',
|
||||
'comic_sans',
|
||||
'courier_new',
|
||||
'impact',
|
||||
'lucida_grande',
|
||||
'times_new_roman',
|
||||
'verdana',
|
||||
],
|
||||
},
|
||||
'removeFormat',
|
||||
],
|
||||
['undo', 'redo'],
|
||||
['viewsource'],
|
||||
]"
|
||||
:fonts="{
|
||||
arial: 'Arial',
|
||||
arial_black: 'Arial Black',
|
||||
comic_sans: 'Comic Sans MS',
|
||||
courier_new: 'Courier New',
|
||||
impact: 'Impact',
|
||||
lucida_grande: 'Lucida Grande',
|
||||
times_new_roman: 'Times New Roman',
|
||||
verdana: 'Verdana',
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 q-mt-md">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="note"
|
||||
label="หมายเหตุ"
|
||||
dense
|
||||
lazy-rules
|
||||
type="textarea"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions class="text-primary q-py-sm">
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="public"
|
||||
@click="checkSave"
|
||||
icon="mdi-content-save-outline"
|
||||
>
|
||||
<q-tooltip>{{ edit ? "แก้ไขข้อมูล" : "บันทึกข้อมูล" }}</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type { QTableProps } from "quasar";
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { useQuasar, QForm } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import type { RequestPeriodCompete } from "@/modules/03_recruiting/interface/request/Period";
|
||||
import type {
|
||||
DataOption,
|
||||
UploadType,
|
||||
} from "@/modules/02_organizational/interface/index/Main";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { date2Thai, success, dateToISO, notifyError } = mixin;
|
||||
const myForm = ref<QForm | null>(null); //form data input
|
||||
const name = ref<string>("");
|
||||
const note = ref<string>("");
|
||||
const editor = ref<string>("");
|
||||
const announcementExam = ref<boolean>(true);
|
||||
const fee = ref<number>(0);
|
||||
const round = ref<number>(1);
|
||||
const yearly = ref<number>(new Date().getFullYear());
|
||||
const dateRegister = ref<[Date, Date]>([new Date(), new Date()]); //วันที่สมัคร
|
||||
const datePayment = ref<[Date, Date]>([new Date(), new Date()]); //วันที่จ่ายเงิน
|
||||
const dateAnnouncement = ref<[Date, Date]>([new Date(), new Date()]); //วันที่ประกาศ
|
||||
const dateExam = ref<Date>(new Date()); //วันที่สอบ
|
||||
const dateAnnounce = ref<Date>(new Date()); //วันที่ประกาศผล
|
||||
const positionPathOptions = ref<DataOption[]>([]);
|
||||
const organizationShortName = ref<DataOption>({ id: "", name: "" });
|
||||
const organizationName = ref<DataOption>({ id: "", name: "" });
|
||||
const organizationNameOptions = ref<DataOption[]>([]);
|
||||
const { messageError } = mixin;
|
||||
const fileDocDataUpload = ref<File[]>([]);
|
||||
const fileDocs = ref<UploadType[]>([]);
|
||||
const fileImgDataUpload = ref<File[]>([]);
|
||||
const fileImgs = ref<UploadType[]>([]);
|
||||
const id = ref<string>("");
|
||||
const pay = ref<string>("");
|
||||
const edit = ref<boolean>(false);
|
||||
const columnsPayment = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "accountNumber",
|
||||
align: "left",
|
||||
label: "เลขบัญชี",
|
||||
sortable: true,
|
||||
field: "accountNumber",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "bankName",
|
||||
align: "left",
|
||||
label: "ธนาคาร",
|
||||
sortable: true,
|
||||
field: "bankName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "accountName",
|
||||
align: "left",
|
||||
label: "ชื่อบัญชี",
|
||||
sortable: true,
|
||||
field: "accountName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumnsPosition = ref<String[]>(["position", "type"]);
|
||||
const columnsPosition = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "position",
|
||||
align: "left",
|
||||
label: "ตำแหน่ง",
|
||||
sortable: true,
|
||||
field: "position",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
align: "left",
|
||||
label: "ประเภทแบบฟอร์ม",
|
||||
sortable: true,
|
||||
field: "type",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
watch(organizationShortName, (count: DataOption, prevCount: DataOption) => {
|
||||
organizationNameOptions.value = [];
|
||||
});
|
||||
|
||||
watch(organizationName, (count: DataOption, prevCount: DataOption) => {
|
||||
positionPathOptions.value = [];
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
if (route.params.id != undefined) {
|
||||
edit.value = true;
|
||||
id.value = route.params.id.toString();
|
||||
await fetchData();
|
||||
} else {
|
||||
edit.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
const clickBack = () => {
|
||||
router.push({ name: "competePeriod" });
|
||||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getPeriodById(id.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result.periods;
|
||||
const images = res.data.result.images;
|
||||
const files = res.data.result.files;
|
||||
|
||||
id.value = data.id;
|
||||
name.value = data.name;
|
||||
round.value = data.order;
|
||||
yearly.value = data.year;
|
||||
fee.value = data.fee;
|
||||
dateAnnouncement.value = [
|
||||
new Date(data.announcementStartDate),
|
||||
new Date(data.announcementEndDate),
|
||||
];
|
||||
dateExam.value = new Date(data.examDate);
|
||||
dateRegister.value = [
|
||||
new Date(data.registerStartDate),
|
||||
new Date(data.registerEndDate),
|
||||
];
|
||||
datePayment.value = [
|
||||
new Date(data.paymentStartDate),
|
||||
new Date(data.paymentEndDate),
|
||||
];
|
||||
editor.value = data.detail;
|
||||
note.value = data.note;
|
||||
dateAnnounce.value = new Date(data.announcementDate);
|
||||
|
||||
fileDocs.value = files;
|
||||
fileImgs.value = images;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const fileUploadDoc = async (files: any) => {
|
||||
files.forEach((file: any) => {
|
||||
fileDocDataUpload.value.push(file);
|
||||
});
|
||||
};
|
||||
|
||||
const fileRemoveDoc = async (files: any) => {
|
||||
files.forEach((file: any) => {
|
||||
const index = fileDocDataUpload.value.findIndex((x: any) => x.__key == file.__key);
|
||||
if (index > -1) {
|
||||
fileDocDataUpload.value.splice(index, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const uploadDocData = async () => {
|
||||
const formData = new FormData();
|
||||
if (fileDocDataUpload.value.length > 0) {
|
||||
fileDocDataUpload.value.forEach((file: any) => {
|
||||
formData.append("", file);
|
||||
});
|
||||
loaderPage(true);
|
||||
await http
|
||||
.put(config.API.periodRecruitDoc(id.value), formData)
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
clickBack();
|
||||
});
|
||||
} else {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
clickBack();
|
||||
}
|
||||
};
|
||||
|
||||
const uploadImgData = async () => {
|
||||
if (fileImgDataUpload.value.length > 0) {
|
||||
const formData = new FormData();
|
||||
fileImgDataUpload.value.forEach((file: any) => {
|
||||
formData.append("", file);
|
||||
});
|
||||
loaderPage(true);
|
||||
await http
|
||||
.put(config.API.periodRecruitImg(id.value), formData)
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const fileUploadImg = async (files: any) => {
|
||||
files.forEach((file: any) => {
|
||||
fileImgDataUpload.value.push(file);
|
||||
});
|
||||
};
|
||||
|
||||
const fileRemoveImg = async (files: any) => {
|
||||
files.forEach((file: any) => {
|
||||
const index = fileImgDataUpload.value.findIndex((x: any) => x.__key == file.__key);
|
||||
if (index > -1) {
|
||||
fileImgDataUpload.value.splice(index, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const downloadData = async (path: string) => {
|
||||
window.open(path);
|
||||
};
|
||||
|
||||
const updateYear = async (e: number) => {
|
||||
yearly.value = e;
|
||||
};
|
||||
|
||||
const checkSave = async () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then(async (success) => {
|
||||
if (success) {
|
||||
if (edit.value) {
|
||||
await editData(id.value);
|
||||
} else {
|
||||
await addData();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const sendData = () => {
|
||||
const valueData: RequestPeriodCompete = {
|
||||
announcementEndDate: dateToISO(dateAnnouncement.value[1]),
|
||||
announcementStartDate: dateToISO(dateAnnouncement.value[0]),
|
||||
examDate: dateToISO(dateExam.value),
|
||||
detail: editor.value,
|
||||
fee: fee.value,
|
||||
id: "",
|
||||
name: name.value,
|
||||
note: note.value,
|
||||
paymentEndDate: dateToISO(datePayment.value[1]),
|
||||
paymentStartDate: dateToISO(datePayment.value[0]),
|
||||
registerEndDate: dateToISO(dateRegister.value[1]),
|
||||
registerStartDate: dateToISO(dateRegister.value[0]),
|
||||
order: round.value,
|
||||
year: yearly.value,
|
||||
announcementDate: dateToISO(dateAnnounce.value),
|
||||
};
|
||||
return valueData;
|
||||
};
|
||||
|
||||
const deleteDocData = async (docId: string) => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.delete(config.API.periodDeleteDoc(docId))
|
||||
.then(async () => {
|
||||
await fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const deleteImgData = async (docId: string) => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.delete(config.API.periodDeleteImg(docId))
|
||||
.then(async () => {
|
||||
await fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const addData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.post(config.API.savePeriod, sendData())
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
id.value = data.id;
|
||||
await uploadImgData();
|
||||
await uploadDocData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
const editData = async (id: string) => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.put(config.API.editPeriod(id), sendData())
|
||||
.then(async () => {
|
||||
await uploadImgData();
|
||||
await uploadDocData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* แปลงช่วงวันที่ถ้า2ค่าเป็นวันเดียวกันจะโชววันเดียวแต่ถ้าไม่เท่ากันจะแสดงเป็นช่วง
|
||||
* @param val ช่วงวันที่
|
||||
*/
|
||||
const dateThaiRange = (val: [Date, Date]) => {
|
||||
if (val === null) {
|
||||
return "";
|
||||
} else if (date2Thai(val[0], true) === date2Thai(val[1], true)) {
|
||||
return `${date2Thai(val[0], true)}`;
|
||||
} else {
|
||||
return `${date2Thai(val[0], true)} - ${date2Thai(val[1], true)}`;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
24
src/modules/03_recruiting/views/01_compete/PeriodStat.vue
Normal file
24
src/modules/03_recruiting/views/01_compete/PeriodStat.vue
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<!-- page:จัดการรอบการสอบ สรรหา -->
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
ข้อมูลสถิติการสมัครสอบแข่งขัน
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-px-md q-py-sm">
|
||||
<iframe
|
||||
:src="panelUrl"
|
||||
style="height: 80vh; width: 100%; border: none; overflow: hidden"
|
||||
></iframe>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import config from "@/app.config";
|
||||
import { ref, onBeforeMount } from "vue";
|
||||
|
||||
const panelUrl = ref<string>("");
|
||||
|
||||
onBeforeMount(async () => {
|
||||
panelUrl.value = config.compettitivePanel;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue