|
@@ -38,6 +38,7 @@
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
+import { fetchReportDetail } from '@/api/kenowledge/index';
|
|
|
|
|
|
const report = ref({
|
|
|
reportId: '',
|
|
@@ -55,12 +56,14 @@ const report = ref({
|
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
|
|
|
|
+// 返回上一级
|
|
|
const goBack = () => {
|
|
|
router.go(-1);
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const handleEdit = () => {
|
|
|
- // 编辑逻辑
|
|
|
ElMessageBox.prompt('编辑报告', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -80,7 +83,6 @@ const handleEdit = () => {
|
|
|
};
|
|
|
|
|
|
const handleDelete = () => {
|
|
|
- // 删除逻辑
|
|
|
ElMessageBox.confirm('此操作将永久删除该报告, 是否继续?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -100,25 +102,29 @@ const handleDelete = () => {
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- const reportId = route.params.reportId;
|
|
|
-
|
|
|
- // 模拟数据对象
|
|
|
- const mockData = {
|
|
|
- reportId: 'YJYA0000000001',
|
|
|
- title: '广东省城市轨道交通运营突发事件总结报告',
|
|
|
- keyword: '轨道交通',
|
|
|
- eventType: '自然灾害',
|
|
|
- publishDate: '2024-07-11 16:09:09',
|
|
|
- sourceUnit: '茂名市应急管理局',
|
|
|
- notificationType: '总结报告',
|
|
|
- summary: '广东省城市轨道交通运营突发事件总结报告。',
|
|
|
- attachmentName: '关于X市公交XXX公交车司机出现状况的调查报告.pdf',
|
|
|
- attachmentUrl: '/path/to/attachment.pdf'
|
|
|
- };
|
|
|
-
|
|
|
- // 直接赋值给 report
|
|
|
- report.value = mockData;
|
|
|
+ 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);
|
|
|
+ });
|
|
|
});
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|