2023-12-14 10:43:13 +07:00
|
|
|
<script setup lang="ts">
|
2023-12-20 13:50:54 +07:00
|
|
|
import { onMounted, ref, watch, useAttrs } from "vue";
|
2023-12-14 10:43:13 +07:00
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
|
|
|
|
|
2023-12-15 13:30:39 +07:00
|
|
|
import Table from "@/modules/12_evaluatePersonal/components/Table.vue";
|
2023-12-14 10:43:13 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
2023-12-15 13:30:39 +07:00
|
|
|
import { useEvalutuonStore } from "@/modules/12_evaluatePersonal/store/Evaluate";
|
2023-12-14 10:43:13 +07:00
|
|
|
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
|
|
|
|
|
|
|
|
|
const $q = useQuasar(); // show dialog
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
//search data table
|
|
|
|
|
const mixin = useCounterMixin();
|
2023-12-14 11:31:12 +07:00
|
|
|
const store = useEvalutuonStore();
|
2023-12-14 10:43:13 +07:00
|
|
|
const { showLoader, hideLoader, messageError } = mixin;
|
2023-12-20 13:50:54 +07:00
|
|
|
const attrs = ref<any>(useAttrs());
|
2023-12-14 10:43:13 +07:00
|
|
|
const initialPagination = ref<Pagination>({
|
|
|
|
|
rowsPerPage: 0,
|
|
|
|
|
});
|
2023-12-20 12:43:08 +07:00
|
|
|
function Detailpage(id: string) {
|
2023-12-19 15:05:48 +07:00
|
|
|
router.push(`/evaluate/detail/${id}`);
|
2023-12-14 19:39:58 +07:00
|
|
|
}
|
2023-12-14 10:43:13 +07:00
|
|
|
|
2023-12-20 12:43:08 +07:00
|
|
|
const currentPage = ref<number>(1);
|
2023-12-14 19:39:58 +07:00
|
|
|
const pageSize = ref<number>(10);
|
2023-12-14 10:43:13 +07:00
|
|
|
const maxPage = ref<number>(1);
|
2023-12-20 12:43:08 +07:00
|
|
|
const page = ref<number>(1);
|
2023-12-14 10:43:13 +07:00
|
|
|
const filter = ref<string>("");
|
2023-12-20 12:43:08 +07:00
|
|
|
const rowsPerPage = ref<number>(10);
|
|
|
|
|
/**
|
|
|
|
|
*pagination ของตาราง
|
|
|
|
|
*/
|
|
|
|
|
const pagination = ref({
|
|
|
|
|
descending: false,
|
|
|
|
|
page: page.value,
|
|
|
|
|
rowsPerPage: rowsPerPage.value,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => currentPage.value,
|
|
|
|
|
() => {
|
|
|
|
|
rowsPerPage.value = pagination.value.rowsPerPage;
|
|
|
|
|
getList();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => pagination.value.rowsPerPage,
|
|
|
|
|
() => {
|
|
|
|
|
rowsPerPage.value = pagination.value.rowsPerPage;
|
|
|
|
|
currentPage.value = 1;
|
|
|
|
|
getList();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
function getList() {
|
|
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(
|
|
|
|
|
config.API.evaluationMain(
|
|
|
|
|
currentPage.value,
|
|
|
|
|
rowsPerPage.value,
|
|
|
|
|
filter.value
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
|
|
|
|
|
const data = res.data.result;
|
|
|
|
|
store.fetchData(data);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-12-14 10:43:13 +07:00
|
|
|
|
|
|
|
|
/**เมื่อเริ่มโหลดหน้า
|
|
|
|
|
* ส่งข้อมูลจำลองไปยัง store
|
|
|
|
|
*/
|
2023-12-14 19:39:58 +07:00
|
|
|
onMounted(async () => {
|
2023-12-20 12:43:08 +07:00
|
|
|
getList();
|
2023-12-14 19:39:58 +07:00
|
|
|
});
|
2023-12-14 10:43:13 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<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>
|
2023-12-20 13:50:54 +07:00
|
|
|
<d-table
|
|
|
|
|
ref="table"
|
2023-12-14 10:43:13 +07:00
|
|
|
:columns="store.columns"
|
2023-12-20 13:50:54 +07:00
|
|
|
:rows="store.rows"
|
|
|
|
|
:filter="filter"
|
|
|
|
|
row-key="interrogated"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
2023-12-14 10:43:13 +07:00
|
|
|
:paging="true"
|
2023-12-20 13:50:54 +07:00
|
|
|
dense
|
|
|
|
|
class="custom-header-table"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
:visible-columns="store.visibleColumns"
|
|
|
|
|
v-model:pagination="pagination"
|
2023-12-14 10:43:13 +07:00
|
|
|
>
|
2023-12-20 13:50:54 +07:00
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr :props="props">
|
|
|
|
|
<q-th auto-width></q-th>
|
|
|
|
|
<q-th
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
:props="props"
|
|
|
|
|
style="color: #000000; font-weight: 500"
|
|
|
|
|
>
|
|
|
|
|
<span class="text-weight-medium">{{ col.label }}</span>
|
|
|
|
|
</q-th>
|
|
|
|
|
<q-th auto-width></q-th>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:body="props">
|
2023-12-14 10:43:13 +07:00
|
|
|
<q-tr :props="props" class="cursor-pointer">
|
2023-12-20 13:50:54 +07:00
|
|
|
<q-td auto-width>
|
|
|
|
|
<q-icon
|
|
|
|
|
v-if="props.row.isDefault === true"
|
|
|
|
|
name="mdi-bookmark"
|
|
|
|
|
size="xs"
|
|
|
|
|
color="primary"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip>เวลา Default</q-tooltip>
|
|
|
|
|
</q-icon>
|
|
|
|
|
</q-td>
|
2023-12-20 12:43:08 +07:00
|
|
|
<q-td
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
:props="props"
|
|
|
|
|
@click="Detailpage(props.row.id)"
|
|
|
|
|
>
|
2023-12-14 10:43:13 +07:00
|
|
|
<div v-if="col.name == 'no'">
|
|
|
|
|
{{ props.rowIndex + 1 }}
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
|
|
|
|
{{ col.value }}
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
2023-12-20 13:50:54 +07:00
|
|
|
</d-table>
|
2023-12-14 10:43:13 +07:00
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style></style>
|