แก้ ui ดาวน์โหลด

This commit is contained in:
STW_TTTY\stwtt 2024-09-24 11:39:26 +07:00
parent 0290f5cd77
commit e89eeeaba3
3 changed files with 23 additions and 17 deletions

View file

@ -686,7 +686,7 @@ const viewFileUpload = async (url: string) => {
v-model="fileOrder"
label="เลือกไฟล์คำสั่ง"
hide-bottom-space
:rules="[(val) => val || 'กรุณาเลือกไฟล์ไฟล์คำสั่ง']"
:rules="[(val:string) => val || 'กรุณาเลือกไฟล์ไฟล์คำสั่ง']"
accept=".pdf"
>
<template v-slot:prepend>
@ -729,7 +729,7 @@ const viewFileUpload = async (url: string) => {
v-model="fileTailer"
label="เลือกไฟล์เอกสารแนบท้าย"
hide-bottom-space
:rules="[(val) => val || 'กรุณาเลือกไฟล์เอกสารแนบท้าย']"
:rules="[(val:string) => val || 'กรุณาเลือกไฟล์เอกสารแนบท้าย']"
accept=".pdf"
>
<template v-slot:prepend>
@ -779,7 +779,7 @@ const viewFileUpload = async (url: string) => {
:readonly="!true"
:borderless="!true"
v-model="order"
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
:disable="orderStatusName == 'ออกคำสั่งแล้ว'"
@ -814,7 +814,7 @@ const viewFileUpload = async (url: string) => {
dense
:model-value="years + 543"
:rules="[
(val) => !!val || `${'กรุณาเลือกปีที่ออกคำสั่ง'}`,
(val:string) => !!val || `${'กรุณาเลือกปีที่ออกคำสั่ง'}`,
]"
hide-bottom-space
:label="`${'ปีที่ออกคำสั่ง'}`"
@ -865,7 +865,7 @@ const viewFileUpload = async (url: string) => {
:model-value="date != null ? date2Thai(date) : null"
:label="`${'วันที่ลงนาม'}`"
:rules="[
(val) => !!val || `${'กรุณาเลือกวันที่ลงนาม'}`,
(val:string) => !!val || `${'กรุณาเลือกวันที่ลงนาม'}`,
]"
>
<template v-slot:prepend>

View file

@ -24,6 +24,7 @@ const {
} = mixin;
const isChangeData = defineModel<boolean>("isChangeData", { required: true });
const isAttachment = defineModel<boolean>("isAttachment", { required: true });
const { onCheckChangeData } = defineProps({
onCheckChangeData: { type: Function, required: true },
});
@ -33,7 +34,6 @@ const page = ref<number>(1);
const numOfPages = ref<number>(0); // pdf
const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); // pdf
const isAttachment = ref<boolean>(true);
const dialog = ref<boolean>(false); // dialog
/**
@ -178,7 +178,11 @@ onMounted(async () => {
<div class="q-pr-sm">คำส</div>
</div>
<div @click="setTab('second')" :class="getClass(tab == 'second')">
<div
v-if="isAttachment"
@click="setTab('second')"
:class="getClass(tab == 'second')"
>
<div class="q-pr-sm">เอกสารแนบทาย</div>
</div>
<q-space />
@ -195,24 +199,23 @@ onMounted(async () => {
<div class="q-pa-sm">
<div class="q-pa-sm row q-gutter-sm">
<q-btn
flat
dense
round
color="red"
icon="mdi-file-pdf"
icon-right="mdi-file-pdf"
label="ดาวน์โหลด ไฟล์ .PDF"
@click="downloadCover('pdf')"
class="q-pa-sm"
>
<q-tooltip>ไฟล .PDF</q-tooltip>
</q-btn>
<q-btn
flat
class="q-pa-sm"
dense
round
color="blue"
icon="mdi-file-word"
icon-right="mdi-file-word"
label="ดาวน์โหลด ไฟล์ .docx"
@click="downloadCover('docx')"
>
<q-tooltip>ไฟล .docx</q-tooltip>
</q-btn>
</div>
<q-card bordered class="card-pdf q-mx-sm q-pa-md">

View file

@ -23,7 +23,7 @@ const router = useRouter();
const route = useRoute();
const commandId = ref<string>(route.params.id.toString()); //ID
const store = useCommandDetail();
const isMomFirst = ref<boolean>(false);
const isAttachment = ref<boolean>(true);
const childDetailRef = ref<InstanceType<typeof Detail> | null>(null); //ref components
const childListPersonsRef = ref<InstanceType<typeof ListPersons> | null>(null); //ref components
@ -86,7 +86,9 @@ async function fetchDataCommandList() {
.then(async (res) => {
const data = await res.data.result;
formCommandList = data;
isChangeData.value = false;
// API isAttachment.value = data.isAttachment ;
isAttachment.value = true; //
isChangeData.value = false; //
})
.catch((err) => {
messageError($q, err);
@ -215,6 +217,7 @@ onMounted(async () => {
ref="childAttachedRef"
v-model:is-change-data="isChangeData"
:on-check-change-data="onCheckChangeData"
v-model:is-attachment="isAttachment"
/>
</q-card>
</q-tab-panel>