API ประเมืน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-12-22 16:00:05 +07:00
parent 0e5d15dc7c
commit 257b4a1424
16 changed files with 700 additions and 186 deletions

View file

@ -17,7 +17,7 @@ const $q = useQuasar();
const store = useEvaluateStore();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const { showLoader, hideLoader, messageError, success } = mixin;
const fullName = ref<string>(
keycloak.tokenParsed ? keycloak.tokenParsed.name!.toString() : ""
@ -124,8 +124,8 @@ async function fetchPathUpload(
file: any
) {
const body = {
fileList: type,
replace: true,
fileList: { fileName: type, metadata: {} },
// "1-",
// "2-",
// "3- ( .)",
@ -162,11 +162,30 @@ async function uploadfile(uploadUrl: string, file: any) {
"Content-Type": file.type,
},
})
.then((res) => {
console.log(res);
.then(() => {
success($q, "อัปโหลไฟล์สำเร็จ");
})
.catch((err) => {
console.log(err);
messageError($q, err);
});
}
async function fetcheSigner(id: string) {
showLoader();
await http
.get(config.API.evaluationSignerDoc1(id))
.then((res) => {
const data = res.data.result;
formCommand.commanderFullname = data.commanderFullname;
formCommand.commanderPosition = data.commanderPosition;
formCommand.commanderAboveFullname = data.commanderAboveFullname;
formCommand.commanderAbovePosition = data.commanderAbovePosition;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -183,6 +202,9 @@ onMounted(async () => {
fileEvaluation5Ref: fileEvaluation5Ref.value,
fileEvaluation6Ref: fileEvaluation6Ref.value,
};
if (store.currentStep > 2) {
fetcheSigner(store.evaluateId);
}
emit("update:form", formCommand, ref);
});
</script>

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref, onMounted } from "vue";
import { ref, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
@ -11,7 +11,7 @@ import { useEvaluateStore } from "@/modules/06_evaluate/store";
const $q = useQuasar();
const store = useEvaluateStore();
const mixin = useCounterMixin();
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
const { showLoader, hideLoader, messageError } = mixin;
const props = defineProps({
evaluateId: {
@ -36,12 +36,11 @@ function handleItemClick(itemNumber: number) {
fetchDocument(fileName.value[itemNumber - 1]);
}
async function fetchDocument(fileName: string) {
showLoader();
// showLoader();
props.evaluateId &&
(await http
.get(config.API.loadFileDocument("เล่ม 1", props.evaluateId, fileName))
.then((res) => {
console.log(res.data.downloadUrl);
downloadFile(res.data.downloadUrl);
})
.catch((err) => {
@ -60,9 +59,6 @@ async function downloadFile(url: string) {
.then((res) => {
const blob = new Blob([res.data]);
const objectUrl = URL.createObjectURL(blob);
console.log(blob);
console.log(objectUrl);
emit("update:file", objectUrl);
})

View file

@ -1,28 +1,72 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted } from "vue";
import config from "@/app.config";
import http from "@/plugins/http";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
const mixins = useCounterMixin();
const { date2Thai } = mixins;
const status = ref<string>("ANNOUNCE_WEB");
const website = ref<string>("https://bma-ehr.frappet.com/");
const AnnouncementDate = ref<string | null>(date2Thai(new Date()));
const $q = useQuasar();
const { date2Thai, success, messageError } = mixins;
const props = defineProps({
evaluateId: {
type: String,
},
});
const dateStartAnnounce = ref<string | null>(date2Thai(new Date()));
const dateEndAnnounce = ref<string | null>(date2Thai(new Date()));
const items = ref<any>([
{ label: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)" },
{ label: "ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)" },
{ label: "เอกสารแสดงผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)" },
{
label: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
fileName: "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
},
{
label: "ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)",
fileName: "10-ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)",
},
{
label: "เอกสารแสดงผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
fileName: "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
},
]);
function copyLink(link: string) {
console.log(`Copying link ${link}`);
const textarea = document.createElement("textarea");
textarea.value = link;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
async function onClickfetchDocument(fileName: string) {
props.evaluateId &&
(await http
.get(config.API.loadFileDocument("เล่ม 1", props.evaluateId, fileName))
.then((res) => {
const downloadUrl = res.data.downloadUrl;
const textarea = document.createElement("textarea");
textarea.value = downloadUrl;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
success($q, "คัดลอกลิ้งค์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
}));
}
async function fetchCheckDate() {
props.evaluateId &&
(await http
.get(config.API.evaluationCheckDate(props.evaluateId))
.then((res) => {
const data = res.data.result;
dateStartAnnounce.value = date2Thai(data.dateStartAnnounce);
dateEndAnnounce.value = date2Thai(data.dateStartAnnounce);
})
.catch((err) => {}));
}
onMounted(async () => {
fetchCheckDate();
});
</script>
<template>
@ -31,7 +75,7 @@ function copyLink(link: string) {
<q-banner class="text-weight-bold text-red-14 bg-red-2">
<div class="text-weight-bold">
<q-icon name="info_outline" color="red-14" size="24px" />
ประกาศเมอวนท {{ AnnouncementDate }}
ประกาศเมอวนท {{ dateStartAnnounce }} {{ dateEndAnnounce }}
</div>
</q-banner>
<!-- <q-badge
@ -67,7 +111,7 @@ function copyLink(link: string) {
round
color="primary"
icon="mdi-clipboard-outline"
@click="copyLink(item.label)"
@click="onClickfetchDocument(item.fileName)"
>
<q-tooltip>ดลอกลงค</q-tooltip>
</q-btn>

View file

@ -1,5 +1,9 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import { useQuasar } from "quasar";
import ViewPDF from "@/modules/06_evaluate/components/viewstep/viewPDF.vue";
import type { FormCommand } from "@/modules/06_evaluate/interface/evalute";
@ -7,9 +11,11 @@ import type { FormCommand } from "@/modules/06_evaluate/interface/evalute";
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateStore } from "@/modules/06_evaluate/store";
const $q = useQuasar();
const store = useEvaluateStore();
const mixins = useCounterMixin();
const { date2Thai } = mixins;
const { date2Thai, showLoader, hideLoader, messageError, success } = mixins;
const props = defineProps({
evaluateId: {
@ -19,8 +25,6 @@ const props = defineProps({
const emit = defineEmits(["update:form"]);
const lastDateSendPerformance = ref<string | null>(date2Thai(new Date()));
const fileEvaluation1 = ref<any>();
const pdfSrc = ref<any>();
@ -35,6 +39,7 @@ const commanderFullnameRef = ref<object | null>(null);
const commanderPositionRef = ref<object | null>(null);
const commanderAboveFullnameRef = ref<object | null>(null);
const commanderAbovePositionRef = ref<object | null>(null);
const fileEvaluation1Ref = ref<object | null>(null);
const modalView = ref<boolean>(false);
function onClickViewPDF(file: any) {
@ -48,17 +53,110 @@ const updateInput = (value: any) => {
commanderPositionRef: commanderPositionRef.value,
commanderAboveFullnameRef: commanderAboveFullnameRef.value,
commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value,
};
emit("update:form", value, ref);
};
async function fetchPathUpload(
volume: string,
id: string | undefined,
type: string,
file: any
) {
const body = {
fileList: { fileName: type, metadata: {} },
// "1-",
// "2-",
// "3- ( .)",
// "4-",
// "5- ( 9)",
// "6- ( 11)",
};
if (id && file) {
showLoader();
await http
.post(config.API.loadPathDocument(volume, id), body)
.then((res) => {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey && uploadfile(res.data[foundKey]?.uploadUrl, file);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
}
async function uploadfile(uploadUrl: string, file: any) {
console.log(uploadUrl);
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(() => {
success($q, "อัปโหลไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
});
}
async function fetcheSigner(id: string) {
showLoader();
await http
.get(config.API.evaluationSignerDoc2(id))
.then((res) => {
const data = res.data.result;
formCommand.commanderFullname = data.commanderFullnameDoc2;
formCommand.commanderPosition = data.commanderPositionDoc2;
formCommand.commanderAboveFullname = data.commanderAboveFullnameDoc2;
formCommand.commanderAbovePosition = data.commanderAbovePositionDoc2;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const dateStartPrepareDoc2 = ref<string | null>(date2Thai(new Date()));
const dateEndPrepareDoc2 = ref<string | null>(date2Thai(new Date()));
async function fetchCheckDate() {
props.evaluateId &&
(await http
.get(config.API.evaluationCheckDate(props.evaluateId))
.then((res) => {
const data = res.data.result;
dateStartPrepareDoc2.value = date2Thai(data.dateStartPrepareDoc2);
dateEndPrepareDoc2.value = date2Thai(data.dateEndPrepareDoc2);
})
.catch((err) => {}));
}
onMounted(async () => {
const ref = {
commanderFullnameRef: commanderFullnameRef.value,
commanderPositionRef: commanderPositionRef.value,
commanderAboveFullnameRef: commanderAboveFullnameRef.value,
commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value,
};
if (store.currentStep > 2) {
fetcheSigner(store.evaluateId);
}
await fetchCheckDate();
emit("update:form", formCommand, ref);
// props.evaluateId && (await fetchPathUpload(" 2", props.evaluateId));
});
@ -70,7 +168,7 @@ onMounted(async () => {
<q-banner class="text-weight-bold text-red-14 bg-red-2">
<div class="text-weight-bold">
<q-icon name="info_outline" color="red-14" size="24px" />
นสดทายของการสงผลงานคอวนท {{ lastDateSendPerformance }}
นสดทายของการสงผลงานคอวนท {{ dateEndPrepareDoc2 }}
</div>
</q-banner>
</div>
@ -109,6 +207,8 @@ onMounted(async () => {
</div>
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation1Ref"
:rules="[(val) => !!val || 'เลือกไฟล']"
v-model="fileEvaluation1"
class="col-12"
outlined
@ -123,7 +223,20 @@ onMounted(async () => {
</q-file>
</div>
<div class="col-2 self-center text-center q-pl-none">
<q-btn flat round dense color="primary" icon="mdi-upload"
<q-btn
flat
round
dense
color="primary"
icon="mdi-upload"
@click="
fetchPathUpload(
'เล่ม 2',
props.evaluateId,
'1-เอกสารเล่ม 2',
fileEvaluation1
)
"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>

View file

@ -1,19 +1,73 @@
<script setup lang="ts">
import { reactive, ref } from "vue";
import { onMounted, ref } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import axios from "axios";
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateStore } from "@/modules/06_evaluate/store";
const store = useEvaluateStore();
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = mixin;
const props = defineProps({
evaluateId: {
type: String,
},
});
const emit = defineEmits(["update:file"]);
const selectedItem = ref(1);
function handleItemClick(itemNumber: number) {
store.tabPanels = itemNumber.toString();
selectedItem.value = itemNumber;
async function fetchDocument() {
showLoader();
props.evaluateId &&
(await http
.get(
config.API.loadFileDocument(
"เล่ม 2",
props.evaluateId,
"1-เอกสารเล่ม 2"
)
)
.then((res) => {
downloadFile(res.data.downloadUrl);
})
.catch((err) => {
messageError($q, err);
}));
}
async function downloadFile(url: string) {
await axios
.get(url, {
responseType: "blob",
headers: {
"Content-Type": "application/json",
},
})
.then((res) => {
const blob = new Blob([res.data]);
const objectUrl = URL.createObjectURL(blob);
emit("update:file", objectUrl);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
onMounted(async () => {
await fetchDocument();
});
</script>
<template>
@ -23,7 +77,6 @@ function handleItemClick(itemNumber: number) {
v-ripple
:active="selectedItem === 1 ? true : false"
active-class="text-primary"
@click="handleItemClick(1)"
>
<q-item-section>เอกสารเล 2</q-item-section>
</q-item>

View file

@ -1,9 +1,26 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted } from "vue";
import axios from "axios";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import genReport from "@/plugins/genreport";
import TableDirector from "@/modules/06_evaluate/components/directorandmeet/Table.vue";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, success } = mixin;
const props = defineProps({
evaluateId: {
type: String,
},
});
const status = ref<string>("WAIT_CHECK_DOC_V2");
const tabMenu = ref<string>("director");
@ -45,6 +62,71 @@ async function onClickDowloadFile(
};
await genReport(body, fileName);
}
const directorList = ref<any>();
const meetingList = ref<any>();
async function fetchDirector() {
showLoader();
props.evaluateId &&
(await http
.get(config.API.evaluationDirectorMeetring(props.evaluateId))
.then((res) => {})
.catch((err) => {})
.finally(() => {
hideLoader();
}));
}
async function fetchPathUpload(
volume: string,
id: string | undefined,
type: string,
file: any
) {
const body = {
fileList: { fileName: type, metadata: {} },
};
if (id && file) {
showLoader();
await http
.post(config.API.loadPathDocument(volume, id), body)
.then((res) => {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey && uploadfile(res.data[foundKey]?.uploadUrl, file);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
}
async function uploadfile(uploadUrl: string, file: any) {
console.log(uploadUrl);
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(() => {
success($q, "อัปโหลไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
});
}
onMounted(async () => {
await fetchDirector();
});
</script>
<template>
@ -99,7 +181,7 @@ async function onClickDowloadFile(
<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 class="col-xs-12 col-sm-6 row">
<q-btn
class="col-12"
outline
@ -116,7 +198,7 @@ async function onClickDowloadFile(
>
<q-tooltip> ดาวนโหลดตนแบบ </q-tooltip></q-btn
>
</div>
</div> -->
<div class="col-xs-12 col-sm-6 row">
<q-btn
v-if="fileEvaluationEdit"
@ -146,7 +228,20 @@ async function onClickDowloadFile(
</q-file>
</div>
<div class="col-2 self-center text-center q-pl-none">
<q-btn flat round dense color="primary" icon="mdi-upload"
<q-btn
flat
round
dense
color="primary"
icon="mdi-upload"
@click="
fetchPathUpload(
'เล่ม 2',
props.evaluateId,
'2-เอกสารเล่ม 2 (ฉบับแก้ไข)',
fileEvaluationEdit
)
"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>

View file

@ -1,24 +1,27 @@
<script setup lang="ts">
import { ref } from "vue";
import { useEvaluateStore } from "@/modules/06_evaluate/store";
const stroe = useEvaluateStore();
const link = ref<string>("https://bma-ehr-publish.frappet.synology.me/");
const status = ref<string>("DONE");
</script>
<template>
<div class="row">
<div class="col-12 text-center">
<!-- <q-badge
v-if="status == 'DONE'"
outline
color="green"
label="เสร็จสิ้น"
class="q-pa-sm"
style="font-size: 16px"
/> -->
<div>
<p class="text-weight-bold" style="font-size: 18px">Public URL</p>
<a :href="link" target="_blank">{{ link }}</a>
</div>
<q-btn
class="q-mt-md"
outline
icon-right="mdi-clipboard-outline"
label="เสร็จสิ้น"
label="คัดลอกลิ้งค์"
color="primary"
>
<q-tooltip> ดลอกลงค </q-tooltip></q-btn