添加标签接口,优化笔记管理界面和逻辑
This commit is contained in:
parent
8b7860e3ef
commit
e639694427
@ -6,6 +6,8 @@ export interface ArticleVO {
|
|||||||
*/
|
*/
|
||||||
id: string | number;
|
id: string | number;
|
||||||
tagId_copy: string[] | number[];
|
tagId_copy: string[] | number[];
|
||||||
|
region?: string;
|
||||||
|
regionCode?: string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,18 @@ export const listTag = (query?: TagQuery): AxiosPromise<TagVO[]> => {
|
|||||||
params: query
|
params: query
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* 获取所有标签
|
||||||
|
* @param query
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const tagAll = (query?: TagQuery): AxiosPromise<TagVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/manage/tag/all',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询标签详细
|
* 查询标签详细
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<span>{{ formatTag(scope.row.tagId.toString()) }}</span>
|
<span>{{ formatTag(scope.row.tagId.toString()) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="笔记详情" align="center" prop="">
|
<el-table-column label="笔记详情" align="center" prop="" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click="handleDetail(scope.row)">查看详情</el-button>
|
<el-button link type="primary" @click="handleDetail(scope.row)">查看详情</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -24,7 +24,11 @@
|
|||||||
<el-button link type="primary" @click="handleComment(scope.row)">12</el-button>
|
<el-button link type="primary" @click="handleComment(scope.row)">12</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="点赞数" align="center" prop="agreeCount" width="80px" />
|
<el-table-column label="点赞数" align="center" prop="agreeCount" width="80px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" @click="handleComment(scope.row)">12</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="发布状态" align="center" prop="">
|
<el-table-column label="发布状态" align="center" prop="">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.status == 0 ? '未发布' : scope.row.status == 1 ? '审核中' : scope.row.status == 2 ? '已发布' : '草稿' }}</span>
|
<span>{{ scope.row.status == 0 ? '未发布' : scope.row.status == 1 ? '审核中' : scope.row.status == 2 ? '已发布' : '草稿' }}</span>
|
||||||
@ -183,7 +187,7 @@ const handleDelete = (row: any) => {
|
|||||||
const formatTag = (tagId: string | null) => {
|
const formatTag = (tagId: string | null) => {
|
||||||
let tagString = '';
|
let tagString = '';
|
||||||
for (let i = 0; i < props.sys_user_tagOptions.length; i++) {
|
for (let i = 0; i < props.sys_user_tagOptions.length; i++) {
|
||||||
const element = props.sys_user_tagOptions[i];
|
const element:any = props.sys_user_tagOptions[i];
|
||||||
if (tagId?.includes(element.id)) {
|
if (tagId?.includes(element.id)) {
|
||||||
tagString += ',' + element.title;
|
tagString += ',' + element.title;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<!-- 笔记管理 -->
|
<!-- 笔记管理 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
||||||
|
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
<div v-show="showSearch" class="mb-[10px]">
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
@ -19,7 +20,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发布状态" prop="tagId">
|
<el-form-item label="发布状态" prop="tagId">
|
||||||
<!-- <el-input v-model="queryParams.tagId" placeholder="请输入标签" clearable @keyup.enter="handleQuery" /> -->
|
<!-- <el-input v-model="queryParams.tagId" placeholder="请输入标签" clearable @keyup.enter="handleQuery" /> -->
|
||||||
<el-select v-model="queryParams.tagId" placeholder="请选择发布状态" style="width: 240px" @keyup.enter="handleQuery">
|
<el-select v-model="queryParams.tagId" placeholder="请选择发布状态" style="width: 240px"
|
||||||
|
@keyup.enter="handleQuery">
|
||||||
<el-option v-for="item in statusoptions" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in statusoptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -36,7 +38,8 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['manage:notebook:add']" type="primary" plain icon="Plus" @click="handleAdd">新增 </el-button>
|
<el-button v-hasPermi="['manage:notebook:add']" type="primary" plain icon="Plus" @click="handleAdd">新增
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">-->
|
<!-- <el-col :span="1.5">-->
|
||||||
<!-- <el-button v-hasPermi="['manage:notebook:remove']" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"-->
|
<!-- <el-button v-hasPermi="['manage:notebook:remove']" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"-->
|
||||||
@ -97,24 +100,23 @@
|
|||||||
<el-table-column label="操作时间" align="center" prop="updateTime" width="200px" />
|
<el-table-column label="操作时间" align="center" prop="updateTime" width="200px" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="handleUpdate(scope.row)"
|
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary"
|
||||||
>编辑</el-button
|
@click="handleUpdate(scope.row)">编辑</el-button>
|
||||||
>
|
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary"
|
||||||
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="fabudata(scope.row)"
|
@click="fabudata(scope.row)">发布</el-button>
|
||||||
>发布</el-button
|
<el-button v-if="scope.row.status == 2" v-hasPermi="['manage:notebook:edit']" link type="primary"
|
||||||
>
|
@click="fabudata(scope.row)">撤销发布</el-button>
|
||||||
<el-button v-if="scope.row.status == 2" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="fabudata(scope.row)"
|
|
||||||
>撤销发布</el-button
|
|
||||||
>
|
|
||||||
<!-- <el-tooltip content="发布" placement="top">-->
|
<!-- <el-tooltip content="发布" placement="top">-->
|
||||||
<!-- <el-button v-hasPermi="['manage:notebook:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>-->
|
<!-- <el-button v-hasPermi="['manage:notebook:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>-->
|
||||||
<!-- </el-tooltip>-->
|
<!-- </el-tooltip>-->
|
||||||
<el-button v-hasPermi="['manage:notebook:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
|
<el-button v-hasPermi="['manage:notebook:remove']" link type="primary"
|
||||||
|
@click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
|
:total="total" @pagination="getList" />
|
||||||
</el-card>
|
</el-card>
|
||||||
<!-- 添加或修改笔记对话框 -->
|
<!-- 添加或修改笔记对话框 -->
|
||||||
<el-dialog v-model="dialog.visible" :title="dialog.title" width="60%" append-to-body>
|
<el-dialog v-model="dialog.visible" :title="dialog.title" width="60%" append-to-body>
|
||||||
@ -231,7 +233,7 @@ const data = reactive<PageData<NotebookForm, NotebookQuery>>({
|
|||||||
rules: {
|
rules: {
|
||||||
id: [{ required: true, message: '笔记ID不能为空', trigger: 'blur' }],
|
id: [{ required: true, message: '笔记ID不能为空', trigger: 'blur' }],
|
||||||
title: [{ required: true, message: '笔记标题不能为空', trigger: 'blur' }],
|
title: [{ required: true, message: '笔记标题不能为空', trigger: 'blur' }],
|
||||||
content: [{ required: true, message: '攻略内容不能为空', trigger: 'blur' }],
|
// content: [{ required: true, message: '攻略内容不能为空', trigger: 'blur' }],
|
||||||
// cover: [{ required: true, message: '笔记照片不能为空', trigger: 'blur' }],
|
// cover: [{ required: true, message: '笔记照片不能为空', trigger: 'blur' }],
|
||||||
status: [{ required: true, message: '帐号状态不能为空', trigger: 'change' }],
|
status: [{ required: true, message: '帐号状态不能为空', trigger: 'change' }],
|
||||||
tagId: [{ required: true, message: '标签不能为空', trigger: 'blur' }],
|
tagId: [{ required: true, message: '标签不能为空', trigger: 'blur' }],
|
||||||
|
@ -399,7 +399,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Article" lang="ts">
|
<script setup name="Article" lang="ts">
|
||||||
import { listTag } from '@/api/manage/tag';
|
import { listTag,tagAll } from '@/api/manage/tag';
|
||||||
import { listArticle, getArticle, delArticle, addArticle, updateArticle, listByTagIdNotebook } from '@/api/manage/scenic';
|
import { listArticle, getArticle, delArticle, addArticle, updateArticle, listByTagIdNotebook } from '@/api/manage/scenic';
|
||||||
import { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/scenic/types';
|
import { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/scenic/types';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
@ -586,8 +586,8 @@ onMounted(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
const getTag = async () => {
|
const getTag = async () => {
|
||||||
const res = await listTag({ pageNum: 1, pageSize: 1000 });
|
const res = await tagAll();
|
||||||
sys_user_tagOptions.value = res.rows; //标签库
|
sys_user_tagOptions.value = res; //标签库
|
||||||
};
|
};
|
||||||
//输入位置,搜索位置
|
//输入位置,搜索位置
|
||||||
const performSearch = async (text) => {
|
const performSearch = async (text) => {
|
||||||
@ -688,7 +688,7 @@ const cancel = (type: string) => {
|
|||||||
}
|
}
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
noteBookVisible.value = false;
|
noteBookVisible.value = false;
|
||||||
noteBookTagIds.value = null; // 清空标签
|
noteBookTagIds.value = ''; // 清空标签
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
@ -813,11 +813,10 @@ const handleDetail = async (row?: ArticleVO) => {
|
|||||||
* @param row 相关笔记
|
* @param row 相关笔记
|
||||||
*/
|
*/
|
||||||
const noteBookVisible = ref(false);
|
const noteBookVisible = ref(false);
|
||||||
const noteBookTagIds = ref(null); //相关笔记的标签id
|
const noteBookTagIds = ref(''); //相关笔记的标签id
|
||||||
const handleNote = async (row?: ArticleVO) => {
|
const handleNote = async (row?: ArticleVO) => {
|
||||||
console.log(row);
|
noteBookTagIds.value = '';
|
||||||
noteBookTagIds.value = null;
|
noteBookTagIds.value = row?.tagId as string;
|
||||||
noteBookTagIds.value = row?.tagId;
|
|
||||||
noteBookVisible.value = true;
|
noteBookVisible.value = true;
|
||||||
console.log(row.tagId);
|
console.log(row.tagId);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user