From ea8fe4b44f2b7f708b2769b53e0901081cd641cc Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 28 Feb 2022 11:05:10 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20tab=E6=96=B0=E5=A2=9E=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/utils/conditionUtil.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/utils/conditionUtil.js b/frontend/src/utils/conditionUtil.js index cc48c9e150..f557d516c6 100644 --- a/frontend/src/utils/conditionUtil.js +++ b/frontend/src/utils/conditionUtil.js @@ -48,7 +48,7 @@ export const buildFilterMap = panelItems => { } if (element.type === 'de-tabs') { element.options.tabList && element.options.tabList.forEach(tab => { - if (tab.content.propValue && tab.content.propValue.viewId) { + if (tab.content && tab.content.propValue && tab.content.propValue.viewId) { result[tab.content.propValue.viewId] = [] } }) From 6c5d080c0a27ea115638ced6671e0aeda66ff144 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 28 Feb 2022 11:15:04 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E6=B1=87=E6=80=BB=E8=A1=A8=E8=81=94?= =?UTF-8?q?=E5=8A=A8=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 26b4eb7e5d..55d58a53b2 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -255,7 +255,9 @@ const data = { for (let index = 0; index < state.componentData.length; index++) { const element = state.componentData[index] if (!element.type || element.type !== 'view') continue - const currentFilters = element.linkageFilters || [] // 当前联动filter + // const currentFilters = element.linkageFilters || [] // 当前联动filter + // 联动的视图情况历史条件 + const currentFilters = [] data.dimensionList.forEach(dimension => { const sourceInfo = viewId + '#' + dimension.id From 5141f52abb7bc9284f717112ce73a7d7e20ff6b0 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 28 Feb 2022 11:17:26 +0800 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/chart/ChartViewController.java | 43 ++++++++++++++----- frontend/src/api/chart/chart.js | 4 +- frontend/src/api/panel/panel.js | 4 +- .../canvas/custom-component/UserView.vue | 2 +- frontend/src/views/chart/group/Group.vue | 9 ++-- frontend/src/views/chart/view/ChartEdit.vue | 11 +++-- .../dataset/common/DatasetChartDetail.vue | 7 ++- 7 files changed, 56 insertions(+), 24 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java index d55cf8be57..cb7a49229c 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -1,7 +1,10 @@ package io.dataease.controller.chart; import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.dataease.auth.annotation.DePermission; import io.dataease.base.domain.ChartViewWithBLOBs; +import io.dataease.commons.constants.DePermissionType; +import io.dataease.commons.constants.ResourceAuthLevel; import io.dataease.commons.utils.AuthUtils; import io.dataease.controller.request.chart.ChartCalRequest; import io.dataease.controller.request.chart.ChartExtRequest; @@ -11,10 +14,12 @@ import io.dataease.dto.chart.ChartViewDTO; import io.dataease.service.chart.ChartViewService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; +import javax.ws.rs.Path; import java.util.List; /** @@ -29,52 +34,65 @@ public class ChartViewController { @Resource private ChartViewService chartViewService; + @RequiresPermissions("data:read") + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE) @ApiOperation("保存") - @PostMapping("/save") - public ChartViewWithBLOBs save(@RequestBody ChartViewWithBLOBs chartViewWithBLOBs) { + @PostMapping("/save/{panelId}") + public ChartViewWithBLOBs save(@PathVariable String panelId, @RequestBody ChartViewWithBLOBs chartViewWithBLOBs) { return chartViewService.save(chartViewWithBLOBs); } + @ApiIgnore @ApiOperation("查询") @PostMapping("/list") public List list(@RequestBody ChartViewRequest chartViewRequest) { return chartViewService.list(chartViewRequest); } + @ApiIgnore @ApiOperation("查询组") @PostMapping("/listAndGroup") public List listAndGroup(@RequestBody ChartViewRequest chartViewRequest) { return chartViewService.listAndGroup(chartViewRequest); } + @RequiresPermissions("data:read") + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW, paramIndex = 1) @ApiOperation("详细信息") - @PostMapping("/get/{id}") - public ChartViewWithBLOBs get(@PathVariable String id) { + @PostMapping("/get/{id}/{panelId}") + public ChartViewWithBLOBs get(@PathVariable String id, @PathVariable String panelId) { return chartViewService.get(id); } + @ApiIgnore @ApiOperation("删除") @PostMapping("/delete/{id}") public void delete(@PathVariable String id) { chartViewService.delete(id); } + @RequiresPermissions("data:read") + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW, paramIndex = 1) @ApiOperation("数据") - @PostMapping("/getData/{id}") - public ChartViewDTO getData(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception { + @PostMapping("/getData/{id}/{panelId}") + public ChartViewDTO getData(@PathVariable String id, @PathVariable String panelId, @RequestBody ChartExtRequest requestList) throws Exception { return chartViewService.getData(id, requestList); } + @RequiresPermissions("data:read") + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW, paramIndex = 1) @ApiOperation("视图详情") - @PostMapping("chartDetail/{id}") - public ChartDetail chartDetail(@PathVariable String id) { + @PostMapping("chartDetail/{id}/{panelId}") + public ChartDetail chartDetail(@PathVariable String id, @PathVariable String panelId) { return chartViewService.getChartDetail(id); } + @RequiresPermissions("data:read") + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE, paramIndex = 1) @ApiOperation("复制") @PostMapping("chartCopy/{id}/{panelId}") public String chartCopy(@PathVariable String id, @PathVariable String panelId) { - return chartViewService.chartCopy(id,panelId); + return chartViewService.chartCopy(id, panelId); } @ApiIgnore @@ -97,12 +115,15 @@ public class ChartViewController { return chartViewService.search(chartViewRequest); } + @RequiresPermissions("data:read") + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW) @ApiOperation("计算结果") - @PostMapping("/calcData") - public ChartViewDTO calcData(@RequestBody ChartCalRequest request) throws Exception { + @PostMapping("/calcData/{panelId}") + public ChartViewDTO calcData(@PathVariable String panelId, @RequestBody ChartCalRequest request) throws Exception { return chartViewService.calcData(request.getView(), request.getRequestList(), false); } + @ApiIgnore @ApiOperation("验证视图是否使用相同数据集") @GetMapping("/checkSameDataSet/{viewIdSource}/{viewIdTarget}") public String checkSameDataSet(@PathVariable String viewIdSource, @PathVariable String viewIdTarget) throws Exception { diff --git a/frontend/src/api/chart/chart.js b/frontend/src/api/chart/chart.js index b7657defbc..98273ff039 100644 --- a/frontend/src/api/chart/chart.js +++ b/frontend/src/api/chart/chart.js @@ -60,9 +60,9 @@ export function checkSameDataSet(viewIdSource, viewIdTarget) { }) } -export function ajaxGetDataOnly(id, data) { +export function ajaxGetDataOnly(id, panelId, data) { return request({ - url: '/chart/view/getData/' + id, + url: '/chart/view/getData/' + id + '/' + panelId, method: 'post', loading: true, hideMsg: true, diff --git a/frontend/src/api/panel/panel.js b/frontend/src/api/panel/panel.js index 0a399b81af..8b9d08eed5 100644 --- a/frontend/src/api/panel/panel.js +++ b/frontend/src/api/panel/panel.js @@ -56,9 +56,9 @@ export function groupTree(data, loading = true, timeout = 60000) { }) } -export function viewData(id, data) { +export function viewData(id, panelId, data) { return request({ - url: '/chart/view/getData/' + id, + url: '/chart/view/getData/' + id + '/' + panelId, method: 'post', hideMsg: true, data diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index a0243333f4..518dd17148 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -433,7 +433,7 @@ export default { ...this.filter, cache: cache } - method(id, requestInfo).then(response => { + method(id, this.panelInfo.id, requestInfo).then(response => { // 将视图传入echart组件 if (response.success) { this.chart = response.data diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index f90c4f38b1..5b89b3b00c 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -423,6 +423,9 @@ export default { computed: { chartType() { return this.view.type + }, + panelInfo() { + return this.$store.state.panel.panelInfo } }, watch: { @@ -545,7 +548,7 @@ export default { if (valid) { view.title = view.name view.sceneId = view.pid - post('/chart/view/save', view).then(response => { + post('/chart/view/save/' + this.panelInfo.id, view).then(response => { this.closeTable() this.$message({ message: this.$t('dataset.save_success'), @@ -772,7 +775,7 @@ export default { view.extBubble = JSON.stringify([]) this.setChartDefaultOptions(view) const _this = this - post('/chart/view/save', view).then(response => { + post('/chart/view/save/' + this.panelInfo.id, view).then(response => { this.closeCreateChart() this.$store.dispatch('chart/setTableId', null) this.$store.dispatch('chart/setTableId', this.table.id) @@ -905,7 +908,7 @@ export default { saveMoveDs() { const newSceneId = this.tDs.id this.dsForm.sceneId = newSceneId - post('/chart/view/save', this.dsForm).then(res => { + post('/chart/view/save/' + this.panelInfo.id, this.dsForm).then(res => { this.closeMoveDs() this.expandedArray.push(newSceneId) this.treeNode() diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 6a28dce9ff..dae87841f3 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1191,6 +1191,9 @@ export default { computed: { chartType() { return this.chart.type + }, + panelInfo() { + return this.$store.state.panel.panelInfo } }, watch: { @@ -1446,7 +1449,7 @@ export default { this.hasEdit = true const view = this.buildParam(getData, trigger, needRefreshGroup, switchType) if (!view) return - post('/chart/view/calcData', { + post('/chart/view/calcData/' + this.panelInfo.id, { view: view, requestList: { filter: [], @@ -1509,7 +1512,7 @@ export default { } const view = this.buildParam(true, 'chart', false, false) if (!view) return - post('/chart/view/save', view).then(response => { + post('/chart/view/save/' + this.panelInfo.id, view).then(response => { this.getChart(response.data.id) this.hasEdit = false this.refreshGroup(view) @@ -1524,7 +1527,7 @@ export default { getData(id) { this.hasEdit = false if (id) { - ajaxGetDataOnly(id, { + ajaxGetDataOnly(id, this.panelInfo.id, { filter: [], drill: this.drillClickDimensionList }).then(response => { @@ -1571,7 +1574,7 @@ export default { }, getChart(id) { if (id) { - post('/chart/view/get/' + id, {}).then(response => { + post('/chart/view/get/' + id + '/' + this.panelInfo.id, {}).then(response => { this.initTableData(response.data.tableId) this.view = JSON.parse(JSON.stringify(response.data)) this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : [] diff --git a/frontend/src/views/dataset/common/DatasetChartDetail.vue b/frontend/src/views/dataset/common/DatasetChartDetail.vue index 76353aca75..c890cddc2d 100644 --- a/frontend/src/views/dataset/common/DatasetChartDetail.vue +++ b/frontend/src/views/dataset/common/DatasetChartDetail.vue @@ -122,6 +122,11 @@ export default { info: {} } }, + computed: { + panelInfo() { + return this.$store.state.panel.panelInfo + } + }, watch: { 'data': function() { this.init() @@ -145,7 +150,7 @@ export default { this.info = JSON.parse(res.data.table.info) }) } else if (this.type === 'chart') { - post('/chart/view/chartDetail/' + this.data.id, null).then(res => { + post('/chart/view/chartDetail/' + this.data.id + '/' + this.panelInfo.id, null).then(res => { this.detail = res.data this.info = JSON.parse(res.data.table.info) }) From 64d9471c3396d5c4d6d7e3d546da9f9c86f30b61 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 28 Feb 2022 11:22:30 +0800 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/controller/chart/ChartViewController.java | 8 -------- frontend/src/api/chart/chart.js | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java index cb7a49229c..826892de72 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -101,14 +101,6 @@ public class ChartViewController { return chartViewService.searchAdviceSceneId(panelId); } - @ApiOperation("根据权限查详情") - @PostMapping("/getOneWithPermission/{id}") - public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception { - //如果能获取用户 则添加对应的权限 - ChartViewDTO dto = chartViewService.getData(id, requestList); - return dto; - } - @ApiOperation("搜索") @PostMapping("search") public List search(@RequestBody ChartViewRequest chartViewRequest) { diff --git a/frontend/src/api/chart/chart.js b/frontend/src/api/chart/chart.js index 98273ff039..396284c29e 100644 --- a/frontend/src/api/chart/chart.js +++ b/frontend/src/api/chart/chart.js @@ -9,16 +9,6 @@ export function post(url, data) { }) } -export function ajaxGetData(id, data) { - return request({ - url: '/chart/view/getOneWithPermission/' + id, - method: 'post', - loading: true, - hideMsg: true, - data - }) -} - export function getChartTree(data) { return request({ url: 'api', From 7aaad18dd90466351474200fd8073da1a8d2dae3 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 28 Feb 2022 11:35:32 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E8=87=AA=E5=B7=B1=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=8F=B3=E4=B8=8A=E8=A7=92?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java | 4 +++- .../java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml | 4 ++-- .../java/io/dataease/service/panel/PanelGroupService.java | 4 ++-- frontend/src/api/panel/panel.js | 3 ++- frontend/src/views/link/view/index.vue | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java index d03e7e7e06..a0ea1417e8 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java @@ -15,7 +15,7 @@ public interface ExtPanelGroupMapper { //会级联删除pid 下的所有数据 int deleteCircle(@Param("pid") String pid); - PanelGroupDTO panelGroup(String id); + PanelGroupDTO findOneWithPrivileges(@Param("panelId") String panelId,@Param("userId") String userId); void copyPanelView(@Param("pid") String panelId); @@ -24,4 +24,6 @@ public interface ExtPanelGroupMapper { List panelGroupInit(); + + } diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml index defc52803c..07d97f2935 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml @@ -12,8 +12,8 @@ - + select panel_group.*,panel_group.name as label , get_auths(panel_group.id,'panel',#{userId}) as `privileges` from panel_group where id =#{panelId}