|
|
|
|
@ -81,6 +81,21 @@
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
v-model="previewVisible"
|
|
|
|
|
:title="$t('btn.preview')"
|
|
|
|
|
width="80%"
|
|
|
|
|
top="5vh"
|
|
|
|
|
destroy-on-close
|
|
|
|
|
:before-close="closePreview"
|
|
|
|
|
>
|
|
|
|
|
<iframe
|
|
|
|
|
v-if="previewUrl"
|
|
|
|
|
:src="previewUrl"
|
|
|
|
|
class="preview-iframe"
|
|
|
|
|
/>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -132,17 +147,29 @@ const goDetail = (id) => router.push(`/admin/hospitals/detail/${id}`);
|
|
|
|
|
const goEdit = (id) => router.push(`/admin/hospitals/edit/${id}`);
|
|
|
|
|
const goAdd = () => router.push("/admin/hospitals/edit");
|
|
|
|
|
|
|
|
|
|
const previewVisible = ref(false);
|
|
|
|
|
const previewUrl = ref("");
|
|
|
|
|
|
|
|
|
|
const cleanupPreviewUrl = () => {
|
|
|
|
|
if (previewUrl.value) {
|
|
|
|
|
URL.revokeObjectURL(previewUrl.value);
|
|
|
|
|
previewUrl.value = "";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const closePreview = () => {
|
|
|
|
|
previewVisible.value = false;
|
|
|
|
|
cleanupPreviewUrl();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const viewReport = async (attachmentPath) => {
|
|
|
|
|
if (!attachmentPath) return;
|
|
|
|
|
const fileName = String(attachmentPath).split(/[/\\]/).pop();
|
|
|
|
|
const fileName = String(attachmentPath);
|
|
|
|
|
try {
|
|
|
|
|
const blob = await getUploadFile(fileName);
|
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
|
const win = window.open(url, "_blank");
|
|
|
|
|
if (!win) {
|
|
|
|
|
ElMessage.warning($t('msg.pleaseFillRequired'));
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => URL.revokeObjectURL(url), 60_000);
|
|
|
|
|
cleanupPreviewUrl();
|
|
|
|
|
previewUrl.value = URL.createObjectURL(blob);
|
|
|
|
|
previewVisible.value = true;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
ElMessage.error(e?.message || $t('msg.failed'));
|
|
|
|
|
}
|
|
|
|
|
@ -160,4 +187,9 @@ onMounted(loadList);
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
.preview-iframe {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 80vh;
|
|
|
|
|
border: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|