Browse Source

feature 1001695

将关联企业与项目名称保存到报告模板中
Kevin Jiang 2 years ago
parent
commit
d659cdfb42

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

@@ -164,7 +164,9 @@ export interface ReportsResponse {
 
 export interface ReportTemplateSave {
   id?: number;
+  companyId: number;
   name: string;
+  reportName: string;
   logoPath: string;
   metadata: ReportMetadataItem[];
   chapters: Chapter[];

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

@@ -207,7 +207,9 @@ function onSaveTemplate(modalData: ReportTemplateModal) {
     } as Chapter
   })
   const reportTemplateSave: ReportTemplateSave = {
+    companyId: report.value?.companyId || 0,
     name: modalData.templateName,
+    reportName: report.value?.reportName || '',
     logoPath: report.value?.logoPath || '',
     metadata: report.value?.metadata || [],
     chapters: chapters || [],

+ 0 - 6
src/views/report/ReportTemplateView.vue

@@ -1,6 +0,0 @@
-<script setup lang="ts">
-</script>
-
-<template>
-  Template Manage
-</template>

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

@@ -1,37 +0,0 @@
-<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>

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

@@ -1,37 +0,0 @@
-<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>

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

@@ -1,37 +0,0 @@
-<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>

+ 18 - 5
src/views/reportTemplate/ReportTemplateEditorView.vue

@@ -6,7 +6,9 @@ import { CompLog } from "@/libs/log.lib";
 import { ChapterManager } from "@/models/report.model";
 import * as reportTemplateService from "@/services/reportTemplate.service"
 import ReportTemplateName from "./components/ReportTemplateName.vue"
-import ReportTemplateLabel from "./components/ReportTemplateLabel.vue"
+import ReportTemplateLabel from "./components/ReportTemplateTags.vue"
+import RelationCompanyInput from '../report/components/report-create/RelationCompanyInput.vue';
+import ReportField from "../report/components/report-create/ReportField.vue"
 import type { Chapter, ChapterType, ReportMetadataItem, ReportTemplateSave } from "@/types/report.types";
 import { PlusOutlined } from "@ant-design/icons-vue";
 import PageHeader from '@/components/PageHeader.vue';
@@ -79,6 +81,12 @@ function onSave() {
   }
 }
 
+function onCompanyChange(companyId: number) {
+  if (reportTemplate.value) {
+    reportTemplate.value.companyId = companyId;
+  }
+}
+
 onMounted(() => {
   const id = parseInt(route.params.id as string)
   if (id) {
@@ -91,11 +99,13 @@ onMounted(() => {
   <PageHeader title="报告模板编辑" />
   <a-row :gutter="24" v-if="reportTemplate">
     <a-col :span="12">
-      <div class="metadata-wrap">
-        <ReportTemplateName v-model="reportTemplate.name"></ReportTemplateName>
-        <ReportTemplateLabel v-model="reportTemplate.tags"> </ReportTemplateLabel>
+      <a-space class="metadata-wrap" direction="vertical">
+        <ReportTemplateName v-model="reportTemplate.name" />
+        <ReportTemplateLabel v-model="reportTemplate.tags" />
+        <RelationCompanyInput v-model:id="reportTemplate.companyId" @change="onCompanyChange" ref="relationCompanyEl" />
+        <ReportField name="项目名称" v-model="reportTemplate.reportName" />
         <DynamicMeta v-model:data="reportTemplate.metadata" @change="onMetaChange" />
-      </div>
+      </a-space>
     </a-col>
     <a-col :span="12">
       <LogoComponent />
@@ -129,6 +139,9 @@ onMounted(() => {
 </template>
 
 <style scoped lang="scss">
+.metadata-wrap {
+  width: 100%;
+}
 
 .add-chapter-wrap {
   margin-top: 3em;

+ 0 - 43
src/views/reportTemplate/components/ReportTemplateLabel.vue

@@ -1,43 +0,0 @@
-<script setup lang="ts">
-import { ref } from 'vue';
-
-// 此处引入
-const emit = defineEmits(['update:modelValue'])
-
-defineProps({
-	modelValue:{ 
-		type: Array,
-	},
-})
-
-// 数据双向绑定
-const onTagsChange = (info: Array<String>) => {
-  info = info.map((item) => item.trim())
-	emit('update:modelValue', info)
-}
-
-
-</script>
-
-<template>
-    <a-row type="flex" style="align-items: center;margin-top: 0.5em;">
-      <a-col style="width: 120px; text-align: right;">
-        报告模板标签:
-      </a-col>
-      <a-col flex="1">
-        <a-select
-          :value="modelValue"
-          mode="tags"
-          :token-separators="[',', ',', ' ']"
-          @change="onTagsChange"
-          placeholder="模板标签,输入逗号、空格或者回车自动分割"
-        ></a-select>
-      </a-col>
-    </a-row>
-</template>
-
-<style scoped lang="scss">
- .ant-select{
-    width: 100%;
-  }
-</style>

+ 12 - 12
src/views/reportTemplate/components/ReportTemplateName.vue

@@ -21,18 +21,18 @@ defineExpose({
 </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)"
-          ref="input"
-        />
-      </a-col>
-    </a-row>
+  <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)"
+        ref="input"
+      />
+    </a-col>
+  </a-row>
 </template>
 
 <style scoped lang="scss">

+ 39 - 0
src/views/reportTemplate/components/ReportTemplateTags.vue

@@ -0,0 +1,39 @@
+<script setup lang="ts">
+const emits = defineEmits<{
+  (e: 'update:modelValue', tags: string[]): void
+}>()
+
+defineProps({
+	modelValue:{
+		type: Array<String>,
+	},
+})
+
+const onTagsChange = (tags: string[]) => {
+  tags = tags.map((tag: string) => tag.trim())
+	emits('update:modelValue', tags)
+}
+</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-select
+        :value="modelValue"
+        mode="tags"
+        :token-separators="[',', ',', ' ']"
+        @change="onTagsChange"
+        placeholder="模板标签,输入逗号、空格或者回车自动分割"
+      ></a-select>
+    </a-col>
+  </a-row>
+</template>
+
+<style scoped lang="scss">
+.ant-select {
+  width: 100%;
+}
+</style>