细节修正
This commit is contained in:
@@ -299,7 +299,7 @@ export interface DataCollectionLog extends BaseDTO {
|
||||
*/
|
||||
export interface ResourceSearchParams {
|
||||
/** 关键词 */
|
||||
keyword?: string;
|
||||
title?: string;
|
||||
/** 标签ID(文章分类标签,tagType=1) */
|
||||
tagID?: string;
|
||||
/** 状态 */
|
||||
|
||||
@@ -10,9 +10,16 @@
|
||||
v-model="searchKeyword"
|
||||
placeholder="搜索文章..."
|
||||
style="width: 300px"
|
||||
onkeydown=""
|
||||
clearable
|
||||
/>
|
||||
@keyup.enter="handleSearch"
|
||||
@clear="handleSearch"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<el-table :data="articles" style="width: 100%">
|
||||
@@ -94,7 +101,8 @@ defineOptions({
|
||||
name: 'ArticleManagementView'
|
||||
});
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage, ElMessageBox, ElIcon } from 'element-plus';
|
||||
import { Search } from '@element-plus/icons-vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { resourceApi, resourceTagApi } from '@/apis/resource'
|
||||
import type { PageParam, ResourceSearchParams, Resource, Tag } from '@/types';
|
||||
@@ -108,7 +116,7 @@ const pageParam = ref<PageParam>({
|
||||
pageSize: 10
|
||||
});
|
||||
const filter = ref<ResourceSearchParams>({
|
||||
keyword: searchKeyword.value
|
||||
title: searchKeyword.value
|
||||
});
|
||||
const total = ref<number>(0);
|
||||
const articles = ref<Resource[]>([]);
|
||||
@@ -135,6 +143,7 @@ async function loadCategories() {
|
||||
}
|
||||
|
||||
async function loadArticles() {
|
||||
filter.value.title = searchKeyword.value;
|
||||
const res = await resourceApi.getResourcePage(pageParam.value, filter.value);
|
||||
if (res.success) {
|
||||
articles.value = res.pageDomain?.dataList || [];
|
||||
@@ -142,6 +151,11 @@ async function loadArticles() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pageParam.value.pageNumber = 1; // 搜索时重置到第一页
|
||||
loadArticles();
|
||||
}
|
||||
|
||||
function showCreateDialog() {
|
||||
// 尝试跳转
|
||||
router.push('/article/add')
|
||||
|
||||
@@ -145,9 +145,9 @@
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="previewAgreementFile(configData[group.groupKey][item.configKey])"
|
||||
@click="downloadAgreementFile(configData[group.groupKey][item.configKey])"
|
||||
>
|
||||
预览文件
|
||||
下载文件
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
@@ -405,12 +405,12 @@ function handleFileUploadSuccess(files: any[], groupKey: string, configKey: stri
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览协议文件(新开tab页)
|
||||
* 下载协议文件
|
||||
*/
|
||||
function previewAgreementFile(fileId: string) {
|
||||
function downloadAgreementFile(fileId: string) {
|
||||
if (fileId) {
|
||||
// 使用文件下载URL在新标签页打开
|
||||
const url = `${import.meta.env.VITE_API_BASE_URL || ''}/api/file/preview/${fileId}`;
|
||||
// 使用文件下载URL
|
||||
const url = `${import.meta.env.VITE_API_BASE_URL || ''}/api/file/download/${fileId}`;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user