标签管理
This commit is contained in:
parent
e4213193fe
commit
3e9cef511a
@ -7,14 +7,8 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
@ -55,7 +49,7 @@ public class SqTagController extends BaseController
|
|||||||
* 模糊查书签TAG
|
* 模糊查书签TAG
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listByUserLike")
|
@GetMapping("/listByUserLike")
|
||||||
public TableDataInfo listByUserLike(SqTagReq req)
|
public TableDataInfo listByUserLike(SqTag req)
|
||||||
{
|
{
|
||||||
SqTag sqTag = new SqTag();
|
SqTag sqTag = new SqTag();
|
||||||
BeanUtils.copyProperties(req,sqTag);
|
BeanUtils.copyProperties(req,sqTag);
|
||||||
@ -70,12 +64,15 @@ public class SqTagController extends BaseController
|
|||||||
* 新增书签_标签
|
* 新增书签_标签
|
||||||
*/
|
*/
|
||||||
@PostMapping("/addByUser")
|
@PostMapping("/addByUser")
|
||||||
public AjaxResult addByUser(SqTagReq req)
|
public AjaxResult addByUser(@RequestBody SqTagReq req)
|
||||||
{
|
{
|
||||||
|
logger.info("[addByUser] 新增标签入参:"+ req.toString());
|
||||||
SqTag sqTag = new SqTag();
|
SqTag sqTag = new SqTag();
|
||||||
BeanUtils.copyProperties(req,sqTag);
|
BeanUtils.copyProperties(req,sqTag);
|
||||||
sqTag.setUserId(getAuthUser().getUserId());
|
sqTag.setUserId(getAuthUser().getUserId());
|
||||||
return toAjax(sqTagService.insertSqTag(sqTag));
|
logger.info("[addByUser] 新增标签:"+ sqTag.toString());
|
||||||
|
sqTagService.insertSqTag(sqTag);
|
||||||
|
return new AjaxResult(200,"操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,15 @@ export function listByUserLike(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增书签管理
|
||||||
|
export function addTagByUser(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tag/addByUser',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<i class="el-icon-price-tag aside-titleB_childi_two"></i>
|
<i class="el-icon-price-tag aside-titleB_childi_two"></i>
|
||||||
<span >标签管理</span>
|
<span >标签管理</span>
|
||||||
<div style="margin-left: 40%" v-show="eidtTAGText">
|
<div style="margin-left: 40%" v-show="eidtTAGText">
|
||||||
<i class="el-icon-search" style="font-size: 19px;margin-left: 5px;margin-top: 7px" @click="searchBkTagCk"></i>
|
<i class="el-icon-search title-name" @click="searchBkTagCk"></i>
|
||||||
<i class="el-icon-folder-add" style="font-size: 19px;margin-left: 5px;margin-top: 7px" @click="addBkTagCk"></i>
|
<i class="el-icon-folder-add title-name" @click="addBkTagCk"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -15,10 +15,11 @@
|
|||||||
<div style="display: flex;justify-items: center;align-items: center">
|
<div style="display: flex;justify-items: center;align-items: center">
|
||||||
<el-input
|
<el-input
|
||||||
v-if="!addBkTAG"
|
v-if="!addBkTAG"
|
||||||
placeholder="输入书签名字"
|
placeholder="新增书签的名字"
|
||||||
v-model="input4"
|
v-model="tagName"
|
||||||
size="mini"
|
size="mini"
|
||||||
style="width: 80%;margin-left: 5%"
|
style="width: 80%;margin-left: 5%"
|
||||||
|
@keyup.enter.native ="addTag"
|
||||||
>
|
>
|
||||||
<i slot="prefix" class="el-input__icon el-icon-circle-plus-outline"></i>
|
<i slot="prefix" class="el-input__icon el-icon-circle-plus-outline"></i>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -29,9 +30,10 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-if="!searchBkTAG"
|
v-if="!searchBkTAG"
|
||||||
placeholder="搜索书签"
|
placeholder="搜索书签"
|
||||||
v-model="input4"
|
v-model="tagName"
|
||||||
size="mini"
|
size="mini"
|
||||||
style="width: 80%;margin-left: 5%"
|
style="width: 80%;margin-left: 5%"
|
||||||
|
@keyup.enter.native ="search"
|
||||||
>
|
>
|
||||||
<i slot="prefix" class="el-icon-search" style="margin-left: 5px"></i>
|
<i slot="prefix" class="el-icon-search" style="margin-left: 5px"></i>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -48,10 +50,15 @@
|
|||||||
<!-- <el-tag type="info" size="mini">{{item.name}}</el-tag>-->
|
<!-- <el-tag type="info" size="mini">{{item.name}}</el-tag>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if=" !(tagList == undefined ||tagList == null || tagList.length <= 0)" class="aside-title name transition-box" >加载更多</div>
|
<div v-if=" tagList != undefined && tagList != null && total > 8 " class="aside-title name transition-box" >加载更多</div>
|
||||||
|
|
||||||
<!-- 无标签 -->
|
<!-- 无标签 -->
|
||||||
<div v-if=" tagList == undefined ||tagList == null || tagList.length <= 0" class="aside-title name transition-box" >暂无标签</div>
|
<div v-if=" tagList == undefined ||tagList == null || tagList.length <= 0" class="aside-title name transition-box" >
|
||||||
|
|
||||||
|
暂无标签
|
||||||
|
<span v-if ="tagNameCopy != undefined && tagNameCopy != null && tagNameCopy!=''"> [{{tagNameCopy}}]</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
|
|
||||||
@ -64,7 +71,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {listByUser,listByUserLike} from "@/api/bookmark/tag";
|
import {listByUser,listByUserLike,addTagByUser} from "@/api/bookmark/tag";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'areaTree',
|
name: 'areaTree',
|
||||||
@ -74,26 +81,97 @@
|
|||||||
return {
|
return {
|
||||||
msg:'暂无标签',
|
msg:'暂无标签',
|
||||||
tagList:[],
|
tagList:[],
|
||||||
|
total:0,
|
||||||
tagParams: {
|
tagParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 8
|
pageSize: 8,
|
||||||
|
name:undefined
|
||||||
},
|
},
|
||||||
|
|
||||||
addBkTAG:true,//添加书TAG
|
addBkTAG:true,//添加书TAG
|
||||||
searchBkTAG:true,//搜索TAG
|
searchBkTAG:true,//搜索TAG
|
||||||
tagListShow:false,//TAGlist
|
tagListShow:false,//TAGlist
|
||||||
eidtTAGText:false,//我的TAG
|
eidtTAGText:false,//我的TAG
|
||||||
|
tagName:undefined,//新增书签 - 搜索的输入框
|
||||||
|
tagNameCopy:''//用于提示
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.listByUser();
|
var that = this;
|
||||||
|
that.listByUsers();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询书签 */
|
// 统一的表单重置
|
||||||
listByUser: function () {
|
reset() {
|
||||||
listByUser(this.tagParams).then(response => {
|
this.form = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 8,
|
||||||
|
name: undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/**回车搜索**/
|
||||||
|
search(){
|
||||||
|
if (this.tagName == undefined || this.tagName == null ||this.tagName.trim() == ''){
|
||||||
|
this.msgInfo("标签名称不能为空")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.tagName.trim().length > 10){
|
||||||
|
this.msgInfo("标签名称太长了")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
this.tagParams.name = this.tagName;
|
||||||
|
console.log("回车搜索",this.tagParams);
|
||||||
|
//初始化
|
||||||
|
this.tagList = null;
|
||||||
|
this.total = 0;
|
||||||
|
listByUserLike(this.tagParams).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.tagList=response.rows;
|
this.tagList=response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
if (this.total == 0){
|
||||||
|
this.tagNameCopy = this.tagName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
/**回车新增标签**/
|
||||||
|
addTag(){
|
||||||
|
if (this.tagName == undefined || this.tagName == null ||this.tagName.trim() == ''){
|
||||||
|
this.msgInfo("标签名称不能为空!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.tagName.trim().length > 10){
|
||||||
|
this.msgInfo("标签名称太长了")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let tagParams = {
|
||||||
|
name:this.tagName
|
||||||
|
};
|
||||||
|
|
||||||
|
addTagByUser(tagParams).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.msgSuccess("新增标签【"+ this.tagName +"】成功");
|
||||||
|
//新增成功后 重新获取
|
||||||
|
this.reset();
|
||||||
|
this.tagName = undefined;
|
||||||
|
this.listByUsers();
|
||||||
|
}else {
|
||||||
|
this.msgError("新增标签【"+ this.tagName +"】失败,系统错误!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询书签 */
|
||||||
|
listByUsers() {
|
||||||
|
var that = this;
|
||||||
|
//初始化
|
||||||
|
listByUser(that.tagParams).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
that.tagList=response.rows;
|
||||||
|
that.total = response.total;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -109,6 +187,12 @@
|
|||||||
this.searchBkTAG = this.searchBkTAG?false:true;
|
this.searchBkTAG = this.searchBkTAG?false:true;
|
||||||
this.addBkTAG = true;
|
this.addBkTAG = true;
|
||||||
this.tagListShow = true;
|
this.tagListShow = true;
|
||||||
|
if(this.searchBkTAG){
|
||||||
|
console.log("关闭搜索")
|
||||||
|
this.reset();
|
||||||
|
this.tagName = undefined;
|
||||||
|
this.listByUsers();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**搜索书签目录**/
|
/**搜索书签目录**/
|
||||||
tagListShowCk(){
|
tagListShowCk(){
|
||||||
@ -122,6 +206,9 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.title-name{
|
||||||
|
font-size: 19px;margin-left: 5px;margin-top: 7px
|
||||||
|
}
|
||||||
.name{
|
.name{
|
||||||
padding-left: 50px;
|
padding-left: 50px;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="url != null and url != ''"> and url = #{url}</if>
|
<if test="url != null and url != ''"> and url = #{url}</if>
|
||||||
<if test="status != null "> and status = #{status}</if>
|
<if test="status != null "> and status = #{status}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSqTagById" parameterType="Long" resultMap="SqTagResult">
|
<select id="selectSqTagById" parameterType="Long" resultMap="SqTagResult">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user