|
|
@@ -8,7 +8,7 @@ import ReportField from "./components/report-create/ReportField.vue"
|
|
|
import DynamicMeta from './components/dynamic-meta/DynamicMeta.vue';
|
|
|
import ChapterTypeSelect from "./components/ChapterTypeSelect.vue";
|
|
|
import LogoComponent from "./components/LogoComponent.vue";
|
|
|
-import type { Chapter, ChapterType, ReportMetadataItem, ReportSaveRequest, ReportTemplateSave } from "@/types/report.types";
|
|
|
+import type { Chapter, ChapterType, ReportMetadataItem, ReportSaveRequest, ReportTemplateSave, DuplicateCheckRequest, ReportChapterRequest } from "@/types/report.types";
|
|
|
import { ChapterManager } from "@/models/report.model";
|
|
|
import ChapterEditor from "./components/ChapterEditor.vue";
|
|
|
import * as reportService from "@/services/report.service";
|
|
|
@@ -32,12 +32,18 @@ const reportExport = useReportExport()
|
|
|
// 权限store
|
|
|
const authStore = useAuthStore()
|
|
|
|
|
|
+const chapterEditors = ref<any | null>([])
|
|
|
+
|
|
|
const report: Ref<ReportSaveRequest | null> = ref(null);
|
|
|
const relationCompanyEl = ref<HTMLInputElement | null>(null);
|
|
|
const reportCategoryEl = ref<HTMLInputElement | null>(null);
|
|
|
const reportNameEl = ref<HTMLInputElement | null>(null);
|
|
|
const supervisorEl = ref<HTMLInputElement | null>(null);
|
|
|
const keywordsEl = ref<HTMLInputElement | null>(null);
|
|
|
+const duplicateCheckRequest: Ref<DuplicateCheckRequest> = ref({
|
|
|
+ reportId: "",
|
|
|
+ contents: []
|
|
|
+});
|
|
|
|
|
|
// 报告元数据
|
|
|
const metadata: Ref<ReportMetadataItem[]> = ref([]);
|
|
|
@@ -236,6 +242,33 @@ function getStatus(){
|
|
|
reportStatus.value = reportStatus.value == 0 ? 1 : 0;
|
|
|
}
|
|
|
|
|
|
+function duplicateCheck() {
|
|
|
+ if (report.value) {
|
|
|
+ extract(report.value.chapters, report.value.id +"")
|
|
|
+ }
|
|
|
+ if (duplicateCheckRequest?.value) {
|
|
|
+ reportService.duplicateCheck(duplicateCheckRequest.value).then((data: any) => {
|
|
|
+ let index = 0;
|
|
|
+ for (let item of data.totals) {
|
|
|
+ console.log(item)
|
|
|
+ if (item && item > 0) {
|
|
|
+ chapterEditors.value[index]?.pointer();
|
|
|
+ }
|
|
|
+ index += 1;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function extract(chapters: ReportChapterRequest[], id: string) {
|
|
|
+ for (var i = 0; i < chapters.length; i ++) {
|
|
|
+ duplicateCheckRequest.value?.contents.push(chapters[i].content)
|
|
|
+ }
|
|
|
+ if (duplicateCheckRequest?.value) {
|
|
|
+ duplicateCheckRequest.value.reportId = id;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
const id = parseInt(route.params.id as string);
|
|
|
if (id && id > 0) {
|
|
|
@@ -286,6 +319,7 @@ onUnmounted(() => {
|
|
|
v-for="(item, index) in chapterManager.getChapters()"
|
|
|
:key="index"
|
|
|
:data="item"
|
|
|
+ ref="chapterEditors"
|
|
|
:reportKeywords="report.keywords"
|
|
|
@change="onChapterChange(index, $event)"
|
|
|
@move-up="onChapterMoveUp(index)"
|
|
|
@@ -309,6 +343,7 @@ onUnmounted(() => {
|
|
|
<a-button @click="onPreview">预览</a-button>
|
|
|
<a-button @click="onExport" :loading="exporting">导出</a-button>
|
|
|
<a-button @click="showTemplateSaveModal">另保存为模板</a-button>
|
|
|
+ <a-button @click="duplicateCheck">查重</a-button>
|
|
|
</a-space>
|
|
|
</div>
|
|
|
<ChapterTypeSelect @ok="onChapterTypeSelected" v-model:visible="chapterTypeSelectVisible" />
|