添加标签接口,优化笔记管理界面和逻辑
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<!-- 笔记管理 -->
|
||||
<template>
|
||||
<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]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
@@ -19,7 +20,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="发布状态" prop="tagId">
|
||||
<!-- <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-select>
|
||||
</el-form-item>
|
||||
@@ -36,7 +38,8 @@
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<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 :span="1.5">-->
|
||||
<!-- <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" class-name="small-padding fixed-width">
|
||||
<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
|
||||
>
|
||||
<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-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary"
|
||||
@click="handleUpdate(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-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-button v-hasPermi="['manage:notebook:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>-->
|
||||
<!-- </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>
|
||||
</el-table-column>
|
||||
</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-dialog v-model="dialog.visible" :title="dialog.title" width="60%" append-to-body>
|
||||
@@ -231,7 +233,7 @@ const data = reactive<PageData<NotebookForm, NotebookQuery>>({
|
||||
rules: {
|
||||
id: [{ required: true, message: '笔记ID不能为空', 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' }],
|
||||
status: [{ required: true, message: '帐号状态不能为空', trigger: 'change' }],
|
||||
tagId: [{ required: true, message: '标签不能为空', trigger: 'blur' }],
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
</template>
|
||||
|
||||
<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 { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/scenic/types';
|
||||
import { useRouter } from 'vue-router';
|
||||
@@ -586,8 +586,8 @@ onMounted(() => {
|
||||
};
|
||||
});
|
||||
const getTag = async () => {
|
||||
const res = await listTag({ pageNum: 1, pageSize: 1000 });
|
||||
sys_user_tagOptions.value = res.rows; //标签库
|
||||
const res = await tagAll();
|
||||
sys_user_tagOptions.value = res; //标签库
|
||||
};
|
||||
//输入位置,搜索位置
|
||||
const performSearch = async (text) => {
|
||||
@@ -688,7 +688,7 @@ const cancel = (type: string) => {
|
||||
}
|
||||
dialog.visible = false;
|
||||
noteBookVisible.value = false;
|
||||
noteBookTagIds.value = null; // 清空标签
|
||||
noteBookTagIds.value = ''; // 清空标签
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -813,11 +813,10 @@ const handleDetail = async (row?: ArticleVO) => {
|
||||
* @param row 相关笔记
|
||||
*/
|
||||
const noteBookVisible = ref(false);
|
||||
const noteBookTagIds = ref(null); //相关笔记的标签id
|
||||
const noteBookTagIds = ref(''); //相关笔记的标签id
|
||||
const handleNote = async (row?: ArticleVO) => {
|
||||
console.log(row);
|
||||
noteBookTagIds.value = null;
|
||||
noteBookTagIds.value = row?.tagId;
|
||||
noteBookTagIds.value = '';
|
||||
noteBookTagIds.value = row?.tagId as string;
|
||||
noteBookVisible.value = true;
|
||||
console.log(row.tagId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user