Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-12-18 16:40:05 +07:00
commit 32c608879e
14 changed files with 284 additions and 160 deletions

View file

@ -23,18 +23,28 @@ const scrollContainer = ref<HTMLElement | null>(null);
/** function ดาวน์โหลดไฟล์โครงสร้าง PNG*/
async function savePNG() {
showLoader();
await scrollToCenter();
await chartRef.value.savePNG();
hideLoader();
try {
showLoader();
await scrollToCenter();
await chartRef.value.savePNG();
} catch {
messageError($q);
} finally {
hideLoader();
}
}
/** function ดาวน์โหลดไฟล์โครงสร้าง PDF*/
async function savePDF() {
showLoader();
await scrollToCenter();
await chartRef.value.savePDF();
hideLoader();
try {
showLoader();
await scrollToCenter();
await chartRef.value.savePDF();
} catch {
messageError($q);
} finally {
hideLoader();
}
}
/**

View file

@ -98,18 +98,28 @@ async function refreshChart(data: any) {
/** โหลด Chart รูป*/
async function savePNG() {
showLoader();
await scrollToCenter();
await chartRef.value.savePNG();
hideLoader();
try {
showLoader();
await scrollToCenter();
await chartRef.value.savePNG();
} catch {
messageError($q);
} finally {
hideLoader();
}
}
/** โหลด Chart PDF*/
async function savePDF() {
showLoader();
await scrollToCenter();
await chartRef.value.savePDF();
hideLoader();
try {
showLoader();
await scrollToCenter();
await chartRef.value.savePDF();
} catch {
messageError($q);
} finally {
hideLoader();
}
}
watch(

View file

@ -168,11 +168,11 @@ async function fetchlistprofile(id: string) {
prefix: e.prefix,
firstName: e.firstName,
lastName: e.lastName,
name: e.prefix + e.firstName + " " + e.lastName,
name: `${e.prefix}${e.firstName} ${e.lastName}`,
organization: e.root,
position: e.position,
positionNumber: e.posNo,
positionType: e.posTypeName,
positionType: `${e.posTypeName} (${e.posLevelName})`,
positionLevel: e.posLevelName,
reason: e.reason,
remove: e.remove,
@ -663,7 +663,13 @@ onMounted(async () => {
><q-tooltip>ลบขอม</q-tooltip></q-btn
>
</q-td>
<q-td key="order" :props="props">{{ props.row.order }} </q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<!-- <q-td key="order" :props="props">{{ props.row.order }} </q-td>
<q-td key="name" :props="props"
>{{ props.row.prefix ? props.row.prefix : ""
}}{{ props.row.firstName ? props.row.firstName : "" }}
@ -688,20 +694,9 @@ onMounted(async () => {
<q-td class="table_ellipsis" key="organization" :props="props">{{
props.row.organization ? props.row.organization : "-"
}}</q-td>
}}</q-td> -->
</q-tr>
</template>
<!-- <template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template> -->
</d-table>
</div>
</q-card>

View file

@ -23,7 +23,8 @@ const stroeResign = useDataStore();
const { statusText } = stroe;
const router = useRouter();
const mixin = useCounterMixin();
const { messageError, date2Thai, showLoader, hideLoader,onSearchDataTable } = mixin;
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
mixin;
/** Table */
const rows = ref<ResponseItems[]>([]);
@ -45,7 +46,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
field: `fullname`,
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -101,7 +105,6 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "วันที่ยื่น",
sortable: true,
// field: (row) => date2Thai(new Date(row.createdAt)),
field: "createdAt",
format(val, row) {
return date2Thai(new Date(val));
@ -115,7 +118,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "สถานะ",
sortable: true,
field: (row) => statusText(row.status),
field: "status",
format(val, row) {
return statusText(row.status);
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -371,7 +377,7 @@ onMounted(async () => {
: ''
"
>
{{ col.value ? col.value : "" }}
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>

View file

@ -23,7 +23,8 @@ const stroeResign = useDataStore();
const { statusText } = stroe;
const router = useRouter();
const mixin = useCounterMixin();
const { messageError, date2Thai, showLoader, hideLoader,onSearchDataTable } = mixin;
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
mixin;
/** Table */
const rows = ref<ResponseItems[]>([]);
@ -45,7 +46,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
field: "fullname",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -114,7 +118,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "สถานะ",
sortable: true,
field: (row) => statusText(row.status),
field: "status",
format(val, row) {
return statusText(row.status);
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -374,7 +381,7 @@ onMounted(async () => {
: ''
"
>
{{ col.value ? col.value : "" }}
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>

View file

@ -81,7 +81,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
field: "fullname",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
headerStyle: "font-size: 14px; min-width: 200px",
style: "font-size: 14px; ",
},
@ -175,7 +178,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "สถานะ",
sortable: true,
field: (row) => statusText(row.draftOrgEmployeeStatus),
field: "statustext",
format(val, row) {
return statusText(row.draftOrgEmployeeStatus);
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},

View file

@ -24,14 +24,8 @@ import LoadView from "@/components/LoadView.vue";
const $q = useQuasar();
const route = useRoute();
const { fetchStructureTree } = useStructureTree();
const {
showLoader,
hideLoader,
date2Thai,
dateToISO,
messageError,
monthYear2Thai,
} = useCounterMixin();
const { date2Thai, dateToISO, messageError, monthYear2Thai } =
useCounterMixin();
const year = ref<number>(new Date().getFullYear());
const dateStart = ref<Date>(new Date(year.value - 1, 9, 1));
@ -77,17 +71,26 @@ const nodeLevel = ref<number>(0);
const node = ref<DataStructureTree[]>([]);
const expanded = ref<string[]>([]);
/** ฟังก์ชันเรียกข้อมูลโครงสร้างหน่วยงาน*/
async function fetchDataTree() {
node.value = await fetchStructureTree(route.meta.Key as string, true);
}
/**
* งกนเลอกหนวยงานทองการดอม
* @param id id หนวยงาน
* @param level node ของหนวงงานทเลอก
*/
function onSelectedNode(id: string, level: number) {
nodeId.value = id;
nodeLevel.value = level;
updateLeaveday();
}
/** function อัปเดทบัญชีแสดงวันลา */
/**
* งกนอปเดทบญชแสดงวนลา
* และเรยกขอมลรายงาน
*/
async function updateLeaveday() {
switch (yearType.value) {
case "FULL":
@ -125,23 +128,17 @@ async function updateLeaveday() {
isLoadPDF.value = true;
pdfSrc.value = undefined;
typeReport.value === "1"
? fetchLeaveday(
employeeClass.value,
yearType.value,
dateStart.value,
dateEnd.value
)
: fetchLeaveday2(
employeeClass.value,
yearType.value,
dateStart.value,
dateEnd.value
);
// fetchLeaveday
fetchLeaveday(
employeeClass.value,
yearType.value,
dateStart.value,
dateEnd.value
);
}
/**
* function เรยกขอมลบญชแสดงวนลา
* งกนเรยกขอมลรายงาน
* @param type สถานภาพ
* @param year
* @param startDate นเรมต
@ -161,38 +158,13 @@ async function fetchLeaveday(
node: nodeLevel.value,
};
await http
.post(config.API.leaveReportLeaveday(type), body)
.then(async (res) => {
const data = res.data.result;
data && (await fetchDocumentTemplate(data));
isReport.value = data ? true : false;
detailReport.value = data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
isLoadPDF.value = false;
});
}
async function fetchLeaveday2(
type: string,
year: string,
startDate: Date,
endDate: Date
) {
const body = {
type: year === "FULL" ? "FULL" : year === "MONTH" ? "MONTH" : "HAFT",
startDate: dateToISO(startDate),
endDate: dateToISO(endDate),
nodeId: nodeId.value,
node: nodeLevel.value,
};
const pathAPI =
typeReport.value === "1"
? config.API.leaveReportLeaveday(type)
: config.API.leaveReportLeave2(type);
await http
.post(config.API.leaveReportLeave2(type), body)
.post(pathAPI, body)
.then(async (res) => {
const data = res.data.result;
data && (await fetchDocumentTemplate(data));
@ -233,12 +205,10 @@ async function fetchDocumentTemplate(data: any) {
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 2000);
});
.finally(() => {});
}
// PDF
const numOfPages = ref<number>(0);
const page = ref<number>(1);
const pdfSrc = ref<any>();
@ -366,7 +336,7 @@ onMounted(() => {
<div class="row col-12 q-col-gutter-sm">
<div class="col-md-3 col-xs-12">
<q-select
class="bg-white"
class="bg-white select_ellipsis3"
hide-bottom-space
outlined
dense

View file

@ -23,6 +23,23 @@ const props = defineProps({
virtual-scroll
class="row col-12"
>
<template v-slot:header="props">
<q-tr :props="props" class="bg-grey-2">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-body2 text-black">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div>
{{ !col.value ? "-" : col.value }}
</div>
</q-td>
</q-tr>
</template>
</q-table>
</template>

View file

@ -20,7 +20,7 @@ const {
columnsCertificates,
columnSalaries,
columnTraining,
columnProjectsProposed,
columnAssessments,
} = store;
const { date2Thai, showLoader, hideLoader } = mixin;
@ -42,7 +42,7 @@ const formDetail = reactive({
position: "", //
oc: "", //
salary: "", //
positionLevel: "", //,
positionLevel: "", //,
posNo: "", //
birthDate: "", //
govAge: "", //
@ -60,20 +60,20 @@ function formattedNumber(x: number) {
onMounted(() => {
if (props.data) {
showLoader();
formDetail.prefix = props.data.prefix;
formDetail.fullName = props.data.fullName;
formDetail.position = props.data.position;
formDetail.oc = props.data.oc;
formDetail.prefix = props.data.prefix ?? "-";
formDetail.fullName = props.data.fullName ?? "-";
formDetail.position = props.data.position ?? "-";
formDetail.oc = props.data.oc ?? "-";
formDetail.salary = props.data.salary
? formattedNumber(props.data.salary)
: "-";
formDetail.positionLevel = props.data.positionLevel;
formDetail.posNo = props.data.posNo;
formDetail.birthDate =
props.data.birthDate && date2Thai(props.data.birthDate);
formDetail.govAge = props.data.govAge;
formDetail.positionLevel = props.data.positionLevel ?? "-";
formDetail.posNo = props.data.posNo ?? "-";
formDetail.birthDate = props.data.birthDate
? date2Thai(props.data.birthDate)
: "-";
formDetail.govAge = props.data.govAge ?? "-";
formDetail.educations = props.data.educations;
formDetail.certificates = props.data.certificates
? props.data.certificates.map((e: CertificatesForm) => ({
certificateNo: e.certificateNo,
@ -255,7 +255,9 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.educationLevel"
:model-value="
education.educationLevel ? education.educationLevel : '-'
"
label="ระดับศึกษา"
/>
</div>
@ -264,7 +266,7 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.institute"
:model-value="education.institute ? education.institute : '-'"
label="สถานศึกษา"
/>
</div>
@ -272,7 +274,9 @@ onMounted(() => {
<div class="col-xs-6 col-sm-4 col-md-3">
<q-input
borderless
:model-value="date2Thai(education.startDate)"
:model-value="
education.startDate ? date2Thai(education.startDate) : '-'
"
readonly
label="ตั้งแต่"
>
@ -282,7 +286,9 @@ onMounted(() => {
<div class="col-xs-6 col-sm-4 col-md-3">
<q-input
borderless
:model-value="date2Thai(education.endDate)"
:model-value="
education.endDate ? date2Thai(education.endDate) : '-'
"
readonly
label="ถึง"
>
@ -291,7 +297,9 @@ onMounted(() => {
<div class="col-xs-6 col-sm-4 col-md-3">
<q-input
borderless
:model-value="date2Thai(education.finishDate)"
:model-value="
education.finishDate ? date2Thai(education.finishDate) : '-'
"
readonly
label="วันที่สำเร็จการศึกษา"
>
@ -311,7 +319,7 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.degree"
:model-value="education.degree ? education.degree:'-'"
label="วุฒิการศึกษา"
/>
</div>
@ -320,7 +328,7 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.field"
:model-value="education.field ? education.field : '-'"
label="สาขาวิชา/ทาง"
/>
</div>
@ -328,7 +336,7 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.fundName"
:model-value="education.fundName? education.fundName:'-'"
label="ทุน"
/>
</div>
@ -337,7 +345,7 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.gpa"
:model-value="education.gpa ? education.gpa :'-'"
label="เกรดเฉลี่ย"
/>
</div>
@ -346,10 +354,16 @@ onMounted(() => {
<q-input
borderless
readonly
:model-value="education.country"
:model-value="education.country ? education.country : '-'"
label="ประเทศ"
/>
</div>
<div
v-if="index + 1 !== formDetail.educations.length"
class="col-12"
>
<q-separator size="2px" />
</div>
</div>
</div>
<div v-else class="row col-12 q-pa-md">ไมประวการศกษา</div>
@ -403,7 +417,10 @@ onMounted(() => {
</div>
<div class="col-12"><q-separator /></div>
<div class="col-10">
<TableData :columns="columnProjectsProposed" />
<TableData
:columns="columnAssessments"
:row="formDetail.assessments"
/>
</div>
</q-card>
</div>

View file

@ -1,8 +1,13 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
const tabMenu = ref<string>("1");
const step = ref<number>(1);
@ -237,54 +242,119 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
]);
/** คอลัมน์ ผลงานที่เคยเสนอขอประเมิน*/
const columnProjectsProposed = ref<QTableProps["columns"]>([
const columnAssessments = ref<QTableProps["columns"]>([
{
name: "receivedDate",
align: "center",
name: "date",
align: "left",
label: "วันที่ได้รับ",
sortable: true,
field: "receivedDate",
field: "date",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
},
{
name: "authority",
name: "point1Total",
align: "left",
label: "ผู้มีอำนาจลงนาม",
label: "ส่วนที่1 (น้ำหนัก)",
sortable: true,
field: "authority",
field: "point1Total",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "datail",
name: "point1",
align: "left",
label: "รายละเอียด",
label: "ผลประเมินส่วนที่1 (คะแนน)",
sortable: true,
field: "detail",
field: "point1",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "orderNumber",
name: "point2Total",
align: "left",
label: "เลขที่คำสั่ง",
label: "ส่วนที่2 (น้ำหนัก)",
sortable: true,
field: "orderNumber",
field: "point2Total",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "doc",
name: "point2",
align: "left",
label: "เอกสารอ้างอิง",
label: "ผลประเมินส่วนที่2 (คะแนน)",
sortable: true,
field: "doc",
field: "point2",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "pointSumTotal",
align: "left",
label: "ผลรวม (น้ำหนัก)",
sortable: true,
field: "pointSumTotal",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "pointSum",
align: "left",
label: "ผลประเมินรวม (คะแนน)",
sortable: true,
field: "pointSum",
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",
format(val, row) {
return `${textPoint(row.pointSum)} ${textRangePoint(row.pointSum)}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
function textRangePoint(val: number | undefined) {
if (val == undefined) val = -1;
if (val < 60.0) return "(คะแนนต่ำกว่าร้อยละ 60.00)";
if (val >= 60.0 && val <= 69.99) return "(คะแนนร้อยละ 60.00 - 69.99)";
if (val >= 70.0 && val <= 79.99) return "(คะแนนร้อยละ 70.00 - 79.99)";
if (val >= 80.0 && val <= 89.99) return " (คะแนนร้อยละ 80.00 - 89.99)";
if (val >= 90.0) return " (คะแนนร้อยละ 90.00 ขึ้นไป)";
else return "";
}
function textPoint(val: number | undefined) {
if (val == undefined) val = -1;
if (val < 60.0) return "ต้องปรับปรุง";
if (val >= 60.0 && val <= 69.99) return "พอใช้";
if (val >= 70.0 && val <= 79.99) return "ดี";
if (val >= 80.0 && val <= 89.99) return "ดีมาก";
if (val >= 90.0) return "ดีเด่น";
else return "-";
}
return {
tabMenu,
step,
@ -294,7 +364,7 @@ export const useEvaluateDetailStore = defineStore("evaluateDetailStore", () => {
columnsCertificates,
columnSalaries,
columnTraining,
columnProjectsProposed,
columnAssessments,
pdfSrcStore,
urlDownloadFile,
numOfPagesStore,

View file

@ -38,7 +38,6 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ลำดับ",
sortable: false,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
field: (row) => rows.value.indexOf(row) + 1,
@ -48,20 +47,24 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ประเภทการลา",
sortable: true,
field: "leaveType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
field: (row) => row.leaveType.name,
format(val, row) {
return row.leaveType.name;
},
},
{
name: "dateLeave",
align: "left",
label: "วัน เดือน ปี ที่ลา",
sortable: true,
field: "dateLeave",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
field: (row) => dateThaiRange([row.dateLeaveStart, row.dateLeaveEnd]),
format(val, row) {
return dateThaiRange([row.dateLeaveStart, row.dateLeaveEnd]);
},
},
{
name: "leaveDays",
@ -165,7 +168,14 @@ onMounted(() => {
<q-card-section class="q-pt-none">
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-space />
<q-input dense outlined v-model="keyword" label="ค้นหา" class="q-mr-sm" @keydown.enter="onSearch">
<q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
</template>