From 0fd5c25a640e7d20661d7f2ed74c7b6a0d66571e Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 26 十二月 2025 16:30:42 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobStandardAdmin
---
src/components/Table/PortraitTableWithAttachment.vue | 87 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/src/components/Table/PortraitTableWithAttachment.vue b/src/components/Table/PortraitTableWithAttachment.vue
new file mode 100644
index 0000000..b8e0a15
--- /dev/null
+++ b/src/components/Table/PortraitTableWithAttachment.vue
@@ -0,0 +1,87 @@
+<template>
+ <PortraitTable v-bind="portraitTableProps" :label-width="labelWidth"> </PortraitTable>
+ <div class="enclosure-list-title">闄勪欢鍒楄〃</div>
+ <ProTableV2
+ :table-data="annexList"
+ :columns="CommonAnnexTableColumns"
+ :operation-btns="operationListBtns"
+ :show-pagination="false"
+ :show-no-data="false"
+ :auto-height="false"
+ :show-table-column-setting="false"
+ :table-props="{ maxHeight: '400px' }"
+ :column-render-map="columnsRenderProps"
+ >
+ </ProTableV2>
+</template>
+
+<script setup lang="ts" generic="TAnnexItem">
+import { downloadFileByUrl } from '@bole-core/core';
+import { CommonAnnexTableColumns } from '@/constants';
+import { bolePreview, ProTableV2, ProTableV2Props } from '@bole-core/components';
+
+defineOptions({
+ name: 'PortraitTableWithAttachment',
+});
+
+type Props = {
+ annexList: TAnnexItem[];
+ customDownLoad?: (row: TAnnexItem) => Promise<any>;
+ labelWidth?: string;
+ portraitTableProps: any;
+ columnsRenderProps?: ProTableV2Props['columnRenderMap'];
+ downloadFileKey?: keyof TAnnexItem;
+};
+
+const props = withDefaults(defineProps<Props>(), {
+ labelWidth: '180px',
+ columnsRenderProps: () => ({}),
+ downloadFileKey: 'url' as any,
+});
+
+const operationListBtns = [
+ {
+ data: {
+ enCode: 'previewBtn',
+ name: '鏌ョ湅',
+ },
+ emits: {
+ onClick: (row) => handlePreview(row),
+ },
+ },
+ {
+ data: {
+ enCode: 'downloadBtn',
+ name: '涓嬭浇',
+ },
+ emits: {
+ onClick: (row) => handleDownload(row),
+ },
+ },
+];
+
+function handleDownload(row: TAnnexItem) {
+ if (props.customDownLoad) {
+ props.customDownLoad(row);
+ } else {
+ downloadFileByUrl(row[props.downloadFileKey] as any);
+ }
+}
+
+function handlePreview(row: TAnnexItem) {
+ bolePreview({
+ fileUrl: row[props.downloadFileKey] as any,
+ });
+}
+</script>
+
+<style lang="scss" scoped>
+@use '@/style/common.scss' as *;
+
+.enclosure-list-title {
+ padding: 16px 0;
+ font-size: 14px;
+ color: getCssVar('text-color', 'primary');
+ line-height: 19px;
+}
+</style>
--
Gitblit v1.10.0