chore: install prettier
This commit is contained in:
@@ -4,11 +4,14 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th style="text-align: center;">Tải xuống</th>
|
||||
<th style="text-align: center">Tải xuống</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="txnfile in txnfiles" :key="txnfile.id">
|
||||
<tr
|
||||
v-for="txnfile in txnfiles"
|
||||
:key="txnfile.id"
|
||||
>
|
||||
<td>
|
||||
<div class="is-flex is-align-items-center">
|
||||
<span class="icon is-medium has-text-primary mr-2">
|
||||
@@ -20,7 +23,10 @@
|
||||
}"
|
||||
></SvgIcon>
|
||||
</span>
|
||||
<div class="is-clickable" @click="open(txnfile)">
|
||||
<div
|
||||
class="is-clickable"
|
||||
@click="open(txnfile)"
|
||||
>
|
||||
<p class="has-text-weight-semibold has-text-primary">
|
||||
{{ txnfile.file__name }}
|
||||
</p>
|
||||
@@ -51,25 +57,30 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="txnfiles.length === 0">
|
||||
<td colspan="4" class="has-text-centered py-4">
|
||||
<p class="has-text-grey">
|
||||
Chưa có tài liệu nào được đính kèm.
|
||||
</p>
|
||||
<td
|
||||
colspan="4"
|
||||
class="has-text-centered py-4"
|
||||
>
|
||||
<p class="has-text-grey">Chưa có tài liệu nào được đính kèm.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<Modal @close="showmodal=undefined" v-bind="showmodal" v-if="showmodal"></Modal>
|
||||
<Modal
|
||||
@close="showmodal = undefined"
|
||||
v-bind="showmodal"
|
||||
v-if="showmodal"
|
||||
></Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref } from "vue";
|
||||
const { $formatFileSize, $getdata, $getpath } = useNuxtApp();
|
||||
|
||||
const props = defineProps({
|
||||
txndetail: [String, Number]
|
||||
txndetail: [String, Number],
|
||||
});
|
||||
|
||||
const showmodal = ref(undefined);
|
||||
@@ -77,22 +88,28 @@ const txnfiles = ref([]);
|
||||
|
||||
async function fetchTxnFiles() {
|
||||
if (props.txndetail) {
|
||||
const data = await $getdata('transactionfile', { txn_detail: props.txndetail });
|
||||
txnfiles.value = Array.isArray(data) ? data : (data ? [data] : []);
|
||||
const data = await $getdata("transactionfile", {
|
||||
txn_detail: props.txndetail,
|
||||
});
|
||||
txnfiles.value = Array.isArray(data) ? data : data ? [data] : [];
|
||||
}
|
||||
}
|
||||
|
||||
function open(v) {
|
||||
const fileName = v.file__name || '';
|
||||
const fileName = v.file__name || "";
|
||||
const filePath = v.file__file || v.file;
|
||||
|
||||
if (!filePath) return;
|
||||
|
||||
if(fileName.indexOf('.png')>=0 || fileName.indexOf('.jpg')>=0 || fileName.indexOf('.jpeg')>=0) {
|
||||
if (fileName.indexOf(".png") >= 0 || fileName.indexOf(".jpg") >= 0 || fileName.indexOf(".jpeg") >= 0) {
|
||||
showmodal.value = {
|
||||
title: fileName,
|
||||
component: 'media/ChipImage',
|
||||
vbind: {extend: false, file: v, image: `${$getpath()}static/files/${filePath}`}
|
||||
title: fileName,
|
||||
component: "media/ChipImage",
|
||||
vbind: {
|
||||
extend: false,
|
||||
file: v,
|
||||
image: `${$getpath()}static/files/${filePath}`,
|
||||
},
|
||||
};
|
||||
return;
|
||||
}
|
||||
@@ -102,14 +119,17 @@ function open(v) {
|
||||
function download(v) {
|
||||
const filePath = v.file__file || v.file;
|
||||
if (!filePath) return;
|
||||
|
||||
window.open(`${$getpath()}static/files/${filePath}`, v.file__name || '_blank');
|
||||
|
||||
window.open(`${$getpath()}static/files/${filePath}`, v.file__name || "_blank");
|
||||
}
|
||||
|
||||
fetchTxnFiles();
|
||||
|
||||
watch(() => props.txndetail, () => {
|
||||
fetchTxnFiles();
|
||||
}, { immediate: true });
|
||||
|
||||
watch(
|
||||
() => props.txndetail,
|
||||
() => {
|
||||
fetchTxnFiles();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user