updated req edit profile

This commit is contained in:
Warunee Tamkoo 2024-10-25 16:25:22 +07:00
parent c365327b43
commit afbbbf4af4
2 changed files with 53 additions and 75 deletions

View file

@ -73,15 +73,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ // {
name: "document", // name: "document",
align: "center", // align: "center",
label: "หลักฐานอ้างอิง", // label: "",
sortable: false, // sortable: false,
field: "document", // field: "document",
headerStyle: "font-size: 14px", // headerStyle: "font-size: 14px",
style: "font-size: 14px", // style: "font-size: 14px",
}, // },
{ {
name: "status", name: "status",
align: "left", align: "left",
@ -108,7 +108,7 @@ const visibleColumns = ref<string[]>([
"fullname", "fullname",
"topic", "topic",
"detail", "detail",
"document", // "document",
"status", "status",
"remark", "remark",
]); ]);
@ -354,7 +354,7 @@ onMounted(() => {
</q-btn> </q-btn>
</q-td> </q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name === 'document'"> <!-- <div v-if="col.name === 'document'">
<q-btn <q-btn
icon="mdi-download" icon="mdi-download"
round round
@ -365,10 +365,10 @@ onMounted(() => {
> >
<q-tooltip>ดาวนโหลดเอกสารหลกฐาน</q-tooltip> <q-tooltip>ดาวนโหลดเอกสารหลกฐาน</q-tooltip>
</q-btn> </q-btn>
</div> </div> -->
<div v-else class="table_ellipsis2"> <!-- <div v-else class="table_ellipsis2"> -->
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> <!-- </div> -->
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
@ -395,8 +395,6 @@ onMounted(() => {
:fetch-data="fetchListRequset" :fetch-data="fetchListRequset"
:request-id="requestId" :request-id="requestId"
/> />
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -30,7 +30,6 @@ const {
success, success,
} = useCounterMixin(); } = useCounterMixin();
const urlImg = ref<string>("");
const modalUpdate = ref<boolean>(false); const modalUpdate = ref<boolean>(false);
const modalFather = ref<boolean>(false); const modalFather = ref<boolean>(false);
const modalMother = ref<boolean>(false); const modalMother = ref<boolean>(false);
@ -85,9 +84,8 @@ async function fetchDataRequest() {
} else { } else {
isReadOnly.value = false; isReadOnly.value = false;
} }
if (dataRequest.value.topic == "ขอแก้ไขรูปภาพประจำตัว") {
onDownloadFile(requestId.value); onDownloadFile(requestId.value);
}
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -143,12 +141,13 @@ function classInput(val: boolean) {
}; };
} }
const checkFile = ref<null | false | "img" | "doc">(null); // null , false , "img" , "doc"
const urlDownload = ref<string>(""); // url
/** /**
* function หาชอไฟล * function หาชอไฟล
* @param id รายการยนคำรองขอแกไขขอม * @param id รายการยนคำรองขอแกไขขอม
*/ */
function onDownloadFile(id: string) { function onDownloadFile(id: string) {
showLoader();
http http
.get( .get(
config.API.file( config.API.file(
@ -161,12 +160,11 @@ function onDownloadFile(id: string) {
if (res.data.length !== 0) { if (res.data.length !== 0) {
await downloadUrl(id, res.data[0].fileName); await downloadUrl(id, res.data[0].fileName);
} else { } else {
hideLoader(); checkFile.value = false;
} }
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
hideLoader();
}); });
} }
@ -186,10 +184,11 @@ async function downloadUrl(id: string, fileName: string) {
) )
) )
.then((res) => { .then((res) => {
urlDownload.value = res.data.downloadUrl;
if (dataRequest.value.topic == "ขอแก้ไขรูปภาพประจำตัว") { if (dataRequest.value.topic == "ขอแก้ไขรูปภาพประจำตัว") {
urlImg.value = res.data.downloadUrl; checkFile.value = "img";
} else { } else {
window.open(res.data.downloadUrl, "_blank"); checkFile.value = "doc";
} }
}) })
.catch((e) => { .catch((e) => {
@ -341,56 +340,37 @@ onMounted(async () => {
type="textarea" type="textarea"
/> />
</div> </div>
<div class="text-weight-bold text-dark col-12">
{{ <div v-if="checkFile != null && checkFile != false">
dataRequest.topic == "ขอแก้ไขรูปภาพประจำตัว" <div class="text-weight-bold text-dark col-12">
? "รูปภาพประจำตัว" {{
: "เอกสารหลักฐาน" checkFile == "img" ? "รูปภาพประจำตัว" : "เอกสารหลักฐาน"
}} }}
</div> </div>
<div class="col-12"> <div class="col-12">
<!-- เอกสารหลกฐาน --> <!-- เอกสารหลกฐาน -->
<q-btn <q-btn
v-if="dataRequest.topic !== 'ขอแก้ไขรูปภาพประจำตัว'" v-if="checkFile == 'doc'"
icon="mdi-download" icon="mdi-download"
dense dense
flat flat
label="ดาวน์โหลดเอกสารหลักฐาน" label="ดาวน์โหลดเอกสารหลักฐาน"
color="blue" color="blue"
@click.stop.pervent="onDownloadFile(requestId)" :href="urlDownload"
> target="_blank"
<q-tooltip>หลกฐานอางอ</q-tooltip> />
</q-btn> <div
<div v-else> v-else-if="checkFile == 'img'"
<span v-if="urlImg == ''" class="q-pa-md q-gutter-sm"
><div
style="
height: 200px;
max-width: 200px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-spinner color="primary" size="3em" :thickness="10" />
</div>
</span>
<q-img
v-else
:src="urlImg"
:ratio="1"
spinner-color="primary"
spinner-size="82px"
fit="cover"
style="
height: 200px;
max-width: 200px;
border-radius: 20px;
"
> >
</q-img> <q-avatar size="120px" color="grey-4">
<img
:src="urlDownload"
class="bg-grey-3"
style="object-fit: cover"
/>
</q-avatar>
</div>
</div> </div>
</div> </div>
</div> </div>