需求--分享权限控制

qianming 2 years ago
parent 37ec629558
commit 1f206bd220

@ -101,6 +101,7 @@ public class ReportDashboardController {
@PostMapping("/share") @PostMapping("/share")
@GaeaAuditLog(pageTitle = "分享") @GaeaAuditLog(pageTitle = "分享")
@Permission(code = "bigScreenManage", name = "分享报表")
public ResponseBean share(@Validated @RequestBody ReportShareDto dto) { public ResponseBean share(@Validated @RequestBody ReportShareDto dto) {
return ResponseBean.builder().data(reportShareService.insertShare(dto)).build(); return ResponseBean.builder().data(reportShareService.insertShare(dto)).build();
} }

@ -10,8 +10,11 @@ import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.Re
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.param.ReportExcelParam; import com.anjiplus.template.gaea.business.modules.reportexcel.controller.param.ReportExcelParam;
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel;
import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService; import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService;
import com.anjiplus.template.gaea.business.modules.reportshare.controller.dto.ReportShareDto;
import com.anjiplus.template.gaea.business.modules.reportshare.service.ReportShareService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
/** /**
@ -27,6 +30,9 @@ public class ReportExcelController extends GaeaBaseController<ReportExcelParam,
@Autowired @Autowired
private ReportExcelService reportExcelService; private ReportExcelService reportExcelService;
@Autowired
private ReportShareService reportShareService;
@Override @Override
public GaeaBaseService<ReportExcelParam, ReportExcel> getService() { public GaeaBaseService<ReportExcelParam, ReportExcel> getService() {
return reportExcelService; return reportExcelService;
@ -75,4 +81,11 @@ public class ReportExcelController extends GaeaBaseController<ReportExcelParam,
// return ResponseBean.builder().code(ResponseCode.SUCCESS_CODE) // return ResponseBean.builder().code(ResponseCode.SUCCESS_CODE)
// .build(); // .build();
// } // }
@PostMapping("/share")
@GaeaAuditLog(pageTitle = "excel分享")
@Permission(code = "reportExcel", name = "分享报表")
public ResponseBean share(@Validated @RequestBody ReportShareDto dto) {
return ResponseBean.builder().data(reportShareService.insertShare(dto)).build();
}
} }

@ -0,0 +1,3 @@
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', 'excelManage', '表格报表', 'share', '分享报表', 231, 1, 0, 'admin', now(), 'admin', now(), 1);
INSERT INTO `aj_report`.`access_role_authority`(`role_code`, `target`, `action`) VALUES ('root', 'excelManage', 'share');

@ -16,6 +16,14 @@ export function reportShareAdd(data) {
}) })
} }
export function excelShareAdd(data) {
return request({
url: 'reportExcel/share',
method: 'post',
data
})
}
export function reportShareDelay(data) { export function reportShareDelay(data) {
return request({ return request({
url: 'reportShare/shareDelay', url: 'reportShare/shareDelay',

@ -269,16 +269,19 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="option.rowButtons.length <= 2"> <div v-if="option.rowButtons.length <= 2">
<el-button <template v-for="(item, index) in option.rowButtons">
v-for="(item, index) in option.rowButtons" <el-button
:key="index" v-if="isHide(item, scope.row)"
v-permission="item.permission" :key="index"
:disabled="isDisabledButton(item, scope.row)" v-permission="item.permission"
:type="item.type || 'text'" :disabled="isDisabledButton(item, scope.row)"
size="small" :type="item.type || 'text'"
@click="item.click(scope.row)" size="small"
@click="item.click(scope.row)"
>{{ handlegetLable(scope.row, item.label) }}</el-button >{{ handlegetLable(scope.row, item.label) }}</el-button
> >
</template>
</div> </div>
<div v-else> <div v-else>
<el-button <el-button
@ -299,20 +302,22 @@
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix"> <el-dropdown-item class="clearfix">
<el-button <template v-for="(item, index) in option.rowButtons.filter(
v-for="(item, index) in option.rowButtons.filter(
(el, index) => index > 0 (el, index) => index > 0
)" )">
:key="index" <el-button
v-permission="item.permission" v-if="isHide(item, scope.row)"
:type="item.type || 'text'" :key="index"
:disabled="isDisabledButton(item, scope.row)" v-permission="item.permission"
size="small" :type="item.type || 'text'"
@click="item.click(scope.row)" :disabled="isDisabledButton(item, scope.row)"
size="small"
@click="item.click(scope.row)"
>{{ >{{
handlegetLable(scope.row, item.label) handlegetLable(scope.row, item.label)
}}</el-button }}</el-button
> >
</template>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@ -665,6 +670,14 @@ export default {
return !!item.disabled; return !!item.disabled;
} }
}, },
//
isHide(item, row) {
if (typeof item.isHide === "function") {
return item.isHide(row);
} else {
return !item.isHide;
}
},
// //
editDialogClosedEvent(value) { editDialogClosedEvent(value) {
// //

@ -90,7 +90,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { reportShareAdd } from "@/api/reportShare"; import { excelShareAdd } from "@/api/reportShare";
import { getDictList } from "@/api/dict-data"; // import { getDictList } from "@/api/dict-data"; //
import Dictionary from "@/components/Dictionary/index"; import Dictionary from "@/components/Dictionary/index";
export default { export default {
@ -175,8 +175,7 @@ export default {
this.dialogForm.reportType = this.reportType; this.dialogForm.reportType = this.reportType;
this.dialogForm.reportCode = this.reportCode; this.dialogForm.reportCode = this.reportCode;
this.dialogForm.shareUrl = window.location.href; this.dialogForm.shareUrl = window.location.href;
console.log(this.dialogForm) const { code, data } = await excelShareAdd(this.dialogForm);
const { code, data } = await reportShareAdd(this.dialogForm);
if (code != "200") return; if (code != "200") return;
this.shareLinkFlag1 = false; this.shareLinkFlag1 = false;
this.$message({ this.$message({

@ -64,7 +64,7 @@
class="view" class="view"
type="text" type="text"
@click="share(item)" @click="share(item)"
v-permission="'bigScreenManage:share'" v-permission="'excelManage:share'"
/> />
<el-button <el-button
icon="el-icon-view" icon="el-icon-view"

@ -91,6 +91,7 @@
</template> </template>
<script> <script>
import { reportShareAdd } from "@/api/reportShare"; import { reportShareAdd } from "@/api/reportShare";
import { excelShareAdd } from "@/api/reportShare";
import { getDictList } from "@/api/dict-data"; // import { getDictList } from "@/api/dict-data"; //
import Dictionary from "@/components/Dictionary/index"; import Dictionary from "@/components/Dictionary/index";
export default { export default {
@ -175,7 +176,8 @@ export default {
this.dialogForm.reportType = this.reportType; this.dialogForm.reportType = this.reportType;
this.dialogForm.reportCode = this.reportCode; this.dialogForm.reportCode = this.reportCode;
this.dialogForm.shareUrl = window.location.href; this.dialogForm.shareUrl = window.location.href;
const { code, data } = await reportShareAdd(this.dialogForm); const urlType = this.reportType == 'report_screen' ? reportShareAdd(this.dialogForm) : excelShareAdd(this.dialogForm)
const { code, data } = await urlType
if (code != "200") return; if (code != "200") return;
this.shareLinkFlag1 = false; this.shareLinkFlag1 = false;
this.$message({ this.$message({

@ -123,6 +123,17 @@ export default {
{ {
label: "分享", label: "分享",
permission: "bigScreenManage:share", permission: "bigScreenManage:share",
isHide: (row) => {
return row.reportType == 'report_screen'
},
click: this.shareReport
},
{
label: "分享",
permission: "excelManage:share",
isHide: (row) => {
return row.reportType == 'report_excel'
},
click: this.shareReport click: this.shareReport
}, },
{ {
@ -361,6 +372,20 @@ export default {
this.reportTypeForShareDialog = val.reportType; this.reportTypeForShareDialog = val.reportType;
this.visibleForShareDialog = true; this.visibleForShareDialog = true;
}, },
checkReport(val) {
if ("report_screen" == val.reportType) {
return true;
}else {
return false;
}
},
checkExcel(val) {
if ("report_excel" == val.reportType) {
return true;
}else {
return false;
}
},
// //
async copyReport(val) { async copyReport(val) {
this.copyVisible = true; this.copyVisible = true;

Loading…
Cancel
Save