Files
web/app/components/media/FileCount.vue
2026-05-05 11:06:49 +07:00

66 lines
1.6 KiB
Vue

<template>
<div>
<span class="tooltip">
<span
class="dot-twitter"
@click="doClick()"
>{{ row[attr] || 0 }}</span
>
<span class="tooliptext">Hồ </span>
</span>
</div>
</template>
<script>
export default {
props: ["row", "api", "pagename", "attr"],
methods: {
async doClick() {
let obj;
if (this.attr === "image_count") {
let rs = await this.$getdata(this.api, {
ref: this.row.id,
file__type: 2,
});
if (rs.length > 0) {
obj = {
component: "media/ImageShow",
title: "Hồ sơ",
width: "80%",
height: "70vh",
vbind: {
row: this.row,
image: rs.map((v) => v.file__file),
pagename: this.pagename,
api: this.api,
},
};
} else {
obj = {
component: "media/ImageGallery",
vbind: { row: this.row, pagename: this.pagename, api: this.api },
width: "50%",
height: "500px",
title: "Hình ảnh",
};
}
} else {
let vbind = {
row: this.row,
api: this.api,
setting: "media-fields",
filter: { ref: this.row.id, file__type: 1 },
};
obj = {
component: "media/FileList",
title: "Hồ sơ",
width: "50%",
height: "300px",
vbind: vbind,
};
}
this.$emit("open", { name: "dataevent", data: { modal: obj } });
},
},
};
</script>