ต่อuiโครงสร้างลูกจ้าง

This commit is contained in:
Kittapath 2023-07-13 09:00:38 +07:00
parent 78ca0ceff7
commit 3b80198220
10 changed files with 3695 additions and 2189 deletions

View file

@ -10,6 +10,7 @@ import env from "../index";
const organizationPath = `${env.API_URI_ORG_SERVICE}/Organization/`;
const postionMasterPath = `${env.API_URI_ORG_SERVICE}/PositionMaster`;
const organizationPosition = `${env.API_URI_ORG_SERVICE}/OrganizationPosition/`;
const organizationEmployeePosition = `${env.API_URI_ORG_EMPLOYEE_SERVICE}/organization-employee/`;
const report = `${env.API_URI}/report/organization/`;
@ -83,8 +84,7 @@ export default {
getPositionNumberIdByOcId: (OcId: string) =>
`${postionMasterPath}/position-number/Oc/${OcId}`,
/**
* api publish
*/
organizationEmployeePosition: `${organizationEmployeePosition}`,
organizationEmployeePositionId: (id: string) =>
`${organizationEmployeePosition}${id}`,
};

View file

@ -12,6 +12,8 @@ const config = ref<any>({
API_URI: "https://bma-ehr.frappet.synology.me/api/v1",
// API_URI_ORG_SERVICE: "https://localhost:7056/api/v1", //ใช้ชั่วคราว
API_URI_ORG_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว
API_URI_ORG_EMPLOYEE_SERVICE: "https://localhost:7208/api/v1", //ใช้ชั่วคราว
// API_URI_ORG_EMPLOYEE_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว
// API_URI_PROFILE_SERVICE: "https://localhost:7159/api/v1",
API_URI_PROFILE_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว
// API_CANDIDATE_URI: "https://localhost:7007/api/v1",
@ -30,6 +32,7 @@ const config = ref<any>({
// API_URI: "https://localhost:5010",
API_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
API_URI_ORG_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, //ใช้ชั่วคราว
API_URI_ORG_EMPLOYEE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, //ใช้ชั่วคราว
API_URI_PROFILE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`,
API_CANDIDATE_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
API_REPORT_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
@ -45,6 +48,9 @@ const API_REPORT_URI = ref<string>(config.value[env.value].API_REPORT_URI);
const API_URI_ORG_SERVICE = ref<string>(
config.value[env.value].API_URI_ORG_SERVICE
);
const API_URI_ORG_EMPLOYEE_SERVICE = ref<string>(
config.value[env.value].API_URI_ORG_EMPLOYEE_SERVICE
);
const MEET_URI = ref<string>(config.value[env.value].MEET_URI);
const API_URI_PROFILE_SERVICE = ref<string>(
config.value[env.value].API_URI_PROFILE_SERVICE
@ -57,6 +63,7 @@ export default {
API_CANDIDATE_URI: API_CANDIDATE_URI.value,
API_REPORT_URI: API_REPORT_URI.value,
API_URI_ORG_SERVICE: API_URI_ORG_SERVICE.value,
API_URI_ORG_EMPLOYEE_SERVICE: API_URI_ORG_EMPLOYEE_SERVICE.value,
API_URI_PROFILE_SERVICE: API_URI_PROFILE_SERVICE.value,
MEET_URI: MEET_URI.value,
};

View file

@ -3,6 +3,7 @@
* เมนูย่อย: ข้อมูลโครงสร้างหน่วยงาน
*/
import env from "../index";
const organizationMain = `${env.API_URI}/metadata/main/`;
const organization = `${env.API_URI}/metadata/organization/`;
const organizationOrganization = `${env.API_URI}/metadata/organization-organization/`;
const organizationShortName = `${env.API_URI}/metadata/organization-shortname/`;
@ -21,6 +22,7 @@ export default {
/**
* api tab tab
*/
organizationMain: `${organizationMain}organization`,
organization,
countDashbordSubHistory: (type: number) => `${dashbord}${type}`,
countDashbordHistory: `${dashbord}`,

View file

@ -3,6 +3,7 @@
* เมนูย่อย: ข้อมูลตำแหน่งของลูกจ้างกรุงเทพมหานคร
*/
import env from "../index";
const positionEmployee = `${env.API_URI}/metadata/main/`;
const positionEmployeePosition = `${env.API_URI}/metadata/position-employee-position/`;
const positionEmployeePositionSide = `${env.API_URI}/metadata/position-employee-position-side/`;
const positionEmployeeGroup = `${env.API_URI}/metadata/position-employee-group/`;
@ -11,6 +12,7 @@ const positionEmployeeLevel = `${env.API_URI}/metadata/position-employee-level/`
const positionEmployeeStatus = `${env.API_URI}/metadata/position-employee-status/`;
export default {
positionEmployee: `${positionEmployee}positionEmployee`,
/**
* api
*/

View file

@ -88,11 +88,16 @@ const menuList = readonly<any[]>([
},
{
key: 3.5,
label: "ผังโครงสร้างลูกจ้าง",
path: "organizationalEmployee",
},
{
key: 3.6,
label: "จัดการบัญชี 2",
path: "manageReport2",
},
{
key: 3.6,
key: 3.7,
label: "รายงานบัญชี",
path: "organizationalReport",
},

View file

@ -9,6 +9,8 @@ const MainStructChart = () =>
const MainOrgChart = () =>
import("@/modules/02_organizational/views/MainOrgChart.vue");
const MainTree = () => import("@/modules/02_organizational/views/MainTree.vue");
const MainTreeEmployee = () =>
import("@/modules/02_organizational/views/MainTreeEmployee.vue");
const MainReport = () =>
import("@/modules/02_organizational/views/MainReport.vue");
const ManageReport2 = () =>
@ -60,6 +62,16 @@ export default [
Role: "organization",
},
},
{
path: "/organizational/employee",
name: "organizationalEmployee",
component: MainTreeEmployee,
meta: {
Auth: true,
Key: [9],
Role: "organization",
},
},
{
path: "/organizational/manage/report",
name: "manageReport2",

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,128 +1,126 @@
<template>
<div class="q-pb-sm row q-col-gutter-sm">
<!-- -->
<div class="q-gutter-sm" v-if="nornmalData == true">
<q-btn
size="12px"
flat
round
color="add"
@click="checkAdd"
icon="mdi-plus"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div>
<div class="row q-gutter-sm q-pb-sm" v-if="conclude == true">
<q-card bordered flat class="q-px-md no-wrap row">
<div class="col-12 text-subtitle2 row items-center">
<span class="text-weight-medium text-dark"
>สมครสอบ</span
>
<q-space />
<q-badge
color="white"
class="text-weight-bold text-subtitle1 text-primary"
:label="`${count}`"
rounded
/>
</div>
</q-card>
<q-card bordered flat class="q-px-md no-wrap row">
<div class="col-12 text-subtitle2 row items-center">
<span class="text-weight-medium text-dark">สอบผาน</span>
<q-space />
<q-badge
color="white"
class="text-weight-bold text-subtitle1 text-blue"
:label="`${pass}`"
rounded
/>
</div>
</q-card>
<div class="q-pb-sm row q-col-gutter-sm">
<!-- -->
<div class="q-gutter-sm" v-if="nornmalData == true">
<q-btn
size="12px"
flat
round
color="add"
@click="checkAdd"
icon="mdi-plus"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div>
<div class="row q-gutter-sm q-pb-sm" v-if="conclude == true">
<q-card bordered flat class="q-px-md no-wrap row">
<div class="col-12 text-subtitle2 row items-center">
<span class="text-weight-medium text-dark">สมครสอบ</span>
<q-space />
<q-badge
color="white"
class="text-weight-bold text-subtitle1 text-primary"
:label="`${count}`"
rounded
/>
</div>
</q-card>
<q-card bordered flat class="q-px-md no-wrap row">
<div class="col-12 text-subtitle2 row items-center">
<span class="text-weight-medium text-dark">สอบผาน</span>
<q-space />
<q-badge
color="white"
class="text-weight-bold text-subtitle1 text-blue"
:label="`${pass}`"
rounded
/>
</div>
</q-card>
<q-card bordered flat class="q-px-md no-wrap row">
<div class="col-12 text-subtitle2 row items-center">
<span class="text-weight-medium text-dark">สอบไมาน</span>
<q-space />
<q-badge
color="white"
class="text-weight-bold text-subtitle1 text-pink"
:label="`${notpass}`"
rounded
/>
</div>
</q-card>
</div>
<q-space />
<div class="items-center q-gutter-sm" style="display: flex">
<!-- นหาขอความใน table -->
<q-input
standout
dense
:model-value="inputfilter"
ref="filterRef"
@update:model-value="updateInput"
outlined
debounce="300"
placeholder="ค้นหา"
style="max-width: 200px"
>
<template v-slot:append>
<q-icon v-if="inputfilter == ''" name="search" />
<q-icon
v-if="inputfilter !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
:model-value="inputvisible"
@update:model-value="updateVisible"
:display-value="$q.lang.table.columns"
multiple
outlined
dense
:options="attrs.columns"
options-dense
option-value="name"
map-options
emit-value
style="min-width: 150px"
class="gt-xs"
>
<template> </template>
</q-select>
</div>
</div>
<q-table
ref="table"
flat
bordered
class="custom-table2"
v-bind="attrs"
virtual-scroll
:virtual-scroll-sticky-size-start="48"
dense
:pagination-label="paginationLabel"
:pagination="initialPagination"
:rows-per-page-options="[0]"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium" v-html="col.label" />
</q-th>
<q-th auto-width v-if="nornmalData == true" />
</q-tr>
</template>
<template #body="props">
<slot v-bind="props" name="columns"></slot>
</template>
</q-table>
<q-card bordered flat class="q-px-md no-wrap row">
<div class="col-12 text-subtitle2 row items-center">
<span class="text-weight-medium text-dark">สอบไมาน</span>
<q-space />
<q-badge
color="white"
class="text-weight-bold text-subtitle1 text-pink"
:label="`${notpass}`"
rounded
/>
</div>
</q-card>
</div>
<q-space />
<div class="items-center q-gutter-sm" style="display: flex">
<!-- นหาขอความใน table -->
<q-input
standout
dense
:model-value="inputfilter"
ref="filterRef"
@update:model-value="updateInput"
outlined
debounce="300"
placeholder="ค้นหา"
style="max-width: 200px"
>
<template v-slot:append>
<q-icon v-if="inputfilter == ''" name="search" />
<q-icon
v-if="inputfilter !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
:model-value="inputvisible"
@update:model-value="updateVisible"
:display-value="$q.lang.table.columns"
multiple
outlined
dense
:options="attrs.columns"
options-dense
option-value="name"
map-options
emit-value
style="min-width: 150px"
class="gt-xs"
>
<template> </template>
</q-select>
</div>
</div>
<q-table
ref="table"
flat
bordered
class="custom-header-table"
v-bind="attrs"
virtual-scroll
:virtual-scroll-sticky-size-start="48"
dense
:pagination-label="paginationLabel"
:pagination="initialPagination"
:rows-per-page-options="[0]"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium" v-html="col.label" />
</q-th>
<q-th auto-width v-if="nornmalData == true" />
</q-tr>
</template>
<template #body="props">
<slot v-bind="props" name="columns"></slot>
</template>
</q-table>
</template>
<script setup lang="ts">
import { ref, useAttrs } from "vue";
@ -132,106 +130,106 @@ const attrs = ref<any>(useAttrs());
const table = ref<any>(null);
const filterRef = ref<any>(null);
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
rowsPerPage: 0,
});
const props = defineProps({
count: Number,
pass: Number,
notpass: Number,
count: Number,
pass: Number,
notpass: Number,
inputfilter: String,
name: String,
icon: String,
inputvisible: Array,
editvisible: Boolean,
add: {
type: Function,
default: () => console.log("not function"),
},
validate: {
type: Function,
default: () => console.log("not function"),
},
nornmalData: {
type: Boolean,
defualt: true,
},
conclude: {
type: Boolean,
defualt: false,
},
inputfilter: String,
name: String,
icon: String,
inputvisible: Array,
editvisible: Boolean,
add: {
type: Function,
default: () => console.log("not function"),
},
validate: {
type: Function,
default: () => console.log("not function"),
},
nornmalData: {
type: Boolean,
defualt: true,
},
conclude: {
type: Boolean,
defualt: false,
},
});
const emit = defineEmits([
"update:inputfilter",
"update:inputvisible",
"update:editvisible",
"update:inputfilter",
"update:inputvisible",
"update:editvisible",
]);
const updateInput = (value: string | number | null) => {
emit("update:inputfilter", value);
emit("update:inputfilter", value);
};
const updateVisible = (value: []) => {
emit("update:inputvisible", value);
emit("update:inputvisible", value);
};
const paginationLabel = (start: string, end: string, total: string) => {
return start + "-" + end + " ใน " + total;
return start + "-" + end + " ใน " + total;
};
const checkAdd = () => {
props.add();
props.add();
};
const resetFilter = () => {
// reset X
emit("update:inputfilter", "");
filterRef.value.focus();
// reset X
emit("update:inputfilter", "");
filterRef.value.focus();
};
</script>
<style lang="scss">
.icon-color {
color: #4154b3;
color: #4154b3;
}
.custom-table2 {
max-height: 64vh;
max-height: 64vh;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
}
.q-table thead tr th {
position: sticky;
}
.q-table td:nth-of-type(2) {
z-index: 3 !important;
}
.q-table td:nth-of-type(2) {
z-index: 3 !important;
}
.q-table th:nth-of-type(2),
.q-table td:nth-of-type(2) {
position: sticky;
left: 0;
z-index: 1;
}
.q-table th:nth-of-type(2),
.q-table td:nth-of-type(2) {
position: sticky;
left: 0;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
.q-table thead tr:first-child th {
top: 0;
}
}
</style>

View file

@ -1,88 +1,79 @@
<!-- 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="examData"
: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="clickEdit(props.row)"
>
<div
v-if="col.name == 'no'"
class="table_ellipsis2"
>
{{ props.rowIndex + 1 }}
</div>
<div
v-else-if="col.name == 'yearly'"
class="table_ellipsis2"
>
{{ col.value + 543 }}
</div>
<div
v-else-if="
col.name == 'dateRegister' ||
col.name == 'datePayment' ||
col.name == 'dateAnnouncement'
"
class="table_ellipsis2"
>
{{ dateThaiRange(col.value) }}
</div>
<div
v-else-if="col.name == 'announcementExam'"
class="table_ellipsis2"
>
{{ col.value ? "ข่าวการสอบ" : "ข่าวทั่วไป" }}
</div>
<div
v-else-if="col.name == 'category'"
class="table_ellipsis2"
>
{{ typeCategoryExam(col.value) }}
</div>
<div v-else class="table_ellipsis2">
{{ col.value }}
</div>
</q-td>
<q-td>
<q-btn
dense
size="12px"
flat
round
color="red"
@click="clickDelete(props.row.id)"
icon="mdi-delete"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</Table>
</div>
</q-card>
<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="examData"
: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="clickEdit(props.row)"
>
<div v-if="col.name == 'no'" class="table_ellipsis2">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'yearly'" class="table_ellipsis2">
{{ col.value + 543 }}
</div>
<div
v-else-if="
col.name == 'dateRegister' ||
col.name == 'datePayment' ||
col.name == 'dateAnnouncement'
"
class="table_ellipsis2"
>
{{ dateThaiRange(col.value) }}
</div>
<div
v-else-if="col.name == 'announcementExam'"
class="table_ellipsis2"
>
{{ col.value ? "ข่าวการสอบ" : "ข่าวทั่วไป" }}
</div>
<div v-else-if="col.name == 'category'" class="table_ellipsis2">
{{ typeCategoryExam(col.value) }}
</div>
<div v-else class="table_ellipsis2">
{{ col.value }}
</div>
</q-td>
<q-td>
<q-btn
dense
size="12px"
flat
round
color="red"
@click="clickDelete(props.row.id)"
icon="mdi-delete"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</Table>
</div>
</q-card>
</template>
<script setup lang="ts">
import type { QTableProps } from "quasar";
@ -90,14 +81,14 @@ import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type {
RequestPeriodExam,
RequestPosition,
RequestPayment,
RequestPeriodExam,
RequestPosition,
RequestPayment,
} from "@/modules/03_recruiting/interface/request/Period";
import type {
ResponsePeriodExam,
ResponsePosition,
ResponsePayment,
ResponsePeriodExam,
ResponsePosition,
ResponsePayment,
} 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";
@ -114,248 +105,236 @@ const router = useRouter();
const { date2Thai, success, typeCategoryExam, messageError } = mixin;
const filter = ref<string>(""); //search data table
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
rowsPerPage: 0,
});
const examData = ref<ResponsePeriodExam[]>([]);
const visibleColumns = ref<String[]>([
"no",
"announcementExam",
"yearly",
"category",
"name",
"document",
"dateAnnouncement",
"dateRegister",
"datePayment",
"fee",
"no",
"announcementExam",
"yearly",
"category",
"name",
"document",
"dateAnnouncement",
"dateRegister",
"datePayment",
"fee",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "center",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "announcementExam",
align: "left",
label: "ประเภทการประกาศ",
sortable: true,
field: "announcementExam",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "yearly",
align: "center",
label: "ปีงบประมาณ",
sortable: true,
field: "yearly",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "category",
align: "left",
label: "สังกัด",
sortable: true,
field: "category",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "รายการประกาศ",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fee",
align: "right",
label: "ค่าธรรมเนียม",
sortable: true,
field: "fee",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateAnnouncement",
align: "left",
label: "วันที่สมัคร",
sortable: true,
field: "dateAnnouncement",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateRegister",
align: "left",
label: "วันที่ชำระเงิน",
sortable: true,
field: "dateRegister",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "datePayment",
align: "left",
label: "วันที่ประกาศ",
sortable: true,
field: "datePayment",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "no",
align: "center",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "announcementExam",
align: "left",
label: "ประเภทการประกาศ",
sortable: true,
field: "announcementExam",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "yearly",
align: "center",
label: "ปีงบประมาณ",
sortable: true,
field: "yearly",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "category",
align: "left",
label: "สังกัด",
sortable: true,
field: "category",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "รายการประกาศ",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fee",
align: "right",
label: "ค่าธรรมเนียม",
sortable: true,
field: "fee",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateAnnouncement",
align: "left",
label: "วันที่สมัคร",
sortable: true,
field: "dateAnnouncement",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateRegister",
align: "left",
label: "วันที่ชำระเงิน",
sortable: true,
field: "dateRegister",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "datePayment",
align: "left",
label: "วันที่ประกาศ",
sortable: true,
field: "datePayment",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
onMounted(async () => {
loaderPage(false);
await fetchData();
loaderPage(false);
await fetchData();
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.periodExamType("all"))
.then((res) => {
const data = res.data.result;
let result: ResponsePeriodExam[] = [];
if (data.length > 0) {
data.map((r: RequestPeriodExam) => {
const positionData: ResponsePosition[] = [];
r.positionExam.map((r: RequestPosition) => {
positionData.push({
id: r.id,
position: {
id: r.positionId,
name: r.positionName,
},
type: {
id: r.typeId,
name: r.typeName,
},
highDegree: r.highDegree,
});
});
const bankData: ResponsePayment[] = [];
r.bankExam.map((r: RequestPayment) => {
bankData.push({
id: r.id,
accountNumber: r.accountNumber,
bankName: r.bankName,
accountName: r.accountName,
});
});
result.push({
id: r.id,
dateAnnounce:
r.announcementDate !== null
? new Date(r.announcementDate)
: null,
announcementExam: r.announcementExam,
name: r.name,
checkDocument: r.checkDocument,
checkDisability: r.checkDisability,
round: r.round,
yearly: r.year,
fee: r.fee,
dateAnnouncement:
r.announcementStartDate !== null &&
r.announcementEndDate !== null
? [
new Date(r.announcementStartDate),
new Date(r.announcementEndDate),
]
: null,
dateExam:
r.examDate !== null ? new Date(r.examDate) : null,
dateRegister:
r.registerStartDate !== null &&
r.registerEndDate !== null
? [
new Date(r.registerStartDate),
new Date(r.registerEndDate),
]
: null,
datePayment:
r.paymentStartDate !== null &&
r.paymentEndDate !== null
? [
new Date(r.paymentStartDate),
new Date(r.paymentEndDate),
]
: null,
organizationName: {
id: r.organizationId,
name: r.organizationName,
},
organizationShortName: {
id: r.organizationCodeId,
name: r.organizationCodeName,
},
positionExam: positionData,
pay: r.bankExam.length > 0 ? "payment2" : "payment1",
bankExam: bankData,
editor: r.detail,
note: r.note,
category: r.category,
});
});
}
examData.value = result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
loaderPage(true);
await http
.get(config.API.periodExamType("all"))
.then((res) => {
const data = res.data.result;
let result: ResponsePeriodExam[] = [];
if (data.length > 0) {
data.map((r: RequestPeriodExam) => {
const positionData: ResponsePosition[] = [];
r.positionExam.map((r: RequestPosition) => {
positionData.push({
id: r.id,
position: {
id: r.positionId,
name: r.positionName,
},
type: {
id: r.typeId,
name: r.typeName,
},
highDegree: r.highDegree,
});
});
const bankData: ResponsePayment[] = [];
r.bankExam.map((r: RequestPayment) => {
bankData.push({
id: r.id,
accountNumber: r.accountNumber,
bankName: r.bankName,
accountName: r.accountName,
});
});
result.push({
id: r.id,
dateAnnounce:
r.announcementDate !== null ? new Date(r.announcementDate) : null,
announcementExam: r.announcementExam,
name: r.name,
checkDocument: r.checkDocument,
checkDisability: r.checkDisability,
round: r.round,
yearly: r.year,
fee: r.fee,
dateAnnouncement:
r.announcementStartDate !== null && r.announcementEndDate !== null
? [
new Date(r.announcementStartDate),
new Date(r.announcementEndDate),
]
: null,
dateExam: r.examDate !== null ? new Date(r.examDate) : null,
dateRegister:
r.registerStartDate !== null && r.registerEndDate !== null
? [new Date(r.registerStartDate), new Date(r.registerEndDate)]
: null,
datePayment:
r.paymentStartDate !== null && r.paymentEndDate !== null
? [new Date(r.paymentStartDate), new Date(r.paymentEndDate)]
: null,
organizationName: {
id: r.organizationId,
name: r.organizationName,
},
organizationShortName: {
id: r.organizationCodeId,
name: r.organizationCodeName,
},
positionExam: positionData,
pay: r.bankExam.length > 0 ? "payment2" : "payment1",
bankExam: bankData,
editor: r.detail,
note: r.note,
category: r.category,
});
});
}
examData.value = result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
const clickEdit = (col: ResponsePeriodExam) => {
router.push(`/qualify/period/${col.id}`);
router.push(`/qualify/period/${col.id}`);
};
const clickDelete = (id: string) => {
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
await deleteData(id);
})
.onCancel(() => {})
.onDismiss(() => {});
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
await deleteData(id);
})
.onCancel(() => {})
.onDismiss(() => {});
};
const clickAdd = () => {
router.push({ name: "qualifyPeriodAdd" });
router.push({ name: "qualifyPeriodAdd" });
};
const deleteData = async (id: string) => {
loaderPage(true);
await http
.delete(config.API.periodExamId(id))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
await fetchData();
});
loaderPage(true);
await http
.delete(config.API.periodExamId(id))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
await fetchData();
});
};
/**
@ -363,13 +342,13 @@ const deleteData = async (id: string) => {
* @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)}`;
}
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>