filter ทะเบียนประวัติ
This commit is contained in:
parent
bd64e91628
commit
8db24538e0
4 changed files with 25 additions and 24 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref, reactive, computed, readonly } from "vue";
|
||||
import { onMounted, ref, reactive, computed } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
|
@ -80,8 +80,8 @@ async function fetchDataRequest() {
|
|||
typeEmp.value == "employee" ? "-employee" : ""
|
||||
) + `${requestId.value}`
|
||||
)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
dataRequest.value = data;
|
||||
|
||||
formData.status = data.status;
|
||||
|
|
@ -93,7 +93,7 @@ async function fetchDataRequest() {
|
|||
isReadOnly.value = false;
|
||||
}
|
||||
|
||||
onDownloadFile(requestId.value);
|
||||
await onDownloadFile(requestId.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -161,7 +161,7 @@ const fileDownloadName = ref<string>("");
|
|||
* function หาชื่อไฟล์
|
||||
* @param id รายการยื่นคำร้องขอแก้ไขข้อมูล
|
||||
*/
|
||||
function onDownloadFile(id: string) {
|
||||
async function onDownloadFile(id: string) {
|
||||
http
|
||||
.get(
|
||||
config.API.file(
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
|||
retireYear: "",
|
||||
node: "เลือกหน่วยงาน",
|
||||
retireType: "ทั้งหมด",
|
||||
sortName: "ลำดับการแสดงผล",
|
||||
});
|
||||
|
||||
function convertTypeRetired(val: string) {
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ function selectType() {
|
|||
if (store.formFilter.type != empType.value) {
|
||||
store.labelOption.posType = "ทั้งหมด";
|
||||
store.labelOption.posLevel = "ทั้งหมด";
|
||||
store.labelOption.sortName = "ลำดับการแสดงผล";
|
||||
store.formFilter.type = empType.value;
|
||||
store.formFilter.dateAppoint = "";
|
||||
store.labelOption.node =
|
||||
|
|
@ -299,6 +300,7 @@ function selectRetireType(item: DataOption) {
|
|||
}
|
||||
|
||||
function selectDisplayOrderType(item: DataOption) {
|
||||
store.labelOption.sortName = item.name;
|
||||
store.formFilter.page = 1;
|
||||
store.formFilter.dateAppoint = item.id;
|
||||
fetchDataPerson();
|
||||
|
|
@ -755,15 +757,7 @@ onMounted(async () => {
|
|||
class="q-px-sm"
|
||||
>
|
||||
<template v-slot:label>
|
||||
{{
|
||||
`ลำดับการแสดผล ${
|
||||
store.formFilter.dateAppoint
|
||||
? store.formFilter.dateAppoint === "ASC"
|
||||
? "เก่า-ล่าสุด"
|
||||
: "ล่าสุด-เก่า"
|
||||
: ""
|
||||
}`
|
||||
}}
|
||||
{{ store.labelOption.sortName }}
|
||||
</template>
|
||||
<q-list>
|
||||
<q-item
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ async function onUpdateFilter() {
|
|||
) {
|
||||
isLoadPDF.value = true;
|
||||
pdfSrc.value = undefined;
|
||||
numOfPages.value = 1;
|
||||
detailReport.value = null;
|
||||
|
||||
await http
|
||||
.post(
|
||||
|
|
@ -222,6 +224,8 @@ async function onUpdateFilter() {
|
|||
} else if (roundId2.value && nodeId.value) {
|
||||
isLoadPDF.value = true;
|
||||
pdfSrc.value = undefined;
|
||||
numOfPages.value = 1;
|
||||
detailReport.value = null;
|
||||
|
||||
await http
|
||||
.post(
|
||||
|
|
@ -236,7 +240,6 @@ async function onUpdateFilter() {
|
|||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
detailReport.value = data;
|
||||
|
||||
await fetchDocumentTemplate(data, "xlsx");
|
||||
})
|
||||
.catch(async (e) => {
|
||||
|
|
@ -294,12 +297,14 @@ function downloadReport(type: string, download: "docx" | "" | "xlsx" = "") {
|
|||
const fileName =
|
||||
optionReport.value.find((e) => e.id === typeReport.value.id)?.name || "";
|
||||
|
||||
if (type === "xlsx" && download === "") {
|
||||
genReportXLSX(detailReport.value, fileName, type);
|
||||
} else if (type === "pdf" && download === "xlsx") {
|
||||
genReportXLSX(detailReport.value, fileName, "pdf");
|
||||
} else {
|
||||
genReport(detailReport.value, fileName, type);
|
||||
if (detailReport.value) {
|
||||
if (type === "xlsx" && download === "") {
|
||||
genReportXLSX(detailReport.value, fileName, type);
|
||||
} else if (type === "pdf" && download === "xlsx") {
|
||||
genReportXLSX(detailReport.value, fileName, "pdf");
|
||||
} else {
|
||||
genReport(detailReport.value, fileName, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -333,6 +338,7 @@ onMounted(async () => {
|
|||
</q-select>
|
||||
|
||||
<q-space />
|
||||
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
|
|
@ -350,9 +356,9 @@ onMounted(async () => {
|
|||
@click="
|
||||
downloadReport(
|
||||
'pdf',
|
||||
typeReport.val != 'report1' ||
|
||||
typeReport.val != 'report2' ||
|
||||
typeReport.val != 'report3'
|
||||
!['report1', 'report2', 'report3'].includes(
|
||||
typeReport.val
|
||||
)
|
||||
? 'xlsx'
|
||||
: 'docx'
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue