หน้า การทดลองปฏิบัติหน้าที่ราชการ (ค้าง ทำfact)
This commit is contained in:
parent
56d6d38ed6
commit
dae79fa548
7 changed files with 1174 additions and 280 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -77,13 +77,14 @@ const reson = ref<string>("");
|
|||
const chairman_dated = ref<string>("");
|
||||
const director1_dated = ref<any>("");
|
||||
const director2_dated = ref<any>("");
|
||||
|
||||
const fullname = ref<string>("")
|
||||
const fecthResult = async (id: string) => {
|
||||
await http
|
||||
.get(config.API.createformReport(id))
|
||||
.then((res: any) => {
|
||||
let data = res.data.data.evaluate;
|
||||
console.log(data);
|
||||
fullname.value = res.data.data.profile.name;
|
||||
date_start.value = data.date_start;
|
||||
date_finish.value = data.date_finish;
|
||||
develop.value = Number(data.develop_complete);
|
||||
|
|
@ -124,7 +125,32 @@ const savaForm = async () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
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 clickdownloadFile = async (type: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportEvaluateResult(type, assignId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
downloadFile(res,`แบบรายงานการประเมินฯ_${fullname.value}.${type}`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
const postData = async () => {
|
||||
const data = await {
|
||||
start_date: date_start.value,
|
||||
|
|
@ -153,6 +179,7 @@ const postData = async () => {
|
|||
|
||||
<template>
|
||||
<div class="row col-12">
|
||||
|
||||
<div class="toptitle text-dark col-12 row items-center q-gutter-md">
|
||||
<div>แบบรายงานการประเมินฯ</div>
|
||||
<!-- <q-space /> -->
|
||||
|
|
@ -160,11 +187,11 @@ const postData = async () => {
|
|||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup @click="clickdownloadFile('pdf')">
|
||||
<q-item-section avatar><q-icon color="red" name="mdi-file-pdf" /></q-item-section>
|
||||
<q-item-section>ไฟล์ .PDF</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup @click="clickdownloadFile('docx')">
|
||||
<q-item-section avatar><q-icon color="blue" name="mdi-file-word" /></q-item-section>
|
||||
<q-item-section>ไฟล์ .docx</q-item-section>
|
||||
</q-item>
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ onMounted(async () => {
|
|||
if (props.tab && props.action == "edit") {
|
||||
evaluate_no.value = Number(props.tab.charAt(4));
|
||||
dataArr.value = await props.data;
|
||||
|
||||
fecthFormdata();
|
||||
}
|
||||
});
|
||||
|
|
@ -69,6 +70,7 @@ watch(props, async () => {
|
|||
if (props.tab && props.action == "edit") {
|
||||
evaluate_no.value = Number(props.tab.charAt(4));
|
||||
dataArr.value = await props.data;
|
||||
console.log(dataArr.value)
|
||||
fecthFormdata();
|
||||
// console.log("props===>", props.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@ const route = useRoute();
|
|||
|
||||
const tabHead = ref<string>("save1");
|
||||
const props = defineProps({
|
||||
FileDownload:{
|
||||
type:Function,
|
||||
default() {
|
||||
return "Default function";
|
||||
},
|
||||
},
|
||||
loop: {
|
||||
type: Number,
|
||||
},
|
||||
|
|
@ -22,6 +28,9 @@ const props = defineProps({
|
|||
},
|
||||
},
|
||||
});
|
||||
const downloadFile = (type:string) =>{
|
||||
props.FileDownload(type)
|
||||
}
|
||||
|
||||
watch(tabHead, () => {
|
||||
props.changeTab(tabHead.value);
|
||||
|
|
@ -58,13 +67,13 @@ const nextPage = () => {
|
|||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup @click="downloadFile('pdf')">
|
||||
<q-item-section avatar
|
||||
><q-icon color="red" name="mdi-file-pdf"
|
||||
/></q-item-section>
|
||||
<q-item-section>ไฟล์ .PDF</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup @click="downloadFile('docx')">
|
||||
<q-item-section avatar
|
||||
><q-icon color="blue" name="mdi-file-word"
|
||||
/></q-item-section>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,18 @@ import { useQuasar } from "quasar";
|
|||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const Header = defineAsyncComponent(() => import("@/modules/05_placement/components/probation/FormEvaluation/Header.vue"));
|
||||
const FormEvaluate = defineAsyncComponent(() => import("@/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue"));
|
||||
const Header = defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
"@/modules/05_placement/components/probation/FormEvaluation/Header.vue"
|
||||
)
|
||||
);
|
||||
const FormEvaluate = defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
"@/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue"
|
||||
)
|
||||
);
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
|
@ -16,7 +26,7 @@ const $q = useQuasar();
|
|||
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 tab = ref<string>("save1");
|
||||
const tabs = ref<any>([]);
|
||||
const dataArrayNumber = ref<number>(1);
|
||||
|
|
@ -37,8 +47,10 @@ const fecthAssign = async (id: string) => {
|
|||
.get(config.API.createformCommader(id))
|
||||
.then((res: any) => {
|
||||
evaluate.value = res.data.data.evaluate;
|
||||
fullname.value = res.data.data.person.name;
|
||||
tabs.value = evaluate.value;
|
||||
dataArrayNumber.value = 1;
|
||||
console.log(fullname.value);
|
||||
})
|
||||
.catch((e: any) => {
|
||||
// console.log(e);
|
||||
|
|
@ -48,6 +60,33 @@ const fecthAssign = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
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);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportEvaluate(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/addevalua/${personalId.value}/${assignId.value}`
|
||||
|
|
@ -56,10 +95,20 @@ const addData = () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Header v-if="tabs.length > 0" :change-tab="changeTab" :loop="tabs.length" :add-data="addData" />
|
||||
<Header
|
||||
v-if="tabs.length > 0"
|
||||
:change-tab="changeTab"
|
||||
:loop="tabs.length"
|
||||
:add-data="addData"
|
||||
:FileDownload="FileDownload"
|
||||
/>
|
||||
|
||||
<q-page-container v-if="tabs.length > 0">
|
||||
<FormEvaluate :tab="tab" :data="evaluate.find((x: any) => x.no === dataArrayNumber)" action="edit" />
|
||||
<FormEvaluate
|
||||
:tab="tab"
|
||||
:data="evaluate.find((x: any) => x.no === dataArrayNumber)"
|
||||
action="edit"
|
||||
/>
|
||||
</q-page-container>
|
||||
|
||||
<div v-else class="q-gutter-md">
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ 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 tab = ref<string>("save1");
|
||||
const tabs = ref<any>([]);
|
||||
const dataArrayNumber = ref<number>(1);
|
||||
|
|
@ -32,6 +33,7 @@ const fecthAssign = async (id: string) => {
|
|||
.get(config.API.createformChairman(id))
|
||||
.then((res: any) => {
|
||||
evaluate.value = res.data.data.evaluate;
|
||||
fullname.value = res.data.data.person.name;
|
||||
tabs.value = evaluate.value;
|
||||
dataArrayNumber.value = 1;
|
||||
})
|
||||
|
|
@ -42,6 +44,33 @@ const fecthAssign = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
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);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportEvaluateChairman(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/addevaluascore/${personalId.value}/${assignId.value}`
|
||||
|
|
@ -55,7 +84,7 @@ const changeTab = (tabVal: string) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Header v-if="tabs.length > 0" :change-tab="changeTab" :loop="tabs.length" :add-data="addData" />
|
||||
<Header v-if="tabs.length > 0" :change-tab="changeTab" :loop="tabs.length" :add-data="addData" :FileDownload="FileDownload"/>
|
||||
|
||||
<q-page-container v-if="tabs.length > 0">
|
||||
<FormEvaluateScore :tab="tab" :data="evaluate.find((x: any) => x.no === dataArrayNumber)" action="edit" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue