แบบบันทึกผล
This commit is contained in:
parent
cc6c637538
commit
14293e6f6b
2 changed files with 87 additions and 18 deletions
|
|
@ -22,9 +22,9 @@ export default {
|
|||
|
||||
//ระบบทดลองงาน
|
||||
reportAssign:(type:string, id:string) => `${reportProbation}/13/${type}/${id}`,
|
||||
reportEvaluate:(type:string, id:string) => `${reportProbation}/14/${type}/${id}`,
|
||||
reportEvaluateRecord1:(type:string, id:string) => `${reportProbation}/15/${type}/${id}`,
|
||||
reportEvaluateRecord2:(type:string, id:string) => `${reportProbation}/16/${type}/${id}`,
|
||||
reportEvaluateRecord1:(type:string, id:string) => `${reportProbation}/14/${type}/${id}`,
|
||||
reportEvaluateRecord2:(type:string, id:string) => `${reportProbation}/15/${type}/${id}`,
|
||||
reportEvaluate:(type:string, id:string) => `${reportProbation}/16/${type}/${id}`,
|
||||
reportEvaluateChairman:(type:string, id:string) => `${reportProbation}/17/${type}/${id}`,
|
||||
reportEvaluateResult:(type:string, id:string) => `${reportProbation}/18/${type}/${id}`,
|
||||
reportSurvey:(type:string, id:string) => `${reportProbation}/19/${type}/${id}`
|
||||
|
|
|
|||
|
|
@ -3,15 +3,17 @@ import { ref, defineAsyncComponent, watch, onMounted, onUpdated } from "vue";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
const Header = defineAsyncComponent(() =>
|
||||
import(
|
||||
"@/modules/05_placement/components/probation/FormEvaluation/Header.vue"
|
||||
)
|
||||
const Header = defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
"@/modules/05_placement/components/probation/FormEvaluation/Header.vue"
|
||||
)
|
||||
);
|
||||
const FormSaveResult = defineAsyncComponent(() =>
|
||||
import(
|
||||
"@/modules/05_placement/components/probation/FormEvaluation/FormSaveResult.vue"
|
||||
)
|
||||
const FormSaveResult = defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
"@/modules/05_placement/components/probation/FormEvaluation/FormSaveResult.vue"
|
||||
)
|
||||
);
|
||||
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -24,12 +26,12 @@ const mixin = useCounterMixin();
|
|||
const { showLoader, hideLoader, messageError, success } = mixin;
|
||||
const assignId = ref<string>(route.params.form.toString());
|
||||
const personalId = ref<string>(route.params.personalId.toString());
|
||||
|
||||
const fullname = ref<string>("");
|
||||
const evaluate = ref<any>([]);
|
||||
const tabs = ref<any>([]);
|
||||
const tab = ref<string>("save1");
|
||||
const dataArrayNumber = ref<number>();
|
||||
|
||||
const dataRole = ref<string>("metor");
|
||||
onMounted(async () => {
|
||||
await fecthAssign(assignId.value);
|
||||
});
|
||||
|
|
@ -41,6 +43,7 @@ const fecthAssign = async (id: string) => {
|
|||
.then(async (res: any) => {
|
||||
evaluate.value = res.data.data.evaluate;
|
||||
tabs.value = evaluate.value;
|
||||
fullname.value = res.data.data.person.name;
|
||||
dataArrayNumber.value = 1;
|
||||
})
|
||||
.catch((e: any) => {
|
||||
|
|
@ -56,6 +59,58 @@ const changeTab = (tabVal: string) => {
|
|||
tab.value = tabVal;
|
||||
dataArrayNumber.value = Number(tabVal.charAt(4));
|
||||
};
|
||||
const downloadFile = (response: any, filename: string) => {
|
||||
const link = document.createElement("a");
|
||||
var fileName = filename;
|
||||
link.href = window.URL.createObjectURL(new Blob([response.data]));
|
||||
link.setAttribute("download", fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
|
||||
const FileDownload = async (type: string) => {
|
||||
let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value);
|
||||
//ผู้ดูเเล
|
||||
if (dataRole.value == "mentor") {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportEvaluateRecord1(type, numTab.id), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
downloadFile(
|
||||
res,
|
||||
`แบบบันทึกผล(ผู้ดูเเล)_${fullname.value}_ครั้งที่${numTab.no}.${type}`
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
//ผุ้บังคับ
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportEvaluateRecord2(type, numTab.id), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
downloadFile(
|
||||
res,
|
||||
`แบบบันทึกผล(ผู้บังคับบัญชา)_${fullname.value}_ครั้งที่${numTab.no}.${type}`
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
const addData = () => {
|
||||
router.push(
|
||||
`/probation/detail/addresult/${personalId.value}/${assignId.value}`
|
||||
|
|
@ -64,15 +119,29 @@ const addData = () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Header v-if="tabs.length > 0" :change-tab="changeTab" :add-data="addData" :loop="tabs.length" />
|
||||
|
||||
<Header
|
||||
v-if="tabs.length > 0"
|
||||
:change-tab="changeTab"
|
||||
:add-data="addData"
|
||||
:loop="tabs.length"
|
||||
:FileDownload="FileDownload"
|
||||
/>
|
||||
<q-page-container v-if="tabs.length > 0">
|
||||
<FormSaveResult :tab="tab" :data="evaluate.find((x: any) => x.no === dataArrayNumber)" action="edit" />
|
||||
<FormSaveResult
|
||||
:tab="tab"
|
||||
:data="evaluate.find((x: any) => x.no === dataArrayNumber)"
|
||||
action="edit"
|
||||
/>
|
||||
</q-page-container>
|
||||
|
||||
<div class="q-gutter-md" v-else-if="tabs.length == 0">
|
||||
<div class="flex justify-center items-center q-my-md q-gutter-md">
|
||||
<q-btn outline color="primary" label="สร้างแบบบันทึกผล" @click="addData" />
|
||||
<q-btn
|
||||
outline
|
||||
color="primary"
|
||||
label="สร้างแบบบันทึกผล"
|
||||
@click="addData"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue