Browse Source

merge "feature/1001919" into "main"
feature/1001919

Kevin 2 years ago
parent
commit
52d114d134

+ 1 - 0
src/types/report.types.ts

@@ -144,6 +144,7 @@ export interface ReportBasic {
   name: string;
   logoPath: string;
   keywords: string;
+  reportName: string;
   metadata: ReportMetadataItem[];
   userId: number;
   createAt?: string;

+ 8 - 0
src/views/report/ReportEditorView.vue

@@ -6,6 +6,7 @@ import PageHeader from '@/components/PageHeader.vue';
 import RelationCompanyInput from './components/report-create/RelationCompanyInput.vue';
 import ReportCategory from './components/report-create/ReportCategory.vue';
 import ReportKeywords from './components/report-create/ReportKeywords.vue';
+import ReportName from "./components/report-create/ReportName.vue";
 import DynamicMeta from './components/dynamic-meta/DynamicMeta.vue';
 import ChapterTypeSelect from "./components/ChapterTypeSelect.vue";
 import LogoComponent from "./components/LogoComponent.vue";
@@ -35,6 +36,7 @@ const authStore = useAuthStore()
 
 const report: Ref<ReportSaveRequest | null> = ref(null);
 const reportCategoryEl = ref<HTMLInputElement | null>(null);
+const reportNameEl = ref<HTMLInputElement | null>(null);
 
 // 报告元数据
 const metadata: Ref<ReportMetadataItem[]> = ref([]);
@@ -125,6 +127,11 @@ function onSave() {
       reportCategoryEl.value?.focus();
       return;
     }
+    if ((report.value.reportName || '').trim() == '') {
+      message.warning("请填写报告名字!");
+      reportNameEl.value?.focus();
+      return;
+    }
     saveLoading.value = true;
     reportService.save(report.value).then(() => {
       saveLoading.value = false;
@@ -221,6 +228,7 @@ onUnmounted(() => {
       <div class="metadata-wrap">
         <RelationCompanyInput v-model:id="report.companyId" @change="onCompanyChange" />
         <ReportCategory v-model="report.name" ref="reportCategoryEl" />
+        <ReportName v-model="report.reportName" ref="reportNameEl"/>
         <ReportKeywords v-model="report.keywords" />
         <DynamicMeta v-model:data="report.metadata" @change="onMetaChange" />
       </div>

+ 37 - 0
src/views/report/components/report-create/ReportName.vue

@@ -0,0 +1,37 @@
+<script setup lang="ts">
+import { ref } from "vue";
+
+defineProps({
+  modelValue: String,
+});
+
+const emits = defineEmits<{
+  (e: "update:modelValue", value: string): void;
+}>();
+
+const input = ref<HTMLInputElement | null>(null);
+
+function focus() {
+  input.value?.focus();
+}
+
+defineExpose({
+  focus
+});
+</script>
+
+<template>
+  <a-row type="flex" style="align-items: center">
+    <a-col style="width: 120px; text-align: right;">
+      报告名字:
+    </a-col>
+    <a-col flex="1">
+      <a-input
+        :value="modelValue"
+        @input="emits('update:modelValue', $event.target.value)"
+        placeholder="请输入名称"
+        ref="input"
+      />
+    </a-col>
+  </a-row>
+</template>