Refactoring code module 12_evaluatePersonal

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-20 13:13:43 +07:00
parent 381ec04492
commit 490f02309e
33 changed files with 598 additions and 1036 deletions

View file

@ -1,9 +1,12 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import axios from "axios";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
@ -12,8 +15,6 @@ import genReport from "@/plugins/genreport";
import type { FileEvaluationRefRef } from "@/modules/12_evaluatePersonal/interface/index/evalute";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
/** uer*/
const store = useEvaluateDetailStore();
@ -21,33 +22,25 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const route = useRoute();
const {
date2Thai,
showLoader,
hideLoader,
messageError,
success,
dialogConfirm,
} = mixin;
const { showLoader, hideLoader, messageError, success, dialogConfirm } = mixin;
const id = ref<string>(route.params.id as string);
const modalConfirm = ref<boolean>(false);
const nameOfWork = ref<string>("");
const nameOfOwner = ref<string>("");
const position = ref<string>("");
const fileEvaluation81 = ref<any>();
const fileEvaluation82 = ref<any>();
const fileEvaluation83 = ref<any>();
const fileEvaluation84 = ref<any>();
const fileEvaluation85 = ref<any>();
const fileEvaluation86 = ref<any>();
const fileEvaluation81 = ref<any>(); // ( )
const fileEvaluation82 = ref<any>(); //- ( 15)
const fileEvaluation83 = ref<any>(); // ( 16)
const fileEvaluation84 = ref<any>(); // ( 17)
const fileEvaluation85 = ref<any>(); // ( 18)
const fileEvaluation86 = ref<any>(); // ( )
const fileEvaluation81Ref = ref<object | null>(null);
const fileEvaluation82Ref = ref<object | null>(null);
const fileEvaluation83Ref = ref<object | null>(null);
const fileEvaluation84Ref = ref<object | null>(null);
const fileEvaluation85Ref = ref<object | null>(null);
const fileEvaluation86Ref = ref<object | null>(null);
const profile = ref<any>();
const fileEvaluationRef: FileEvaluationRefRef = {
fileEvaluation81: fileEvaluation81Ref,
fileEvaluation82: fileEvaluation82Ref,
@ -57,7 +50,9 @@ const fileEvaluationRef: FileEvaluationRefRef = {
fileEvaluation86: fileEvaluation86Ref,
};
/** function ดาวน์โหลดไฟล์ต้นแบบ*/
/**
* function ดาวนโหลดไฟลนแบบ
*/
async function onClickDowloadFile(
tp: string,
templateName: string,
@ -141,7 +136,9 @@ function fileUpLoad(url: string, file: any) {
});
}
/** function ยืนยันผลการพิจารณา*/
/**
* function นยนผลการพจารณา
*/
async function confirmApprove() {
const fileEvaluationValues = [
fileEvaluation81,
@ -216,7 +213,9 @@ async function confirmApprove() {
}, 100);
}
/** function ยืนยันผลการพิจารณา*/
/**
* function นยนผลการพจารณา
*/
function nextStep() {
showLoader();
http
@ -234,26 +233,10 @@ function nextStep() {
});
}
/** function เรียกข้แมูลคุณสมบัติ*/
async function fetchProfile() {
showLoader();
await http
.get(config.API.evaluateGetDetail(id.value))
.then((res) => {
const data = res.data.result;
profile.value = data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 2000);
});
}
const downloadDocEditUrl = ref<string>("");
/**
* function ตรวจสอบไฟลแกไข
*/
async function checkDocEdit() {
showLoader();
await http
@ -277,12 +260,13 @@ async function checkDocEdit() {
});
}
const downloadFile1 = ref<string>("");
const downloadFile2 = ref<string>("");
const downloadFile3 = ref<string>("");
const downloadFile4 = ref<string>("");
const downloadFile5 = ref<string>("");
const downloadFile6 = ref<string>("");
//
const downloadFile1 = ref<string>(""); //" ( )
const downloadFile2 = ref<string>(""); //- ( 15)"
const downloadFile3 = ref<string>(""); // ( 16)
const downloadFile4 = ref<string>(""); // ( 17)
const downloadFile5 = ref<string>(""); // ( 18)
const downloadFile6 = ref<string>(""); // ( )
/**
* function ดาวนโหลดไฟล
@ -317,11 +301,13 @@ async function downloadFileList(fileName: string) {
});
}
const author = ref<string>("");
const subject = ref<string>("");
const assignedPosition = ref<string>("");
const author = ref<string>(""); //
const subject = ref<string>(""); //
const assignedPosition = ref<string>(""); //
/** function เรียกข้อมูลผลงาน*/
/**
* function เรยกขอมลผลงาน
*/
async function fetchDataSigner() {
showLoader();
await http
@ -350,7 +336,6 @@ async function fetchDataSigner() {
onMounted(async () => {
await Promise.all([
fetchProfile(),
fetchDataSigner(),
downloadFileList(
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)"
@ -663,6 +648,7 @@ onMounted(async () => {
</div>
</q-card>
</div>
<div class="col-6">
<q-card bordered style="border: 1px solid #d6dee1">
<div
@ -758,6 +744,7 @@ onMounted(async () => {
</div>
</q-card>
</div>
<div class="col-6">
<q-card bordered style="border: 1px solid #d6dee1">
<div
@ -855,6 +842,7 @@ onMounted(async () => {
</div>
</q-card>
</div>
<div class="col-6">
<q-card bordered style="border: 1px solid #d6dee1">
<div