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