no message
This commit is contained in:
parent
11be473f54
commit
f2023a2b51
1 changed files with 0 additions and 128 deletions
|
|
@ -4,7 +4,6 @@ import { useRouter, useRoute } from "vue-router";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { FormRef } from "@/modules/06_evaluate/interface/evalute";
|
||||
import axios from "axios";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
|
|
@ -12,8 +11,6 @@ import genReport from "@/plugins/genreport";
|
|||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const evaluateId = ref<string>(route.params.id as string);
|
||||
const profile = ref<any>();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -26,27 +23,6 @@ const {
|
|||
success,
|
||||
} = mixin;
|
||||
|
||||
interface FormCommand {
|
||||
commanderFullname: string;
|
||||
commanderPosition: string;
|
||||
commanderAboveFullname: string;
|
||||
commanderAbovePosition: string;
|
||||
author: string;
|
||||
subject: string;
|
||||
assignedPosition: string;
|
||||
}
|
||||
|
||||
/** form ผู้เซ็นเอกสาร*/
|
||||
const formCommand = reactive<FormCommand>({
|
||||
commanderFullname: "",
|
||||
commanderPosition: "",
|
||||
commanderAboveFullname: "",
|
||||
commanderAbovePosition: "",
|
||||
author: "",
|
||||
subject: "",
|
||||
assignedPosition: "",
|
||||
});
|
||||
|
||||
const formData = reactive<any>({
|
||||
subject: "",
|
||||
author: "",
|
||||
|
|
@ -56,21 +32,6 @@ const formData = reactive<any>({
|
|||
commanderAbovePosition: "",
|
||||
});
|
||||
|
||||
const downloadFile1 = ref<string>("");
|
||||
const downloadFile2 = ref<string>("");
|
||||
const downloadFile3 = ref<string>("");
|
||||
const downloadFile4 = ref<string>("");
|
||||
const downloadFile5 = ref<string>("");
|
||||
const downloadFile6 = ref<string>("");
|
||||
|
||||
/** ตัวแปร file*/
|
||||
const fileEvaluation1 = ref<any>();
|
||||
const fileEvaluation2 = ref<any>();
|
||||
const fileEvaluation3 = ref<any>();
|
||||
const fileEvaluation4 = ref<any>();
|
||||
const fileEvaluation5 = ref<any>();
|
||||
const fileEvaluation6 = ref<any>();
|
||||
|
||||
const subjectRef = ref<Object | null>(null);
|
||||
const authorRef = ref<Object | null>(null);
|
||||
const commanderFullnameRef = ref<Object | null>(null);
|
||||
|
|
@ -142,26 +103,6 @@ const files = [
|
|||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* function ดาวน์โหลดไฟล์
|
||||
* @param name ชื้อไฟล์
|
||||
*/
|
||||
async function downloadFile(name: string) {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.evaluationFilebyId("เล่ม 1", id.value, name))
|
||||
// .then((res) => {
|
||||
// const link = res.data.downloadUrl;
|
||||
// const type = res.data.fileType;
|
||||
// const fileName = res.data.fileName;
|
||||
// getPDF(link, type, fileName);
|
||||
// })
|
||||
// .catch((e) => {})
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
|
|
@ -290,75 +231,6 @@ async function onClickDowloadFile(
|
|||
await genReport(body, fileName); //สร้างไฟล์ต้นแบบ
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ลิงก์อัปโหลดไฟล์
|
||||
* @param volume เล่ม
|
||||
* @param id evaluate ID
|
||||
* @param type ประเภทไฟล์
|
||||
* @param file ไฟล์
|
||||
*/
|
||||
async function fetchPathUpload(
|
||||
volume: string,
|
||||
id: string | undefined,
|
||||
type: string,
|
||||
file: any
|
||||
) {
|
||||
const body = {
|
||||
fileList: {
|
||||
fileName: type,
|
||||
metadata: {
|
||||
subject: formCommand.subject,
|
||||
author: formCommand.author,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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(() => {
|
||||
downloadFile(type);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* functoin อัปโหลดไฟล์
|
||||
* @param uploadUrl link อัปโหลด
|
||||
* @param file ไฟล์
|
||||
*/
|
||||
async function uploadfile(uploadUrl: string, file: any) {
|
||||
showLoader();
|
||||
await axios
|
||||
.put(uploadUrl, file, {
|
||||
headers: {
|
||||
"Content-Type": file.type,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
success($q, "อัปโหลไฟล์สำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue