เพิ่ม ui อัพโหลดไฟล์ / detail file

This commit is contained in:
AnandaTon 2023-08-30 12:51:12 +07:00
parent 72529c5d6c
commit 38e7c6b56a
2 changed files with 180 additions and 3 deletions

View file

@ -45,6 +45,8 @@ const popup = () => {
modal.value = true;
};
const modalupload = ref<boolean>(false);
const modalTree = ref<boolean>(false);
const personal = ref<any[]>([]);
const personalId = ref<string>("");
@ -70,7 +72,8 @@ const visibleColumns2 = ref<string[]>([
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const files = ref<any>();
const fileDocDataUpload = ref<File[]>([]);
const listRecevice = ref<any[]>([]);
const filters = ref<ResponseRow[]>([]);
const rows = ref<ResponseRow[]>([
@ -309,6 +312,32 @@ const fecthlistRecevice = async () => {
});
};
const fileUploadDoc = async (files: any) => {
files.forEach((file: any) => {
fileDocDataUpload.value.push(file);
});
};
const addUpload= async () => {
// showLoader();
// await http
// .post(config.API.listRoundInsignia())
// .then(() => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// });
};
const SaveData = async () => {
await addUpload();
await clickCloseUpload();
};
const resetFilter = () => {
filterKeyword.value = "";
filterKeyword2.value = "";
@ -328,6 +357,9 @@ const add = () => {
const clickClose = () => {
modal.value = false;
};
const clickCloseUpload = () => {
modalupload.value = false;
};
const openModalTree = (id: string) => {
personalId.value = id;
@ -337,6 +369,11 @@ const openModalTree = (id: string) => {
modalTree.value = true;
};
const openUpload = (id: string) => {
personalId.value = id;
modalupload.value = true;
};
const openDelete = (id: string) => {
dialogRemove($q, async () => await fetchDataDelete(id));
};
@ -594,6 +631,35 @@ const saveOrder = async () => {
>เลอกหนวยงานทบโอน</q-item-section
>
</q-item>
<q-item
clickable
v-close-popup
@click="openUpload(props.row.personalId)"
:disable="
props.row.status == 'REPORT' ||
props.row.status == 'DONE'
"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon
:color="
props.row.status == 'REPORT' ||
props.row.status == 'DONE'
? 'grey'
: 'blue'
"
size="xs"
name="attach_file"
/>
</q-item-section>
<q-item-section
>พโหลดเอกสาร</q-item-section
>
</q-item>
<q-item
clickable
v-close-popup
@ -794,6 +860,47 @@ const saveOrder = async () => {
</q-card>
</q-dialog>
<q-dialog v-model="modalupload">
<q-card style="width: 600px">
<DialogHeader title="อัพโหลดเอกสาร" :close="clickCloseUpload" />
<q-separator />
<q-separator />
<q-card-section class="q-pt-none">
<div class="col-12 row items-center q-col-gutter-sm">
<div class="col-12">
<q-file
outlined
dense
v-model="files"
@added="fileUploadDoc"
label="อัพโหลดเอกสาร"
lazy-rules
>
<!-- :rules="[
(val) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
]" -->
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
</div>
</q-card-section>
<q-card-actions class="text-primary q-py-sm">
<q-space />
<q-btn
flat
round
color="public"
@click="SaveData"
icon="mdi-content-save-outline"
>
<q-tooltip>นท</q-tooltip>
</q-btn>
</q-card-actions>
</q-card>
</q-dialog>
<DialogOrgTree
v-model:modal="modalTree"
:close="closeModalTree"