|
@@ -1,129 +1,132 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <div v-show="!dialog.visible">
|
|
|
- <transition name="fade">
|
|
|
- <div v-show="showSearch">
|
|
|
- <el-form ref="queryFormRef" :model="queryParams">
|
|
|
- <el-row :gutter="20">
|
|
|
- <!-- 第一行 -->
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="事件类型:" prop="eventType">
|
|
|
- <el-select v-model="queryParams.eventType" placeholder="全部" clearable>
|
|
|
- <el-option label="全部" value=""></el-option>
|
|
|
- <el-option v-for="item in eventTypeSelection" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="发布日期:" prop="publishDate">
|
|
|
- <el-date-picker
|
|
|
- v-model="queryParams.publishDate"
|
|
|
- type="daterange"
|
|
|
- range-separator="-"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item>
|
|
|
- <el-input v-model="queryParams.query" placeholder="请输入报告的名称" clearable @keyup.enter="handleQuery" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button @click="resetQuery">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </transition>
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate(selectedRow)">修改</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(selectedRow)">删除</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
|
|
- </el-col>
|
|
|
- <!-- <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>-->
|
|
|
- </el-row>
|
|
|
+ <div>
|
|
|
+ <div class="app-container">
|
|
|
+ <div v-show="!dialog.visible && !knowledgeDetailState.show">
|
|
|
+ <transition name="fade">
|
|
|
+ <div v-show="showSearch">
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <!-- 第一行 -->
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="事件类型:" prop="eventType">
|
|
|
+ <el-select v-model="queryParams.eventType" placeholder="全部" clearable>
|
|
|
+ <el-option label="全部" value=""></el-option>
|
|
|
+ <el-option v-for="item in eventTypeSelection" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="发布日期:" prop="publishDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="queryParams.publishDate"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input v-model="queryParams.query" placeholder="请输入报告的名称" clearable @keyup.enter="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </transition>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate(selectedRow)">修改</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(selectedRow)">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <!-- <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>-->
|
|
|
+ </el-row>
|
|
|
|
|
|
- <!-- 表格组件 -->
|
|
|
- <el-table v-loading="loading" :data="demoList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="报告编号" align="center" prop="reportId" />
|
|
|
- <el-table-column label="报告名称" align="center" prop="reportName" />
|
|
|
- <el-table-column label="主题词" align="center" prop="subject" />
|
|
|
- <el-table-column label="事件类型" align="center" prop="eventType">
|
|
|
- <template #default="scope">
|
|
|
- <dict-tag :options="mm_event_type" :value="scope.row.eventType" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="摘要" align="center" prop="summary" />
|
|
|
- <el-table-column label="来源单位" align="center" prop="publishingUnit" />
|
|
|
- <el-table-column label="发布日期" align="center" prop="publishDate" />
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template #default="scope">
|
|
|
- <el-text class="common-btn-text-primary" @click="handleView(scope.row)">查看</el-text>
|
|
|
- <el-text class="common-btn-text-primary" @click="handleUpdate(scope.row)">修改</el-text>
|
|
|
- <el-text class="common-btn-text-danger" @click="handleDelete(scope.row)">删除</el-text>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <!-- 表格组件 -->
|
|
|
+ <el-table v-loading="loading" :data="demoList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="报告编号" align="center" prop="reportId" />
|
|
|
+ <el-table-column label="报告名称" align="center" prop="reportName" />
|
|
|
+ <el-table-column label="主题词" align="center" prop="subject" />
|
|
|
+ <el-table-column label="事件类型" align="center" prop="eventType">
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :options="mm_event_type" :value="scope.row.eventType" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="摘要" align="center" prop="summary" />
|
|
|
+ <el-table-column label="来源单位" align="center" prop="publishingUnit" />
|
|
|
+ <el-table-column label="发布日期" align="center" prop="publishDate" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-text class="common-btn-text-primary" @click="handleView(scope.row)">查看</el-text>
|
|
|
+ <el-text class="common-btn-text-primary" @click="handleUpdate(scope.row)">修改</el-text>
|
|
|
+ <el-text class="common-btn-text-danger" @click="handleDelete(scope.row)">删除</el-text>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
|
|
|
- <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
|
|
- </div>
|
|
|
- <!-- 新增/修改弹窗 -->
|
|
|
- <div v-show="dialog.visible" class="common-dialog">
|
|
|
- <div class="common-dialog-content">
|
|
|
- <div class="common-dialog-title-box">
|
|
|
- <i class="common-dialog-title-icon" />
|
|
|
- <div>{{ dialog.title }}</div>
|
|
|
- </div>
|
|
|
- <div class="common-dialog-box">
|
|
|
- <el-form ref="demoFormRef" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="报告名称:" prop="reportName">
|
|
|
- <el-input v-model="form.reportName" placeholder="请输入报告名称" style="width: 468px !important" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="主题词:" prop="subject">
|
|
|
- <el-input v-model="form.subject" placeholder="请输入主题词" style="width: 468px !important" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="事件类型:" prop="eventType">
|
|
|
- <el-select v-model="form.eventType" placeholder="请选择事件类型" clearable style="width: 468px !important">
|
|
|
- <el-option v-for="item in eventTypeSelection" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="摘要:" prop="summary">
|
|
|
- <el-input v-model="form.summary" placeholder="请输入摘要" style="width: 468px !important" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="来源单位:" prop="publishingUnit">
|
|
|
- <el-input v-model="form.publishingUnit" placeholder="请输入来源单位" style="width: 468px !important" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="发布日期:" prop="publishDate">
|
|
|
- <el-date-picker v-model="form.publishDate" type="datetime" placeholder="选择发布日期" style="width: 468px !important"></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- <el-col :span="1.5">
|
|
|
- <!-- 使用分片上传组件,每个分片 -->
|
|
|
- <!-- <chunk-upload ref="chunkUploadRef" :max-file-size="50 * 1024 * 1024" :max-files="5" />-->
|
|
|
- <FileUpload v-model="form.fileNames" />
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- <div class="common-dialog-footer" style="display: flex; justify-content: center">
|
|
|
- <el-button :loading="buttonLoading" type="primary" @click="submitForm">确定</el-button>
|
|
|
- <el-button @click="cancel">取消</el-button>
|
|
|
+ <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
|
|
+ </div>
|
|
|
+ <!-- 新增/修改弹窗 -->
|
|
|
+ <div v-show="dialog.visible" class="common-dialog">
|
|
|
+ <div class="common-dialog-content">
|
|
|
+ <div class="common-dialog-title-box">
|
|
|
+ <i class="common-dialog-title-icon" />
|
|
|
+ <div>{{ dialog.title }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="common-dialog-box">
|
|
|
+ <el-form ref="demoFormRef" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="报告名称:" prop="reportName">
|
|
|
+ <el-input v-model="form.reportName" placeholder="请输入报告名称" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="主题词:" prop="subject">
|
|
|
+ <el-input v-model="form.subject" placeholder="请输入主题词" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="事件类型:" prop="eventType">
|
|
|
+ <el-select v-model="form.eventType" placeholder="请选择事件类型" clearable style="width: 468px !important">
|
|
|
+ <el-option v-for="item in eventTypeSelection" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="摘要:" prop="summary">
|
|
|
+ <el-input v-model="form.summary" placeholder="请输入摘要" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="来源单位:" prop="publishingUnit">
|
|
|
+ <el-input v-model="form.publishingUnit" placeholder="请输入来源单位" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="发布日期:" prop="publishDate">
|
|
|
+ <el-date-picker v-model="form.publishDate" type="datetime" placeholder="选择发布日期" style="width: 468px !important"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <!-- 使用分片上传组件,每个分片 -->
|
|
|
+ <!-- <chunk-upload ref="chunkUploadRef" :max-file-size="50 * 1024 * 1024" :max-files="5" />-->
|
|
|
+ <FileUpload v-model="form.fileNames" />
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="common-dialog-footer" style="display: flex; justify-content: center">
|
|
|
+ <el-button :loading="buttonLoading" type="primary" @click="submitForm">确定</el-button>
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <KnowledgeDetail v-if="knowledgeDetailState.show" :reportId="knowledgeDetailState.reportId" @close="handleKnowledgeDetailClose"></KnowledgeDetail>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -136,6 +139,7 @@ import { AddReportParams, QueryParams, ReportItem } from '@/api/kenowledge/types
|
|
|
import { getDicts } from '@/api/system/dict/data';
|
|
|
import router from '@/router';
|
|
|
import axios, { AxiosError, isAxiosError } from 'axios';
|
|
|
+import KnowledgeDetail from './detail.vue';
|
|
|
|
|
|
const demoFormRef = ref(null);
|
|
|
const demoList = ref<ReportItem[]>([]);
|
|
@@ -190,6 +194,11 @@ const dialog = reactive({
|
|
|
title: ''
|
|
|
});
|
|
|
|
|
|
+let knowledgeDetailState = reactive({
|
|
|
+ show: false,
|
|
|
+ reportId: ''
|
|
|
+});
|
|
|
+
|
|
|
// getLists是获取列表数据的方法
|
|
|
const getList = async () => {
|
|
|
// 开始加载数据
|
|
@@ -271,6 +280,7 @@ const handleAdd = () => {
|
|
|
// 修改报告
|
|
|
const handleUpdate = (row: ReportItem) => {
|
|
|
if (row) {
|
|
|
+ selectedRow.value = row;
|
|
|
resetForm();
|
|
|
Object.assign(form, row);
|
|
|
dialog.visible = true;
|
|
@@ -280,6 +290,26 @@ const handleUpdate = (row: ReportItem) => {
|
|
|
|
|
|
// 删除报告
|
|
|
const handleDelete = async (row: ReportItem) => {
|
|
|
+ ElMessageBox.confirm('此操作将永久删除该报告, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ deleteReport(row.reportId);
|
|
|
+ ElMessage({
|
|
|
+ type: 'success',
|
|
|
+ message: '报告已删除'
|
|
|
+ });
|
|
|
+ getList();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ /*
|
|
|
try {
|
|
|
await deleteReport(row.reportId);
|
|
|
ElMessage.success('删除成功');
|
|
@@ -287,16 +317,23 @@ const handleDelete = async (row: ReportItem) => {
|
|
|
} catch (error) {
|
|
|
ElMessage.error('删除失败');
|
|
|
}
|
|
|
+ */
|
|
|
};
|
|
|
|
|
|
// 详情页
|
|
|
const handleView = (row: ReportItem) => {
|
|
|
- router.push({
|
|
|
- path: `/knowledge/knowledge-management/detail`,
|
|
|
- query: { reportID: row.reportId }
|
|
|
- });
|
|
|
+ knowledgeDetailState.reportId = row.reportId;
|
|
|
+ knowledgeDetailState.show = true;
|
|
|
+ //router.push({
|
|
|
+ // path: `/knowledge/knowledge-management/detail`,
|
|
|
+ // query: { reportID: row.reportId }
|
|
|
+ //});
|
|
|
};
|
|
|
|
|
|
+const handleKnowledgeDetailClose = () => {
|
|
|
+ knowledgeDetailState.show = false;
|
|
|
+}
|
|
|
+
|
|
|
// 格式化日期
|
|
|
const formatDate = (date: Date): string => {
|
|
|
const yyyy = date.getFullYear();
|
|
@@ -318,13 +355,14 @@ const submitForm = () => {
|
|
|
form.publishDate = formatDate(new Date(form.publishDate));
|
|
|
|
|
|
// 打印发送的数据,检查格式是否正确
|
|
|
- console.log('提交给后端的 JSON 数据:', JSON.stringify(form, null, 2));
|
|
|
+ console.log(dialog.title, '提交给后端的 JSON 数据:', JSON.stringify(form, null, 2));
|
|
|
|
|
|
if (dialog.title === '修改报告' && selectedRow.value) {
|
|
|
const updateData = {
|
|
|
...form,
|
|
|
reportId: selectedRow.value.reportId
|
|
|
};
|
|
|
+ console.log('modify:', updateData)
|
|
|
await updateReport(updateData);
|
|
|
ElMessage.success('更新成功');
|
|
|
} else {
|