clear code + comment

This commit is contained in:
STW_TTTY\stwtt 2024-04-30 14:31:55 +07:00
parent a9609d2d7f
commit ac70090e22
19 changed files with 231 additions and 166 deletions

View file

@ -16,6 +16,7 @@ import DialogGov from "@/modules/15_development/components/history/DialogGov.vue
import { useCounterMixin } from "@/stores/mixin";
const fileBackReceived = ref<string>("");
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
@ -160,6 +161,10 @@ const formBody = reactive<FormsSholarship>({
isNoUseBudget: false,
});
/**
* งขอมลรายละเอยด
* @param id จาก id
*/
function fetchDataDetail(id: string) {
showLoader();
http
@ -262,6 +267,7 @@ function fetchDataDetail(id: string) {
});
}
/** บันทึกข้อมูล */
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
@ -299,6 +305,7 @@ function onSubmit() {
});
}
/** เช็ควันที่เริ่ม/สิ้นสุด */
function changeStartDate(type: string) {
switch (type) {
case "startDate":
@ -351,6 +358,7 @@ function changeStartDate(type: string) {
}
}
/** เช็คข้อมูล เรียนจบ/ไม่จบ */
function onClickUpdateStatus(type: string) {
dialogConfirm($q, () => {
if (scholarshipId.value) {
@ -372,6 +380,12 @@ function onClickUpdateStatus(type: string) {
});
}
/**
* update date
* @param startDate นทเร
* @param endDate นทนส
* @param toDo true/false
*/
function updateTotalPeriod(
startDate: any,
endDate: any,
@ -389,6 +403,7 @@ function onSelectGov(isGov: boolean) {
modalDialogGov.value = true;
}
/** update ข้อมูลโ้วยจากเกก็บไว้ในตัวแปร */
function upDate(data: DataPerson) {
if (isSelectGov.value) {
formBody.profileId = data.id;
@ -445,7 +460,10 @@ function upDate(data: DataPerson) {
}
}
const fileBackReceived = ref<string>("");
/**
* งขอม ไฟล
* @param id id ของรายการ
*/
async function checkFileBackReceived(id: string) {
showLoader();
await http
@ -461,14 +479,16 @@ async function checkFileBackReceived(id: string) {
});
}
function downloadFileBackReceived(id: string) {
/** download file */
function downloadFileBackReceived() {
showLoader();
if (scholarshipId.value !== null && fileBackReceived.value !== null) {
http
.get(
config.API.fileByFile(
"ระบบพัฒนาบุคคล",
"ฟอร์มรายงานตัวกลับเข้ารับราชการ",
id,
scholarshipId.value,
fileBackReceived.value
)
)
@ -482,8 +502,10 @@ function downloadFileBackReceived(id: string) {
.finally(async () => {
hideLoader();
});
}
}
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
onMounted(() => {
if (scholarshipId.value) {
fetchDataDetail(scholarshipId.value);
@ -514,7 +536,7 @@ onMounted(() => {
dense
icon="download"
color="blue"
@click="downloadFileBackReceived(scholarshipId)"
@click="downloadFileBackReceived()"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>