From 763bec8077191e42a779e8f77e5126e5dd09b27f Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期三, 14 五月 2025 14:32:43 +0800
Subject: [PATCH] feat: 接口

---
 src/components/Table/PortraitTableWithAttachment.vue |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/src/components/Table/PortraitTableWithAttachment.vue b/src/components/Table/PortraitTableWithAttachment.vue
new file mode 100644
index 0000000..cefb234
--- /dev/null
+++ b/src/components/Table/PortraitTableWithAttachment.vue
@@ -0,0 +1,72 @@
+<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 { 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: 'downloadBtn',
+      name: '涓嬭浇',
+    },
+    emits: {
+      onClick: (row) => handleDownload(row),
+    },
+  },
+];
+
+function handleDownload(row: TAnnexItem) {
+  if (props.customDownLoad) {
+    props.customDownLoad(row);
+  } else {
+    downloadFileByUrl(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.9.1