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

View file

@ -24,6 +24,7 @@ const {
} = mixin; } = mixin;
const isChangeData = defineModel<boolean>("isChangeData", { required: true }); const isChangeData = defineModel<boolean>("isChangeData", { required: true });
const isAttachment = defineModel<boolean>("isAttachment", { required: true });
const { onCheckChangeData } = defineProps({ const { onCheckChangeData } = defineProps({
onCheckChangeData: { type: Function, required: true }, onCheckChangeData: { type: Function, required: true },
}); });
@ -33,7 +34,6 @@ const page = ref<number>(1);
const numOfPages = ref<number>(0); // pdf const numOfPages = ref<number>(0); // pdf
const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); // pdf const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); // pdf
const isAttachment = ref<boolean>(true);
const dialog = ref<boolean>(false); // dialog const dialog = ref<boolean>(false); // dialog
/** /**
@ -178,7 +178,11 @@ onMounted(async () => {
<div class="q-pr-sm">คำส</div> <div class="q-pr-sm">คำส</div>
</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 class="q-pr-sm">เอกสารแนบทาย</div>
</div> </div>
<q-space /> <q-space />
@ -195,24 +199,23 @@ onMounted(async () => {
<div class="q-pa-sm"> <div class="q-pa-sm">
<div class="q-pa-sm row q-gutter-sm"> <div class="q-pa-sm row q-gutter-sm">
<q-btn <q-btn
flat
dense dense
round
color="red" color="red"
icon="mdi-file-pdf" icon-right="mdi-file-pdf"
label="ดาวน์โหลด ไฟล์ .PDF"
@click="downloadCover('pdf')" @click="downloadCover('pdf')"
class="q-pa-sm"
> >
<q-tooltip>ไฟล .PDF</q-tooltip>
</q-btn> </q-btn>
<q-btn <q-btn
flat class="q-pa-sm"
dense dense
round
color="blue" color="blue"
icon="mdi-file-word" icon-right="mdi-file-word"
label="ดาวน์โหลด ไฟล์ .docx"
@click="downloadCover('docx')" @click="downloadCover('docx')"
> >
<q-tooltip>ไฟล .docx</q-tooltip>
</q-btn> </q-btn>
</div> </div>
<q-card bordered class="card-pdf q-mx-sm q-pa-md"> <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 route = useRoute();
const commandId = ref<string>(route.params.id.toString()); //ID const commandId = ref<string>(route.params.id.toString()); //ID
const store = useCommandDetail(); const store = useCommandDetail();
const isMomFirst = ref<boolean>(false); const isAttachment = ref<boolean>(true);
const childDetailRef = ref<InstanceType<typeof Detail> | null>(null); //ref components const childDetailRef = ref<InstanceType<typeof Detail> | null>(null); //ref components
const childListPersonsRef = ref<InstanceType<typeof ListPersons> | null>(null); //ref components const childListPersonsRef = ref<InstanceType<typeof ListPersons> | null>(null); //ref components
@ -86,7 +86,9 @@ async function fetchDataCommandList() {
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
formCommandList = data; formCommandList = data;
isChangeData.value = false; // API isAttachment.value = data.isAttachment ;
isAttachment.value = true; //
isChangeData.value = false; //
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -215,6 +217,7 @@ onMounted(async () => {
ref="childAttachedRef" ref="childAttachedRef"
v-model:is-change-data="isChangeData" v-model:is-change-data="isChangeData"
:on-check-change-data="onCheckChangeData" :on-check-change-data="onCheckChangeData"
v-model:is-attachment="isAttachment"
/> />
</q-card> </q-card>
</q-tab-panel> </q-tab-panel>