ปรับ Code ประเมืน
This commit is contained in:
parent
f9c4bb3b80
commit
5b2be2af2b
24 changed files with 603 additions and 1398 deletions
|
|
@ -2,27 +2,18 @@
|
|||
import { ref, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import axios from "axios";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import genReport from "@/plugins/genreport";
|
||||
|
||||
/** importStore*/
|
||||
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
|
||||
|
||||
const store = useEvaluateDetailStore();
|
||||
|
||||
const modalView = ref<boolean>(false);
|
||||
const fullName = ref<string>(
|
||||
keycloak.tokenParsed ? keycloak.tokenParsed.name!.toString() : ""
|
||||
);
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const numOfPages = ref<number>(0);
|
||||
const page = ref<number>(1);
|
||||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const store = useEvaluateDetailStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogConfirm,
|
||||
|
|
@ -32,15 +23,16 @@ const {
|
|||
messageError,
|
||||
success,
|
||||
} = mixin;
|
||||
|
||||
const page = ref<number>(1);
|
||||
const numOfPages = ref<number>(0);
|
||||
const modalView = ref<boolean>(false);
|
||||
const AnnouncementStartDate = ref<string | null>();
|
||||
const AnnouncementEndDate = ref<string | null>();
|
||||
const id = ref<string>(route.params.id as string);
|
||||
const pdfSrc = ref<any>();
|
||||
const fileEvaluation5 = ref<any>();
|
||||
const fileEvaluation5Ref = ref<any>();
|
||||
const status = ref<string>("ANNOUNCE_WEB");
|
||||
const website = ref<string>("https://bma-ehr.frappet.com/");
|
||||
|
||||
const files = [
|
||||
{
|
||||
id: "file1",
|
||||
|
|
@ -59,28 +51,8 @@ const files = [
|
|||
},
|
||||
];
|
||||
|
||||
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() {
|
||||
/** function บันทึกแจ้งผลการประกาศคัดเลือก*/
|
||||
async function save() {
|
||||
download10Url.value === ""
|
||||
? (fileEvaluation5.value = "")
|
||||
: fileEvaluation5.value;
|
||||
|
|
@ -89,16 +61,17 @@ function save() {
|
|||
fileEvaluation5Ref.value.hasError === false &&
|
||||
download10Url.value !== ""
|
||||
) {
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
dialogConfirm($q, async () => {
|
||||
await showLoader();
|
||||
http
|
||||
.put(config.API.evaluationNext5To6(id.value))
|
||||
// .then((res) => {})
|
||||
.then(() => {
|
||||
success($q, "บันทึกแจ้งผลการประกาศคัดเลือกสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
success($q, "บันทึกแจ้งผลการประกาศคัดเลือกสำเร็จ");
|
||||
store.step = 6;
|
||||
store.currentStep = 6;
|
||||
hideLoader();
|
||||
|
|
@ -107,6 +80,10 @@ function save() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียก link อัปโหลด
|
||||
* @param file ไฟล์
|
||||
*/
|
||||
function upLoadFile(file: any) {
|
||||
if (file) {
|
||||
showLoader();
|
||||
|
|
@ -139,36 +116,27 @@ function upLoadFile(file: any) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function อัปโหลดไฟล์
|
||||
* @param url link อัปโหลด
|
||||
*/
|
||||
function fileUpLoad(url: string) {
|
||||
axios
|
||||
.put(url, fileEvaluation5.value, {
|
||||
headers: { "Content-Type": fileEvaluation5.value?.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.then(() => {
|
||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
checkDocResult();
|
||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||
});
|
||||
}
|
||||
|
||||
function getFileName(fileName: string) {
|
||||
if (fileName && fileName.lastIndexOf(".") !== -1) {
|
||||
const index = fileName.indexOf("(");
|
||||
if (index !== -1) {
|
||||
return fileName.substring(0, index).trim();
|
||||
} else {
|
||||
// กรณีไม่มีวงเล็บ
|
||||
return fileName.split(".").slice(0, -1).join(".");
|
||||
}
|
||||
} else {
|
||||
// ในกรณีที่ไม่มีนามสกุล
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
|
||||
/** ไปหน้าต่อไปของรายงาน */
|
||||
function nextPage() {
|
||||
if (page.value < numOfPages.value) {
|
||||
|
|
@ -183,31 +151,31 @@ function backPage() {
|
|||
}
|
||||
}
|
||||
|
||||
function copyLink(name: string) {
|
||||
showLoader();
|
||||
http
|
||||
/**
|
||||
* function คัดลอก URL
|
||||
* @param name ชื่อไฟล์
|
||||
*/
|
||||
async function copyLink(name: string) {
|
||||
await http
|
||||
.get(config.API.evaluationFilebyId("เล่ม 1", id.value, name))
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
const link = res.data.downloadUrl;
|
||||
navigator.clipboard.writeText(link);
|
||||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
success($q, "คัดลอก URL สำเร็จ");
|
||||
hideLoader();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
function getDate() {
|
||||
/** function เรียกข้อมูลวันที่ประกาศ*/
|
||||
async function getDate() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.evaluationDateAnnounce(id.value))
|
||||
.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(data.dateEndAnnounce);
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -217,50 +185,12 @@ function getDate() {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
// function linkCopy(link: string) {
|
||||
// navigator.clipboard
|
||||
// .writeText(link)
|
||||
// .then(() => {
|
||||
// console.log(`Copied link for file: ${link}`);
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// success($q, "คัดลอกสำเร็จ");
|
||||
// });
|
||||
// }
|
||||
|
||||
// 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;
|
||||
// }
|
||||
|
||||
const download10Url = ref<string>("");
|
||||
function checkDocResult() {
|
||||
/** function เช็คไฟล์อัปโหลด*/
|
||||
async function checkDocResult() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.evaluationPatchData(
|
||||
"เล่ม 1",
|
||||
|
|
@ -271,9 +201,9 @@ function checkDocResult() {
|
|||
.then((res: any) => {
|
||||
download10Url.value = res.data.downloadUrl;
|
||||
})
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
.catch(() => {
|
||||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
|
@ -281,10 +211,10 @@ function checkDocResult() {
|
|||
|
||||
const author = ref<string>("");
|
||||
const subject = ref<string>("");
|
||||
|
||||
function fetchDataSigner() {
|
||||
/** function เรียกข้อมูลผลงาน*/
|
||||
async function fetchDataSigner() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.evaluationSigner(id.value, 1))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
|
|
@ -428,91 +358,6 @@ onMounted(async () => {
|
|||
</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">
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="upLoadFile"
|
||||
><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>
|
||||
<q-card class="q-pa-md" bordered> ไม่มีรายการเอกสาร </q-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div> -->
|
||||
<div v-if="store.currentStep == 5" class="col-12">
|
||||
<div class="q-mt-xs q-gutter-md" align="right">
|
||||
<q-btn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue