浏览代码

报表管理添加分享按钮

Raod 4 年之前
父节点
当前提交
d235f9c329

+ 16 - 11
report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java

@@ -9,12 +9,12 @@ import com.anjiplus.template.gaea.business.modules.report.controller.dto.ReportD
 import com.anjiplus.template.gaea.business.modules.report.controller.param.ReportParam;
 import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report;
 import com.anjiplus.template.gaea.business.modules.report.service.ReportService;
+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 org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * TODO
@@ -28,6 +28,9 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/report")
 public class ReportController extends GaeaBaseController<ReportParam, Report, ReportDto> {
 
+    @Autowired
+    private ReportShareService reportShareService;
+
     @Autowired
     private ReportService reportService;
 
@@ -47,15 +50,17 @@ public class ReportController extends GaeaBaseController<ReportParam, Report, Re
     }
 
     @DeleteMapping("/delReport")
-    @Permission(
-            code = "delete",
-            name = "删除"
-    )
-    @GaeaAuditLog(
-            pageTitle = "删除"
-    )
+    @Permission(code = "delete", name = "删除")
+    @GaeaAuditLog(pageTitle = "删除")
     public ResponseBean delReport(@RequestBody ReportDto reportDto) {
         reportService.delReport(reportDto);
         return ResponseBean.builder().build();
     }
+
+    @PostMapping("/share")
+    @Permission(code = "share", name = "分享")
+    @GaeaAuditLog(pageTitle = "分享")
+    public ResponseBean share(@Validated @RequestBody ReportShareDto dto) {
+        return ResponseBean.builder().data(reportShareService.insertShare(dto)).build();
+    }
 }

+ 71 - 84
report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/controller/ReportShareController.java

@@ -1,84 +1,71 @@
-
-package com.anjiplus.template.gaea.business.modules.reportshare.controller;
-
-import com.anji.plus.gaea.annotation.AccessKey;
-import com.anji.plus.gaea.annotation.Permission;
-import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
-import com.anji.plus.gaea.bean.ResponseBean;
-import com.anji.plus.gaea.curd.controller.GaeaBaseController;
-import com.anji.plus.gaea.curd.service.GaeaBaseService;
-import com.anji.plus.gaea.utils.GaeaBeanUtils;
-import com.anji.plus.gaea.utils.GaeaUtils;
-import com.anjiplus.template.gaea.business.modules.reportshare.controller.dto.ReportShareDto;
-import com.anjiplus.template.gaea.business.modules.reportshare.controller.param.ReportShareParam;
-import com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare;
-import com.anjiplus.template.gaea.business.modules.reportshare.service.ReportShareService;
-import io.swagger.annotations.Api;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author Raod
- * @desc 报表分享 controller
- * @date 2021-08-18 13:37:26.663
- **/
-@RestController
-@Api(tags = "报表分享管理")
-@RequestMapping("/reportShare")
-@Permission(code = "ReportShare", name = "报表分享管理")
-public class ReportShareController extends GaeaBaseController<ReportShareParam, ReportShare, ReportShareDto> {
-
-    @Autowired
-    private ReportShareService reportShareService;
-
-    @Override
-    public GaeaBaseService<ReportShareParam, ReportShare> getService() {
-        return reportShareService;
-    }
-
-    @Override
-    public ReportShare getEntity() {
-        return new ReportShare();
-    }
-
-    @Override
-    public ReportShareDto getDTO() {
-        return new ReportShareDto();
-    }
-
-
-    @GetMapping({"/{id}"})
-    @AccessKey
-    @Override
-    @Permission(code = "detail", name = "明细")
-    public ResponseBean detail(@PathVariable("id") Long id) {
-        this.logger.info("{}根据ID查询服务开始,id为:{}", this.getClass().getSimpleName(), id);
-        ReportShare result = reportShareService.getDetail(id);
-        ReportShareDto dto = this.getDTO();
-        GaeaBeanUtils.copyAndFormatter(result, dto);
-        ResponseBean responseBean = this.responseSuccessWithData(this.resultDtoHandle(dto));
-        this.logger.info("{}根据ID查询结束,结果:{}", this.getClass().getSimpleName(), GaeaUtils.toJSONString(responseBean));
-        return responseBean;
-    }
-
-    @GetMapping({"/detailByCode"})
-    @Permission(code = "detail", name = "明细")
-    public ResponseBean detailByCode(@RequestParam("shareCode") String shareCode) {
-        return ResponseBean.builder().data(reportShareService.detailByCode(shareCode)).build();
-    }
-
-    @PostMapping
-    @Permission(
-            code = "insert",
-            name = "新增"
-    )
-    @GaeaAuditLog(
-            pageTitle = "新增"
-    )
-    @Override
-    public ResponseBean insert(@Validated @RequestBody ReportShareDto dto) {
-        return ResponseBean.builder().data(reportShareService.insertShare(dto)).build();
-    }
-
-}
+//
+//package com.anjiplus.template.gaea.business.modules.reportshare.controller;
+//
+//import com.anji.plus.gaea.annotation.AccessKey;
+//import com.anji.plus.gaea.annotation.Permission;
+//import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
+//import com.anji.plus.gaea.bean.ResponseBean;
+//import com.anji.plus.gaea.curd.controller.GaeaBaseController;
+//import com.anji.plus.gaea.curd.service.GaeaBaseService;
+//import com.anji.plus.gaea.utils.GaeaBeanUtils;
+//import com.anji.plus.gaea.utils.GaeaUtils;
+//import com.anjiplus.template.gaea.business.modules.reportshare.controller.dto.ReportShareDto;
+//import com.anjiplus.template.gaea.business.modules.reportshare.controller.param.ReportShareParam;
+//import com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare;
+//import com.anjiplus.template.gaea.business.modules.reportshare.service.ReportShareService;
+//import io.swagger.annotations.Api;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.validation.annotation.Validated;
+//import org.springframework.web.bind.annotation.*;
+//
+///**
+// * @author Raod
+// * @desc 报表分享 controller
+// * @date 2021-08-18 13:37:26.663
+// **/
+//@RestController
+//@Api(tags = "报表分享管理")
+//@RequestMapping("/reportShare")
+//@Permission(code = "reportShareManage", name = "报表分享管理")
+//public class ReportShareController extends GaeaBaseController<ReportShareParam, ReportShare, ReportShareDto> {
+//
+//    @Autowired
+//    private ReportShareService reportShareService;
+//
+//    @Override
+//    public GaeaBaseService<ReportShareParam, ReportShare> getService() {
+//        return reportShareService;
+//    }
+//
+//    @Override
+//    public ReportShare getEntity() {
+//        return new ReportShare();
+//    }
+//
+//    @Override
+//    public ReportShareDto getDTO() {
+//        return new ReportShareDto();
+//    }
+//
+//
+//    @GetMapping({"/{id}"})
+//    @AccessKey
+//    @Override
+//    @Permission(code = "detail", name = "明细")
+//    public ResponseBean detail(@PathVariable("id") Long id) {
+//        this.logger.info("{}根据ID查询服务开始,id为:{}", this.getClass().getSimpleName(), id);
+//        ReportShare result = reportShareService.getDetail(id);
+//        ReportShareDto dto = this.getDTO();
+//        GaeaBeanUtils.copyAndFormatter(result, dto);
+//        ResponseBean responseBean = this.responseSuccessWithData(this.resultDtoHandle(dto));
+//        this.logger.info("{}根据ID查询结束,结果:{}", this.getClass().getSimpleName(), GaeaUtils.toJSONString(responseBean));
+//        return responseBean;
+//    }
+//
+//    @GetMapping({"/detailByCode"})
+//    @Permission(code = "detail", name = "明细")
+//    public ResponseBean detailByCode(@RequestParam("shareCode") String shareCode) {
+//        return ResponseBean.builder().data(reportShareService.detailByCode(shareCode)).build();
+//    }
+//
+//}

+ 1 - 1
report-ui/src/api/reportShare.js

@@ -10,7 +10,7 @@ export function reportShareList(params) {
 
 export function reportShareAdd(data) {
   return request({
-    url: 'reportShare',
+    url: 'report/share',
     method: 'post',
     data
   })

+ 5 - 2
report-ui/src/views/report/report/components/share.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog class="tree_dialog" :title="title" width="60%" :close-on-click-modal="false" center :visible.sync="visib" :before-close="closeDialog">
+  <el-dialog class="tree_dialog" :title="titleBuild()" width="60%" :close-on-click-modal="false" center :visible.sync="visib" :before-close="closeDialog">
     <el-form ref="userForm" :model="dialogForm" :rules="rules" size="small" label-width="100px">
       <el-row :gutter="10">
         <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
@@ -50,7 +50,7 @@ export default {
   },
   data() {
     return {
-      title: '报表分享-' + this.reportName + '【' +this.reportCode + '】',
+      title: '报表分享',
       reportShareUrl:'',
       shareValidTypeOptions: [], // 有效期类型
       dialogForm: {
@@ -76,6 +76,9 @@ export default {
   },
   created() {},
   methods: {
+    titleBuild(){
+      return '【' +this.reportName + '】' + '报表分享-' + this.reportCode
+    },
     selectChange(val) {
       this.dialogForm.shareValidType = val
     },

+ 28 - 1
report-ui/src/views/report/report/index.vue

@@ -19,6 +19,21 @@
         v-permission="'bigScreenManage:design'"
         >设计</el-button
       >
+      <el-button
+        type="text"
+        @click="shareReport(props.msg)"
+        v-permission="'bigScreenManage:share'"
+      >分享</el-button
+      >
+    </template>
+
+    <template v-slot:pageSection>
+      <Share
+        :visib="visibleForShareDialog"
+        :reportCode="reportCodeForShareDialog"
+        :reportName="reportNameForShareDialog"
+        @handleClose="visibleForShareDialog = false"
+      />
     </template>
   </anji-crud>
 </template>
@@ -30,13 +45,19 @@ import {
   reportUpdate,
   reportDetail
 } from "@/api/reportmanage";
+import Share from "@/views/report/report/components/share";
 export default {
   name: "Report",
   components: {
-    anjiCrud: require("@/components/AnjiPlus/anji-crud/anji-crud").default
+    anjiCrud: require("@/components/AnjiPlus/anji-crud/anji-crud").default,
+    Share
   },
   data() {
     return {
+      // 分享
+      visibleForShareDialog: false,
+      reportCodeForShareDialog: "",
+      reportNameForShareDialog: "",
       crudOption: {
         // 使用菜单做为页面标题
         title: "报表管理",
@@ -233,6 +254,12 @@ export default {
         }
       });
       window.open(routeUrl.href, "_blank");
+    },
+    //分享
+    shareReport(val){
+      this.reportCodeForShareDialog = val.reportCode;
+      this.reportNameForShareDialog = val.reportName;
+      this.visibleForShareDialog = true;
     }
   }
 };