เพิ่ม 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

@ -49,7 +49,36 @@ const status = ref<string>("");
const myForm = ref<QForm | null>(null);
const edit = ref<boolean>(false);
const rows = ref<any[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fileName",
align: "left",
label: "ชื่อไฟล์",
sortable: true,
field: "fileName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "btnMicrosoft",
align: "right",
label: "ปุ่ม",
sortable: true,
field: "btnMicrosoft",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const profileId = ref<string>("");
const educationOld = ref<string>("");
const organizationPositionOld = ref<string>("");
@ -170,7 +199,17 @@ const getData = async () => {
.get(config.API.receiveDataId(paramsId.toString()))
.then(async (res: any) => {
const data = res.data.result;
// console.log(data);
let list: any[] = [];
if (data.docs.length > 0) {
data.docs.map((doc: any) => {
list.push({
pathName: doc.pathName ?? "",
fileName: doc.fileName ?? "",
});
});
}
rows.value = list;
profileId.value = data.profileId;
title.value.fullname = `${data.firstname ?? "-"} ${data.lastname ?? "-"}`;
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
@ -1012,6 +1051,37 @@ const getClass = (val: boolean) => {
</div>
</div>
</q-form>
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">เอกสารเพมเต</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="col-12">
<d-table
:rows="rows"
:columns="columns"
row-key="fileName"
hide-header
hide-bottom
>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="fileName" :props="props">
{{ props.row.fileName }}
</q-td>
<q-td key="btnMicrosoft" :props="props">
<q-btn type="a" target="_blank" :href="props.row.pathName" flat dense round color="red" icon="picture_as_pdf">
<q-tooltip>ไฟล PDF</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card>
</q-card>
</template>