|
|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, type Ref } from "vue";
|
|
|
+import { ref, onMounted, type Ref } from "vue";
|
|
|
import { PlusOutlined } from "@ant-design/icons-vue";
|
|
|
import PageHeader from '@/components/PageHeader.vue';
|
|
|
import RelationCompanyInput from './components/report-create/RelationCompanyInput.vue';
|
|
|
@@ -7,24 +7,27 @@ import ReportCategory from './components/report-create/ReportCategory.vue';
|
|
|
import DynamicMeta from './components/dynamic-meta/DynamicMeta.vue';
|
|
|
import ChapterTypeSelect from "./components/ChapterTypeSelect.vue";
|
|
|
import LogoComponent from "./components/LogoComponent.vue";
|
|
|
-import type { ChapterType } from "@/types/report.types";
|
|
|
+import type { Chapter, ChapterType } from "@/types/report.types";
|
|
|
import { ChapterManager } from "@/models/report.model";
|
|
|
-import ContentEditor from "./components/ContentEditor.vue";
|
|
|
+import ChapterEditor from "./components/ChapterEditor.vue";
|
|
|
|
|
|
+// 报告元数据
|
|
|
const metadata: Ref<any[]> = ref([]);
|
|
|
+// 章节类型选择器可见状态
|
|
|
+const chapterTypeSelectVisible = ref(false);
|
|
|
+// 章节管理对象
|
|
|
+const chapterManager = ref(new ChapterManager());
|
|
|
|
|
|
function onMetaChange(data: any[]) {
|
|
|
metadata.value = data;
|
|
|
- console.log('metadata', metadata.value);
|
|
|
}
|
|
|
|
|
|
-const chapterTypeSelectVisible = ref(false);
|
|
|
-
|
|
|
-const chapterManager = ref(new ChapterManager());
|
|
|
-
|
|
|
function onChapterTypeSelected(type: ChapterType) {
|
|
|
chapterManager.value.addChapter(type);
|
|
|
- console.log('chapterManager', chapterManager);
|
|
|
+}
|
|
|
+
|
|
|
+function onChapterChange(index: number, data: Chapter) {
|
|
|
+ chapterManager.value.setChapter(index, data);
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
@@ -44,12 +47,12 @@ function onChapterTypeSelected(type: ChapterType) {
|
|
|
</a-row>
|
|
|
<a-divider />
|
|
|
<div class="chapter-wrap">
|
|
|
- <div v-for="(item, index) in chapterManager.getChapters()" :key="index">
|
|
|
- <h1>{{ item.fullTitle }}</h1>
|
|
|
- <p>
|
|
|
- <ContentEditor />
|
|
|
- </p>
|
|
|
- </div>
|
|
|
+ <ChapterEditor
|
|
|
+ v-for="(item, index) in chapterManager.getChapters()"
|
|
|
+ :key="index"
|
|
|
+ :data="item"
|
|
|
+ @change="onChapterChange(index, $event)"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="add-chapter-wrap">
|
|
|
<a-button @click="() => chapterTypeSelectVisible = true">
|