Merge branch 'NiceDev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-08 14:19:08 +07:00
parent 37bef4e836
commit 0b8b5d497c
13 changed files with 168 additions and 357 deletions

View file

@ -1,27 +1,26 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import axios from "axios";
/** importStroe*/
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateStore } from "@/modules/06_evaluate/store";
/** use*/
const $q = useQuasar();
const store = useEvaluateStore();
const mixin = useCounterMixin();
const route = useRoute();
const { showLoader, hideLoader, messageError } = mixin;
/** id ประเมิน*/
const evaluateId = ref<string>(route.params.id.toString());
// const props = defineProps({
// evaluateId: {
// type: String,
// },
// });
/** emit*/
const emit = defineEmits(["update:file"]);
const selectedItem = ref(1);
@ -34,13 +33,22 @@ const fileName = ref([
"6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
]);
/**
* function กดเลอกแสดงเอกสาน
* @param itemNumber เอกสาร
*/
function handleItemClick(itemNumber: number) {
store.tabPanels = itemNumber.toString();
selectedItem.value = itemNumber;
fetchDocument(fileName.value[itemNumber - 1]);
}
/**
* function เรกยเอกสาร
* @param fileName อเอกสาร
*/
async function fetchDocument(fileName: string) {
// showLoader();
showLoader();
evaluateId.value &&
(await http
.get(config.API.loadFileDocument("เล่ม 1", evaluateId.value, fileName))
@ -52,6 +60,10 @@ async function fetchDocument(fileName: string) {
}));
}
/**
* function ดาวนโหลดไฟล
* @param url งกดาวนโหลดไฟล
*/
async function downloadFile(url: string) {
await axios
.get(url, {
@ -77,6 +89,7 @@ async function downloadFile(url: string) {
});
}
/** HooK lifecycle*/
onMounted(async () => {
await fetchDocument(fileName.value[selectedItem.value - 1]);
});