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