需求----新增报表分享菜单

Raod 2 years ago
parent 50a3aa2e29
commit db091f00b7

@ -66,4 +66,11 @@ public class ReportShareController extends GaeaBaseController<ReportShareParam,
return ResponseBean.builder().data(reportShareService.detailByCode(shareCode)).build();
}
@PostMapping({"/shareDelay"})
@Permission(code = "shareDelay", name = "分享延期")
public ResponseBean shareDelay(@RequestBody ReportShareDto dto) {
reportShareService.shareDelay(dto);
return ResponseBean.builder().build();
}
}

@ -2,6 +2,8 @@
package com.anjiplus.template.gaea.business.modules.reportshare.controller.dto;
import java.io.Serializable;
import com.anji.plus.gaea.annotation.Formatter;
import com.anji.plus.gaea.curd.dto.GaeaBaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ -1,16 +1,26 @@
/**/
package com.anjiplus.template.gaea.business.modules.reportshare.controller.param;
import com.anji.plus.gaea.annotation.Query;
import com.anji.plus.gaea.constant.QueryEnum;
import com.anji.plus.gaea.curd.params.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @desc ReportShare
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
* @author Raod
* @desc ReportShare
* @date 2021-08-18 13:37:26.663
**/
@Data
public class ReportShareParam extends PageParam implements Serializable{
public class ReportShareParam extends PageParam implements Serializable {
/** 分享编码系统生成默认UUID */
@Query(value = QueryEnum.EQ)
private String shareCode;
/** 报表编码 */
@Query(value = QueryEnum.LIKE)
private String reportCode;
}

@ -24,4 +24,10 @@ public interface ReportShareService extends GaeaBaseService<ReportShareParam, Re
ReportShareDto insertShare(ReportShareDto dto);
ReportShare detailByCode(String shareCode);
/**
*
* @param dto
*/
void shareDelay(ReportShareDto dto);
}

@ -86,6 +86,23 @@ public class ReportShareServiceImpl implements ReportShareService {
return reportShare;
}
/**
*
*
* @param dto
*/
@Override
public void shareDelay(ReportShareDto dto) {
Integer shareValidType = dto.getShareValidType();
if (null == dto.getId() || null == shareValidType) {
throw BusinessExceptionBuilder.build("入参不完整");
}
ReportShare entity = selectOne(dto.getId());
entity.setShareValidTime(DateUtil.getFutureDateTmdHmsByTime(entity.getShareValidTime(), shareValidType));
entity.setShareToken(JwtUtil.createToken(entity.getReportCode(), entity.getShareCode(), entity.getSharePassword(), entity.getShareValidTime()));
update(entity);
}
@Override
public void processBeforeOperation(ReportShare entity, BaseOperationEnum operationEnum) throws BusinessException {
switch (operationEnum) {

@ -62,6 +62,23 @@ public class DateUtil {
return calendar.getTime();
}
/**
*
* @param time
* @param day
* @return
*/
public static Date getFutureDateTmdHmsByTime(Date time, int day) {
if (day <= 0) {
//默认2099年
return parse("2099-01-01", defaultDatePattern);
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(time);
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + day);
return calendar.getTime();
}
public static void main(String[] args) {
Date futureDateTmdHms = getFutureDateTmdHms(7);
System.out.println(futureDateTmdHms);

@ -0,0 +1,8 @@
INSERT INTO `aj_report`.`access_authority`(`parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('report', 'reportShareManage', '报表分享', 'query', '查询报表分享', 231, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
INSERT INTO `aj_report`.`access_authority`(`parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('report', 'reportShareManage', '报表分享', 'detail', '查询明细', 232, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
INSERT INTO `aj_report`.`access_authority`(`parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('report', 'reportShareManage', '报表分享', 'shareDelay', '分享延期', 233, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
INSERT INTO `aj_report`.`access_authority`(`parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('report', 'reportShareManage', '报表分享', 'delete', '删除分享', 234, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
INSERT INTO `aj_report`.`access_role_authority`(`role_code`, `target`, `action`) VALUES ('root', 'reportShareManage', 'query');
INSERT INTO `aj_report`.`access_role_authority`(`role_code`, `target`, `action`) VALUES ('root', 'reportShareManage', 'detail');
INSERT INTO `aj_report`.`access_role_authority`(`role_code`, `target`, `action`) VALUES ('root', 'reportShareManage', 'shareDelay');
INSERT INTO `aj_report`.`access_role_authority`(`role_code`, `target`, `action`) VALUES ('root', 'reportShareManage', 'delete');

@ -16,12 +16,20 @@ export function reportShareAdd(data) {
})
}
export function reportShareDelay(data) {
return request({
url: 'reportShare/shareDelay',
method: 'post',
data
})
}
export function reportShareDeleteBatch(data) {
return request({
url: 'reportShare/delete/batch',
method: 'post',
data
})
return request({
url: 'reportShare/delete/batch',
method: 'post',
data
})
}
export function reportShareUpdate(data) {
@ -35,7 +43,7 @@ export function reportShareDetail(data) {
return request({
url: 'reportShare/' + data.id,
method: 'get',
params: { accessKey: data.accessKey }
params: {accessKey: data.accessKey}
})
}
@ -43,8 +51,8 @@ export function reportShareDetailByCode(data) {
return request({
url: 'reportShare/detailByCode',
method: 'get',
params: { shareCode: data }
params: {shareCode: data}
})
}
export default { reportShareList, reportShareAdd, reportShareDeleteBatch, reportShareUpdate, reportShareDetail }
export default {reportShareList, reportShareAdd, reportShareDeleteBatch, reportShareUpdate, reportShareDetail}

@ -176,6 +176,18 @@ export const constantRouterMap = [
permission: 'excelManage'
}
},
{
path: 'reportshare',
name: 'reportshare',
component: () => import('@/views/reportShare/index'),
meta: {
title: '报表分享',
icon: 'iconliebiao',
keepAlive: true,
requireAuth: true,
permission: 'reportShareManage'
}
},
]
},
{

@ -0,0 +1,238 @@
<template>
<anji-crud ref="listPage" :option="crudOption">
<template v-slot:pageSection>
</template>
</anji-crud>
</template>
<script>
import {
reportShareDeleteBatch,
reportShareDetail,
reportShareList,
reportShareDelay, reportShareAdd
} from "@/api/reportShare";
export default {
name: "Report",
components: {
anjiCrud: require("@/components/AnjiPlus/anji-crud/anji-crud").default,
},
data() {
return {
crudOption: {
// 使
title: '报表分享',
//
labelWidth: '120px',
//
queryFormFields: [
{
inputType: "input",
label: "分享编码",
field: "shareCode"
},
{
inputType: "input",
label: "报表编码",
field: "reportCode"
},
],
//
tableButtons: [
{
label: "删除",
type: "danger",
permission: "reportShareManage:delete",
icon: "el-icon-delete",
plain: false,
click: () => {
return this.$refs.listPage.handleDeleteBatch();
}
}
],
//
rowButtons: [
{
label: "复制url",
click: this.copyUrlPath
},
{
label: "删除",
permission: "reportShareManage:delete",
click: row => {
return this.$refs.listPage.handleDeleteBatch(row);
}
},
{
label: "延期1天",
permission: "reportShareManage:shareDelay",
click: this.shareDelay_1
},
{
label: "延期1周",
permission: "reportShareManage:shareDelay",
click: this.shareDelay_7
},
{
label: "延期1月",
permission: "reportShareManage:shareDelay",
click: this.shareDelay_30
},
],
//
buttons: {
query: {
api: reportShareList,
permission: 'ReportShare:query'
},
queryByPrimarykey: {
api: reportShareDetail,
permission: 'ReportShare:detail'
},
delete: {
api: reportShareDeleteBatch,
permission: 'ReportShare:delete'
},
rowButtonsWidth: 150 // row
},
//
columns: [
{
label: '',
field: 'id',
primaryKey: true, // ,
tableHide: true, //
editHide: true, //
},
{
label: '报表编码',//
placeholder: '',
field: 'reportCode',
editField: 'reportCode',
inputType: 'input',
rules: [
{ min: 1, max: 50, message: '不超过50个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享编码',//UUID
placeholder: '',
field: 'shareCode',
editField: 'shareCode',
inputType: 'input',
rules: [
{ min: 1, max: 50, message: '不超过50个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享有效期类型',//DIC_NAME=SHARE_VAILD
placeholder: '',
field: 'shareValidType',
fieldTableRowRenderer: row => {
return this.getDictLabelByCode("SHARE_VAILD", row["shareValidType"]);
},
editField: 'shareValidType',
inputType: 'input',
rules: [
],
disabled: false,
},
{
label: '分享有效期',//
placeholder: '',
field: 'shareValidTime',
editField: 'shareValidTime',
inputType: 'input',
rules: [
],
disabled: false,
},
{
label: '分享token',//token
placeholder: '',
field: 'shareToken',
editField: 'shareToken',
inputType: 'input',
rules: [
{ min: 1, max: 255, message: '不超过255个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享url',//url
placeholder: '',
field: 'shareUrl',
editField: 'shareUrl',
inputType: 'input',
rules: [
{ min: 1, max: 100, message: '不超过100个字符', trigger: 'blur' }
],
disabled: false,
},
],
//
// formData fieldName, fieldVal, fieldExtend
// fieldName input name
// fieldVal input
// fieldExtend select
formChange: (formData, fieldName, fieldVal, fieldExtend) => {
}
},
//
copyVisible: false,
rowData: {}
};
},
created() {},
methods: {
handleOpenDialog1() {
alert("自定义按钮1点击事件");
},
shareDelay_1(val) {
this.shareDelay(val.id, 1)
},
shareDelay_7(val) {
this.shareDelay(val.id, 7)
},
shareDelay_30(val) {
this.shareDelay(val.id, 30)
},
async shareDelay(shareId, shareValidType) {
const param = {}
param['id'] = shareId
param['shareValidType'] = shareValidType
const {code} = await reportShareDelay(param);
if (code != "200") return;
this.$message({
message: "延期成功!",
type: "success"
});
this.$refs.listPage.handleQueryForm("query");
},
copyUrlPath(val) {
this.copyToClip(val.shareUrl);
this.$message({
message: "已将url路径复制至剪切板",
type: "success"
});
},
copyToClip(content, message) {
let aux = document.createElement("input");
aux.setAttribute("value", content);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
}
}
};
</script>
Loading…
Cancel
Save