fix ViewCommand

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-05 15:23:40 +07:00
parent c33ece8586
commit 26a1270dd2
5 changed files with 113 additions and 41 deletions

View file

@ -7,8 +7,6 @@ import { VuePDF, usePDF } from "@tato30/vue-pdf";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import genReport from "@/plugins/genreport";
import genReportXLSX from "@/plugins/genreportxlsx";
import DialogHeader from "@/components/DialogHeader.vue";
@ -21,7 +19,6 @@ const { showLoader, hideLoader, messageError } = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
const command = defineModel<string>("command", { required: true });
const commandId = defineModel<string>("commandId", { required: true });
const issue = ref<string | null>(null);
const promises = ref<any>([]);
const tab = ref<string>("main"); //tab
@ -80,21 +77,8 @@ async function checkAttachment() {
async function downloadCover(type: string) {
if (tab.value === "main") {
window.open(dataCover.value?.downloadUrl, "_blank");
// genReport(
// dataCover.value,
// ` ${issue.value}`,
// type,
// "?folder=command"
// );
} else {
window.open(dataAttachment.value?.downloadUrl, "_blank");
// genReportXLSX(
// dataAttachment.value,
// ` ${issue.value}`,
// type,
// "?folder=command"
// );
}
}
@ -161,11 +145,9 @@ watch(
if (modal.value) {
showLoader();
promises.value = [checkAttachment(), fetchDataCommand("cover")];
await Promise.all(promises.value)
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {
hideLoader();
@ -177,9 +159,7 @@ watch(
}
);
/**
* check tab เมอมการเปลยน tab
*/
/** check tab เมื่อมีการเปลี่ยน tab*/
watch(
() => tab.value,
() => {
@ -198,7 +178,7 @@ watch(
<DialogHeader :tittle="`คำสั่ง ${command}`" :close="closeDialog" />
<q-separator />
<q-card-section class="scroll" style="max-height: 90vh;">
<q-card-section class="scroll" style="max-height: 90vh">
<div class="space">
<div @click="setTab('main')" :class="getClass(tab == 'main')">
<div class="q-pr-sm">คำส</div>
@ -231,6 +211,7 @@ watch(
label="ดาวน์โหลดไฟล์ PDF"
@click="downloadCover('pdf')"
class="q-px-sm"
:loading="!isLoadView"
>
</q-btn>