aegon-lv82 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -0
- package/src/App.vue +44 -0
- package/src/api/index.ts +19 -0
- package/src/api/modules/build-report/reportEditor.ts +526 -0
- package/src/api/modules/build-report/reportPermission.ts +64 -0
- package/src/api/modules/index.ts +69 -0
- package/src/api/modules/industry/green_mortgage.ts +42 -0
- package/src/api/modules/user/index.ts +4 -0
- package/src/api/request.ts +124 -0
- package/src/assets/sample-access-icon.png +0 -0
- package/src/assets/sample-pie-chart.png +0 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/CapsuleScrollbar.vue +7 -0
- package/src/components/Export/ExcelExport.vue +592 -0
- package/src/components/Export/ExcelExport2.vue +494 -0
- package/src/components/Export/ExcelExport3.vue +342 -0
- package/src/components/Export/ExcelExport4.vue +665 -0
- package/src/components/Export/excelExport.js +547 -0
- package/src/components/Export/excelExport.ts +551 -0
- package/src/components/GEN-AI/index.vue +140 -0
- package/src/components/GEN-AI/index1.vue +422 -0
- package/src/components/GEN-AI/index10.vue +5 -0
- package/src/components/GEN-AI/index2.vue +548 -0
- package/src/components/GEN-AI/index3.vue +605 -0
- package/src/components/GEN-AI/index4.vue +609 -0
- package/src/components/GEN-AI/index5.vue +558 -0
- package/src/components/GEN-AI/index6.vue +634 -0
- package/src/components/GEN-AI/index7.vue +688 -0
- package/src/components/GEN-AI/index8.vue +458 -0
- package/src/components/GEN-AI/index9.vue +1217 -0
- package/src/components/GEN-AI/types.ts +12 -0
- package/src/components/GEN-AI/utils.ts +42 -0
- package/src/components/HelloWorld.vue +41 -0
- package/src/components/PageCard.vue +124 -0
- package/src/components/PageHeader.vue +32 -0
- package/src/components/backup/index5 copy.vue +556 -0
- package/src/components/backup/index5.vue +620 -0
- package/src/components/backup/index9 copy.vue +1029 -0
- package/src/components/backup/index9-pro.vue +1065 -0
- package/src/components/backup/index9.vue +1057 -0
- package/src/directives/btnLoading.ts +455 -0
- package/src/directives/debounce copy.ts +670 -0
- package/src/directives/debounce.ts +98 -0
- package/src/directives/index.ts +25 -0
- package/src/layouts/MainLayout.vue +129 -0
- package/src/main.ts +76 -0
- package/src/router/index.ts +142 -0
- package/src/router/menus.ts +28 -0
- package/src/store/modules/gen-ai/index.ts +1 -0
- package/src/store/modules/gen-ai/reportBuild.ts +37 -0
- package/src/style.css +79 -0
- package/src/styles/report-config-popover.css +39 -0
- package/src/styles/report-icon-btn.css +19 -0
- package/src/test/mock.ts +101 -0
- package/src/test/test1.vue +402 -0
- package/src/test/test2.vue +1689 -0
- package/src/types/gen-ai/build-report/reportEditor.ts +684 -0
- package/src/utils/function.ts +46 -0
- package/src/utils/gen-ai-navigation.ts +1 -0
- package/src/utils/gen-ai-scroll.ts +1 -0
- package/src/utils/openDataLoaderWordExport.ts +33 -0
- package/src/utils/pageScrollbar.ts +115 -0
- package/src/utils/randomTranscode.ts +87 -0
- package/src/utils/reportPdfExport.ts +44 -0
- package/src/views/Blank.vue +68 -0
- package/src/views/Home.vue +29 -0
- package/src/views/TemplateCenter/Knowledge.ts +83 -0
- package/src/views/TemplateCenter/data.d.ts +10 -0
- package/src/views/TemplateCenter/index.vue +1128 -0
- package/src/views/TemplateCenter/service.ts +69 -0
- package/src/views/gen-ai/build-report/chartStreamRefs.ts +174 -0
- package/src/views/gen-ai/build-report/coherence-check/index.vue +559 -0
- package/src/views/gen-ai/build-report/components/ReportChapterWorkspace.vue +4258 -0
- package/src/views/gen-ai/build-report/components/ReportConfigPanel.vue +727 -0
- package/src/views/gen-ai/build-report/components/ReportGenerateSettingsPanel.vue +2361 -0
- package/src/views/gen-ai/build-report/components/ReportGeneratingPanel.vue +1765 -0
- package/src/views/gen-ai/build-report/components/ReportPromptPanel.vue +614 -0
- package/src/views/gen-ai/build-report/components/ReportSourceFileSummary.vue +656 -0
- package/src/views/gen-ai/build-report/components/ReportSourcesPanel.vue +1327 -0
- package/src/views/gen-ai/build-report/components/ReportTemplateDetail.vue +191 -0
- package/src/views/gen-ai/build-report/components/ReportTemplateEditorFormPanel.vue +667 -0
- package/src/views/gen-ai/build-report/components/ReportTemplatePicker.vue +302 -0
- package/src/views/gen-ai/build-report/components/ReportWorkflowSidebar.vue +148 -0
- package/src/views/gen-ai/build-report/components/paramsSetting.vue +886 -0
- package/src/views/gen-ai/build-report/components/reportEdit.vue +2283 -0
- package/src/views/gen-ai/build-report/index.vue +856 -0
- package/src/views/gen-ai/build-report/report-domain.ts +1133 -0
- package/src/views/gen-ai/build-report/report-template-data.ts +295 -0
- package/src/views/gen-ai/build-report/useReportWorkflow.ts +1408 -0
- package/src/views/gen-ai/common/assets/NotoSans-SC.woff2 +0 -0
- package/src/views/gen-ai/common/assets/NotoSans-TC.woff2 +0 -0
- package/src/views/gen-ai/common/assets/NotoSans.woff2 +0 -0
- package/src/views/gen-ai/common/assets/fonts.css +278 -0
- package/src/views/gen-ai/common/assets/pagination.css +163 -0
- package/src/views/gen-ai/common/directives/btnLoading.ts +455 -0
- package/src/views/gen-ai/common/directives/debounce.ts +98 -0
- package/src/views/gen-ai/common/directives/index.ts +30 -0
- package/src/views/gen-ai/common/en.md +417 -0
- package/src/views/gen-ai/common/index.ts +36 -0
- package/src/views/gen-ai/common/types/component-expose.ts +9 -0
- package/src/views/gen-ai/common/utils/api-res-status.ts +7 -0
- package/src/views/gen-ai/common/utils/navigation.ts +59 -0
- package/src/views/gen-ai/common/utils/remote-request.ts +45 -0
- package/src/views/gen-ai/common/utils/scroll.ts +577 -0
- package/src/views/gen-ai/components/AIExport/docx-export.ts +950 -0
- package/src/views/gen-ai/components/AIExport/docxExport.ts +2566 -0
- package/src/views/gen-ai/components/AIExport/index.ts +52 -0
- package/src/views/gen-ai/components/AIExport/parseMarkdownHtml.ts +649 -0
- package/src/views/gen-ai/components/CapsuleScrollbar.vue +149 -0
- package/src/views/gen-ai/components/ChapterTitleScroll.vue +468 -0
- package/src/views/gen-ai/components/EntryHeroNavCards.vue +379 -0
- package/src/views/gen-ai/components/GenAiPagination.vue +52 -0
- package/src/views/gen-ai/components/ModelCard.vue +1114 -0
- package/src/views/gen-ai/components/Preview/FilePreviewPage.vue +947 -0
- package/src/views/gen-ai/components/Preview/PreviewCapsuleScroll.vue +205 -0
- package/src/views/gen-ai/components/Preview/PreviewOutlineTree.vue +148 -0
- package/src/views/gen-ai/components/Preview/index.ts +11 -0
- package/src/views/gen-ai/components/Preview/preview.ts +722 -0
- package/src/views/gen-ai/components/PromptField.vue +505 -0
- package/src/views/gen-ai/components/RecentReportsTable.vue +974 -0
- package/src/views/gen-ai/components/ReportCollapsibleSection.vue +172 -0
- package/src/views/gen-ai/components/ReportHistoryList.vue +637 -0
- package/src/views/gen-ai/components/ReportSectionConfirmPopover.vue +251 -0
- package/src/views/gen-ai/components/editor/ChapterTiptapEditor.vue +3139 -0
- package/src/views/gen-ai/components/editor/StructureBlockView.vue +441 -0
- package/src/views/gen-ai/components/editor/TiptapToolbar.vue +1036 -0
- package/src/views/gen-ai/components/editor/TypewriterDocEditor.vue +398 -0
- package/src/views/gen-ai/components/editor/_StructureOrgNode.vue +326 -0
- package/src/views/gen-ai/components/editor/index.ts +12 -0
- package/src/views/gen-ai/components/editor/parseMarkdownHtml.ts +667 -0
- package/src/views/gen-ai/gen-entry/api/index.ts +32 -0
- package/src/views/gen-ai/gen-entry/index.vue +287 -0
- package/src/views/gen-ai/gen-entry/types/index.ts +4 -0
- package/src/views/gen-ai/i.mark +2 -0
- package/src/views/gen-ai/management-center/index.vue +1815 -0
- package/src/views/gen-ai/management-center/mockData.ts +248 -0
- package/src/views/gen-ai/management-center/types/index.ts +37 -0
- package/src/views/gen-ai/model-manager/TemplateEditorFormPanel.vue +661 -0
- package/src/views/gen-ai/model-manager/api/index.ts +32 -0
- package/src/views/gen-ai/model-manager/api/mockApi.ts +33 -0
- package/src/views/gen-ai/model-manager/index.vue +1583 -0
- package/src/views/gen-ai/model-manager/mockData.ts +177 -0
- package/src/views/gen-ai/model-manager/template-detail-shared.ts +154 -0
- package/src/views/gen-ai/model-manager/template-editor.vue +345 -0
- package/src/views/gen-ai/model-manager/types/index.ts +40 -0
- package/src/views/gen-ai/model-manager/utils.ts +25 -0
- package/src/views/greenMortgage.vue +1834 -0
- package/src/vite-env.d.ts +46 -0
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex h-screen bg-[#F3F4F6] text-[#333]">
|
|
3
|
+
<main class="flex-1 overflow-y-auto p-12">
|
|
4
|
+
<div
|
|
5
|
+
class="max-w-5xl mx-auto bg-white shadow-sm border border-gray-100 rounded-sm p-10 min-h-screen relative"
|
|
6
|
+
id="report-container"
|
|
7
|
+
>
|
|
8
|
+
<!-- 导出按钮组(导出时会自动隐藏) -->
|
|
9
|
+
<div
|
|
10
|
+
class="absolute top-6 right-8 flex gap-4 no-print"
|
|
11
|
+
style="margin: 10px 0; text-align: end"
|
|
12
|
+
>
|
|
13
|
+
<el-button
|
|
14
|
+
@click="handleExportPDF"
|
|
15
|
+
size="small"
|
|
16
|
+
plain
|
|
17
|
+
type="danger"
|
|
18
|
+
:loading="isExporting"
|
|
19
|
+
>
|
|
20
|
+
匯出為PDF
|
|
21
|
+
</el-button>
|
|
22
|
+
<el-button
|
|
23
|
+
@click="handleExportWord"
|
|
24
|
+
size="small"
|
|
25
|
+
plain
|
|
26
|
+
type="danger"
|
|
27
|
+
:loading="isExporting"
|
|
28
|
+
>
|
|
29
|
+
匯出為Word
|
|
30
|
+
</el-button>
|
|
31
|
+
<el-button @click="handlePrint" size="small" plain type="success">
|
|
32
|
+
打印 / 另存為PDF
|
|
33
|
+
</el-button>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!-- 可滚动的内容容器 -->
|
|
37
|
+
<div
|
|
38
|
+
ref="scrollContainer"
|
|
39
|
+
class="prose prose-slate max-w-none"
|
|
40
|
+
style="
|
|
41
|
+
margin: 0px;
|
|
42
|
+
padding: 10px;
|
|
43
|
+
border: 1px solid #ccc;
|
|
44
|
+
min-height: 600px;
|
|
45
|
+
max-height: 60vh;
|
|
46
|
+
overflow-y: auto;
|
|
47
|
+
"
|
|
48
|
+
>
|
|
49
|
+
<div class="font-bold flex items-center mb-5 text-lg border-t pt-6">
|
|
50
|
+
正文:
|
|
51
|
+
<Edit3Icon :size="18" class="ml-2 text-[#C54E5E] cursor-pointer" />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="content-wrapper space-y-4">
|
|
55
|
+
<template v-for="(item, idx) in displaySequence" :key="idx">
|
|
56
|
+
<TypewriterText
|
|
57
|
+
v-if="item.type === 'text' && idx < activeIndex"
|
|
58
|
+
:text="item.content!"
|
|
59
|
+
:auto-start="idx === activeIndex - 1 && idx === lastStartedTextIndex"
|
|
60
|
+
@completed="onTextCompleted"
|
|
61
|
+
@typing="scrollToBottom"
|
|
62
|
+
class="text-paragraph"
|
|
63
|
+
/>
|
|
64
|
+
<component
|
|
65
|
+
v-else-if="item.type === 'component' && idx < activeIndex"
|
|
66
|
+
:is="item.component"
|
|
67
|
+
class="my-4"
|
|
68
|
+
@ready="onComponentReady"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<span
|
|
74
|
+
v-if="activeIndex < displaySequence.length"
|
|
75
|
+
class="inline-block w-[2px] h-[18px] bg-[#C54E5E] animate-pulse ml-1 align-middle"
|
|
76
|
+
></span>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</main>
|
|
80
|
+
|
|
81
|
+
<aside class="w-80 bg-white border-l border-gray-200 p-6 no-print">
|
|
82
|
+
<h3 class="font-bold text-gray-700 mb-6">生成報告設置</h3>
|
|
83
|
+
<p class="text-sm text-gray-500">✨ 完整图文混排 + 打字机效果</p>
|
|
84
|
+
<p class="text-xs text-gray-400 mt-2">
|
|
85
|
+
包含:带状态表格 / 按钮组 / 图标集 / 完整文本段落 / ECharts混合图表<br />
|
|
86
|
+
上半部分+下半部分全部按顺序逐字/逐组件展示
|
|
87
|
+
</p>
|
|
88
|
+
<el-button @click="restartDemo" type="danger" plain class="w-full mt-6"> 重新播放 </el-button>
|
|
89
|
+
<div class="mt-6 text-xs text-gray-400 border-t pt-4">
|
|
90
|
+
💡 提示:<br />
|
|
91
|
+
• 表格、按钮、图标、图表均会逐步出现<br />
|
|
92
|
+
• 文本逐字显示,完成后自动展示下一项<br />
|
|
93
|
+
• PDF/Word导出前自动等待所有内容渲染完成
|
|
94
|
+
</div>
|
|
95
|
+
</aside>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script setup lang="ts">
|
|
100
|
+
import {
|
|
101
|
+
ref,
|
|
102
|
+
onMounted,
|
|
103
|
+
onUnmounted,
|
|
104
|
+
defineComponent,
|
|
105
|
+
h,
|
|
106
|
+
markRaw,
|
|
107
|
+
type Component,
|
|
108
|
+
nextTick,
|
|
109
|
+
} from 'vue'
|
|
110
|
+
import { Edit3Icon } from 'lucide-vue-next'
|
|
111
|
+
import { ElButton, ElTable, ElTableColumn, ElIcon } from 'element-plus'
|
|
112
|
+
import { Platform, Eleme, DeleteFilled, Delete } from '@element-plus/icons-vue'
|
|
113
|
+
import * as echarts from 'echarts'
|
|
114
|
+
import html2canvas from 'html2canvas'
|
|
115
|
+
import jsPDF from 'jspdf'
|
|
116
|
+
import { asBlob } from 'html-docx-js-typescript'
|
|
117
|
+
import { saveAs } from 'file-saver'
|
|
118
|
+
|
|
119
|
+
// ---------- 滚动容器引用 ----------
|
|
120
|
+
const scrollContainer = ref<HTMLElement | null>(null)
|
|
121
|
+
|
|
122
|
+
// 滚动到底部(平滑滚动)
|
|
123
|
+
const scrollToBottom = () => {
|
|
124
|
+
nextTick(() => {
|
|
125
|
+
if (scrollContainer.value) {
|
|
126
|
+
scrollContainer.value.scrollTo({
|
|
127
|
+
top: scrollContainer.value.scrollHeight,
|
|
128
|
+
behavior: 'smooth',
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ---------- 导出工具函数 ----------
|
|
135
|
+
const isExporting = ref(false)
|
|
136
|
+
|
|
137
|
+
const waitForFullDisplay = async () => {
|
|
138
|
+
if (activeIndex.value < displaySequence.value.length) {
|
|
139
|
+
activeIndex.value = displaySequence.value.length
|
|
140
|
+
await nextTick()
|
|
141
|
+
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const exportToPDF = async (containerId: string, filename: string) => {
|
|
146
|
+
const element = document.getElementById(containerId)
|
|
147
|
+
if (!element) return
|
|
148
|
+
try {
|
|
149
|
+
isExporting.value = true
|
|
150
|
+
await waitForFullDisplay()
|
|
151
|
+
const cursor = document.querySelector('.animate-pulse')
|
|
152
|
+
if (cursor) (cursor as HTMLElement).style.display = 'none'
|
|
153
|
+
|
|
154
|
+
const canvas = await html2canvas(element, {
|
|
155
|
+
scale: 3,
|
|
156
|
+
backgroundColor: '#ffffff',
|
|
157
|
+
useCORS: true,
|
|
158
|
+
logging: false,
|
|
159
|
+
windowWidth: element.scrollWidth,
|
|
160
|
+
windowHeight: element.scrollHeight,
|
|
161
|
+
onclone: (clonedDoc, _element) => {
|
|
162
|
+
const charts = clonedDoc.querySelectorAll('.echarts-container')
|
|
163
|
+
charts.forEach((chart: any) => {
|
|
164
|
+
chart.style.height = '400px'
|
|
165
|
+
})
|
|
166
|
+
},
|
|
167
|
+
})
|
|
168
|
+
const imgData = canvas.toDataURL('image/png')
|
|
169
|
+
const pdf = new jsPDF('p', 'mm', 'a4')
|
|
170
|
+
const imgWidth = 210
|
|
171
|
+
const pageHeight = 297
|
|
172
|
+
const imgHeight = (canvas.height * imgWidth) / canvas.width
|
|
173
|
+
let heightLeft = imgHeight
|
|
174
|
+
let position = 0
|
|
175
|
+
pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)
|
|
176
|
+
heightLeft -= pageHeight
|
|
177
|
+
while (heightLeft > 0) {
|
|
178
|
+
position = heightLeft - imgHeight
|
|
179
|
+
pdf.addPage()
|
|
180
|
+
pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)
|
|
181
|
+
heightLeft -= pageHeight
|
|
182
|
+
}
|
|
183
|
+
pdf.save(`${filename}.pdf`)
|
|
184
|
+
if (cursor) (cursor as HTMLElement).style.display = ''
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error('PDF导出失败:', error)
|
|
187
|
+
alert('PDF导出失败,请重试')
|
|
188
|
+
} finally {
|
|
189
|
+
isExporting.value = false
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const exportToWord = async (containerId: string, filename: string) => {
|
|
194
|
+
const element = document.getElementById(containerId)
|
|
195
|
+
if (!element) return
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
isExporting.value = true
|
|
199
|
+
await waitForFullDisplay()
|
|
200
|
+
|
|
201
|
+
const cloneContainer = element.cloneNode(true) as HTMLElement
|
|
202
|
+
const chartDivs = cloneContainer.querySelectorAll('.echarts-container')
|
|
203
|
+
const originalCharts = element.querySelectorAll('.echarts-container canvas')
|
|
204
|
+
|
|
205
|
+
chartDivs.forEach((div, index) => {
|
|
206
|
+
const canvas = originalCharts[index] as HTMLCanvasElement
|
|
207
|
+
if (canvas) {
|
|
208
|
+
const img = document.createElement('img')
|
|
209
|
+
img.src = canvas.toDataURL('image/png')
|
|
210
|
+
img.width = 600
|
|
211
|
+
div.innerHTML = ''
|
|
212
|
+
div.appendChild(img)
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
const allElements = cloneContainer.querySelectorAll('*')
|
|
217
|
+
allElements.forEach((el) => {
|
|
218
|
+
const htmlEl = el as HTMLElement
|
|
219
|
+
const style = window.getComputedStyle(el)
|
|
220
|
+
htmlEl.style.color = style.color
|
|
221
|
+
htmlEl.style.fontSize = style.fontSize
|
|
222
|
+
htmlEl.style.fontFamily = style.fontFamily
|
|
223
|
+
htmlEl.style.fontWeight = style.fontWeight
|
|
224
|
+
htmlEl.style.backgroundColor = style.backgroundColor
|
|
225
|
+
if (htmlEl.tagName === 'TABLE') {
|
|
226
|
+
htmlEl.style.borderCollapse = 'collapse'
|
|
227
|
+
htmlEl.style.width = '100%'
|
|
228
|
+
}
|
|
229
|
+
if (htmlEl.tagName === 'TD' || htmlEl.tagName === 'TH') {
|
|
230
|
+
htmlEl.style.border = '1px solid #dee2e6'
|
|
231
|
+
htmlEl.style.padding = '8px'
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
cloneContainer.querySelectorAll('.no-print, .animate-pulse').forEach((el) => el.remove())
|
|
236
|
+
|
|
237
|
+
const contentHtml = cloneContainer.innerHTML
|
|
238
|
+
const fullHtml = `
|
|
239
|
+
<!DOCTYPE html>
|
|
240
|
+
<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'>
|
|
241
|
+
<head>
|
|
242
|
+
<meta charset="utf-8">
|
|
243
|
+
<style>
|
|
244
|
+
@page {
|
|
245
|
+
size: 21cm 29.7cm;
|
|
246
|
+
margin: 2cm;
|
|
247
|
+
}
|
|
248
|
+
body {
|
|
249
|
+
font-family: "Microsoft YaHei", "SimSun", sans-serif;
|
|
250
|
+
}
|
|
251
|
+
.text-paragraph { margin-bottom: 15pt; line-height: 1.5; }
|
|
252
|
+
</style>
|
|
253
|
+
</head>
|
|
254
|
+
<body>
|
|
255
|
+
${contentHtml}
|
|
256
|
+
</body>
|
|
257
|
+
</html>
|
|
258
|
+
`
|
|
259
|
+
|
|
260
|
+
const blob = await asBlob(fullHtml, {
|
|
261
|
+
orientation: 'portrait',
|
|
262
|
+
margins: { top: 720, right: 720, bottom: 720, left: 720 },
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
saveAs(blob as Blob, `${filename}.docx`)
|
|
266
|
+
} catch (error) {
|
|
267
|
+
console.error('Word 导出失败:', error)
|
|
268
|
+
alert('Word 导出失败,请检查浏览器控制台')
|
|
269
|
+
} finally {
|
|
270
|
+
isExporting.value = false
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const handleExportPDF = () => exportToPDF('report-container', '图文报告_房地产整合')
|
|
275
|
+
const handleExportWord = () => exportToWord('report-container', '图文报告_房地产整合')
|
|
276
|
+
const handlePrint = () => window.print()
|
|
277
|
+
|
|
278
|
+
// ---------- 报告文本 ----------
|
|
279
|
+
const rawReport = `2024年香港房地產市場整體呈現「價跌量穩、租金偏強、商業不振」的分化局面,全年各類物業價格普遍下調,但成交及租賃需求在政策放寬和人口流入支持下較前兩年有所改善。住宅方面,撤銷所有樓市「辣招」、放寬按揭成數及利率見頂後回落,帶動一手主導的成交回升,但無礙樓價全年再跌約中個百分比,反映經濟及供應壓力仍然主導價格走勢。
|
|
280
|
+
|
|
281
|
+
在住宅市場,本年特點包括:
|
|
282
|
+
一、銷售量回升、價格續調:2024年在全面撤辣及按揭寬鬆後,全年住宅買賣宗數按年錄得逾兩成增長,但全年樓價仍錄得約6%至7%的跌幅,延續過去兩年的調整趨勢。
|
|
283
|
+
二、供應顯著增加:私樓落成量約2.4萬個單位,較2023年大幅增加約七成,主要為中小型單位,為後市價格帶來持續壓力。
|
|
284
|
+
三、租金走勢優於樓價:在人口及人才計劃帶動下,住宅租金全年錄得中低個位升幅,租金指數距歷史高位僅約數個百分點,令小型單位的平均回報率升至近十多年高位水平。
|
|
285
|
+
|
|
286
|
+
在非住宅方面,2024年為商廈及舖位市場的「谷底年」,寫字樓空置率創逾十年新高,商業成交金額及宗數均跌至有紀錄以來低位。
|
|
287
|
+
|
|
288
|
+
下半部分额外内容:以下是按钮组与折柱图展示区。`
|
|
289
|
+
|
|
290
|
+
const rawParagraphs = rawReport.split(/\n\s*\n/).filter((p) => p.trim().length > 0)
|
|
291
|
+
const [para1 = '', para2 = '', para3 = '', paraExtra] = rawParagraphs
|
|
292
|
+
|
|
293
|
+
// ---------- 组件定义(markRaw) ----------
|
|
294
|
+
const ElStatusTable = markRaw(
|
|
295
|
+
defineComponent({
|
|
296
|
+
name: 'ElStatusTable',
|
|
297
|
+
setup(_, { emit }) {
|
|
298
|
+
const tableData = [
|
|
299
|
+
{
|
|
300
|
+
date: '2016-05-02',
|
|
301
|
+
name: '王小虎',
|
|
302
|
+
address: '上海市普陀区金沙江路1518弄',
|
|
303
|
+
status: 'success',
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
date: '2016-05-04',
|
|
307
|
+
name: '王小虎',
|
|
308
|
+
address: '上海市普陀区金沙江路1518弄',
|
|
309
|
+
status: 'info',
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
date: '2016-05-01',
|
|
313
|
+
name: '王小虎',
|
|
314
|
+
address: '上海市普陀区金沙江路1518弄',
|
|
315
|
+
status: 'warning',
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
date: '2016-05-03',
|
|
319
|
+
name: '王小虎',
|
|
320
|
+
address: '上海市普陀区金沙江路1518弄',
|
|
321
|
+
status: 'danger',
|
|
322
|
+
},
|
|
323
|
+
]
|
|
324
|
+
const rowClassName = ({ row }: { row: any }) => {
|
|
325
|
+
if (row.status === 'success') return 'success-row'
|
|
326
|
+
if (row.status === 'info') return 'info-row'
|
|
327
|
+
if (row.status === 'warning') return 'warning-row'
|
|
328
|
+
if (row.status === 'danger') return 'danger-row'
|
|
329
|
+
return ''
|
|
330
|
+
}
|
|
331
|
+
onMounted(() => emit('ready'))
|
|
332
|
+
return () =>
|
|
333
|
+
h(
|
|
334
|
+
ElTable,
|
|
335
|
+
{
|
|
336
|
+
data: tableData,
|
|
337
|
+
style: { width: '100%' },
|
|
338
|
+
rowClassName,
|
|
339
|
+
border: true,
|
|
340
|
+
},
|
|
341
|
+
() => [
|
|
342
|
+
h(ElTableColumn, { prop: 'date', label: '日期', width: '120' }),
|
|
343
|
+
h(ElTableColumn, { prop: 'name', label: '姓名', width: '100' }),
|
|
344
|
+
h(ElTableColumn, { prop: 'address', label: '地址' }),
|
|
345
|
+
h(
|
|
346
|
+
ElTableColumn,
|
|
347
|
+
{ label: '状态', width: '100' },
|
|
348
|
+
{
|
|
349
|
+
default: ({ row }: any) => {
|
|
350
|
+
let type: 'success' | 'info' | 'warning' | 'danger' = 'success'
|
|
351
|
+
if (row.status === 'info') type = 'info'
|
|
352
|
+
if (row.status === 'warning') type = 'warning'
|
|
353
|
+
if (row.status === 'danger') type = 'danger'
|
|
354
|
+
return h(ElButton, { size: 'small', type, plain: true }, () => row.status)
|
|
355
|
+
},
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
]
|
|
359
|
+
)
|
|
360
|
+
},
|
|
361
|
+
})
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
const ButtonGroup = markRaw(
|
|
365
|
+
defineComponent({
|
|
366
|
+
setup(_, { emit }) {
|
|
367
|
+
onMounted(() => emit('ready'))
|
|
368
|
+
return () =>
|
|
369
|
+
h('div', { class: 'flex flex-wrap gap-3 my-2' }, [
|
|
370
|
+
h(ElButton, { type: 'primary' }, () => '主要按钮'),
|
|
371
|
+
h(ElButton, { type: 'success' }, () => '成功按钮'),
|
|
372
|
+
h(ElButton, { type: 'info' }, () => '信息按钮'),
|
|
373
|
+
h(ElButton, { type: 'warning' }, () => '警告按钮'),
|
|
374
|
+
h(ElButton, { type: 'danger' }, () => '危险按钮'),
|
|
375
|
+
h(ElButton, {}, () => '默认按钮'),
|
|
376
|
+
h(ElButton, { round: true }, () => '圆角按钮'),
|
|
377
|
+
])
|
|
378
|
+
},
|
|
379
|
+
})
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
const IconShowcase = markRaw(
|
|
383
|
+
defineComponent({
|
|
384
|
+
setup(_, { emit }) {
|
|
385
|
+
onMounted(() => emit('ready'))
|
|
386
|
+
return () =>
|
|
387
|
+
h('div', { class: 'flex gap-4 items-center py-3 border-y border-gray-100' }, [
|
|
388
|
+
h(ElIcon, { size: 24, color: '#409EFF' }, () => h(Platform)),
|
|
389
|
+
h(ElIcon, { size: 24, color: '#67C23A' }, () => h(Eleme)),
|
|
390
|
+
h(ElIcon, { size: 24, color: '#F56C6C' }, () => h(DeleteFilled)),
|
|
391
|
+
h(ElIcon, { size: 24, color: '#E6A23C' }, () => h(Delete)),
|
|
392
|
+
h(
|
|
393
|
+
'span',
|
|
394
|
+
{ class: 'text-sm text-gray-500 ml-2' },
|
|
395
|
+
'el-icon-platform-eleme / eleme / delete-filled / delete'
|
|
396
|
+
),
|
|
397
|
+
])
|
|
398
|
+
},
|
|
399
|
+
})
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
const EChartsMixed = markRaw(
|
|
403
|
+
defineComponent({
|
|
404
|
+
name: 'EChartsMixed',
|
|
405
|
+
setup(_, { emit }) {
|
|
406
|
+
const chartRef = ref<HTMLDivElement | null>(null)
|
|
407
|
+
let chartInstance: echarts.ECharts | null = null
|
|
408
|
+
const initChart = () => {
|
|
409
|
+
if (!chartRef.value) return
|
|
410
|
+
chartInstance = echarts.init(chartRef.value)
|
|
411
|
+
const option = {
|
|
412
|
+
tooltip: {
|
|
413
|
+
trigger: 'axis',
|
|
414
|
+
axisPointer: { type: 'cross', crossStyle: { color: '#999' } },
|
|
415
|
+
},
|
|
416
|
+
toolbox: {
|
|
417
|
+
feature: {
|
|
418
|
+
dataView: { show: true, readOnly: false },
|
|
419
|
+
magicType: { show: true, type: ['line', 'bar'] },
|
|
420
|
+
restore: { show: true },
|
|
421
|
+
saveAsImage: { show: true },
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
legend: { data: ['Evaporation', 'Precipitation', 'Temperature'] },
|
|
425
|
+
xAxis: [
|
|
426
|
+
{
|
|
427
|
+
type: 'category',
|
|
428
|
+
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
429
|
+
axisPointer: { type: 'shadow' },
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
yAxis: [
|
|
433
|
+
{
|
|
434
|
+
type: 'value',
|
|
435
|
+
name: 'Precipitation',
|
|
436
|
+
min: 0,
|
|
437
|
+
max: 250,
|
|
438
|
+
interval: 50,
|
|
439
|
+
axisLabel: { formatter: '{value} ml' },
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
type: 'value',
|
|
443
|
+
name: 'Temperature',
|
|
444
|
+
min: 0,
|
|
445
|
+
max: 25,
|
|
446
|
+
interval: 5,
|
|
447
|
+
axisLabel: { formatter: '{value} °C' },
|
|
448
|
+
},
|
|
449
|
+
],
|
|
450
|
+
series: [
|
|
451
|
+
{
|
|
452
|
+
name: 'Evaporation',
|
|
453
|
+
type: 'bar',
|
|
454
|
+
tooltip: { valueFormatter: (value: any) => value + ' ml' },
|
|
455
|
+
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6],
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: 'Precipitation',
|
|
459
|
+
type: 'bar',
|
|
460
|
+
tooltip: { valueFormatter: (value: any) => value + ' ml' },
|
|
461
|
+
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6],
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: 'Temperature',
|
|
465
|
+
type: 'line',
|
|
466
|
+
yAxisIndex: 1,
|
|
467
|
+
tooltip: { valueFormatter: (value: any) => value + ' °C' },
|
|
468
|
+
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3],
|
|
469
|
+
},
|
|
470
|
+
],
|
|
471
|
+
}
|
|
472
|
+
chartInstance.setOption(option)
|
|
473
|
+
window.addEventListener('resize', () => chartInstance?.resize())
|
|
474
|
+
emit('ready')
|
|
475
|
+
}
|
|
476
|
+
onMounted(() => {
|
|
477
|
+
nextTick(() => initChart())
|
|
478
|
+
})
|
|
479
|
+
onUnmounted(() => {
|
|
480
|
+
chartInstance?.dispose()
|
|
481
|
+
})
|
|
482
|
+
return () =>
|
|
483
|
+
h('div', {
|
|
484
|
+
ref: chartRef,
|
|
485
|
+
style: { width: '100%', height: '400px' },
|
|
486
|
+
class: 'echarts-container',
|
|
487
|
+
})
|
|
488
|
+
},
|
|
489
|
+
})
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
// ---------- 显示序列 ----------
|
|
493
|
+
type DisplayItem = { type: 'text'; content: string } | { type: 'component'; component: Component }
|
|
494
|
+
|
|
495
|
+
const displaySequence = ref<DisplayItem[]>([
|
|
496
|
+
{ type: 'text', content: para1 },
|
|
497
|
+
{ type: 'component', component: ElStatusTable },
|
|
498
|
+
{ type: 'text', content: '📌 带状态表格(高亮区分成功/信息/警告/危险)' },
|
|
499
|
+
{ type: 'text', content: para2 },
|
|
500
|
+
{ type: 'component', component: ButtonGroup },
|
|
501
|
+
{ type: 'component', component: IconShowcase },
|
|
502
|
+
{ type: 'text', content: para3 },
|
|
503
|
+
{
|
|
504
|
+
type: 'text',
|
|
505
|
+
content: paraExtra || '📊 下半部分:按钮组与折柱图详细数据展示',
|
|
506
|
+
},
|
|
507
|
+
{ type: 'component', component: ButtonGroup },
|
|
508
|
+
{ type: 'component', component: EChartsMixed },
|
|
509
|
+
{ type: 'text', content: '✅ 以上为完整报告,包含上下两部分全部内容。' },
|
|
510
|
+
])
|
|
511
|
+
|
|
512
|
+
// ---------- 顺序控制 ----------
|
|
513
|
+
const activeIndex = ref(0)
|
|
514
|
+
const lastStartedTextIndex = ref(-1)
|
|
515
|
+
|
|
516
|
+
const nextItem = () => {
|
|
517
|
+
if (activeIndex.value < displaySequence.value.length) {
|
|
518
|
+
activeIndex.value++
|
|
519
|
+
const newItem = displaySequence.value[activeIndex.value - 1]
|
|
520
|
+
if (!newItem) return
|
|
521
|
+
if (newItem.type === 'text') {
|
|
522
|
+
lastStartedTextIndex.value = activeIndex.value - 1
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
scrollToBottom()
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const onTextCompleted = () => nextItem()
|
|
529
|
+
const onComponentReady = () => nextItem()
|
|
530
|
+
|
|
531
|
+
const startSequence = () => {
|
|
532
|
+
if (displaySequence.value.length === 0) return
|
|
533
|
+
activeIndex.value = 1
|
|
534
|
+
const firstItem = displaySequence.value[0]
|
|
535
|
+
if (firstItem?.type === 'text') lastStartedTextIndex.value = 0
|
|
536
|
+
scrollToBottom()
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const restartDemo = () => {
|
|
540
|
+
activeIndex.value = 0
|
|
541
|
+
lastStartedTextIndex.value = -1
|
|
542
|
+
nextTick(() => startSequence())
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
onMounted(() => startSequence())
|
|
546
|
+
|
|
547
|
+
// ---------- 打字机组件(增强:每打字一个字符都触发滚动) ----------
|
|
548
|
+
const TypewriterText = defineComponent({
|
|
549
|
+
name: 'TypewriterText',
|
|
550
|
+
props: {
|
|
551
|
+
text: { type: String, required: true },
|
|
552
|
+
autoStart: { type: Boolean, default: false },
|
|
553
|
+
},
|
|
554
|
+
emits: ['completed', 'typing'],
|
|
555
|
+
setup(props, { emit }) {
|
|
556
|
+
const displayed = ref('')
|
|
557
|
+
let interval: number | null = null
|
|
558
|
+
let isStarted = false
|
|
559
|
+
|
|
560
|
+
const startTyping = () => {
|
|
561
|
+
if (isStarted) return
|
|
562
|
+
isStarted = true
|
|
563
|
+
displayed.value = ''
|
|
564
|
+
let i = 0
|
|
565
|
+
interval = window.setInterval(() => {
|
|
566
|
+
if (i < props.text.length) {
|
|
567
|
+
displayed.value += props.text[i]
|
|
568
|
+
i++
|
|
569
|
+
emit('typing') // 每打一个字符触发滚动
|
|
570
|
+
} else {
|
|
571
|
+
if (interval) clearInterval(interval)
|
|
572
|
+
interval = null
|
|
573
|
+
emit('completed')
|
|
574
|
+
}
|
|
575
|
+
}, 28)
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (props.autoStart) startTyping()
|
|
579
|
+
|
|
580
|
+
return () => h('div', { class: 'typewriter-text' }, displayed.value)
|
|
581
|
+
},
|
|
582
|
+
})
|
|
583
|
+
</script>
|
|
584
|
+
|
|
585
|
+
<style scoped>
|
|
586
|
+
:deep(.el-table .success-row) {
|
|
587
|
+
background-color: #f0f9eb;
|
|
588
|
+
}
|
|
589
|
+
:deep(.el-table .info-row) {
|
|
590
|
+
background-color: #e6f7ff;
|
|
591
|
+
}
|
|
592
|
+
:deep(.el-table .warning-row) {
|
|
593
|
+
background-color: #fdf6ec;
|
|
594
|
+
}
|
|
595
|
+
:deep(.el-table .danger-row) {
|
|
596
|
+
background-color: #fef0f0;
|
|
597
|
+
}
|
|
598
|
+
.text-paragraph {
|
|
599
|
+
line-height: 1.8;
|
|
600
|
+
font-size: 15px;
|
|
601
|
+
letter-spacing: 0.01em;
|
|
602
|
+
color: #374151;
|
|
603
|
+
margin-bottom: 1rem;
|
|
604
|
+
white-space: pre-wrap;
|
|
605
|
+
}
|
|
606
|
+
.typewriter-text {
|
|
607
|
+
white-space: pre-wrap;
|
|
608
|
+
}
|
|
609
|
+
@media print {
|
|
610
|
+
.no-print {
|
|
611
|
+
display: none !important;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
/* 针对滚动容器 */
|
|
615
|
+
.prose.prose-slate.max-w-none::-webkit-scrollbar {
|
|
616
|
+
width: 8px; /* 垂直滚动条宽度 */
|
|
617
|
+
height: 8px; /* 水平滚动条高度(如有需要) */
|
|
618
|
+
display: none;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.prose.prose-slate.max-w-none::-webkit-scrollbar-track {
|
|
622
|
+
background: #f1f1f1;
|
|
623
|
+
border-radius: 10px;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.prose.prose-slate.max-w-none::-webkit-scrollbar-thumb {
|
|
627
|
+
background: #c1c1c1;
|
|
628
|
+
border-radius: 10px;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.prose.prose-slate.max-w-none::-webkit-scrollbar-thumb:hover {
|
|
632
|
+
background: #a8a8a8;
|
|
633
|
+
}
|
|
634
|
+
</style>
|