暂时提交
parent
599c10da3c
commit
f7478d1964
@ -0,0 +1,84 @@
|
||||
package com.ruoyi.biemo.business.controller;
|
||||
|
||||
import com.ruoyi.biemo.business.domain.Category;
|
||||
import com.ruoyi.biemo.business.service.CategoryService;
|
||||
import com.ruoyi.biemo.core.page.Page;
|
||||
import com.ruoyi.biemo.core.page.PageFactory;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/makesoft/category")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
/**
|
||||
* 查询分类管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('biemo:category:list')")
|
||||
@GetMapping("/list")
|
||||
public Page<Category> list(Category category)
|
||||
{
|
||||
Page<Category> page = categoryService.selectCategoryPage(category,PageFactory.defaultPage());
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分类管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('biemo:category:export')")
|
||||
@Log(title = "分类管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Category category)
|
||||
{
|
||||
List<Category> list = categoryService.selectCategoryList(category);
|
||||
ExcelUtil<Category> util = new ExcelUtil<>(Category.class);
|
||||
util.exportExcel(response, list, "分类管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('biemo:category:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return AjaxResult.success(categoryService.selectCategoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增分类管理或修改文章
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('biemo:category:add')")
|
||||
@Log(title = "分类管理", businessType = BusinessType.INSERT)
|
||||
@RequestMapping
|
||||
public AjaxResult add(@RequestBody Category category)
|
||||
{
|
||||
categoryService.insertOrUpdateCategory(category);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除分类管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('biemo:category:remove')")
|
||||
@Log(title = "分类管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
categoryService.deleteCategoryByIds(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,40 +1,82 @@
|
||||
package com.ruoyi.biemo.business.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.TreeEntity;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.biemo.elasticsearch.annotation.EsId;
|
||||
import com.ruoyi.biemo.elasticsearch.annotation.FieldInfo;
|
||||
import com.ruoyi.biemo.mongodb.bean.CreateTime;
|
||||
import com.ruoyi.biemo.mongodb.bean.IgnoreColumn;
|
||||
import com.ruoyi.biemo.mongodb.bean.UpdateTime;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.elasticsearch.annotations.Document;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Document
|
||||
public class Category extends TreeEntity<Category> implements Cloneable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Document(indexName = "category")
|
||||
@org.springframework.data.mongodb.core.mapping.Document("category")
|
||||
@Data
|
||||
public class Category implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 本体主键
|
||||
*/
|
||||
private Long id;
|
||||
@EsId
|
||||
private String id;
|
||||
/**
|
||||
* 本体名称
|
||||
* 分类名称
|
||||
*/
|
||||
private String cateName;
|
||||
|
||||
|
||||
private Long type;
|
||||
|
||||
|
||||
private String typeName;
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 显示颜色
|
||||
*/
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private String color;
|
||||
|
||||
/**
|
||||
* 图标名称
|
||||
*/
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private String icon;
|
||||
|
||||
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private Integer isSync;
|
||||
|
||||
/** 父菜单名称 */
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private String parentName;
|
||||
|
||||
/** 父菜单ID */
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private String parentId;
|
||||
|
||||
/** 显示顺序 */
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private Integer orderNum;
|
||||
|
||||
/** 创建人 **/
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private Long createdBy;
|
||||
|
||||
/** 修改人 **/
|
||||
@FieldInfo(type = "keyword",participle = 0)
|
||||
private Long updatedBy;
|
||||
|
||||
@CreateTime
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@FieldInfo(type = "datetime",participle = 0)
|
||||
private Long createTime;
|
||||
|
||||
@UpdateTime
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@FieldInfo(type = "datetime",participle = 0)
|
||||
private Long updateTime;
|
||||
|
||||
|
||||
|
||||
// /** 子类 */
|
||||
// @Transient
|
||||
// private List<?> children = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.ruoyi.biemo.business.domain.event;
|
||||
|
||||
import com.ruoyi.biemo.business.domain.DocInfo;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2021-03-19 17:13
|
||||
*/
|
||||
public class CategoryDeleteEvent extends ApplicationEvent {
|
||||
|
||||
private List<String> ids;
|
||||
|
||||
public CategoryDeleteEvent(Object source, String id) {
|
||||
super(source);
|
||||
this.ids=new ArrayList<>(1);
|
||||
this.ids.add(id);
|
||||
}
|
||||
|
||||
public CategoryDeleteEvent(Object source, List<String> ids) {
|
||||
super(source);
|
||||
this.ids=ids;
|
||||
}
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.ruoyi.biemo.business.domain.event;
|
||||
|
||||
import com.ruoyi.biemo.business.domain.Category;
|
||||
import com.ruoyi.biemo.business.domain.DocInfo;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author makesoft
|
||||
* @date 2022-09-10 17:13
|
||||
*/
|
||||
public class CategorySaveEvent extends ApplicationEvent {
|
||||
|
||||
private List<Category> list;
|
||||
public CategorySaveEvent(Object source, Category t) {
|
||||
super(source);
|
||||
this.list=new ArrayList<>(1);
|
||||
this.list.add(t);
|
||||
}
|
||||
|
||||
public CategorySaveEvent(Object source, List<Category> t) {
|
||||
super(source);
|
||||
this.list = t;
|
||||
}
|
||||
|
||||
public List<Category> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<Category> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.biemo.business.domain.event;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2021-03-19 17:13
|
||||
*/
|
||||
public class DocInfoDeleteEvent extends ApplicationEvent {
|
||||
|
||||
private List<String> ids;
|
||||
|
||||
public DocInfoDeleteEvent(Object source, String id) {
|
||||
super(source);
|
||||
this.ids=new ArrayList<>(1);
|
||||
this.ids.add(id);
|
||||
}
|
||||
|
||||
public DocInfoDeleteEvent(Object source, List<String> ids) {
|
||||
super(source);
|
||||
this.ids=ids;
|
||||
}
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.ruoyi.biemo.business.service;
|
||||
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import com.ruoyi.biemo.business.domain.Category;
|
||||
import com.ruoyi.biemo.business.domain.DocInfo;
|
||||
import com.ruoyi.biemo.business.domain.event.CategoryDeleteEvent;
|
||||
import com.ruoyi.biemo.business.domain.event.CategorySaveEvent;
|
||||
import com.ruoyi.biemo.core.page.Page;
|
||||
import com.ruoyi.biemo.elasticsearch.util.EsService;
|
||||
import com.ruoyi.biemo.mongodb.utils.MongoHelper;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author makesoft
|
||||
* @version 1.0
|
||||
* @date 2021/1/14 11:59
|
||||
*/
|
||||
@Service
|
||||
public class CategoryService extends EsService<Category> {
|
||||
|
||||
@Autowired
|
||||
private MongoHelper mongoHelper;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
protected Category loadData(SearchSourceBuilder context, SearchHit hit) {
|
||||
String id = hit.getId();
|
||||
if (Objects.isNull(id) || StringUtil.isEmpty(id)) return null;
|
||||
return mongoHelper.findById(id,Category.class);
|
||||
}
|
||||
@Override
|
||||
public List<Category> batchLoadData(SearchSourceBuilder context, SearchHit[] hitArr) {
|
||||
List<String> ids = new ArrayList<>();
|
||||
for(SearchHit hit:hitArr){
|
||||
String id = hit.getId();
|
||||
if (Objects.isNull(id) || StringUtil.isEmpty(id)) continue;
|
||||
ids.add(id);
|
||||
}
|
||||
return mongoHelper.findListByIds(ids,Category.class);
|
||||
}
|
||||
/**
|
||||
* 查询分类管理
|
||||
*
|
||||
* @param id 分类管理主键
|
||||
* @return 分类管理
|
||||
*/
|
||||
public Category selectCategoryById(String id)
|
||||
{
|
||||
return esLambdaQuery().eq(Category::getId,id).query().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类管理列表
|
||||
*
|
||||
* @param category 分类管理
|
||||
* @return 分类管理
|
||||
*/
|
||||
public List<Category> selectCategoryList(Category category)
|
||||
{
|
||||
return esLambdaQuery().eqAll(category).query();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类管理分页列表
|
||||
*
|
||||
* @param category 分类管理
|
||||
* @return 分类管理
|
||||
*/
|
||||
public Page<Category> selectCategoryPage(Category category, Page<Category> page){
|
||||
return esLambdaQuery().eqAll(category).sort(Category::getOrderNum, SortOrder.ASC).page(page.getPageNum(),page.getPageSize()).queryPage(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增分类管理
|
||||
*
|
||||
* @param category 分类管理
|
||||
* @return 结果
|
||||
*/
|
||||
public String insertOrUpdateCategory(Category category)
|
||||
{
|
||||
String id = mongoHelper.insert(category);
|
||||
category.setId(id);
|
||||
applicationContext.publishEvent(new CategorySaveEvent(this,category));
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除分类管理
|
||||
*
|
||||
* @param ids 需要删除的分类管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteCategoryByIds(String[] ids)
|
||||
{
|
||||
List<String> list = Arrays.stream(ids).collect(Collectors.toList());
|
||||
mongoHelper.deleteByIds(list, DocInfo.class);
|
||||
applicationContext.publishEvent(new CategoryDeleteEvent(this,list));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分类管理信息
|
||||
*
|
||||
* @param id 分类管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteCategoryById(String id)
|
||||
{
|
||||
mongoHelper.deleteById(id,Category.class);
|
||||
applicationContext.publishEvent(new CategoryDeleteEvent(this,id));
|
||||
}
|
||||
|
||||
@EventListener(classes = {CategorySaveEvent.class})
|
||||
public void saveIndex(ApplicationEvent event) {
|
||||
CategorySaveEvent saveEvent = (CategorySaveEvent)event;
|
||||
List<Category> list = saveEvent.getList();
|
||||
insertBatch(list);
|
||||
}
|
||||
|
||||
@EventListener(classes = {CategoryDeleteEvent.class})
|
||||
public void delIndex(ApplicationEvent event) {
|
||||
CategoryDeleteEvent saveEvent = (CategoryDeleteEvent)event;
|
||||
List<String> ids = saveEvent.getIds();
|
||||
deleteBatch(ids);
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.ruoyi.biemo.business.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import com.ruoyi.biemo.business.domain.DocInfo;
|
||||
import com.ruoyi.biemo.business.domain.event.DocInfoSaveEvent;
|
||||
import com.ruoyi.biemo.elasticsearch.util.EsService;
|
||||
import com.ruoyi.biemo.mongodb.entity.Topic;
|
||||
import com.ruoyi.biemo.mongodb.utils.MongoHelper;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author makesoft
|
||||
* @version 1.0
|
||||
* @date 2021/1/14 11:59
|
||||
*/
|
||||
@Service
|
||||
public class DocInfoMongoService {
|
||||
|
||||
@Autowired
|
||||
private MongoHelper mongoHelper;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
public String insert(DocInfo docInfo) {
|
||||
String id = mongoHelper.insert(docInfo);
|
||||
docInfo.setId(id);
|
||||
applicationContext.publishEvent(new DocInfoSaveEvent(this,docInfo));
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.biemo.elasticsearch.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FieldMapping {
|
||||
|
||||
private String field;
|
||||
|
||||
private String type;
|
||||
|
||||
private int participle;
|
||||
|
||||
private int ignoreAbove;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询分类管理列表
|
||||
export function listCategory(query) {
|
||||
return request({
|
||||
url: '/makesoft/category/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询分类管理详细
|
||||
export function getCategory(id) {
|
||||
return request({
|
||||
url: '/makesoft/category/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增分类管理
|
||||
export function addCategory(data) {
|
||||
return request({
|
||||
url: '/makesoft/category',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改分类管理
|
||||
export function updateCategory(data) {
|
||||
return request({
|
||||
url: '/makesoft/category',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除分类管理
|
||||
export function delCategory(id) {
|
||||
return request({
|
||||
url: '/makesoft/category/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询文章管理列表
|
||||
export function listDocInfo(query) {
|
||||
return request({
|
||||
url: '/makesoft/docInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询文章管理详细
|
||||
export function getDocInfo(id) {
|
||||
return request({
|
||||
url: '/makesoft/docInfo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增文章管理
|
||||
export function addDocInfo(data) {
|
||||
return request({
|
||||
url: '/makesoft/docInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改文章管理
|
||||
export function updateDocInfo(data) {
|
||||
return request({
|
||||
url: '/makesoft/docInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除文章管理
|
||||
export function delDocInfo(id) {
|
||||
return request({
|
||||
url: '/makesoft/docInfo/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
<iFrame :src="url1"></iFrame>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
div{color:red}
|
||||
</style>
|
||||
<script>
|
||||
import iFrame from "@/components/iFrame/index";
|
||||
export default{
|
||||
components: {iFrame},
|
||||
data () {
|
||||
return {
|
||||
url1: '',
|
||||
url2: ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.url1 = 'http://39.108.144.227:9999/spiderList.html'
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,347 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入标题"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="content">
|
||||
<el-input
|
||||
v-model="queryParams.content"
|
||||
placeholder="请输入内容"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="cateId">
|
||||
<el-select
|
||||
v-model="queryParams.cateId"
|
||||
placeholder="选择分类"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in ['分类1','分类2']"
|
||||
:key="dict"
|
||||
:label="dict"
|
||||
:value="dict"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="选择状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in ['已分析','未分析']"
|
||||
:key="dict"
|
||||
:label="dict"
|
||||
:value="dict"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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="['biemo:docInfo: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="['biemo:docInfo: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="['biemo:docInfo: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="['biemo:docInfo:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="docInfoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="摘要" align="center" prop="summary" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="分属分类" align="center" prop="cateId" />
|
||||
<el-table-column label="修改时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column fixed="right" 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="['biemo:docInfo:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['biemo:docInfo: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="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="内容">
|
||||
<editor v-model="form.content" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input v-model="form.author" placeholder="请输入作者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="来源" prop="source">
|
||||
<el-input v-model="form.source" placeholder="请输入来源" />
|
||||
</el-form-item>
|
||||
<el-form-item label="评分" prop="score">
|
||||
<el-input v-model="form.score" placeholder="请输入评分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="cateId">
|
||||
<el-input v-model="form.cateId" placeholder="请输入分类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否禁用" prop="disabled">
|
||||
<el-input v-model="form.disabled" placeholder="请输入是否禁用0启用1禁用" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="deleted">
|
||||
<el-input v-model="form.deleted" placeholder="请输入是否删除0正常1删除" />
|
||||
</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 { listDocInfo, getDocInfo, delDocInfo, addDocInfo, updateDocInfo } from "@/api/biemo/docInfo";
|
||||
|
||||
export default {
|
||||
name: "DocInfo",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 文章管理表格数据
|
||||
docInfoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
title: null,
|
||||
type: null,
|
||||
status: null,
|
||||
content: null,
|
||||
author: null,
|
||||
source: null,
|
||||
score: null,
|
||||
cateId: null,
|
||||
disabled: null,
|
||||
deleted: null,
|
||||
createdBy: null,
|
||||
updatedBy: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
parserGraphData: null,
|
||||
parserNamedEntity: null,
|
||||
parserEmotion: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询文章管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDocInfo(this.queryParams).then(response => {
|
||||
this.docInfoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
status: null,
|
||||
title: null,
|
||||
type: null,
|
||||
summary: null,
|
||||
content: null,
|
||||
author: null,
|
||||
source: null,
|
||||
score: null,
|
||||
cateId: null,
|
||||
audio: null,
|
||||
video: null,
|
||||
disabled: null,
|
||||
deleted: null,
|
||||
createdBy: null,
|
||||
updatedBy: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
parserGraphData: null,
|
||||
parserNamedEntity: null,
|
||||
parserEmotion: 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
|
||||
getDocInfo(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) {
|
||||
updateDocInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDocInfo(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 delDocInfo(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('biemo/docInfo/export', {
|
||||
...this.queryParams
|
||||
}, `docInfo_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue