This commit is contained in:
Warunee Tamkoo 2025-02-13 22:10:05 +07:00
parent 5f2d8cd481
commit 832db7c582

View file

@ -110,6 +110,30 @@ async function fecthlistRound() {
});
}
const roundId2 = ref<string>("");
const roundOtionMain2 = ref<any[]>([]);
const roundOtion2 = ref<any[]>([]);
/** ฟังก์ชันคึงข้อมูลรอบการเสนอขอ note*/
async function fecthlistRound2() {
showLoader();
await http
.get(config.API.noteround(), { params: { path: "RECORD" } })
.then((res: any) => {
roundOtionMain2.value = res.data.result.map((e: any) => ({
id: e.id,
year: e.year,
name: e.name,
}));
roundOtion2.value = roundOtionMain2.value;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
@ -163,7 +187,13 @@ async function onUpdateFilter() {
name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไม่ได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)",
};
}
if (typeReport.value && roundId.value && nodeId.value) {
if (
(typeReport.value.val === "report1" ||
typeReport.value.val === "report2" ||
typeReport.value.val === "report3") &&
(roundId.value || roundId2.value) &&
nodeId.value
) {
isLoadPDF.value = true;
pdfSrc.value = undefined;
@ -180,13 +210,34 @@ async function onUpdateFilter() {
.then(async (res) => {
const data = await res.data.result;
detailReport.value = data;
const type =
typeReport.value.val === "report4" ||
typeReport.value.val === "report5" ||
typeReport.value.val === "report6"
? "xlsx"
: "docx";
await fetchDocumentTemplate(data, type);
await fetchDocumentTemplate(data, "docx");
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
isLoadPDF.value = false;
});
} else if (roundId2.value && nodeId.value) {
isLoadPDF.value = true;
pdfSrc.value = undefined;
await http
.post(
config.API.reportInsigniaNew +
`/${typeReport.value.val}/${employeeClass.value}`,
{
roundId: roundId2.value,
node: nodeLevel.value,
nodeId: nodeId.value,
}
)
.then(async (res) => {
const data = await res.data.result;
detailReport.value = data;
await fetchDocumentTemplate(data, "xlsx");
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
@ -251,7 +302,7 @@ function downloadReport(type: string) {
}
onMounted(async () => {
await Promise.all([fetchDataTree(), fecthlistRound()]);
await Promise.all([fetchDataTree(), fecthlistRound(), fecthlistRound2()]);
});
</script>
@ -342,6 +393,12 @@ onMounted(async () => {
<div class="col-md-4 col-xs-12">
<q-select
v-if="
typeReport &&
(typeReport.val == 'report1' ||
typeReport.val == 'report2' ||
typeReport.val == 'report3')
"
class="bg-white"
use-input
fill-input
@ -368,6 +425,35 @@ onMounted(async () => {
</q-item>
</template>
</q-select>
<q-select
v-else
class="bg-white"
use-input
fill-input
hide-selected
dense
lazy-rules
outlined
v-model="roundId2"
:options="roundOtion2"
label="เลือกรอบ"
option-value="id"
option-label="name"
emit-value
map-options
@update:model-value="onUpdateFilter"
@filter="(inputValue:string,doneFn:Function) =>
filterSelector(inputValue, doneFn,'round') "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
</div>
</q-card>