2023-12-14 12:23:34 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from "vue";
|
2023-12-22 10:05:18 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const { date2Thai, showLoader, hideLoader, messageError, success } = mixin;
|
|
|
|
|
const AnnouncementDate = ref<string | null>(date2Thai(new Date()));
|
|
|
|
|
const id = ref<string>(route.params.id as string);
|
|
|
|
|
|
2023-12-14 12:23:34 +07:00
|
|
|
|
2023-12-20 14:00:56 +07:00
|
|
|
const fileEvaluation5 = ref<any>();
|
2023-12-14 12:23:34 +07:00
|
|
|
const status = ref<string>("ANNOUNCE_WEB");
|
|
|
|
|
const website = ref<string>("https://bma-ehr.frappet.com/");
|
2023-12-20 14:00:56 +07:00
|
|
|
|
|
|
|
|
const files = [
|
|
|
|
|
{
|
2023-12-22 10:05:18 +07:00
|
|
|
id: "file1",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
|
|
|
|
pathName: "12",
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-12-22 10:05:18 +07:00
|
|
|
id: "file2",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)",
|
|
|
|
|
pathName: "12",
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-12-22 10:05:18 +07:00
|
|
|
id: "file3",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "เอกสารแสดงผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
|
|
|
|
pathName: "12",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const listFile = [
|
|
|
|
|
{
|
|
|
|
|
id: "x1",
|
|
|
|
|
fileName: "เอกสาร 1",
|
|
|
|
|
pathName: "12",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "x2",
|
|
|
|
|
fileName: "เอกสาร 2",
|
|
|
|
|
pathName: "12",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
function downloadFile(name: string) {
|
|
|
|
|
console.log("download");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteFile(name: string) {
|
|
|
|
|
console.log("delete");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
|
console.log("save");
|
|
|
|
|
}
|
2023-12-22 10:05:18 +07:00
|
|
|
|
|
|
|
|
function upLoadFile() {
|
|
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.post(config.API.evaluationFileListbyId("เล่ม 1", id.value), {
|
|
|
|
|
fileList: {
|
|
|
|
|
fileName: "บันทึกแจ้งผลการประกาศคัดเลือก",
|
|
|
|
|
metadata: {
|
|
|
|
|
tag: "value",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const foundKey: any = Object.keys(res.data).find(
|
|
|
|
|
(key) =>
|
|
|
|
|
res.data[key]?.fileName !== undefined &&
|
|
|
|
|
res.data[key]?.fileName !== ""
|
|
|
|
|
);
|
|
|
|
|
const link = res.data[foundKey]?.uploadUrl;
|
|
|
|
|
fileUpLoad(link);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fileUpLoad(url: string) {
|
|
|
|
|
axios
|
|
|
|
|
.put(url, fileEvaluation5.value, {
|
|
|
|
|
headers: { "Content-Type": fileEvaluation5.value?.type },
|
|
|
|
|
onUploadProgress: (e) => console.log(e),
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
fileEvaluation5.value = null;
|
|
|
|
|
success($q, "อัปโหลดไฟล์สำเร็จ");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function copyLink(link: string) {
|
|
|
|
|
navigator.clipboard
|
|
|
|
|
.writeText(link)
|
|
|
|
|
.then(() => {
|
|
|
|
|
console.log(`Copied link for file: ${link}`);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
success($q, "คัดลอกสำเร็จ");
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-12-14 12:23:34 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2023-12-20 14:00:56 +07:00
|
|
|
<div class="row q-gutter-sm">
|
|
|
|
|
<div class="col-12">
|
2023-12-22 10:05:18 +07:00
|
|
|
<q-banner class="text-weight-bold text-red-14 bg-red-2 text-center">
|
|
|
|
|
<div class="text-weight-bold">
|
|
|
|
|
<q-icon name="info_outline" color="red-14" size="24px" />
|
|
|
|
|
ประกาศเมื่อวันที่ {{ AnnouncementDate }}
|
|
|
|
|
</div>
|
2023-12-20 14:00:56 +07:00
|
|
|
</q-banner>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div 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">
|
|
|
|
|
เอกสารประกาศผลการคัดเลือกบุคคล
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
|
|
|
|
|
|
|
|
|
<q-list
|
|
|
|
|
v-for="file in files"
|
|
|
|
|
:key="file.id"
|
|
|
|
|
class="full-width"
|
|
|
|
|
bordered
|
|
|
|
|
separator
|
|
|
|
|
>
|
|
|
|
|
<q-item clickable v-ripple>
|
|
|
|
|
<q-item-section>{{ file.fileName }}</q-item-section>
|
|
|
|
|
<q-item-section avatar>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
round
|
2023-12-22 10:05:18 +07:00
|
|
|
color="primary"
|
|
|
|
|
icon="mdi-clipboard-outline"
|
|
|
|
|
@click="copyLink(file.fileName)"
|
2023-12-20 14:00:56 +07:00
|
|
|
>
|
2023-12-22 10:05:18 +07:00
|
|
|
<q-tooltip>คัดลอกลิ้งค์</q-tooltip>
|
2023-12-20 14:00:56 +07:00
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-card>
|
|
|
|
|
</div>
|
|
|
|
|
<div 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">
|
|
|
|
|
บันทึกแจ้งผลการประกาศคัดเลือก
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12 q-pa-sm">
|
|
|
|
|
<div class="row q-col-gutter-md col-12 q-mb-xs">
|
|
|
|
|
<div class="col-xs-12 col-sm-11 row">
|
|
|
|
|
<q-file
|
|
|
|
|
v-model="fileEvaluation5"
|
|
|
|
|
class="col-12"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
lazy-rules
|
|
|
|
|
accept=".pdf"
|
|
|
|
|
label="อัปโหลดไฟล์"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="attach_file" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-file>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-1 self-center text-center q-pl-none">
|
2023-12-22 10:05:18 +07:00
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
round
|
|
|
|
|
dense
|
|
|
|
|
color="primary"
|
|
|
|
|
icon="mdi-upload"
|
|
|
|
|
@click="upLoadFile"
|
2023-12-20 14:00:56 +07:00
|
|
|
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="listFile.length > 0">
|
|
|
|
|
<q-list
|
|
|
|
|
v-for="file in listFile"
|
|
|
|
|
:key="file.id"
|
|
|
|
|
class="full-width"
|
|
|
|
|
bordered
|
|
|
|
|
separator
|
|
|
|
|
>
|
|
|
|
|
<q-item clickable v-ripple>
|
|
|
|
|
<q-item-section>{{ file.fileName }}</q-item-section>
|
|
|
|
|
<q-item-section avatar>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
round
|
|
|
|
|
size="12px"
|
|
|
|
|
color="blue"
|
|
|
|
|
icon="mdi-download-outline"
|
|
|
|
|
@click="downloadFile(file.pathName)"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
round
|
|
|
|
|
size="12px"
|
|
|
|
|
color="red"
|
|
|
|
|
icon="mdi-trash-can-outline"
|
|
|
|
|
@click="deleteFile(file.pathName)"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip>ลบไฟล์</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12" v-else>
|
2023-12-22 10:05:18 +07:00
|
|
|
<q-card class="q-pa-md" bordered> ไม่มีรายการเอกสาร </q-card>
|
|
|
|
|
</div>
|
2023-12-20 14:00:56 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="q-mt-xs q-gutter-md" align="right">
|
|
|
|
|
<q-btn
|
|
|
|
|
unelevated
|
|
|
|
|
label="บันทึกแจ้งผลการประกาศคัดเลือก"
|
|
|
|
|
color="public"
|
|
|
|
|
@click="save"
|
|
|
|
|
/>
|
2023-12-14 12:23:34 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped></style>
|