This commit is contained in:
Warunee Tamkoo 2023-12-23 21:51:15 +07:00
parent 43e36b7b74
commit 6eed463eb5
6 changed files with 313 additions and 190 deletions

View file

@ -82,9 +82,19 @@ async function onClickDowloadFile(
{ positionLevel: profile.value == null ? "" : profile.value.positionLevel },
{ posNo: profile.value == null ? "" : profile.value.posNo },
{ oc: profile.value == null ? "" : profile.value.oc },
{ birthDate: profile.value == null ? "" : date2Thai(profile.value.birthDate) },
{
birthDate:
profile.value == null ? "" : date2Thai(profile.value.birthDate),
},
{ govAge: profile.value == null ? "" : profile.value.govAge },
{ positionLevelNew: profile.value == null ? "" : (profile.value.type == "EXPERT"? "ชำนาญการ":"ชำนาญการพิเศษ")},
{
positionLevelNew:
profile.value == null
? ""
: profile.value.type == "EXPERT"
? "ชำนาญการ"
: "ชำนาญการพิเศษ",
},
tp === "EV1_005" || tp === "EV1_007"
? { organizationName: "หน่วยงาน" }
: null,
@ -246,24 +256,26 @@ function fileUpLoad(url: string) {
}
function sentMessenger() {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.evaluationSentToContact(id.value), {
subject: title.value,
body: messenger.value,
})
.then((res) => {
console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
modalEvaluation.value = false;
hideLoader();
});
});
// dialogConfirm($q, () => {
showLoader();
http
.put(config.API.evaluationSentToContact(id.value), {
subject: title.value,
body: messenger.value,
})
.then((res) => {
title.value = "";
messenger.value = "";
success($q, "ส่งข้อความสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
modalEvaluation.value = false;
hideLoader();
});
// });
}
const download10Url = ref<string>("");
@ -286,7 +298,7 @@ function checkDoc10() {
.finally(() => {
hideLoader();
});
fetchProfile()
fetchProfile();
}
async function fetchProfile() {
@ -295,7 +307,7 @@ async function fetchProfile() {
.get(config.API.evaluateGetDetail(id.value))
.then((res) => {
const data = res.data.result;
profile.value =data
profile.value = data;
})
.catch((err) => {
messageError($q, err);
@ -358,7 +370,7 @@ onMounted(() => {
<div class="row">
<div class="col-12 q-pa-sm">
<div class="row q-col-gutter-md col-12">
<div class="col-xs-12 col-sm-6 row">
<div v-if="store.currentStep == 4" class="col-xs-12 col-sm-6 row">
<q-btn
class="col-12"
outline
@ -369,7 +381,7 @@ onMounted(() => {
onClickDowloadFile(
'เอกสารหมายเลข 10',
'template-4',
'แบบประเมินคุณลักษณะบุคคล'
'ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)'
)
"
>
@ -390,31 +402,34 @@ onMounted(() => {
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
</div>
<div class="col-xs-12 col-sm-11 row">
<q-file
v-model="fileEvaluationUpload"
class="col-12"
outlined
dense
hide-bottom-space
lazy-rules
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
<div class="col-1 self-center text-center q-pl-none">
<q-btn
flat
round
dense
color="primary"
icon="mdi-upload "
@click="upLoadFile"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
<div v-if="store.currentStep == 4" class="row col-12">
<div class="col-xs-12 col-sm-11 row">
<q-file
v-model="fileEvaluationUpload"
class="col-12"
outlined
dense
hide-bottom-space
lazy-rules
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
<div class="col-1 self-center text-center q-pl-none">
<q-btn
flat
round
dense
color="primary"
icon="mdi-upload "
@click="upLoadFile"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>
</div>
</div>
</div>

View file

@ -171,7 +171,6 @@ function backPage() {
}
function copyLink(name: string) {
console.log(name);
showLoader();
http
.get(config.API.evaluationFilebyId("เล่ม 1", id.value, name))
@ -194,9 +193,9 @@ function getDate() {
.then((res) => {
const data = res.data.result;
AnnouncementStartDate.value = date2Thai(data.dateStartAnnounce);
const endDate = new Date(data.dateStartAnnounce);
endDate.setDate(endDate.getDate() + 30);
AnnouncementEndDate.value = date2Thai(endDate);
// const endDate = new Date(data.dateStartAnnounce);
// endDate.setDate(endDate.getDate() + 30);
AnnouncementEndDate.value = date2Thai(data.dateEndAnnounce);
})
.catch((e) => {
messageError($q, e);
@ -219,31 +218,31 @@ function getDate() {
// });
// }
async function onClickDowloadFile(
tp: string,
templateName: string,
fileName: string
) {
showLoader();
const data = Object.assign(
{ fullName: fullName.value },
tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "-" } : null,
tp === "EV1_007" ? { positionName: "-" } : null,
tp === "EV1_007" ? { positionLeaveName: "-" } : null
);
const body = {
template: tp,
reportName: templateName,
data: data,
};
console.log(body);
await genReport(body, fileName);
}
// async function onClickDowloadFile(
// tp: string,
// templateName: string,
// fileName: string
// ) {
// showLoader();
// const data = Object.assign(
// { fullName: fullName.value },
// tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "-" } : null,
// tp === "EV1_007" ? { positionName: "-" } : null,
// tp === "EV1_007" ? { positionLeaveName: "-" } : null
// );
// const body = {
// template: tp,
// reportName: templateName,
// data: data,
// };
// console.log(body);
// await genReport(body, fileName);
// }
function onClickViewPDF(file: any) {
// pdfSrc.value = file.webkitRelativePath;
modalView.value = true;
}
// function onClickViewPDF(file: any) {
// // pdfSrc.value = file.webkitRelativePath;
// modalView.value = true;
// }
const download10Url = ref<string>("");
function checkDocResult() {
@ -304,6 +303,16 @@ onMounted(() => {
<q-item-section avatar>
<div class="row">
<div>
<!-- <q-btn
:href="file.pathName"
target="_blank"
flat
round
color="blue-6"
icon="mdi-download"
>
<q-tooltip>ดลอกลงค</q-tooltip>
</q-btn> -->
<q-btn
flat
round
@ -344,33 +353,35 @@ onMounted(() => {
>
</div>
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation1Ref"
v-model="fileEvaluation5"
class="col-12"
outlined
dense
label="อัปโหลดไฟล์"
hide-bottom-space
lazy-rules
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
<div class="col-2 self-center text-center q-pl-none">
<q-btn
flat
round
dense
color="primary"
icon="mdi-upload"
@click="upLoadFile"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
<div v-if="store.currentStep == 5" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation1Ref"
v-model="fileEvaluation5"
class="col-12"
outlined
dense
label="อัปโหลดไฟล์"
hide-bottom-space
lazy-rules
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
<div class="col-2 self-center text-center q-pl-none">
<q-btn
flat
round
dense
color="primary"
icon="mdi-upload"
@click="upLoadFile"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>
</div>
</div>
</div>

View file

@ -43,12 +43,10 @@ function getDate() {
.get(config.API.evaluationDateAnnounce(id.value))
.then((res) => {
const data = res.data.result;
const endDate = new Date(data.dateStartAnnounce);
endDate.setDate(endDate.getDate() + 210);
const endDate = new Date(data.dateEndAnnounce);
endDate.setDate(endDate.getDate() + 180);
dateEndPrepareDoc2.value = date2Thai(endDate);
dateEndPrepareDoc2.value = data.dateEndPrepareDoc2
? date2Thai(data.dateEndPrepareDoc2)
: dateEndPrepareDoc2.value;
// dateEndPrepareDoc2.value = dateEndPrepareDoc2.value;
})
.catch((e) => {
messageError($q, e);
@ -69,9 +67,9 @@ function getSigner() {
formCommand.abovelevelFullname = data.commanderAboveFullnameDoc2;
formCommand.abovelevelPosition = data.commanderAbovePositionDoc2;
})
.catch((e) => {
messageError($q, e);
})
// .catch((e) => {
// messageError($q, e);
// })
.finally(() => {
hideLoader();
});

View file

@ -50,9 +50,19 @@ async function onClickDowloadFile(
{ positionLevel: profile.value == null ? "" : profile.value.positionLevel },
{ posNo: profile.value == null ? "" : profile.value.posNo },
{ oc: profile.value == null ? "" : profile.value.oc },
{ birthDate: profile.value == null ? "" : date2Thai(profile.value.birthDate) },
{
birthDate:
profile.value == null ? "" : date2Thai(profile.value.birthDate),
},
{ govAge: profile.value == null ? "" : profile.value.govAge },
{ positionLevelNew: profile.value == null ? "" : (profile.value.type == "EXPERT"? "ชำนาญการ":"ชำนาญการพิเศษ")}
{
positionLevelNew:
profile.value == null
? ""
: profile.value.type == "EXPERT"
? "ชำนาญการ"
: "ชำนาญการพิเศษ",
}
);
const body = {
@ -96,6 +106,7 @@ function upLoadFile(name: string, file: any) {
messageError($q, e);
})
.finally(() => {
downloadFileList(name);
hideLoader();
});
}
@ -120,67 +131,84 @@ function fileUpLoad(url: string, file: any) {
});
}
function downloadFile() {
// const fileEdit2 = ref<string>("");
// function downloadFile() {
// showLoader();
// http
// .get(
// config.API.evaluationFilebyId(
// " 2",
// id.value,
// "2- 2 ()"
// )
// )
// .then((res) => {
// fileEdit2.value = res.data.downloadUrl;
// const link = res.data.downloadUrl;
// const type = res.data.fileType;
// const fileName = res.data.fileName;
// getPDF(link, type, fileName);
// })
// .catch((e) => {})
// .finally(() => {
// hideLoader();
// });
// }
// function getPDF(url: string, type: string, fileName: string) {
// axios
// .get(url, {
// method: "GET",
// responseType: "blob",
// headers: {
// "Content-Type": "application/json",
// Accept: type, //
// },
// })
// .then(async (res) => {
// console.log(res);
// const a = document.createElement("a");
// a.href = window.URL.createObjectURL(res.data);
// a.download = fileName;
// // a.download = res.data.fileName + `.${mime.getExtension(res.data.fileType)}`
// a.click();
// })
// .catch((e) => {})
// .finally(() => {});
// }
function confirmApprove() {
const data = {
metadata: {
additionalProp1: nameOfWork.value,
additionalProp2: nameOfOwner.value,
additionalProp3: position.value,
},
};
showLoader();
http
.get(config.API.evaluationFilebyId("เล่ม 2", id.value, '2-เอกสารเล่ม 2 (ฉบับแก้ไข)'))
.patch(
config.API.evaluationPatchData(
"เล่ม 2",
id.value,
"2-เอกสารเล่ม 2 (ฉบับแก้ไข)"
),
data
)
.then((res) => {
const link = res.data.downloadUrl;
const type = res.data.fileType;
const fileName = res.data.fileName;
getPDF(link, type, fileName);
console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.catch((e) => {})
.finally(() => {
nextStep();
modalConfirm.value = false;
hideLoader();
});
}
function getPDF(url: string, type: string, fileName: string) {
axios
.get(url, {
method: "GET",
responseType: "blob",
headers: {
"Content-Type": "application/json",
Accept: type, //
},
})
.then(async (res) => {
console.log(res);
const a = document.createElement("a");
a.href = window.URL.createObjectURL(res.data);
a.download = fileName;
// a.download = res.data.fileName + `.${mime.getExtension(res.data.fileType)}`
a.click();
})
.catch((e) => {})
.finally(() => {});
}
function confirmApprove(){
const data = {
metadata: {
additionalProp1: nameOfWork.value,
additionalProp2: nameOfOwner.value,
additionalProp3: position.value,
},
}
showLoader()
http
.patch(config.API.evaluationPatchData('เล่ม 2',id.value,'2-เอกสารเล่ม 2 (ฉบับแก้ไข)'),data)
.then((res)=>{
console.log(res)
}).catch((e)=>{
messageError($q,e)
}).finally(()=>{
nextStep();
modalConfirm.value = false
hideLoader()
})
}
function nextStep(){
function nextStep() {
showLoader();
http
.put(config.API.evaluationNextFinish(id.value))
@ -202,7 +230,7 @@ async function fetchProfile() {
.get(config.API.evaluateGetDetail(id.value))
.then((res) => {
const data = res.data.result;
profile.value =data
profile.value = data;
})
.catch((err) => {
messageError($q, err);
@ -212,9 +240,75 @@ async function fetchProfile() {
});
}
onMounted(()=>{
fetchProfile()
})
const downloadDocEditUrl = ref<string>("");
function checkDocEdit() {
showLoader();
http
.get(
config.API.evaluationPatchData(
"เล่ม 2",
id.value,
"2-เอกสารเล่ม 2 (ฉบับแก้ไข)"
)
)
.then((res: any) => {
downloadDocEditUrl.value = res.data.downloadUrl;
})
// .catch((e) => {
// messageError($q, e);
// })
.finally(() => {
hideLoader();
});
}
const downloadFile1 = ref<string>("");
const downloadFile2 = ref<string>("");
const downloadFile3 = ref<string>("");
const downloadFile4 = ref<string>("");
const downloadFile5 = ref<string>("");
const downloadFile6 = ref<string>("");
async function downloadFileList(fileName: string) {
showLoader();
await http
.get(config.API.evaluationFilebyId("เล่ม 2", id.value, fileName))
.then((res) => {
console.log(res.data);
if (
fileName ===
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)"
) {
downloadFile1.value = res.data.downloadUrl;
} else if (fileName === "บัญชีแสดงการรับ-ส่งผลงาน (เอกสารหมายเลข 15)") {
downloadFile2.value = res.data.downloadUrl;
} else if (fileName === "แบบประเมินผลงาน (เอกสารหมายเลข 16)") {
downloadFile3.value = res.data.downloadUrl;
} else if (fileName === "แบบแสดงการประเมินผลงาน (เอกสารหมายเลข 17)") {
downloadFile4.value = res.data.downloadUrl;
} else if (fileName === "แบบรายงานผลการประเมินบุคคล (เอกสารหมายเลข 18)") {
downloadFile5.value = res.data.downloadUrl;
} else if (fileName === "แบบสรุปผลการประเมิน (เอกสารแบบ ง)") {
downloadFile6.value = res.data.downloadUrl;
}
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
fetchProfile();
downloadFileList(
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)"
);
downloadFileList("บัญชีแสดงการรับ-ส่งผลงาน (เอกสารหมายเลข 15)");
downloadFileList("แบบประเมินผลงาน (เอกสารหมายเลข 16)");
downloadFileList("แบบแสดงการประเมินผลงาน (เอกสารหมายเลข 17)");
downloadFileList("แบบรายงานผลการประเมินบุคคล (เอกสารหมายเลข 18)");
downloadFileList("แบบสรุปผลการประเมิน (เอกสารแบบ ง)");
checkDocEdit();
});
</script>
<template>
@ -258,13 +352,14 @@ onMounted(()=>{
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation81"
v-if="downloadFile1"
:href="downloadFile1"
target="_blank"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation81)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
@ -279,7 +374,6 @@ onMounted(()=>{
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -336,13 +430,14 @@ onMounted(()=>{
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation82"
v-if="downloadFile2"
:href="downloadFile2"
target="_blank"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation82)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
@ -357,7 +452,6 @@ onMounted(()=>{
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -414,13 +508,14 @@ onMounted(()=>{
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation83"
v-if="downloadFile3"
:href="downloadFile3"
target="_blank"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation83)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
@ -491,13 +586,14 @@ onMounted(()=>{
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation84"
v-if="downloadFile4"
:href="downloadFile4"
target="_blank"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation84)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
@ -568,13 +664,14 @@ onMounted(()=>{
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation85"
v-if="downloadFile5"
:href="downloadFile5"
target="_blank"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation85)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
@ -645,13 +742,14 @@ onMounted(()=>{
</div>
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluation86"
v-if="downloadFile6"
:href="downloadFile6"
target="_blank"
class="col-12"
outline
icon="visibility"
label="ดูไฟล์เอกสาร"
color="primary"
@click="onClickViewPDF(fileEvaluation86)"
>
<q-tooltip> ไฟลเอกสาร </q-tooltip></q-btn
>
@ -698,7 +796,7 @@ onMounted(()=>{
</div>
</q-card>
</div>
<div class="col-12">
<div v-if="downloadDocEditUrl != ''" class="col-12">
<q-card bordered style="border: 1px solid #d6dee1">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
เอกสารเล 2 (ฉบบแกไข)
@ -709,11 +807,12 @@ onMounted(()=>{
<div class="row q-col-gutter-md col-12">
<div class="col-xs-12 col-sm-12 row">
<q-btn
:href="downloadDocEditUrl"
target="_blank"
class="col-12"
icon="download"
label="ดาวน์โหลด"
color="primary"
@click="downloadFile"
>
<q-tooltip> ดาวนโหลดตนแบบ </q-tooltip></q-btn
>

View file

@ -32,7 +32,7 @@ const props = defineProps({
default: () => "",
}
});
const { showLoader, hideLoader, messageError, dialogConfirm } = mixin;
const { showLoader, hideLoader, messageError, dialogConfirm, success } = mixin;
const columns = ref<QTableProps["columns"]>([
{
@ -155,7 +155,7 @@ function returnDirector(data: any) {
directors: dataList,
})
.then((res) => {
console.log(res);
success($q, "บันทึกสำเร็จ")
})
.catch((e) => {
messageError($q, e);

View file

@ -22,7 +22,7 @@ const props = defineProps({
default: () => "",
}
});
const { showLoader, hideLoader, messageError, dialogConfirm, date2Thai } =
const { showLoader, hideLoader, messageError, dialogConfirm, date2Thai, success } =
mixin;
import DialogMeet from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/DialogMeet.vue";
@ -115,7 +115,7 @@ function returnData(data: any) {
meetings: dataList,
})
.then((res) => {
console.log(res);
success($q, "บันทึกสำเร็จ")
})
.catch((e) => {
messageError($q, e);