修改文章管理,增加已发布/草稿箱快速检索

This commit is contained in:
jacky 2024-06-11 21:52:39 +08:00
parent e67b8d10b1
commit 7fbf8d7c72
2 changed files with 22 additions and 19 deletions

View File

@ -91,7 +91,6 @@ import {
import AcademicianEdit from '@/view/content/components/academicianEdit.vue'
import SelectArticle from '@/view/content/components/selectArticle.vue'
import { useRoute } from 'vue-router'
import { getTable } from '@/api/autoCode'
const route = useRoute()
const page = ref(1)

View File

@ -1,5 +1,9 @@
<template>
<div>
<el-tabs v-model="activeTabName" type="" class="demo-tabs" @tab-change="handleChangeTab">
<el-tab-pane label="已发布" name="release"></el-tab-pane>
<el-tab-pane label="草稿箱" name="draft"></el-tab-pane>
</el-tabs>
<div class="gva-search-box">
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" label-width="0" class="demo-form-inline"
@keyup.enter="handleSubmitSearch">
@ -17,21 +21,6 @@
<el-input v-model="searchInfo.keyword" class="keyword" placeholder="请输入关键词" clearable style="width:100%" />
</el-tooltip>
</el-form-item>
<!-- <el-form-item label="所属栏目" prop="channelId" style="width:300px">
<el-cascader v-model="searchChannelId" :options="channelOptions" style="width:100%"
:props="{ label: 'title', value: 'ID', disabled: 'disabled', emitPath: false }" :show-all-levels="true"
clearable placeholder="请选择" filterable />
</el-form-item>
<el-form-item label="文章分类" prop="categoryId" style="width:300px">
<el-cascader v-model="searchCategoryId" :options="categoryOptions" style="width:100%"
:props="{ label: 'title', value: 'ID', disabled: 'disabled', emitPath: false }" :show-all-levels="true"
clearable placeholder="请选择" filterable />
</el-form-item> -->
<el-form-item label="" prop="status" style="width:200px">
<el-select v-model="searchInfo.status" placeholder="请选择状态" clearable style="width:300px">
<el-option v-for="item in statusOptions" :key="item.key" :label="item.label" :value="item.key" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleSubmitSearch">查询</el-button>
<el-button icon="refresh" @click="handleResetSearch">重置</el-button>
@ -222,11 +211,20 @@ const elSearchFormRef = ref()
const formatTags = (tags) => {
return tags && tags.split(',')
}
const activeTabName = ref('release')
const statusList = ref([4])
const handleChangeTab = (name) => {
if (name === 'release') {
statusList.value = [4]
} else {
statusList.value = [1, 2, 3, 5]
}
getTableData()
}
const initSearchInfo = () => {
const endDate = new Date()
const startDate = new Date(endDate.getTime() - 30 * 24 * 60 * 60 * 1000)
searchChannelId.value = ''
searchCategoryId.value = ''
@ -234,7 +232,8 @@ const initSearchInfo = () => {
dateRange: [
formatTimeToStr(startDate, 'yyyy-MM-dd'),
formatTimeToStr(endDate, 'yyyy-MM-dd'),
]
],
statusList: [],
}
}
@ -378,7 +377,7 @@ const handleRowChange = (row, status) => {
type: 'success',
message: msg + '成功!'
})
row.status = status
getTableData()
}
})
}
@ -482,6 +481,7 @@ watch(() => tableData.value, () => {
// ----- -----
const getTableData = async () => {
searchInfo.value.statusList = statusList.value
const res = await getArticleList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
if (res.code === 0) {
tableData.value = res.data.list
@ -569,4 +569,8 @@ getTableData()
color: var(--el-text-color-disabled);
font-size: 14px;
}
.status-box {
margin-bottom: 15px;
}
</style>