Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-06-28 14:07:55 +07:00
commit 55182b688d
23 changed files with 1461 additions and 652 deletions

View file

@ -11,6 +11,7 @@ const KpiFile = `${env.API_URI}/salary/file`;
const KpiEvaluationInfo = `${env.API_URI}/kpi/evaluation`;
const Kpiorg = `${env.API_URI}/org/profile/commander`;
const Kpi = `${env.API_URI}/kpi`;
const KpiUser = `${env.API_URI}/kpi/user`;
const kpiAchievement = `${env.API_URI}/kpi/user/achievement`;
const kpiReason = `${env.API_URI}/kpi/reason`;
@ -45,7 +46,8 @@ export default {
kpiSendToStatus: (id: string) => `${kpiEvaluation}/status/${id}`,
kpiSendToSummary: (id: string) => `${kpiEvaluation}/summary/${id}`,
kpiSendToGet: (id: string) => `${kpiEvaluation}/reason/${id}`,
kpiSendToReason: (id: string,type:string) => `${kpiEvaluation}/reason/${type}/${id}`,
kpiSendToReason: (id: string, type: string) =>
`${kpiEvaluation}/reason/${type}/${id}`,
kpiReqEdit: (id: string) => `${kpiEvaluation}/edit/${id}`,
/**ประเมิน*/
kpiAchievementDevelop: `${kpiAchievement}/development`,
@ -59,4 +61,5 @@ export default {
sendToSummary: (id: string) => `${kpiEvaluation}/summary/${id}`,
updatePoint: (id: string) => `${kpiEvaluation}/point/${id}`,
openPoint: (id: string) => `${kpiEvaluation}/open/${id}`,
kpiReport: (id: string) => `${Kpi}/report/kpi9/${id}`,
};

View file

@ -0,0 +1,15 @@
import env from "./index";
const development = `${env.API_URI}/development`;
const urlFile = `${env.API_URI}/salary`;
export default {
// portfolio
portfolio: `${development}/portfolio`,
portfolioId: (id: string) => `${development}/portfolio/${id}`,
file: (name: string, group: string, id: string) =>
`${urlFile}/file/${name}/${group}/${id}`,
fileByFile: (name: string, group: string, id: string, fileName: string) =>
`${urlFile}/file/${name}/${group}/${id}/${fileName}`,
};

View file

@ -12,21 +12,51 @@ import org from "./api/org/api.org";
import scholarship from "./api/scholarship/api.scholarship";
import kpi from "./api/KPI/api.kpis";
import probation from "./api/probation/api.probation";
import development from "./api/api.development";
const API = {
...testtest,
...retirementResign,
...placementTransfer,
...message,
...evaluate,
...appeal,
...support,
...org,
...scholarship,
...kpi,
...probation,
...testtest,
...retirementResign,
...placementTransfer,
...message,
...evaluate,
...appeal,
...support,
...org,
...scholarship,
...kpi,
...probation,
...development,
};
const path = "http://localhost:3008";
const generatePopupPath = (routeName: any) => {
if (routeName.includes("metadata")) {
return `${path}/manual/chapter-2-admin-metadata`;
}
if (routeName.includes("leave")) {
return `${path}/manual/chapter-3-user-leave`;
}
// if (routeName.includes("compete")) {
// return `${path}/manual/chapter-10-admin-recruit`;
// }
// if (routeName.includes("registryNew")) {
// return `${path}/manual/chapter-7-admin-registry`;
// }
// if (routeName.includes("registry")) {
// return `${path}/manual/chapter-7-admin-registry`;
// }
else {
return manualConfig[routeName as keyof typeof manualConfig];
}
};
const manualConfig = {
dashboard: `${path}/manual/chapter-1-user-organization-chart`,
};
export default {
API: API,
API: API,
generatePopupPath,
};

View file

@ -34,6 +34,14 @@ const items = ref<any>([
path: "/organization-chart",
active: false,
},
{
icon: "mdi-clipboard-account-outline",
title: "ทะเบียนประวัติ",
sub: "ข้อมูลทะเบียนประวัติ",
color: "blue-4",
path: "/registry",
active: false,
},
{
icon: "mdi-clipboard-account-outline",
title: "ประเมินบุคคล",
@ -55,7 +63,7 @@ const items = ref<any>([
title: "ผลงาน",
sub: "ดูผลงาน",
color: "light-green-3",
path: "",
path: "/portfolio",
active: false,
},
{
@ -66,14 +74,14 @@ const items = ref<any>([
path: "/transfer",
active: false,
},
{
/*{
icon: "mdi-account-remove-outline",
title: "ลาออก",
sub: "ทำเรื่องลาออก",
color: "orange-3",
path: "/retire",
active: false,
},
},*/
{
icon: "mdi-scale-balance",
title: "อุทธรณ์ร้องทุกข์",

View file

@ -99,13 +99,13 @@ const fecthDataTransfer = async (id: string) => {
};
/**
* งกนดาวโหลดอโหลดไฟล
* งกนดาวโหลดอโหลดไฟล
*/
const fileDocDataUpload = ref<File[]>([]);
const filesNull = () => {
files.value = null;
};
//
//
const fileUploadDoc = async (file: any) => {
fileDocDataUpload.value.push(file);
nameFile.value = file[0].name;
@ -178,25 +178,12 @@ function fileOpen(url: string) {
lazy-rules
hide-bottom-space
accept=".pdf"
:rules="[
(val) => !!val || 'กรุณากรอกอัพโหลดเอกสารเพิ่มเติม',
]"
:rules="[(val: string) => !!val || 'กรุณาเลือกไฟล์เอกสารเพิ่มเติม']"
label="เอกสารเพิ่มเติม"
>
<template v-slot:prepend>
<q-icon name="attach_file" /> </template
></q-file>
<!-- <q-uploader
bordered
flat
class="col-12"
accept=".jpg,.png,.pdf,.csv,.doc"
url="http://localhost:4444/upload"
label="เอกสารเพิ่มเติม"
type="file"
@added="fileUploadDoc"
@removed="filesNull"
/> -->
</div>
<div class="col-12 row" v-if="routeName != 'addTransfer'">
<q-card bordered flat class="full-width">
@ -209,10 +196,7 @@ function fileOpen(url: string) {
</div>
<q-separator />
<q-list separator>
<q-item
v-for="file in files"
:key="file.key"
>
<q-item v-for="file in files" :key="file.key">
<q-item-section>
{{ file.fileName }}
</q-item-section>

View file

@ -234,7 +234,7 @@ function downloadFile(data: string) {
"
:label="`${'วันที่ยื่นขอลาออกจากราชการ'}`"
:rules="[
(val) =>
(val: string) =>
!!val || `${'กรุณาเลือกวันที่ยื่นขอลาออกจากราชการ'}`,
]"
>
@ -282,7 +282,7 @@ function downloadFile(data: string) {
"
:label="`${'วันที่ขอลาออกจากราชการ'}`"
:rules="[
(val) =>
(val: string) =>
!!val || `${'กรุณาเลือกวันที่ขอลาออกจากราชการ'}`,
]"
>
@ -309,7 +309,7 @@ function downloadFile(data: string) {
hide-bottom-space
:readonly="routeName != 'AddRetire'"
:rules="[
(val) => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`,
(val: string) => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`,
]"
/>
@ -322,9 +322,7 @@ function downloadFile(data: string) {
lazy-rules
hide-bottom-space
accept=".pdf"
:rules="[
(val) => !!val || 'กรุณากรอกอัพโหลดเอกสารเพิ่มเติม',
]"
:rules="[(val: string) => !!val || 'กรุณาเลือกเอกสารเพิ่มเติม']"
label="เอกสารเพิ่มเติม"
>
<template v-slot:prepend>
@ -332,12 +330,7 @@ function downloadFile(data: string) {
></q-file>
</div>
<div class="col-12 row" v-if="routeName != 'AddRetire'">
<q-card
bordered
flat
class="row col-12 text-dark q-mt-sm"
>
<q-card bordered flat class="row col-12 text-dark q-mt-sm">
<div
class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"
>
@ -376,11 +369,7 @@ function downloadFile(data: string) {
</div>
<div class="col-12 row" v-if="routeName != 'AddRetire'">
<q-card
bordered
class="row col-12 text-dark q-mt-sm"
>
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div
class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"
>
@ -444,11 +433,7 @@ function downloadFile(data: string) {
</div>
<div class="col-12 row" v-if="routeName != 'AddRetire'">
<q-card
bordered
class="row col-12 text-dark q-mt-sm"
>
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div
class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"
>
@ -511,11 +496,7 @@ function downloadFile(data: string) {
</q-card>
</div>
<div class="col-12 row" v-if="routeName != 'AddRetire'">
<q-card
bordered
class="row col-12 text-dark q-mt-sm"
>
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div
class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"
>
@ -579,27 +560,33 @@ function downloadFile(data: string) {
</div>
</div>
</div>
</div>
<q-separator v-if="routeName !== 'AddRetire'" />
<q-card-actions align="right" v-if="routeName !== 'AddRetire'" class="q-px-md">
<q-btn
v-if="
dataDetail.status !== 'DELETE' &&
dataDetail.status !== 'DONE' &&
dataDetail.status !== 'CANCEL'
"
unelevated
class="q-px-md items-center"
color="orange"
label="ยกเลิกการลาออก"
@click="cancelResing"
:disable="tranferOrg == '' && noteReason == ''"
/>
</q-card-actions>
<q-card-actions
align="right"
v-if="routeName !== 'AddRetire'"
class="q-px-md"
>
<q-btn
v-if="
dataDetail.status !== 'DELETE' &&
dataDetail.status !== 'DONE' &&
dataDetail.status !== 'CANCEL'
"
unelevated
class="q-px-md items-center"
color="orange"
label="ยกเลิกการลาออก"
@click="cancelResing"
:disable="tranferOrg == '' && noteReason == ''"
/>
</q-card-actions>
<q-separator v-if="routeName == 'AddRetire'" />
<q-card-actions align="right" v-if="routeName == 'AddRetire'" class="q-px-md">
<q-card-actions
align="right"
v-if="routeName == 'AddRetire'"
class="q-px-md"
>
<q-space />
<q-btn
unelevated

View file

@ -139,7 +139,7 @@ const clickBack = () => {
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn
<!-- <q-btn
icon="mdi-arrow-left"
unelevated
round
@ -148,8 +148,8 @@ const clickBack = () => {
color="primary"
class="q-mr-sm"
@click="clickBack"
/>
ลาออก
/> -->
ขอลาออก
</div>
<div class="col-12">
<q-card bordered class="q-pa-md">

View file

@ -185,22 +185,6 @@ watch(
store.indicatorScoreVal =
store.indicatorPercentVal * (store.indicatorScore / 100);
if (store.isUpdate && store.tabMain === "3") {
http
.put(config.API.updatePoint(evaluationId.value), {
totalPoint1: (
store.indicatorPercentVal *
(store.indicatorScore / 100)
).toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
}
}
);
@ -229,7 +213,7 @@ onMounted(() => {
<!-- องคประกอบท 1 -->
<div
v-if="
store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร'
"
>

View file

@ -6,6 +6,7 @@ import { useKpiDataStore } from "@/modules/08_KPI/store";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
import genReport from "@/plugins/genreport";
const store = useKpiDataStore();
const $q = useQuasar();
@ -191,6 +192,33 @@ function getData() {
.finally(() => {});
}
/**
* งกนดาวนโหลดรายงาน
*/
async function downloadReport() {
showLoader();
await http
.get(config.API.kpiReport(id.value))
.then(async (res) => {
console.log(res.data.result.data);
const data = res.data.result;
await genReport(
data,
"แบบรายงานผลการปฏิบัติราชการ " +
store.dataEvaluation.prefix +
store.dataEvaluation.fileName +
" " +
store.dataEvaluation.lastName
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
getData();
fetchEvaluation();
@ -206,6 +234,21 @@ onMounted(() => {
<q-toolbar-title class="text-subtitle2 text-bold"
>สรปผลการประเม</q-toolbar-title
>
<q-space />
<q-btn
v-if="store.dataEvaluation.evaluationStatus === 'COMPLETE'"
outline
flat
dense
color="blue"
icon="mdi-download"
size="12px"
class="q-mr-md"
@click="downloadReport"
>
<q-tooltip>ดาวนโหลดแบบรายงานผลการปฏราชการ</q-tooltip>
</q-btn>
</q-toolbar>
<q-separator />
<q-card-section>

View file

@ -277,12 +277,22 @@ watch(
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 85%">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader :tittle="`เพิ่มสมรรถนะ`" :close="closeDialog" />
<DialogHeader
:tittle="
competencyType == 'HEAD' || competencyType == 'GROUP'
? `รายละเอียดสมรรถนะ`
: `เพิ่มสมรรถนะ`
"
:close="closeDialog"
/>
<q-separator />
<q-card-section class="q-pa-none scroll" style="max-height: 80vh">
<div class="row">
<div class="bg-grey-1 q-pa-md col-xs-12 col-md-3 row lineRight">
<div
v-if="competencyType != 'HEAD' && competencyType != 'GROUP'"
class="bg-grey-1 q-pa-md col-xs-12 col-md-3 row lineRight"
>
<div class="col-12 q-col-gutter-sm fit">
<div class="col-12">
<q-select
@ -362,7 +372,13 @@ watch(
</div>
</div>
<div class="col-xs-12 col-md-9 q-pa-md q-col-gutter-sm">
<div
:class="
competencyType == 'HEAD' || competencyType == 'GROUP'
? `col-xs-12 col-md-12 q-pa-md q-col-gutter-sm`
: `col-xs-12 col-md-9 q-pa-md q-col-gutter-sm`
"
>
<span class="text-body2 text-weight-medium"
>รายละเอยดสมรรถนะ</span
>

View file

@ -19,6 +19,7 @@ import type {
import DialogListCriteria from "@/modules/08_KPI/components/Tab/Dialog/DialogListCriteria.vue";
import DialogCompetncyByRow from "@/modules/08_KPI/components/Tab/Dialog/DialogCompetncyByRow.vue";
import DialogLevel from "@/modules/08_KPI/components/Tab/Dialog/DialogLevel.vue";
import type { DataOptions } from "@/modules/08_KPI/interface/index/Main";
const modalLevel = ref<boolean>(false);
const modalCompetncyByRow = ref<boolean>(false);
@ -146,8 +147,8 @@ function getData(type: string) {
let result = 0;
let weight = 0;
let total = 0;
for (let index = 0; index < store.competencyType.length; index++) {
const element = await store.competencyType[index];
for (let index = 0; index < competencyType.value.length; index++) {
const element = await competencyType.value[index];
const dataArr = await lists.value.find(
(x: any) => x.type == element.id
@ -171,7 +172,7 @@ function getData(type: string) {
let resultAvg = result / total;
if (
store.dataEvaluation.posTypeName == "อำนวยการ" &&
store.dataEvaluation.posTypeName == "อำนวยการ" ||
store.dataEvaluation.posTypeName == "บริหาร"
) {
store.competencyScoreVal =
@ -184,24 +185,6 @@ function getData(type: string) {
? (resultAvg / weightAvg) * store.competencyScore
: 0;
}
if (
store.isUpdate &&
store.tabMain === "3" &&
(store.dataEvaluation.evaluationStatus === "EVALUATOR" ||
store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR")
) {
http
.put(config.API.updatePoint(store.dataEvaluation.id), {
totalPoint2_1: store.competencyScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
}
});
}
@ -273,18 +256,6 @@ const isEditStep3 = computed(() => {
);
});
watch(
() => store.dataEvaluation.capacityPoint,
(newValue, oldValue) => {
if (newValue !== oldValue) {
for (let index = 0; index < store.competencyType.length; index++) {
const element = store.competencyType[index];
getData(element.id);
}
}
}
);
function onInfo() {
modalCriteria.value = true;
}
@ -299,16 +270,32 @@ function onLevel(num: number, list: any) {
modalLevel.value = true;
}
onMounted(() => {
for (let index = 0; index < store.competencyType.length; index++) {
const element = store.competencyType[index];
getData(element.id);
}
const competencyType = ref<DataOptions[]>([]);
onMounted(async () => {
setTimeout(async () => {
competencyType.value = await (store.dataEvaluation.posTypeName ==
"อำนวยการ" || store.dataEvaluation.posTypeName == "บริหาร"
? store.competencyType.filter(
(x: DataOptions) =>
x.id == "HEAD" ||
x.id == "EXECUTIVE" ||
x.id == "INSPECTOR" ||
x.id == "DIRECTOR"
)
: store.competencyType.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
));
for (let index = 0; index < competencyType.value.length; index++) {
const element = competencyType.value[index];
getData(element.id);
}
}, 1000);
});
</script>
<template>
<div v-for="(item, index) in store.competencyType" :key="index">
<div v-for="(item, index) in competencyType" :key="index">
<q-card bordered style="border-radius: 5px" class="no-shadow q-mt-sm">
<q-card-section class="bg-grey-2 q-py-sm">
<div class="row items-center">
@ -468,7 +455,10 @@ onMounted(() => {
color="info"
@click.stop.pervent="onEdit(props.row, item.id)"
>
<q-tooltip>แกไข </q-tooltip>
<q-tooltip v-if="item.id == 'HEAD' || item.id == 'GROUP'"
>รายละเอยด</q-tooltip
>
<q-tooltip v-else>แก้ไข</q-tooltip>
</q-btn>
<q-btn
flat

View file

@ -126,24 +126,6 @@ function getDevelop() {
(sum: number, e: any) => sum + e.summary,
0
);
if (
store.isUpdate &&
store.tabMain === "3" &&
(store.dataEvaluation.evaluationStatus === "EVALUATOR" ||
store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR")
) {
http
.put(config.API.updatePoint(store.dataEvaluation.id), {
totalPoint2_2: store.devScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
});
}

View file

@ -58,7 +58,9 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const dataEvaluation = ref<any>({
evaluationReqEdit: null,
evaluationResults: null,
evaluationStatus: null,
isOpen: null,
profileId: null,
evaluatorId: null,
commanderId: null,
@ -66,6 +68,17 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
plannedPoint: 0,
rolePoint: 0,
specialPoint: 0,
prefix: "",
firstName: "",
lastName: "",
posExecutiveName: "",
posLevelName: "",
posTypeName: "",
position: "",
summaryPoint: 0,
totalPoint1: 0,
totalPoint2_1: 0,
totalPoint2_2: 0,
});
const competencyType = ref<DataOptions[]>([
@ -144,39 +157,41 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
}
}
async function checkCompetency() {
// const position = await dataEvaluation.value.position;
// const executiveName = await dataEvaluation.value.posExecutiveName;
const posTypeName = dataEvaluation.value.posTypeName;
const posLevelName = dataEvaluation.value.posLevelName;
// async function checkCompetency() {
// // const position = await dataEvaluation.value.position;
// // const executiveName = await dataEvaluation.value.posExecutiveName;
// const posTypeName = await dataEvaluation.value.posTypeName;
// const posLevelName = dataEvaluation.value.posLevelName;
// if (
// position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
// position == "ผู้ตรวจราชการ"
// ) {
// competencyType.value = competencyType.value.filter(
// (x: DataOptions) => x.id == "HEAD" || x.id == "INSPECTOR"
// );
// } else if (position == "ผู้อำนวยการเขต") {
// competencyType.value = competencyType.value.filter(
// (x: DataOptions) => x.id == "HEAD" || x.id == "DIRECTOR"
// );
// } else {
if (posTypeName == "อำนวยการ" || posTypeName == "บริหาร") {
competencyType.value = competencyType.value.filter(
(x: DataOptions) =>
x.id == "HEAD" ||
x.id == "EXECUTIVE" ||
x.id == "INSPECTOR" ||
x.id == "DIRECTOR"
);
} else {
competencyType.value = competencyType.value.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
);
}
// }
}
// console.log("posTypeName===>", posTypeName);
// // if (
// // position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
// // position == "ผู้ตรวจราชการ"
// // ) {
// // competencyType.value = competencyType.value.filter(
// // (x: DataOptions) => x.id == "HEAD" || x.id == "INSPECTOR"
// // );
// // } else if (position == "ผู้อำนวยการเขต") {
// // competencyType.value = competencyType.value.filter(
// // (x: DataOptions) => x.id == "HEAD" || x.id == "DIRECTOR"
// // );
// // } else {
// if (posTypeName == "อำนวยการ" || posTypeName == "บริหาร") {
// competencyType.value = await competencyType.value.filter(
// (x: DataOptions) =>
// x.id == "HEAD" ||
// x.id == "EXECUTIVE" ||
// x.id == "INSPECTOR" ||
// x.id == "DIRECTOR"
// );
// } else {
// competencyType.value = await competencyType.value.filter(
// (x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
// );
// }
// // }
// }
const defaultCompetencyCoreLevel = ref<number>();
const defaultCompetencyGroupLevel = ref<number | null>(null);
@ -343,46 +358,46 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const indicatorScoreVal = ref<number>(0); // สรุปผลการประเมินผลสัมฤทธิ์ของงานที่ได้
const competencyScoreVal = ref<number>(0); // ผลการประเมินสมรรถนะที่ได้กี่คะแนน
function getDataWork() {
showLoader();
http
.get(config.API.orgPosition + `/${dataProfile.value.profileId}`)
.then((res) => {
const data = res.data.result.isProbation;
work.value = data;
if (data) {
indicatorScore.value = 50;
competencyScore.value = 40;
excusiveCompetencyScore.value = 40;
competencyDevScore.value = 10;
} else {
indicatorScore.value = 70;
competencyScore.value = 20;
excusiveCompetencyScore.value = 20;
competencyDevScore.value = 30;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
// function getDataWork() {
// showLoader();
// http
// .get(config.API.orgPosition + `/${dataProfile.value.profileId}`)
// .then((res) => {
// const data = res.data.result.isProbation;
// work.value = data;
// if (data) {
// indicatorScore.value = 50;
// competencyScore.value = 40;
// excusiveCompetencyScore.value = 40;
// competencyDevScore.value = 10;
// } else {
// indicatorScore.value = 70;
// competencyScore.value = 20;
// excusiveCompetencyScore.value = 20;
// competencyDevScore.value = 30;
// }
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// }
watch(
() => tabMain.value,
() => {
if (tabMain.value == "3" && tabOpen.value == 3) {
getDataWork();
} else {
indicatorScore.value = 70;
competencyScore.value = 20;
excusiveCompetencyScore.value = 20;
competencyDevScore.value = 30;
}
}
);
// watch(
// () => tabMain.value,
// () => {
// if (tabMain.value == "3" && tabOpen.value == 3) {
// getDataWork();
// } else {
// indicatorScore.value = 70;
// competencyScore.value = 20;
// excusiveCompetencyScore.value = 20;
// competencyDevScore.value = 30;
// }
// }
// );
return {
tabMain,
@ -392,7 +407,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
convertCompetencyType,
convertStatus,
convertResults,
checkCompetency,
// checkCompetency,
checkCompetencyDefaultCompetencyLevel,
defaultCompetencyCoreLevel,
defaultCompetencyGroupLevel,

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, reactive, computed, watch } from "vue";
import { ref, onMounted, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
@ -66,7 +66,7 @@ async function fetchEvaluation() {
store.dataEvaluation = await data;
formProfile.status = store.convertStatus(data.evaluationStatus);
formProfile.result = store.convertResults(data.evaluationResults);
store.checkCompetency();
// store.checkCompetency();
store.checkCompetencyDefaultCompetencyLevel();
fetchProfile(data.profileId);
@ -264,8 +264,8 @@ function filterOption(val: any, update: Function, refData: string) {
async function getAll() {
await fetchEvaluation();
getProfile();
getOrgOp();
await getProfile();
await getOrgOp();
}
function sendToEvaluatore() {
@ -401,14 +401,44 @@ function sendToEvauator() {
});
}
function goToSummary() {
async function goToSummary() {
dialogConfirm(
$q,
() => {
async () => {
showLoader();
http
await http
.get(config.API.sendToSummary(store.dataEvaluation.id))
.then(async (res) => {
await http
.put(
config.API.updatePoint(store.dataEvaluation.id),
store.dataEvaluation.posTypeName != "อำนวยการ" &&
store.dataEvaluation.posTypeName != "บริหาร"
? {
totalPoint1: store.indicatorScoreVal.toFixed(2),
totalPoint2_1: store.competencyScoreVal.toFixed(2),
totalPoint2_2: store.devScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
}
: {
totalPoint1: (
store.excusiveIndicator1ScoreVal +
store.excusiveIndicator2ScoreVal
).toFixed(2),
totalPoint2_1: store.competencyScoreVal.toFixed(2),
summaryPoint: (
store.excusiveIndicator1ScoreVal +
store.excusiveIndicator2ScoreVal +
store.competencyScoreVal
).toFixed(2),
}
)
.then((res) => {});
await fetchEvaluation();
store.tabMain = "4";
store.tabOpen = 4;
@ -502,15 +532,15 @@ onMounted(async () => {
<div class="q-gutter-x-sm">
<span
v-if="
(store.tabMain === '1' &&
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.tabMain === '1' &&
store.dataEvaluation.evaluationStatus == 'NEW' &&
((store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร' &&
store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'บริหาร' &&
(store.indicatorWeight1Total != 100 ||
store.indicatorWeight2Total != 20) &&
store.dataEvaluation.evaluationStatus == 'NEW')
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร') &&
(store.indicatorWeight1Total != 100 ||
store.indicatorWeight2Total != 20)))
"
class="text-red"
>*ำหน(อยละ) ผลสมฤทธของงานไมกตอง</span
@ -525,8 +555,8 @@ onMounted(async () => {
(store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร' &&
store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'บริหาร' &&
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร') &&
(store.indicatorWeight1Total != 100 ||
store.indicatorWeight2Total != 20))
"

View file

@ -275,8 +275,6 @@ function getProfile() {
.then(async (res) => {
const data = await res.data.result;
store.dataProfile = data;
store.checkCompetency();
store.checkCompetencyDefaultCompetencyLevel();
formRound.profileId = data.profileId;
formRound.prefix = data.prefix;

View file

@ -292,7 +292,7 @@ async function clickUpload(file: any) {
}
/**
* งกนสำหรบอโหลดไฟลเอกสารหลกฐาน
* งกนสำหรบอโหลดไฟลเอกสารหลกฐาน
*/
async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData();

View file

@ -132,16 +132,34 @@ const doLogout = () => {
);
};
/**
* งชนกลบหนาหล
*/
const clickBack = () => {
router.push(`/`);
};
onMounted(async () => {
store.typeProfile = "OFFICER";
await getType();
await getMain();
});
</script>
<template>
<div class="row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="clickBack"
/>
อมลทะเบยนประว
</div>
<div v-if="$q.screen.gt.xs" class="row q-col-gutter-md">

View file

@ -0,0 +1,33 @@
/**
* Router
*/
const MainPage = () => import("@/modules/13_portfolio/views/Main.vue");
const FormData = () => import("@/modules/13_portfolio/views/Add.vue");
export default [
{
path: "/portfolio",
name: "portfolio",
component: MainPage,
meta: {
Auth: true,
},
},
{
path: "/portfolio/add",
name: "addPortfolio",
component: FormData,
meta: {
Auth: true,
},
},
{
path: "/portfolio/:id",
name: "portfolioDetail",
component: FormData,
meta: {
Auth: true,
},
},
];

View file

@ -0,0 +1,302 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import type { QForm } from "quasar";
const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin();
const { success, messageError, showLoader, hideLoader, dialogConfirm } = mixin;
/**
* วแปรทใชงาน
*/
const route = useRoute();
const files = ref<any>();
const name = ref("");
const detail = ref("");
const id = ref<string>("");
const routeName = router.currentRoute.value.name;
const fileList = ref<any[]>([]);
/**
* เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/
onMounted(() => {
if (route.params.id !== undefined) {
id.value = route.params.id.toString();
fecthData(id.value);
}
});
const saveData = async () => {
dialogConfirm(
$q,
() => {
createTransfer();
},
"ยืนยันการยื่นข้อมูลการโอน",
"ต้องการยื่นข้อมูลการโอนนี้ใช่หรือไม่"
);
};
/**
* งกนสรางขอโอน
*/
const createTransfer = async () => {
showLoader();
await http
.post(config.API.portfolio, { name: name.value, detail: detail.value })
.then(async (res) => {
uploadFiles(res.data.result);
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
};
/**
* งกนเรยกขอมลจาก Api
* @param id ไอดของขอม
*/
const fecthData = async (id: string) => {
showLoader();
await http
.get(config.API.portfolioId(id))
.then((res: any) => {
let data = res.data.result;
name.value = data.name;
detail.value = data.detail;
fetchFile();
})
.catch((e: any) => {
messageError($q, e);
hideLoader();
});
};
/**
* function ปโหลดไฟล
* @param id ผลงาน
*/
function uploadFiles(id: string) {
showLoader();
http
.post(config.API.file("ระบบผลงาน", "เอกสารผลงาน", id), {
replace: true,
fileList: [
{
fileName: files.value.name,
},
],
})
.then(async (res) => {
console.log(res);
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey && uploadFileURL(res.data[foundKey]?.uploadUrl);
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}
/**
* function นทกไฟล
* @param uploadUrl นทกไฟล
*/
function uploadFileURL(uploadUrl: string) {
const Data = new FormData();
Data.append("file", files.value);
showLoader();
axios
.put(uploadUrl, files.value, {
headers: {
"Content-Type": files.value.type,
},
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
router.push(`/portfolio`);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
files.value = null;
});
}
/**
*function fetch รายการเอกสาร
*/
function fetchFile() {
showLoader();
http
.get(config.API.file("ระบบผลงาน", "เอกสารผลงาน", id.value))
.then((res) => {
fileList.value = res.data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนดาวโหลดอปโหลดไฟล
* @param fileName อไฟล
*/
function fileOpen(fileName: string) {
showLoader();
http
.get(
config.API.fileByFile("ระบบผลงาน", "เอกสารผลงาน", id.value, fileName)
)
.then((res) => {
const data = res.data.downloadUrl;
window.open(data, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
</script>
<template>
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white 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)"
/>
<div v-if="routeName == 'addTransfer'">เพิ่มเอกสาร/ผลงาน</div>
<div v-else>รายละเอียดเอกสาร/ผลงาน</div>
</div>
<q-form
class="col-12"
greedy
@submit.prevent
@validation-success="saveData"
>
<q-card bordered>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input
:class="
routeName != 'addPortfolio' ? 'col-12' : 'col-12 inputgreen'
"
dense
outlined
v-model="name"
hide-bottom-space
label="ชื่อเอกสาร/ผลงาน"
:readonly="routeName != 'addPortfolio'"
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อเอกสาร/ผลงาน'}`]"
/>
<q-input
:class="
routeName != 'addPortfolio' ? 'col-12' : 'col-12 inputgreen'
"
dense
outlined
v-model="detail"
label="รายละเอียดเอกสาร/ผลงาน"
hide-bottom-space
type="textarea"
:readonly="routeName != 'addPortfolio'"
:rules="[(val:string) => !!val || `${'กรุณากรอกรายละเอียดเอกสาร/ผลงาน'}`]"
/>
<div class="col-12 row" v-if="routeName == 'addPortfolio'">
<q-file
v-model="files"
class="col-xs-12 col-sm-12 inputgreen"
outlined
dense
lazy-rules
hide-bottom-space
accept=".pdf, .docx, .doc, .xlsx, .xls"
:rules="[
(val:string) => !!val || 'กรุณาเลือกไฟล์เอกสาร/ผลงาน',
]"
label="เอกสาร/ผลงาน"
>
<template v-slot:prepend>
<q-icon name="attach_file" /> </template
></q-file>
</div>
<div class="col-12 row" v-if="routeName != 'addPortfolio'">
<q-card bordered flat class="full-width">
<div
class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"
>
<div class="q-pl-sm text-weight-bold text-dark">
เอกสาร/ผลงาน
</div>
</div>
<q-separator />
<q-list separator>
<q-item v-for="file in fileList" :key="file.key">
<q-item-section>
{{ file.fileName }}
</q-item-section>
<q-item-section avatar>
<q-btn
color="teal-5"
round
flat
icon="mdi-download"
@click="fileOpen(file.fileName)"
></q-btn>
</q-item-section>
</q-item>
</q-list>
</q-card>
</div>
</div>
</div>
</div>
<q-separator v-if="routeName == 'addPortfolio'" />
<q-card-actions
align="right"
class="row col-12"
v-if="routeName == 'addPortfolio'"
>
<q-space />
<q-btn
unelevated
class="q-px-md items-center"
color="primary"
label="บันทึก"
type="onsubmit"
/>
</q-card-actions>
</q-card>
</q-form>
</div>
</div>
</template>

View file

@ -0,0 +1,303 @@
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const currentPage = ref<number>(1);
const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
date2Thai,
messageError,
showLoader,
hideLoader,
dialogRemove,
success,
} = mixin;
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
/**
* เพมหวขอตาราง
*/
const filter = ref<string>("");
const rows = ref<any>([]);
const visibleColumns = ref<String[]>(["no", "name", "detail"]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5px;",
},
{
name: "name",
align: "left",
label: "ชื่อเอกสาร/ผลงาน",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5px;",
},
{
name: "detail",
align: "left",
label: "รายละเอียดเอกสาร/ผลงาน",
sortable: true,
field: "detail",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5px;",
},
]);
/**
* เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/
onMounted(async () => {
await fecthList();
});
//
const fecthList = async () => {
showLoader();
await http
.get(config.API.portfolio)
.then((res: any) => {
rows.value = res.data.result;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
/**
* งกนกดเพมไปหนาเพมขอโอน
*/
const clickAdd = async () => {
router.push(`/portfolio/add`);
};
/**
* งกนกดยอนกล
*/
const clickBack = () => {
router.push(`/`);
};
function onDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.portfolioId(id))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
fecthList();
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
});
}
</script>
<template>
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="clickBack"
/>
รายการเอกสาร/ผลงาน
</div>
<div class="col-12">
<q-card bordered class="q-pa-md">
<div class="q-pb-sm row">
<div>
<q-btn
size="14px"
flat
dense
color="blue"
@click="clickAdd"
icon="mdi-plus"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div>
<q-space />
<div class="items-center q-gutter-sm" style="display: flex">
<!-- นหาขอความใน table -->
<q-input
standout
dense
v-model="filter"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
style="max-width: 200px"
>
<template v-slot:append>
<q-icon v-if="filter == ''" name="search" />
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
v-model="visibleColumns"
:display-value="$q.lang.table.columns"
multiple
outlined
dense
:options="columns"
options-dense
option-value="name"
map-options
emit-value
style="min-width: 150px"
class="gt-xs"
>
<template> </template>
</q-select>
</div>
</div>
<div>
<d-table
flat
bordered
dense
:paging="true"
row-key="id"
class="custom-table2"
style="max-height: 80vh"
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
>
<template v-slot:pagination="scope">
งหมด {{ rows.length }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
<template v-slot:header="props">
<q-tr :props="props">
<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-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="router.push(`/portfolio/` + props.row.id)"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else class="table_ellipsis2">
{{ col.value }}
</div>
</q-td>
<q-td>
<q-btn
dense
flat
round
color="red"
icon="delete"
@click.pervent="onDelete(props.row.id)"
/>
</q-td>
</q-tr>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat>
<q-list @click="router.push(`/portfolio/` + props.row.id)">
<q-item
v-for="col in props.cols.filter((col:any) => col.name !== 'desc')"
:key="col.name"
>
<q-item-section>
<q-item-label caption>{{ col.label }}</q-item-label>
<q-item-label v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</q-item-label>
<q-item-label v-else>{{
col.value ?? "-"
}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
<q-separator />
<q-card-actions vertical align="center">
<q-btn
dense
flat
round
color="red"
icon="delete"
@click.pervent="onDelete(props.row.id)"
/>
</q-card-actions>
</q-card>
</div>
</template>
</d-table>
</div>
</q-card>
</div>
</div>
</div>
</template>
<style scoped lang="scss"></style>

View file

@ -16,6 +16,7 @@ import ModuleScholarship from "@/modules/09_scholarship/router";
import ModuleRegistry from "@/modules/10_registry/router";
import ModuleProbation from "@/modules/11_probation/router";
import ModuleOrganization from "@/modules/12_organization/router";
import ModulePortfolio from "@/modules/13_portfolio/router";
// TODO: ใช้หรือไม่?
import keycloak from "@/plugins/keycloak";
@ -57,6 +58,7 @@ const router = createRouter({
...ModuleRegistry,
...ModuleProbation,
...ModuleOrganization,
...ModulePortfolio,
],
},
],

View file

@ -89,5 +89,28 @@ input.input-alert
text-overflow: ellipsis
width: 200px
.q-card__actions .q-btn--rectangle
padding: 0 14px !important
.q-card__actions .q-btn--rectangle
padding: 0 14px !important
.table_ellipsis
max-width: 200px
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
.table_ellipsis:hover
word-wrap: break-word
overflow: visible
white-space: normal
.table_ellipsis2
max-width: 25vw
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
.table_ellipsis2:hover
word-wrap: break-word
overflow: visible
white-space: normal
transition: width 2s

View file

@ -14,13 +14,13 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const {
date2Thai,
dialogRemove,
showLoader,
hideLoader,
messageError,
success,
dialogConfirm,
date2Thai,
dialogRemove,
showLoader,
hideLoader,
messageError,
success,
dialogConfirm,
} = mixin;
const fullname = ref<string>("");
@ -34,54 +34,54 @@ const link = ref<string>("");
* เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/
onMounted(async () => {
await fetchTotolNotificate();
if (keycloak.tokenParsed != null) {
fullname.value = keycloak.tokenParsed.name;
}
await fetchTotolNotificate();
if (keycloak.tokenParsed != null) {
fullname.value = keycloak.tokenParsed.name;
}
});
const totalNoti = ref<number>(0);
async function fetchTotolNotificate() {
await http
.get(config.API.msgNotificateTotal)
.then((res) => {
totalNoti.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
});
await http
.get(config.API.msgNotificateTotal)
.then((res) => {
totalNoti.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
});
}
const statusLoad = ref<boolean>(false);
const fetchlistNotification = async (index: number, type: string) => {
await http
.get(config.API.msgNotificate + `?page=${index}&pageSize=${15}`)
.then((res: any) => {
const data = res.data.result.data;
totalInbox.value = res.data.result.total;
let list: any[] = [];
if (type === "DEL") {
notiList.value = [];
}
data.map((e: any) => {
list.push({
id: e.id,
sender:
e.createdFullName == "" || e.createdFullName == null
? "เจ้าหน้าที่"[0]
: e.createdFullName[0],
body: e.body ?? "",
timereceive: date2Thai(e.createdAt),
isOpen: e.isOpen,
receiveDate: e.receiveDate,
});
});
notiList.value.push(...list);
statusLoad.value = totalInbox.value === 0 ? true : false;
})
.catch((err) => {
console.log(err);
});
await http
.get(config.API.msgNotificate + `?page=${index}&pageSize=${15}`)
.then((res: any) => {
const data = res.data.result.data;
totalInbox.value = res.data.result.total;
let list: any[] = [];
if (type === "DEL") {
notiList.value = [];
}
data.map((e: any) => {
list.push({
id: e.id,
sender:
e.createdFullName == "" || e.createdFullName == null
? "เจ้าหน้าที่"[0]
: e.createdFullName[0],
body: e.body ?? "",
timereceive: date2Thai(e.createdAt),
isOpen: e.isOpen,
receiveDate: e.receiveDate,
});
});
notiList.value.push(...list);
statusLoad.value = totalInbox.value === 0 ? true : false;
})
.catch((err) => {
console.log(err);
});
};
/**
@ -89,280 +89,311 @@ const fetchlistNotification = async (index: number, type: string) => {
* confirm อนออกจากระบบ
*/
const doLogout = () => {
dialogConfirm(
$q,
() => {
keycloak.logout();
},
"ยืนยันการออกจากระบบ",
"ต้องการออกจากระบบใช่หรือไม่"
);
dialogConfirm(
$q,
() => {
keycloak.logout();
},
"ยืนยันการออกจากระบบ",
"ต้องการออกจากระบบใช่หรือไม่"
);
};
const clickDelete = async (id: string, index: number) => {
dialogRemove($q, async () => {
// showLoader();
await http
.delete(config.API.msgId(id))
.then(() => {
notiList.value.splice(index, 1);
totalInbox.value--;
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
notiList.value.length === 12 && fetchlistNotification(1, "DEL");
// hideLoader();
});
});
dialogRemove($q, async () => {
// showLoader();
await http
.delete(config.API.msgId(id))
.then(() => {
notiList.value.splice(index, 1);
totalInbox.value--;
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
notiList.value.length === 12 && fetchlistNotification(1, "DEL");
// hideLoader();
});
});
};
const totalInbox = ref<number>(0);
const page = ref<number>(0);
async function onLoad(index: any, done: any) {
if (
notiList.value.length < totalInbox.value ||
(notiList.value.length === 0 && totalInbox.value === 0)
) {
page.value++;
setTimeout(async () => {
await fetchlistNotification(page.value, "NOMAL");
done();
}, 1500);
}
if (
notiList.value.length < totalInbox.value ||
(notiList.value.length === 0 && totalInbox.value === 0)
) {
page.value++;
setTimeout(async () => {
await fetchlistNotification(page.value, "NOMAL");
done();
}, 1500);
}
}
watch(
() => notiTrigger.value,
() => {
if (!notiTrigger.value) {
const updatedNotifications = notiList.value.map((item: any) => ({
...item,
isOpen: true,
}));
notiList.value = updatedNotifications;
fetchTotolNotificate();
}
}
() => notiTrigger.value,
() => {
if (!notiTrigger.value) {
const updatedNotifications = notiList.value.map((item: any) => ({
...item,
isOpen: true,
}));
notiList.value = updatedNotifications;
fetchTotolNotificate();
}
}
);
const thaiOptions: Intl.DateTimeFormatOptions = {
hour: "2-digit",
minute: "2-digit",
hour: "2-digit",
minute: "2-digit",
};
const handleButtonClick = () => {
const currentPath = route.name;
const queryParams = { role: "user" }; // Replace with your query parameters
const queryString = new URLSearchParams(queryParams).toString();
// Assuming config.generatePopupPath() returns a base URL
const popupBasePath = config.generatePopupPath(currentPath);
if (popupBasePath) {
const popupPath = `${popupBasePath}?${queryString}`;
window.open(popupPath, "_blank"); // Opens in a new tab/window
} else {
console.log("No manual available for this page:", currentPath);
}
};
function onInfo() {
router.push(`/registry`);
router.push(`/retire`);
}
</script>
<!-- โครงเว -->
<template>
<q-layout view="hHh LpR fFr">
<!-- header -->
<q-header flat class="text-dark col-12 bg-top header-br" height-hint="7">
<q-toolbar
class="q-my-xs items-center"
:style="$q.screen.gt.xs ? 'padding: 1% 2%;' : 'padding: 1% 4%;'"
>
<div class="row items-center no-wrap" v-if="$q.screen.gt.xs">
<q-img
src="@/assets/logo.png"
spinner-color="white"
style="height: 35px; max-width: 35px"
/>
<div class="row q-ml-md items-center q-pt-xs">
<div
style="color: #ffffff; letter-spacing: 1px; line-height: 10px"
class="text-body2 text-weight-bolder col-12"
>
ระบบ<span class="text-primary">บรหารทรพยากรบคคล</span>
</div>
<div class="text-caption text-white">ของกรงเทพมหานคร</div>
</div>
</div>
<div v-else class="row items-center">
<img src="@/assets/logo.png" style="height: 35px; max-width: 35px" />
</div>
<div v-if="$q.screen.gt.xs">
<q-tabs
v-model="tab"
align="justify"
indicator-color="transparent"
active-color="white bg-white-btn border-100"
dense
inline-label
class="text-grey-5 tabsHome"
>
<q-tab
class="border-100 q-mr-sm"
name="dashboard"
label="หน้าแรก"
icon="mdi-view-dashboard-outline"
@click="router.push(`/`)"
/>
<!-- <q-tab class="border-100" name="Checkin" label="ลงเวลางาน" icon="mdi-map-marker-check-outline"
<q-layout view="hHh LpR fFr">
<!-- header -->
<q-header flat class="text-dark col-12 bg-top header-br" height-hint="7">
<q-toolbar
class="q-my-xs items-center"
:style="$q.screen.gt.xs ? 'padding: 1% 2%;' : 'padding: 1% 4%;'"
>
<div class="row items-center no-wrap" v-if="$q.screen.gt.xs">
<q-img
src="@/assets/logo.png"
spinner-color="white"
style="height: 35px; max-width: 35px"
/>
<div class="row q-ml-md items-center q-pt-xs">
<div
style="color: #ffffff; letter-spacing: 1px; line-height: 10px"
class="text-body2 text-weight-bolder col-12"
>
ระบบ<span class="text-primary">บรหารทรพยากรบคคล</span>
</div>
<div class="text-caption text-white">ของกรงเทพมหานคร</div>
</div>
</div>
<div v-else class="row items-center">
<img src="@/assets/logo.png" style="height: 35px; max-width: 35px" />
</div>
<div v-if="$q.screen.gt.xs">
<q-tabs
v-model="tab"
align="justify"
indicator-color="transparent"
active-color="white bg-white-btn border-100"
dense
inline-label
class="text-grey-5 tabsHome"
>
<q-tab
class="border-100 q-mr-sm"
name="dashboard"
label="หน้าแรก"
icon="mdi-view-dashboard-outline"
@click="router.push(`/`)"
/>
<!-- <q-tab class="border-100" name="Checkin" label="ลงเวลางาน" icon="mdi-map-marker-check-outline"
@click="router.push(`/check-in`)" /> -->
<q-tab
class="border-100 q-mr-sm"
name="leave"
label="การลา"
icon="mdi-calendar-blank-outline"
@click="router.push(`/leave`)"
/>
</q-tabs>
</div>
<q-space />
<q-tab
class="border-100 q-mr-sm"
name="leave"
label="การลา"
icon="mdi-calendar-blank-outline"
@click="router.push(`/leave`)"
/>
</q-tabs>
</div>
<q-space />
<q-btn
round
dense
flat
size="13px"
class="bg-white-btn"
:color="totalNoti === 0 ? 'grey-6' : 'grey-8'"
no-caps
@click="handleButtonClick()"
style="margin-right: 10px"
>
<q-icon name="mdi-book-open-variant" size="18px" color="white" />
<q-tooltip></q-tooltip>
</q-btn>
<!-- Notification -->
<q-btn
round
dense
flat
size="13px"
:class="$q.screen.gt.xs ? 'bg-white-btn q-mx-md' : 'q-mr-sm'"
:color="totalNoti === 0 ? 'grey-6' : 'grey-8'"
no-caps
>
<q-icon name="mdi-bell-outline" size="22px" color="white" />
<q-badge
rounded
v-show="totalNoti !== 0"
color="negative"
text-color="white"
floating
>{{ totalNoti }}</q-badge
>
<q-menu v-model="notiTrigger" :offset="[0, 8]" style="width: 480px">
<div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">การแจงเตอน</div>
<q-space />
<div class="text-grey-5" style="font-size: 12px">
งหมด {{ totalInbox }} อความ
</div>
</div>
<q-infinite-scroll
@load="onLoad"
:offset="250"
v-if="statusLoad === false"
>
<div
v-for="(item, index) in notiList"
:key="index"
class="caption"
>
<q-item v-ripple class="mytry q-py-sm" dense>
<q-item-section avatar top style="min-width: 10px">
<q-avatar
rounded
color="primary"
size="25px"
text-color="white"
>
<span class="text-weight-medium text-uppercase">{{
item.body[0]
}}</span>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label caption class="text-grey-7">
{{ date2Thai(item.receiveDate) }}
{{
new Date(item.receiveDate).toLocaleTimeString(
"th-TH",
thaiOptions
)
}}
. <q-space />
</q-item-label>
<q-item-label
caption
:class="
item.isOpen
? 'text-grey-7'
: 'text-dark text-weight-medium'
"
>{{ item.body }}</q-item-label
>
<q-item-label
caption
class="row items-center text-grey-7"
style="font-size: 12px"
>{{ item.timereceive }}</q-item-label
>
</q-item-section>
<div>
<q-btn
size="sm"
unelevated
dense
icon="mdi-close"
class="mybtn q-mx-xs"
@click="clickDelete(item.id, index)"
></q-btn>
</div>
</q-item>
</div>
<!-- Notification -->
<q-btn
round
dense
flat
size="13px"
class="bg-white-btn"
:color="totalNoti === 0 ? 'grey-6' : 'grey-8'"
no-caps
style="margin-right: 10px"
>
<q-icon name="mdi-bell-outline" size="22px" color="white" />
<q-badge
rounded
v-show="totalNoti !== 0"
color="negative"
text-color="white"
floating
>{{ totalNoti }}</q-badge
>
<q-menu v-model="notiTrigger" :offset="[0, 8]" style="width: 480px">
<div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">การแจงเตอน</div>
<q-space />
<div class="text-grey-5" style="font-size: 12px">
งหมด {{ totalInbox }} อความ
</div>
</div>
<q-infinite-scroll
@load="onLoad"
:offset="250"
v-if="statusLoad === false"
>
<div
v-for="(item, index) in notiList"
:key="index"
class="caption"
>
<q-item v-ripple class="mytry q-py-sm" dense>
<q-item-section avatar top style="min-width: 10px">
<q-avatar
rounded
color="primary"
size="25px"
text-color="white"
>
<span class="text-weight-medium text-uppercase">{{
item.body[0]
}}</span>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label caption class="text-grey-7">
{{ date2Thai(item.receiveDate) }}
{{
new Date(item.receiveDate).toLocaleTimeString(
"th-TH",
thaiOptions
)
}}
. <q-space />
</q-item-label>
<q-item-label
caption
:class="
item.isOpen
? 'text-grey-7'
: 'text-dark text-weight-medium'
"
>{{ item.body }}</q-item-label
>
<q-item-label
caption
class="row items-center text-grey-7"
style="font-size: 12px"
>{{ item.timereceive }}</q-item-label
>
</q-item-section>
<div>
<q-btn
size="sm"
unelevated
dense
icon="mdi-close"
class="mybtn q-mx-xs"
@click="clickDelete(item.id, index)"
></q-btn>
</div>
</q-item>
</div>
<template
v-slot:loading
v-if="
notiList.length < totalInbox ||
(notiList.length === 0 && totalInbox === 0)
"
>
<div class="text-center q-my-md">
<q-spinner-dots color="primary" size="40px" />
</div>
</template>
</q-infinite-scroll>
<div class="q-pa-md" v-else>
<q-banner rounded class="bg-amber-1 text-center">
<div class="text-yellow-10">
<q-icon
name="mdi-alert-box"
class="q-mx-xs"
size="sm"
color="yellow-10"
/>
ไมมอม
</div>
</q-banner>
</div>
</q-menu>
</q-btn>
<template
v-slot:loading
v-if="
notiList.length < totalInbox ||
(notiList.length === 0 && totalInbox === 0)
"
>
<div class="text-center q-my-md">
<q-spinner-dots color="primary" size="40px" />
</div>
</template>
</q-infinite-scroll>
<div class="q-pa-md" v-else>
<q-banner rounded class="bg-amber-1 text-center">
<div class="text-yellow-10">
<q-icon
name="mdi-alert-box"
class="q-mx-xs"
size="sm"
color="yellow-10"
/>
ไมมอม
</div>
</q-banner>
</div>
</q-menu>
</q-btn>
<!-- User -->
<q-btn-dropdown
v-if="$q.screen.gt.xs"
rounded
dense
flat
:class="$q.screen.gt.xs ? 'bg-white-btn' : ''"
color="white"
class="q-pr-sm border-10"
dropdown-icon="mdi-chevron-down"
>
<template v-slot:label>
<q-item dense v-close-popup class="q-pa-none q-pl-xs">
<q-item-section avatar class="q-pa-none" style="min-width: 30px">
<q-img
src="@/assets/avatar_user.jpg"
class="border-100"
spinner-color="white"
style="height: 30px; max-width: 30px"
/>
</q-item-section>
<q-item-section class="text-left text-white q-pa-none q-pl-sm">
<q-item-label class="text-caption text-weight-medium">{{
fullname
}}</q-item-label>
</q-item-section>
</q-item>
</template>
<q-list>
<q-item clickable v-close-popup @click="onInfo">
<!-- User -->
<q-btn-dropdown
v-if="$q.screen.gt.xs"
rounded
dense
flat
:class="$q.screen.gt.xs ? 'bg-white-btn' : ''"
color="white"
class="q-pr-sm border-10"
dropdown-icon="mdi-chevron-down"
>
<template v-slot:label>
<q-item dense v-close-popup class="q-pa-none q-pl-xs">
<q-item-section avatar class="q-pa-none" style="min-width: 30px">
<q-img
src="@/assets/avatar_user.jpg"
class="border-100"
spinner-color="white"
style="height: 30px; max-width: 30px"
/>
</q-item-section>
<q-item-section class="text-left text-white q-pa-none q-pl-sm">
<q-item-label class="text-caption text-weight-medium">{{
fullname
}}</q-item-label>
</q-item-section>
</q-item>
</template>
<q-list>
<!-- <q-item clickable v-close-popup @click="onInfo">
<q-item-section avatar style="min-width: 30px">
<q-icon
color="blue-9"
@ -375,39 +406,51 @@ function onInfo() {
>อมลทะเบยนประว</q-item-label
></q-item-section
>
</q-item>
</q-item> -->
<q-item clickable v-close-popup @click="onInfo">
<q-item-section avatar style="min-width: 30px">
<q-icon
color="red-9"
size="18px"
name="mdi-account-remove-outline"
/>
</q-item-section>
<q-item-section
><q-item-label>ขอลาออก</q-item-label></q-item-section
>
</q-item>
<q-item clickable v-close-popup>
<q-item-section avatar style="min-width: 30px">
<q-icon color="orange-9" size="18px" name="mdi-lock-outline" />
</q-item-section>
<q-item-section
><q-item-label>เปลยนรหสผาน</q-item-label></q-item-section
>
</q-item>
<q-item clickable v-close-popup>
<q-item-section avatar style="min-width: 30px">
<q-icon color="orange-9" size="18px" name="mdi-lock-outline" />
</q-item-section>
<q-item-section
><q-item-label>เปลยนรหสผาน</q-item-label></q-item-section
>
</q-item>
<q-item clickable v-close-popup @click="doLogout">
<q-item-section avatar style="min-width: 30px">
<q-icon color="primary" size="18px" name="mdi-logout-variant" />
</q-item-section>
<q-item-section>
<q-item-label>ออกจากระบบ</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
<q-item clickable v-close-popup @click="doLogout">
<q-item-section avatar style="min-width: 30px">
<q-icon color="primary" size="18px" name="mdi-logout-variant" />
</q-item-section>
<q-item-section>
<q-item-label>ออกจากระบบ</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
<div v-else class="q-ml-sm" style="width: 30px">
<q-btn round>
<q-avatar>
<q-img
src="@/assets/avatar_user.jpg"
class="border-100"
spinner-color="white"
style="height: 30px; max-width: 30px"
/>
</q-avatar>
<!-- <q-menu>
<div v-else class="q-ml-sm" style="width: 30px">
<q-btn round>
<q-avatar>
<q-img
src="@/assets/avatar_user.jpg"
class="border-100"
spinner-color="white"
style="height: 30px; max-width: 30px"
/>
</q-avatar>
<!-- <q-menu>
<q-list dense style="min-width: 200px">
<q-item clickable v-close-popup>
<q-item-section>
@ -460,119 +503,119 @@ function onInfo() {
</q-item>
</q-list>
</q-menu> -->
</q-btn>
</div>
</q-toolbar>
</q-header>
<div
class="bg-top"
:style="$q.screen.gt.xs ? 'height: 200px;' : 'height: 200px;'"
/>
<!-- end header -->
</q-btn>
</div>
</q-toolbar>
</q-header>
<div
class="bg-top"
:style="$q.screen.gt.xs ? 'height: 200px;' : 'height: 200px;'"
/>
<!-- end header -->
<q-footer class="bg-top" v-if="!$q.screen.gt.xs">
<q-toolbar style="padding: 2% 2%">
<div class="row col-12 justify-around">
<q-btn
flat
round
color="white"
icon="mdi-home"
@click="router.push(`/`)"
/>
<!-- <q-btn
<q-footer class="bg-top" v-if="!$q.screen.gt.xs">
<q-toolbar style="padding: 2% 2%">
<div class="row col-12 justify-around">
<q-btn
flat
round
color="white"
icon="mdi-home"
@click="router.push(`/`)"
/>
<!-- <q-btn
flat
round
color="white"
icon="mdi-map-marker-check-outline"
@click="router.push(`/check-in`)"
/> -->
<q-btn
flat
round
color="white"
icon="mdi-calendar-blank-outline"
@click="router.push(`/leave`)"
/>
<q-btn
flat
round
color="white"
icon="mdi-account-outline"
@click="router.push(`/registry`)"
/>
</div>
</q-toolbar>
</q-footer>
<q-btn
flat
round
color="white"
icon="mdi-calendar-blank-outline"
@click="router.push(`/leave`)"
/>
<q-btn
flat
round
color="white"
icon="mdi-account-outline"
@click="router.push(`/registry`)"
/>
</div>
</q-toolbar>
</q-footer>
<q-page-container class="bg-grey-2 q-pb-md">
<q-page
:style="
$q.screen.gt.xs
? 'padding: 1.8% 2%; margin-top: -200px;'
: 'padding: 5% 4%; margin-top: -200px;'
"
>
<router-view :key="$route.fullPath" />
</q-page>
</q-page-container>
</q-layout>
<q-page-container class="bg-grey-2 q-pb-md">
<q-page
:style="
$q.screen.gt.xs
? 'padding: 1.8% 2%; margin-top: -200px;'
: 'padding: 5% 4%; margin-top: -200px;'
"
>
<router-view :key="$route.fullPath" />
</q-page>
</q-page-container>
</q-layout>
</template>
<style>
.bg-drawer {
background: #242a3d;
background: #242a3d;
}
.menu {
padding-bottom: 5px;
padding-top: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.tabsHome .q-tab__icon {
font-size: 18px;
font-size: 18px;
}
.border-100 {
border-radius: 100px;
border-radius: 100px;
}
.bg-top {
background: #273238;
background: #273238;
}
.header-br {
border-bottom: 1px solid #fdfdfd31;
border-bottom: 1px solid #fdfdfd31;
}
.menuActive {
background: #1e2234;
border-radius: 0 100px 100px 0;
margin-right: 4%;
background: #1e2234;
border-radius: 0 100px 100px 0;
margin-right: 4%;
}
.q-card {
box-shadow: 3px 3px 20px -10px rgba(151, 150, 150, 0.261) !important;
/* border: 1px solid #eeeded; */
border-radius: 8px;
box-shadow: 3px 3px 20px -10px rgba(151, 150, 150, 0.261) !important;
/* border: 1px solid #eeeded; */
border-radius: 8px;
}
.q-menu {
box-shadow: 3px 3px 10px 1px rgba(95, 95, 95, 0.15) !important;
box-shadow: 3px 3px 10px 1px rgba(95, 95, 95, 0.15) !important;
}
.toptitle {
font-size: 1.2rem;
font-weight: bold;
margin-bottom: 1.2%;
font-size: 1.2rem;
font-weight: bold;
margin-bottom: 1.2%;
}
.q-field--outlined .q-field__control {
border-radius: 5px;
border-radius: 5px;
}
.q-field--outlined .q-field__control:before {
border-color: #c8d3db;
border-color: #c8d3db;
}
/* .q-field--outlined .q-icon {
@ -580,11 +623,11 @@ function onInfo() {
} */
.shadow-0 {
box-shadow: none !important;
box-shadow: none !important;
}
.btnBlue {
background-color: #016987;
color: #fff;
background-color: #016987;
color: #fff;
}
</style>