Quellcode durchsuchen

完善知识库详情页界面

愿你天天开心 vor 1 Jahr
Ursprung
Commit
27994613c3
2 geänderte Dateien mit 91 neuen und 38 gelöschten Zeilen
  1. 5 4
      src/types/components.d.ts
  2. 86 34
      src/views/knowledge/knowledge-management/detail.vue

+ 5 - 4
src/types/components.d.ts

@@ -21,6 +21,7 @@ declare module 'vue' {
     ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
     ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
     ElButton: typeof import('element-plus/es')['ElButton']
+    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElCol: typeof import('element-plus/es')['ElCol']
     ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
@@ -37,34 +38,34 @@ declare module 'vue' {
     ElIcon: typeof import('element-plus/es')['ElIcon']
     ElInput: typeof import('element-plus/es')['ElInput']
     ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
+    ElLink: typeof import('element-plus/es')['ElLink']
     ElMenu: typeof import('element-plus/es')['ElMenu']
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElPagination: typeof import('element-plus/es')['ElPagination']
     ElPopover: typeof import('element-plus/es')['ElPopover']
+    ElProgress: typeof import('element-plus/es')['ElProgress']
     ElRadio: typeof import('element-plus/es')['ElRadio']
     ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
     ElRow: typeof import('element-plus/es')['ElRow']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElSelect: typeof import('element-plus/es')['ElSelect']
-    ElStep: typeof import('element-plus/es')['ElStep']
-    ElSteps: typeof import('element-plus/es')['ElSteps']
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElSwitch: typeof import('element-plus/es')['ElSwitch']
     ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     ElTag: typeof import('element-plus/es')['ElTag']
-    ElTimeline: typeof import('element-plus/es')['ElTimeline']
-    ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
     ElTree: typeof import('element-plus/es')['ElTree']
     ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
+    ElUpload: typeof import('element-plus/es')['ElUpload']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
     Hamburger: typeof import('./../components/Hamburger/index.vue')['default']
     HeaderSearch: typeof import('./../components/HeaderSearch/index.vue')['default']
     IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
     IEpCaretBottom: typeof import('~icons/ep/caret-bottom')['default']
     IEpCaretTop: typeof import('~icons/ep/caret-top')['default']
+    IEpUploadFilled: typeof import('~icons/ep/upload-filled')['default']
     IFrame: typeof import('./../components/iFrame/index.vue')['default']
     ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
     ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']

+ 86 - 34
src/views/knowledge/knowledge-management/detail.vue

@@ -14,23 +14,44 @@
     <div class="basic-info">
       <strong>基本信息</strong>
       <el-row>
-        <el-col :span="8">报告编号:{{ report.reportId }}</el-col>
-        <el-col :span="8">主题词:{{ report.keyword }}</el-col>
-        <el-col :span="8">事件类型:{{ report.eventType }}</el-col>
+        <el-col :span="8">
+          <span class="label">报告编号:</span>
+          <span class="value">{{ report.reportId }}</span>
+        </el-col>
+        <el-col :span="8">
+          <span class="label">主题词:</span>
+          <span class="value">{{ report.subject }}</span>
+        </el-col>
+        <el-col :span="8" style="display: flex; align-items: center;">
+          <span class="label">事件类型:</span>
+          <dict-tag class="value" :options="mm_event_type" :value="report.eventType" style="margin-left: 8px;" />
+        </el-col>
       </el-row>
       <el-row>
-        <el-col :span="8">发布日期:{{ report.publishDate }}</el-col>
-        <el-col :span="8">来源单位:{{ report.sourceUnit }}</el-col>
-        <el-col :span="8">通知类型:{{ report.notificationType }}</el-col>
+        <el-col :span="8">
+          <span class="label">发布日期:</span>
+          <span class="value">{{ report.publishDate }}</span>
+        </el-col>
+        <el-col :span="8">
+          <span class="label">来源单位:</span>
+          <span class="value">{{ report.sourceUnit }}</span>
+        </el-col>
+        <el-col :span="8">
+          <span class="label">通知类型:</span>
+          <span class="value">{{ report.notificationType }}</span>
+        </el-col>
       </el-row>
       <el-row>
-        <el-col :span="24">摘要:{{ report.summary }}</el-col>
+        <el-col :span="24">
+          <span class="label">摘要:</span>
+          <span class="value">{{ report.summary }}</span>
+        </el-col>
       </el-row>
     </div>
     <div class="attachments">
       <strong>报告附件:</strong>
     </div>
-    <el-link :href="report.attachmentUrl" target="_blank">{{ report.attachmentName }}</el-link>
+    <el-link :href="report.attachmentUrl" target="_blank" class="value">{{ report.attachmentName }}</el-link>
   </div>
 </template>
 
@@ -39,11 +60,12 @@ import { ref, onMounted } from 'vue';
 import { useRoute, useRouter } from 'vue-router';
 import { ElMessageBox, ElMessage } from 'element-plus';
 import { fetchReportDetail } from '@/api/kenowledge/index';
+import { getDicts } from "@/api/system/dict/data/index";
 
 const report = ref({
   reportId: '',
   title: '',
-  keyword: '',
+  subject: '',
   eventType: '',
   publishDate: '',
   sourceUnit: '',
@@ -56,13 +78,14 @@ const report = ref({
 const route = useRoute();
 const router = useRouter();
 
+// 初始化事件类型字典
+const mm_event_type = ref([]);
+
 // 返回上一级
 const goBack = () => {
   router.go(-1);
 };
 
-
-
 const handleEdit = () => {
   ElMessageBox.prompt('编辑报告', '提示', {
     confirmButtonText: '确定',
@@ -101,30 +124,46 @@ const handleDelete = () => {
   });
 };
 
-onMounted(() => {
-  const reportId = route.query.reportID;
-  fetchReportDetail(reportId)
-    .then(response => {
-      const data = response.data[0]; // 假设 data 是一个数组,取第一个元素
-      report.value = {
-        reportId: data.report_id, // 将 report_id 映射到 reportId
-        title: data.reportName, // 将 reportName 映射到 title
-        keyword: '',
-        eventType: data.eventType, // 保持不变
-        publishDate: data.publishDate, // 保持不变
-        sourceUnit: data.publishingUnit,
-        notificationType: data.notificationType,
-        summary: data.summary,
-        attachmentName: data.file.length > 0 ? data.file[0].name : '',
-        attachmentUrl: data.file.length > 0 ? data.file[0].url : ''
-      };
-    })
-    .catch(error => {
-      ElMessage.error('获取报告详情失败');
-      console.error(error);
-    });
-});
+onMounted(async () => {
+  try {
+    const dictResponse = await getDicts('mm_event_type');
+
+    // 格式化字典数据
+    mm_event_type.value = dictResponse.data.map(item => ({
+      label: item.dictLabel,
+      value: item.dictValue,
+    }));
+
+    const reportId = route.query.reportID;
+    const response = await fetchReportDetail(reportId);
+    const data = response.data[0];
+
+    const publishDate = new Date(data.publishDate).toLocaleString('zh-CN', {
+      year: 'numeric',
+      month: '2-digit',
+      day: '2-digit',
+      hour: '2-digit',
+      minute: '2-digit',
+      second: '2-digit',
+    }).replace(/\//g, '-');
 
+    report.value = {
+      reportId: data.report_id,
+      title: data.reportName,
+      subject: data.subject,
+      eventType: data.eventType,
+      publishDate: publishDate,
+      sourceUnit: data.publishingUnit,
+      notificationType: data.notificationType,
+      summary: data.summary,
+      attachmentName: data.file.length > 0 ? data.file[0].name : '',
+      attachmentUrl: data.file.length > 0 ? data.file[0].url : ''
+    };
+  } catch (error) {
+    ElMessage.error('获取报告详情或字典数据失败');
+    console.error(error);
+  }
+});
 </script>
 
 <style scoped>
@@ -140,4 +179,17 @@ onMounted(() => {
 .attachments {
   margin-bottom: 20px;
 }
+
+.label {
+  font-weight: bold; /* 保持标签加粗 */
+}
+
+.value {
+  font-weight: normal; /* 去除后端数据的加粗 */
+  color: #333; /* 可选:更改字体颜色 */
+}
+
+.el-divider {
+  margin-top: 1px;
+}
 </style>