运维社区运维社区举报中心更新

This commit is contained in:
zhangjunwen 2024-05-10 11:03:33 +08:00
parent 505b55a351
commit f425a592f6
13 changed files with 844 additions and 17 deletions

View File

@ -2,6 +2,8 @@ package com.inspur.web.controller.community;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.inspur.community.domain.vo.CommunityPostReportVO;
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.web.bind.annotation.GetMapping;
@ -42,7 +44,7 @@ public class CommunityPostReportController extends BaseController
public TableDataInfo list(CommunityPostReport communityPostReport) public TableDataInfo list(CommunityPostReport communityPostReport)
{ {
startPage(); startPage();
List<CommunityPostReport> list = communityPostReportService.selectCommunityPostReportList(communityPostReport); List<CommunityPostReportVO> list = communityPostReportService.selectCommunityPostReportList(communityPostReport);
return getDataTable(list); return getDataTable(list);
} }
@ -54,8 +56,8 @@ public class CommunityPostReportController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, CommunityPostReport communityPostReport) public void export(HttpServletResponse response, CommunityPostReport communityPostReport)
{ {
List<CommunityPostReport> list = communityPostReportService.selectCommunityPostReportList(communityPostReport); List<CommunityPostReportVO> list = communityPostReportService.selectCommunityPostReportList(communityPostReport);
ExcelUtil<CommunityPostReport> util = new ExcelUtil<CommunityPostReport>(CommunityPostReport.class); ExcelUtil<CommunityPostReportVO> util = new ExcelUtil<CommunityPostReportVO>(CommunityPostReportVO.class);
util.exportExcel(response, list, "社区帖子举报数据"); util.exportExcel(response, list, "社区帖子举报数据");
} }

View File

@ -1,10 +1,13 @@
package com.inspur.community.domain; package com.inspur.community.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.inspur.common.annotation.Excel; import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity; import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/** /**
* 社区帖子举报对象 community_post_report * 社区帖子举报对象 community_post_report
* *
@ -46,6 +49,12 @@ public class CommunityPostReport extends BaseEntity
@Excel(name = "处理结果") @Excel(name = "处理结果")
private String result; private String result;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
public void setReportId(String reportId) public void setReportId(String reportId)
{ {
this.reportId = reportId; this.reportId = reportId;
@ -119,6 +128,22 @@ public class CommunityPostReport extends BaseEntity
return result; return result;
} }
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,44 @@
package com.inspur.community.domain.vo;
import com.inspur.common.annotation.Excel;
import lombok.Data;
/**
* @Author zhangjunwen
* @create 2024/5/9
*/
@Data
public class CommunityPostReportVO {
private String reportId;
/** 举报用户id */
@Excel(name = "举报用户id")
private Long reportUserId;
/** 被举报内容id */
@Excel(name = "被举报内容id")
private String reportContentId;
/** 举报时间 */
@Excel(name = "举报时间")
private String reportTime;
/** 举报原因 */
@Excel(name = "举报原因")
private String reportReason;
/** 状态0 未处理1 已处理 */
@Excel(name = "状态0 未处理1 已处理")
private String status;
/** 举报类型0 帖子1 回复 */
@Excel(name = "举报类型0 帖子1 回复")
private String reportType;
/** 处理结果 */
@Excel(name = "处理结果")
private String result;
private String userName;
}

View File

@ -2,6 +2,7 @@ package com.inspur.community.mapper;
import java.util.List; import java.util.List;
import com.inspur.community.domain.CommunityPostReport; import com.inspur.community.domain.CommunityPostReport;
import com.inspur.community.domain.vo.CommunityPostReportVO;
/** /**
* 社区帖子举报Mapper接口 * 社区帖子举报Mapper接口
@ -17,7 +18,7 @@ public interface CommunityPostReportMapper
* @param reportId 社区帖子举报主键 * @param reportId 社区帖子举报主键
* @return 社区帖子举报 * @return 社区帖子举报
*/ */
public CommunityPostReport selectCommunityPostReportByReportId(String reportId); public CommunityPostReportVO selectCommunityPostReportByReportId(String reportId);
/** /**
* 查询社区帖子举报列表 * 查询社区帖子举报列表
@ -25,7 +26,7 @@ public interface CommunityPostReportMapper
* @param communityPostReport 社区帖子举报 * @param communityPostReport 社区帖子举报
* @return 社区帖子举报集合 * @return 社区帖子举报集合
*/ */
public List<CommunityPostReport> selectCommunityPostReportList(CommunityPostReport communityPostReport); public List<CommunityPostReportVO> selectCommunityPostReportList(CommunityPostReport communityPostReport);
/** /**
* 新增社区帖子举报 * 新增社区帖子举报

View File

@ -2,6 +2,7 @@ package com.inspur.community.service;
import java.util.List; import java.util.List;
import com.inspur.community.domain.CommunityPostReport; import com.inspur.community.domain.CommunityPostReport;
import com.inspur.community.domain.vo.CommunityPostReportVO;
/** /**
* 社区帖子举报Service接口 * 社区帖子举报Service接口
@ -17,7 +18,7 @@ public interface ICommunityPostReportService
* @param reportId 社区帖子举报主键 * @param reportId 社区帖子举报主键
* @return 社区帖子举报 * @return 社区帖子举报
*/ */
public CommunityPostReport selectCommunityPostReportByReportId(String reportId); public CommunityPostReportVO selectCommunityPostReportByReportId(String reportId);
/** /**
* 查询社区帖子举报列表 * 查询社区帖子举报列表
@ -25,7 +26,7 @@ public interface ICommunityPostReportService
* @param communityPostReport 社区帖子举报 * @param communityPostReport 社区帖子举报
* @return 社区帖子举报集合 * @return 社区帖子举报集合
*/ */
public List<CommunityPostReport> selectCommunityPostReportList(CommunityPostReport communityPostReport); public List<CommunityPostReportVO> selectCommunityPostReportList(CommunityPostReport communityPostReport);
/** /**
* 新增社区帖子举报 * 新增社区帖子举报

View File

@ -1,11 +1,22 @@
package com.inspur.community.service.impl; package com.inspur.community.service.impl;
import java.util.List; import java.util.List;
import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.SecurityUtils;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.community.domain.CommunityPostInfo;
import com.inspur.community.domain.CommunityPostReply;
import com.inspur.community.domain.vo.CommunityPostReportVO;
import com.inspur.community.mapper.CommunityPostInfoMapper;
import com.inspur.community.mapper.CommunityPostReplyMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostReportMapper; import com.inspur.community.mapper.CommunityPostReportMapper;
import com.inspur.community.domain.CommunityPostReport; import com.inspur.community.domain.CommunityPostReport;
import com.inspur.community.service.ICommunityPostReportService; import com.inspur.community.service.ICommunityPostReportService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 社区帖子举报Service业务层处理 * 社区帖子举报Service业务层处理
@ -19,6 +30,12 @@ public class CommunityPostReportServiceImpl implements ICommunityPostReportServi
@Autowired @Autowired
private CommunityPostReportMapper communityPostReportMapper; private CommunityPostReportMapper communityPostReportMapper;
@Autowired
private CommunityPostInfoMapper communityPostInfoMapper;
@Autowired
private CommunityPostReplyMapper communityPostReplyMapper;
/** /**
* 查询社区帖子举报 * 查询社区帖子举报
* *
@ -26,7 +43,7 @@ public class CommunityPostReportServiceImpl implements ICommunityPostReportServi
* @return 社区帖子举报 * @return 社区帖子举报
*/ */
@Override @Override
public CommunityPostReport selectCommunityPostReportByReportId(String reportId) public CommunityPostReportVO selectCommunityPostReportByReportId(String reportId)
{ {
return communityPostReportMapper.selectCommunityPostReportByReportId(reportId); return communityPostReportMapper.selectCommunityPostReportByReportId(reportId);
} }
@ -38,7 +55,7 @@ public class CommunityPostReportServiceImpl implements ICommunityPostReportServi
* @return 社区帖子举报 * @return 社区帖子举报
*/ */
@Override @Override
public List<CommunityPostReport> selectCommunityPostReportList(CommunityPostReport communityPostReport) public List<CommunityPostReportVO> selectCommunityPostReportList(CommunityPostReport communityPostReport)
{ {
return communityPostReportMapper.selectCommunityPostReportList(communityPostReport); return communityPostReportMapper.selectCommunityPostReportList(communityPostReport);
} }
@ -52,6 +69,10 @@ public class CommunityPostReportServiceImpl implements ICommunityPostReportServi
@Override @Override
public int insertCommunityPostReport(CommunityPostReport communityPostReport) public int insertCommunityPostReport(CommunityPostReport communityPostReport)
{ {
communityPostReport.setReportId(IdUtils.simpleUUID());
communityPostReport.setReportUserId(SecurityUtils.getLoginUser().getUserId());
communityPostReport.setReportTime(DateUtils.getTime());
communityPostReport.setStatus("0");
return communityPostReportMapper.insertCommunityPostReport(communityPostReport); return communityPostReportMapper.insertCommunityPostReport(communityPostReport);
} }
@ -61,9 +82,26 @@ public class CommunityPostReportServiceImpl implements ICommunityPostReportServi
* @param communityPostReport 社区帖子举报 * @param communityPostReport 社区帖子举报
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int updateCommunityPostReport(CommunityPostReport communityPostReport) public int updateCommunityPostReport(CommunityPostReport communityPostReport)
{ {
Integer processStatus = communityPostReport.getResult().split(":")[0] != null ? Integer.parseInt(communityPostReport.getResult().split(":")[0]) : 0;
if(processStatus != 0){
//找到贴子或者评论
if("0".equals(communityPostReport.getReportType())){//帖子
CommunityPostInfo communityPostInfo = new CommunityPostInfo();
communityPostInfo.setPostId(communityPostReport.getReportContentId());
communityPostInfo.setStatus(String.valueOf(processStatus));
communityPostInfoMapper.updateCommunityPostInfo(communityPostInfo);
}else{//回复
CommunityPostReply communityPostReply = new CommunityPostReply();
communityPostReply.setReplyId(communityPostReport.getReportContentId());
communityPostReply.setStatus(String.valueOf(processStatus));
communityPostReplyMapper.updateCommunityPostReply(communityPostReply);
}
}
communityPostReport.setStatus("1");
return communityPostReportMapper.updateCommunityPostReport(communityPostReport); return communityPostReportMapper.updateCommunityPostReport(communityPostReport);
} }

View File

@ -15,24 +15,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="result" column="result" /> <result property="result" column="result" />
</resultMap> </resultMap>
<resultMap type="CommunityPostReportVO" id="CommunityPostReportVOResult">
<result property="reportId" column="report_id" />
<result property="reportUserId" column="report_user_id" />
<result property="userName" column="user_name" />
<result property="reportContentId" column="report_content_id" />
<result property="reportTime" column="report_time" />
<result property="reportReason" column="report_reason" />
<result property="status" column="status" />
<result property="reportType" column="report_type" />
<result property="result" column="result" />
</resultMap>
<sql id="selectCommunityPostReportVo"> <sql id="selectCommunityPostReportVo">
select report_id, report_user_id, report_content_id, report_time, report_reason, status, report_type, result from community_post_report select report_id, report_user_id, report_content_id, report_time, report_reason, a.status, report_type, result, b.nick_name as user_name from community_post_report a
left join sys_user b on a.report_user_id = b.user_id
</sql> </sql>
<select id="selectCommunityPostReportList" parameterType="CommunityPostReport" resultMap="CommunityPostReportResult"> <select id="selectCommunityPostReportList" parameterType="CommunityPostReport" resultMap="CommunityPostReportVOResult">
<include refid="selectCommunityPostReportVo"/> <include refid="selectCommunityPostReportVo"/>
<where> <where>
<if test="reportUserId != null "> and report_user_id = #{reportUserId}</if> <if test="reportUserId != null "> and report_user_id = #{reportUserId}</if>
<if test="reportContentId != null and reportContentId != ''"> and report_content_id = #{reportContentId}</if> <if test="reportContentId != null and reportContentId != ''"> and report_content_id = #{reportContentId}</if>
<if test="reportTime != null and reportTime != ''"> and report_time = #{reportTime}</if> <if test="startTime != null"> and report_time &gt;= #{startTime}</if>
<if test="endTime != null"> and report_time &lt;= #{endTime}</if>
<if test="reportReason != null and reportReason != ''"> and report_reason = #{reportReason}</if> <if test="reportReason != null and reportReason != ''"> and report_reason = #{reportReason}</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="reportType != null and reportType != ''"> and report_type = #{reportType}</if> <if test="reportType != null and reportType != ''"> and report_type = #{reportType}</if>
<if test="result != null and result != ''"> and result = #{result}</if> <if test="result != null and result != ''"> and result = #{result}</if>
</where> </where>
order by a.status
</select> </select>
<select id="selectCommunityPostReportByReportId" parameterType="String" resultMap="CommunityPostReportResult"> <select id="selectCommunityPostReportByReportId" parameterType="String" resultMap="CommunityPostReportVOResult">
<include refid="selectCommunityPostReportVo"/> <include refid="selectCommunityPostReportVo"/>
where report_id = #{reportId} where report_id = #{reportId}
</select> </select>

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715234160945" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1823" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M960.288 787.488c-98.88-154.08-287.36-469.568-385.76-622.912-21.44-27.968-71.872-44-102.88 0L61.504 803.872c-23.36 33.888-23.008 79.872 49.376 82.432h824.64c48.416-2.784 48.416-62.496 24.768-98.816z m-437.44-27.776a47.296 47.296 0 1 1 0-94.592 47.296 47.296 0 0 1 0 94.592z m35.456-165.536c0.448 11.52-10.944 23.68-23.648 23.68h-23.648c-12.672 0-23.2-12.16-23.616-23.68l-23.68-224.64c0-19.552 15.904-35.456 35.488-35.456h47.296c19.584 0 35.456 15.904 35.456 35.488l-23.648 224.64z" fill="#111111" p-id="1824"></path></svg>

After

Width:  |  Height:  |  Size: 855 B

View File

@ -66,6 +66,7 @@
<comment <comment
:comments="messageList" :comments="messageList"
@replyConfirm="commitComment" @replyConfirm="commitComment"
@reportHandle="handleReport"
></comment> ></comment>
<pagination <pagination
v-show="total>0" v-show="total>0"
@ -182,6 +183,9 @@ export default {
}); });
}); });
}, },
handleReport(info, type) {
this.$emit("reportHandle", info, type);
},
/** /**
* 提交评论 * 提交评论
*/ */

View File

@ -42,6 +42,13 @@
<svg-icon icon-class="comment" /> <svg-icon icon-class="comment" />
<span style="margin-left: 5px;">回复</span> <span style="margin-left: 5px;">回复</span>
</span> </span>
<div
class="blog-report"
@click="handleReport(item,1)"
>
<svg-icon icon-class="report"></svg-icon>
<span>举报</span>
</div>
</div> </div>
<div class="reply"> <div class="reply">
<div <div
@ -70,6 +77,13 @@
<svg-icon icon-class="comment" /> <svg-icon icon-class="comment" />
<span style="margin-left: 5px;">回复</span> <span style="margin-left: 5px;">回复</span>
</span> </span>
<div
class="blog-report"
@click="handleReport(reply,1)"
>
<svg-icon icon-class="report"></svg-icon>
<span>举报</span>
</div>
</div> </div>
</div> </div>
<div <div
@ -214,6 +228,10 @@ export default {
this.showItemId = ""; this.showItemId = "";
}, },
handleReport(info, type) {
this.$emit("reportHandle", info, type);
},
/** /**
* 提交评论 * 提交评论
*/ */
@ -314,6 +332,12 @@ export default {
} }
} }
} }
.blog-report {
margin-left: 30px;
text-align: right;
cursor: pointer;
}
.reply { .reply {
margin: 10px 0; margin: 10px 0;
border-left: 2px solid #dcdfe6; border-left: 2px solid #dcdfe6;

View File

@ -30,6 +30,13 @@
<span> {{blog.views}}</span> <span> {{blog.views}}</span>
</div> </div>
</div> </div>
<div
class="blog-report"
@click="handleReport(blog,0)"
>
<svg-icon icon-class="report"></svg-icon>
<span>举报</span>
</div>
<h2 class="blog-title header">{{blog.postTitle}} <h2 class="blog-title header">{{blog.postTitle}}
<!-- <el-tag <!-- <el-tag
size="mini" size="mini"
@ -174,7 +181,7 @@
> >
评论 评论
</div> </div>
<comment></comment> <comment @reportHandle="handleReport"></comment>
</el-card> </el-card>
</el-card> </el-card>
</el-col> </el-col>
@ -202,6 +209,54 @@
<svg-icon icon-class="top" /> <svg-icon icon-class="top" />
</div> </div>
</el-backtop> </el-backtop>
<!-- 举报对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
append-to-body
>
<el-form
ref="reportForm"
:model="reportForm"
:rules="reportRules"
label-width="80px"
>
<!-- <el-form-item label="举报用户id" prop="reportUserId">
<el-input v-model="form.reportUserId" placeholder="请输入举报用户id" />
</el-form-item>
<el-form-item label="被举报内容id" prop="reportContentId">
<el-input v-model="form.reportContentId" placeholder="请输入被举报内容id" />
</el-form-item>
<el-form-item label="举报时间" prop="reportTime">
<el-input v-model="form.reportTime" placeholder="请输入举报时间" />
</el-form-item> -->
<el-form-item
label="举报原因"
prop="reportReason"
>
<el-input
v-model="reportForm.reportReason"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
<!-- <el-form-item label="处理结果" prop="result">
<el-input v-model="form.result" type="textarea" placeholder="请输入内容" />
</el-form-item> -->
</el-form>
<div
slot="footer"
class="dialog-footer"
>
<el-button
type="primary"
@click="submitReportForm"
> </el-button>
<el-button @click="cancelReport"> </el-button>
</div>
</el-dialog>
</el-row> </el-row>
</template> </template>
@ -216,7 +271,13 @@ import {
CommunityInfo, CommunityInfo,
addViews, addViews,
} from "@/api/community/info"; } from "@/api/community/info";
import {
listReport,
getReport,
delReport,
addReport,
updateReport,
} from "@/api/community/report";
export default { export default {
dicts: ["post_type", "community_field", "community_industry"], dicts: ["post_type", "community_field", "community_industry"],
components: { components: {
@ -228,6 +289,19 @@ export default {
commentForm: { commentForm: {
content: "", content: "",
}, },
//
reportForm: {},
reportRules: {
reportReason: [
{
required: true,
message: "举报原因不能为空",
trigger: "blur",
},
],
},
title: "举报内容",
open: false,
}; };
}, },
watch: { watch: {
@ -242,6 +316,47 @@ export default {
...mapState(["userInfo", "administrator"]), ...mapState(["userInfo", "administrator"]),
}, },
methods: { methods: {
/** 提交按钮 */
submitReportForm() {
this.$refs["reportForm"].validate((valid) => {
addReport(this.reportForm).then((response) => {
this.$modal.msgSuccess("举报成功");
this.open = false;
this.reportForm = {};
});
});
},
cancelReport() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
reportId: null,
reportUserId: null,
reportContentId: null,
reportTime: null,
reportReason: null,
status: null,
reportType: null,
result: null,
};
this.resetForm("reportForm");
},
//
handleReport(info, type) {
if (type == 0) {
//
this.reportForm.reportContentId = info.postId;
this.reportForm.reportType = "0";
} else {
//
this.reportForm.reportContentId = info.replyId;
this.reportForm.reportType = "1";
}
this.open = true;
},
// //
async getBlogInfomation() { async getBlogInfomation() {
// //
@ -391,6 +506,11 @@ hr.style-one {
float: right; float: right;
} }
.blog-report {
text-align: right;
cursor: pointer;
}
.user-info { .user-info {
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;

View File

@ -316,7 +316,7 @@
<div class="tags"> <div class="tags">
<div <div
class=" tag-item" class=" tag-item"
v-for="tag in dict.type.community_industry" v-for="tag in dict.type.community_field"
:key="tag.value" :key="tag.value"
@click="selectFieldTag(tag)" @click="selectFieldTag(tag)"
> >

View File

@ -0,0 +1,552 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
style="text-align:right"
>
<el-form-item
label="处理状态"
prop="status"
>
<el-select
v-model="queryParams.status"
placeholder="请选择"
>
<el-option
v-for="item in dict.type.community_report_status"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="举报时间"
prop="reportTime"
>
<el-date-picker
v-model="datetimerange"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
clearable
>
</el-date-picker>
</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="['system:report: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:report: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:report: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:report:export']"
>导出</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> -->
<el-table
v-loading="loading"
:data="reportList"
>
<!-- <el-table-column
type="selection"
width="55"
align="center"
/> -->
<!-- <el-table-column
label="举报id"
align="center"
prop="reportId"
/> -->
<el-table-column
label="举报用户"
align="center"
prop="userName"
/>
<el-table-column
label="被举报内容"
align="center"
prop="reportContentId"
></el-table-column>
<el-table-column
label="举报时间"
align="center"
prop="reportTime"
/>
<el-table-column
label="举报原因"
align="center"
prop="reportReason"
/>
<el-table-column
label="状态"
align="center"
prop="status"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.community_report_status"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column
label="举报类型"
align="center"
prop="reportType"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.community_report_type"
:value="scope.row.reportType"
/>
</template>
</el-table-column>
<el-table-column
label="处理结果"
align="center"
prop="result"
/>
<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:report:edit']"
>处理</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:report: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-card class="box-card">
<el-row>
<el-col :span="12"> <el-form-item
label="举报用户"
prop="userName"
>
<span class="diag-content">{{ form.userName }}</span>
</el-form-item></el-col>
<el-col :span="12"> <el-form-item
label="举报时间"
prop="reportTime"
>
<span class="diag-content">{{ form.reportTime }}</span>
</el-form-item></el-col>
</el-row>
<el-row>
<el-col :span="24"><el-form-item
label="举报内容"
prop="reportContentId"
>
<span class="diag-content">{{ form.reportContentId }}</span>
</el-form-item></el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="举报原因"
prop="reportReason"
>
<span class="diag-content">{{ form.reportReason }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="处理结果"
prop="result"
>
<el-input
v-model="form.result"
type="textarea"
placeholder="请输入处理结论"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="处理结论"
prop="process"
>
<el-select
v-model="form.process"
placeholder="请选择"
>
<el-option
v-for="item in dict.type.community_report_result"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-card>
</el-form>
<!-- <el-form
ref="form"
:model="form"
:rules="rules"
label-width="80px"
>
<el-form-item
label="举报用户id"
prop="reportUserId"
>
<el-input
v-model="form.reportUserId"
placeholder="请输入举报用户id"
/>
</el-form-item>
<el-form-item
label="被举报内容id"
prop="reportContentId"
>
<el-input
v-model="form.reportContentId"
placeholder="请输入被举报内容id"
/>
</el-form-item>
<el-form-item
label="举报时间"
prop="reportTime"
>
<el-input
v-model="form.reportTime"
placeholder="请输入举报时间"
/>
</el-form-item>
<el-form-item
label="举报原因"
prop="reportReason"
>
<el-input
v-model="form.reportReason"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
<el-form-item
label="处理结果"
prop="result"
>
<el-input
v-model="form.result"
type="textarea"
placeholder="请输入内容"
/>
</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 {
listReport,
getReport,
delReport,
addReport,
updateReport,
} from "@/api/community/report";
export default {
name: "Report",
dicts: [
"community_report_status",
"community_report_type",
"community_report_result",
],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
reportList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
reportUserId: null,
reportContentId: null,
reportTime: null,
reportReason: null,
status: null,
reportType: null,
result: null,
startTime: null,
endTime: null,
},
//
form: {
process: 0,
},
//
rules: {
result: [
{
required: true,
message: "处理结果不能为空",
trigger: "blur",
},
],
process: [
{
required: true,
message: "处理结论不能为空",
trigger: "blur",
},
],
},
datetimerange: [],
};
},
created() {
this.getList();
},
methods: {
/** 查询社区帖子举报列表 */
getList() {
this.loading = true;
listReport(this.queryParams).then((response) => {
this.reportList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
reportId: null,
reportUserId: null,
reportContentId: null,
reportTime: null,
reportReason: null,
status: null,
reportType: null,
result: null,
userName: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.queryParams.startTime = this.datetimerange[0];
this.queryParams.endTime = this.datetimerange[1];
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.datetimerange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.reportId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加社区帖子举报";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const reportId = row.reportId || this.ids;
getReport(reportId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "社区贴子举报处理";
});
},
/** 提交按钮 */
submitForm() {
this.form.result = this.form.process + ":" + this.form.result;
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.reportId != null) {
updateReport(this.form).then((response) => {
this.$modal.msgSuccess("处理提交成功");
this.open = false;
this.getList();
});
} else {
addReport(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const reportIds = row.reportId || this.ids;
this.$modal
.confirm('是否确认删除社区帖子举报编号为"' + reportIds + '"的数据项?')
.then(function () {
return delReport(reportIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/report/export",
{
...this.queryParams,
},
`report_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<style scoped>
.diag-content {
color: darkgreen;
white-space: nowrap;
}
</style>