จัดโค้ด

This commit is contained in:
setthawutttty 2023-11-17 18:00:02 +07:00
parent 50298e9976
commit 1e16bd7b2d
7 changed files with 174 additions and 86 deletions

View file

@ -33,10 +33,16 @@ const fullname = ref<string>("");
const tab = ref<string>("save1");
const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor");
onMounted(async () => {
await fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
/**
* get data
* @param id person id
*/
async function fecthAssign(id: string){
showLoader();
await http
.get(config.API.formevaluateCommander(id))
@ -54,11 +60,18 @@ const fecthAssign = async (id: string) => {
hideLoader();
});
};
const changeTab = (tabVal: string) => {
/**
* เปลยน tab
* @param tabVal type
*/
function changeTab(tabVal: string){
tab.value = tabVal;
dataArrayNumber.value = Number(tabVal.charAt(4));
};
const downloadFile = (response: any, filename: string) => {
/** เปลี่ยน type file */
function downloadFile(response: any, filename: string){
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -67,7 +80,12 @@ const downloadFile = (response: any, filename: string) => {
link.click();
document.body.removeChild(link);
};
const FileDownload = async (type: string) => {
/**
* download file
* @param type type
*/
async function FileDownload(type: string){
let numTab = probationStore.evaluate.find(
(e: any) => e.no === dataArrayNumber.value
);
@ -111,7 +129,9 @@ const FileDownload = async (type: string) => {
});
}
};
const addData = () => {
/** เปลี่ยนหน้า เพิ่ม */
function addData(){
router.push(
`/probation/detail/addevaluacommander/${personalId.value}/${assignId.value}`
);