猜你像搜索
This commit is contained in:
@@ -0,0 +1,98 @@
|
|||||||
|
package com.ruoyi.web.controller.back;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SearchContent;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.ISearchContentService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/back/content")
|
||||||
|
public class SearchContentController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISearchContentService searchContentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:content:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SearchContent searchContent)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SearchContent> list = searchContentService.selectSearchContentList(searchContent);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:content:export')")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SearchContent searchContent)
|
||||||
|
{
|
||||||
|
List<SearchContent> list = searchContentService.selectSearchContentList(searchContent);
|
||||||
|
ExcelUtil<SearchContent> util = new ExcelUtil<SearchContent>(SearchContent.class);
|
||||||
|
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取【请填写功能名称】详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:content:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(searchContentService.selectSearchContentById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:content:add')")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SearchContent searchContent)
|
||||||
|
{
|
||||||
|
return toAjax(searchContentService.insertSearchContent(searchContent));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:content:edit')")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SearchContent searchContent)
|
||||||
|
{
|
||||||
|
return toAjax(searchContentService.updateSearchContent(searchContent));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:content:remove')")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(searchContentService.deleteSearchContentByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.web.controller.client;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SearchContent;
|
||||||
|
import com.ruoyi.system.service.ISearchContentService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RequestMapping("/client/search")
|
||||||
|
@RestController
|
||||||
|
public class SearchClientContentController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISearchContentService searchContentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SearchContent searchContent)
|
||||||
|
{
|
||||||
|
List<SearchContent> list = searchContentService.selectSearchContentList(searchContent);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】对象 search_content
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-19
|
||||||
|
*/
|
||||||
|
public class SearchContent extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
public void setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content)
|
||||||
|
{
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent()
|
||||||
|
{
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("content", getContent())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SearchContent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-19
|
||||||
|
*/
|
||||||
|
public interface SearchContentMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public SearchContent selectSearchContentById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<SearchContent> selectSearchContentList(SearchContent searchContent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSearchContent(SearchContent searchContent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSearchContent(SearchContent searchContent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSearchContentById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSearchContentByIds(String[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SearchContent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-19
|
||||||
|
*/
|
||||||
|
public interface ISearchContentService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public SearchContent selectSearchContentById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<SearchContent> selectSearchContentList(SearchContent searchContent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSearchContent(SearchContent searchContent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSearchContent(SearchContent searchContent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSearchContentByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】信息
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSearchContentById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SearchContent;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.system.mapper.SearchContentMapper;
|
||||||
|
import com.ruoyi.system.service.ISearchContentService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SearchContentServiceImpl implements ISearchContentService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SearchContentMapper searchContentMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SearchContent selectSearchContentById(String id)
|
||||||
|
{
|
||||||
|
return searchContentMapper.selectSearchContentById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SearchContent> selectSearchContentList(SearchContent searchContent)
|
||||||
|
{
|
||||||
|
return searchContentMapper.selectSearchContentList(searchContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSearchContent(SearchContent searchContent)
|
||||||
|
{
|
||||||
|
searchContent.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return searchContentMapper.insertSearchContent(searchContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param searchContent 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSearchContent(SearchContent searchContent)
|
||||||
|
{
|
||||||
|
return searchContentMapper.updateSearchContent(searchContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSearchContentByIds(String[] ids)
|
||||||
|
{
|
||||||
|
return searchContentMapper.deleteSearchContentByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】信息
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSearchContentById(String id)
|
||||||
|
{
|
||||||
|
return searchContentMapper.deleteSearchContentById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.system.mapper.SearchContentMapper">
|
||||||
|
|
||||||
|
<resultMap type="SearchContent" id="SearchContentResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="content" column="content" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSearchContentVo">
|
||||||
|
select id, content, create_time from search_content
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSearchContentList" parameterType="SearchContent" resultMap="SearchContentResult">
|
||||||
|
<include refid="selectSearchContentVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSearchContentById" parameterType="String" resultMap="SearchContentResult">
|
||||||
|
<include refid="selectSearchContentVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSearchContent" parameterType="SearchContent" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into search_content
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="content != null">content,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="content != null">#{content},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSearchContent" parameterType="SearchContent">
|
||||||
|
update search_content
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="content != null">content = #{content},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSearchContentById" parameterType="String">
|
||||||
|
delete from search_content where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSearchContentByIds" parameterType="String">
|
||||||
|
delete from search_content where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
44
ruoyi-ui/src/api/search/content.js
Normal file
44
ruoyi-ui/src/api/search/content.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询【请填写功能名称】列表
|
||||||
|
export function listContent(query) {
|
||||||
|
return request({
|
||||||
|
url: '/back/content/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询【请填写功能名称】详细
|
||||||
|
export function getContent(id) {
|
||||||
|
return request({
|
||||||
|
url: '/back/content/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增【请填写功能名称】
|
||||||
|
export function addContent(data) {
|
||||||
|
return request({
|
||||||
|
url: '/back/content',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改【请填写功能名称】
|
||||||
|
export function updateContent(data) {
|
||||||
|
return request({
|
||||||
|
url: '/back/content',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除【请填写功能名称】
|
||||||
|
export function delContent(id) {
|
||||||
|
return request({
|
||||||
|
url: '/back/content/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
243
ruoyi-ui/src/views/search/index.vue
Normal file
243
ruoyi-ui/src/views/search/index.vue
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:content:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:content:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:content:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:content:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="contentList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="标签" align="center" prop="id" />
|
||||||
|
<el-table-column label="内容" align="center" prop="content" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:content:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:content:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改【请填写功能名称】对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="内容">
|
||||||
|
<el-input v-model="form.content" type="textarea" placeholder="请输入内容" :rows="4"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listContent, getContent, delContent, addContent, updateContent } from "@/api/search/content"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Content",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 【请填写功能名称】表格数据
|
||||||
|
contentList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
content: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询【请填写功能名称】列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
listContent(this.queryParams).then(response => {
|
||||||
|
this.contentList = response.rows
|
||||||
|
this.total = response.total
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false
|
||||||
|
this.reset()
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
content: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
this.resetForm("form")
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm")
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset()
|
||||||
|
this.open = true
|
||||||
|
this.title = "添加字符串"
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset()
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getContent(id).then(response => {
|
||||||
|
this.form = response.data
|
||||||
|
this.open = true
|
||||||
|
this.title = "修改字符串"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateContent(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addContent(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids
|
||||||
|
this.$modal.confirm('是否确认删除字符串编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delContent(ids)
|
||||||
|
}).then(() => {
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/content/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `content_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user