feat: 跳转支持和过滤组件允许配合使用 #5924
This commit is contained in:
parent
6d3e004e59
commit
2c7a5c623a
@ -1,6 +1,7 @@
|
|||||||
package io.dataease.controller.panel;
|
package io.dataease.controller.panel;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.dataease.dto.panel.PanelComponentDTO;
|
||||||
import io.dataease.dto.panel.PanelViewTableDTO;
|
import io.dataease.dto.panel.PanelViewTableDTO;
|
||||||
import io.dataease.service.panel.PanelViewService;
|
import io.dataease.service.panel.PanelViewService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -29,4 +30,10 @@ public class PanelViewController {
|
|||||||
public List<PanelViewTableDTO> detailList(@PathVariable String panelId) throws Exception {
|
public List<PanelViewTableDTO> detailList(@PathVariable String panelId) throws Exception {
|
||||||
return panelViewService.detailList(panelId);
|
return panelViewService.detailList(panelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("组件信息")
|
||||||
|
@GetMapping("/getComponentInfo/{panelId}")
|
||||||
|
public PanelComponentDTO getComponentInfo(@PathVariable String panelId) throws Exception {
|
||||||
|
return panelViewService.getComponentInfo(panelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
package io.dataease.dto.panel;
|
||||||
|
|
||||||
|
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||||
|
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: wangjiahao
|
||||||
|
* Date: 2021-03-05
|
||||||
|
* Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PanelComponentDTO {
|
||||||
|
|
||||||
|
private String bashComponentData;
|
||||||
|
|
||||||
|
private List<PanelViewTableDTO> panelViewTables;
|
||||||
|
|
||||||
|
public PanelComponentDTO(String bashComponentData, List<PanelViewTableDTO> panelViewTables) {
|
||||||
|
this.bashComponentData = bashComponentData;
|
||||||
|
this.panelViewTables = panelViewTables;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -17,6 +17,9 @@ public class PanelViewTableDTO extends ChartViewWithBLOBs {
|
|||||||
@ApiModelProperty("仪表板ID")
|
@ApiModelProperty("仪表板ID")
|
||||||
private String panelId;
|
private String panelId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仪表板数据")
|
||||||
|
private String basePanelData;
|
||||||
|
|
||||||
private List<DatasetTableField> tableFields;
|
private List<DatasetTableField> tableFields;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package io.dataease.service.panel;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import io.dataease.dto.panel.PanelComponentDTO;
|
||||||
import io.dataease.ext.ExtChartViewMapper;
|
import io.dataease.ext.ExtChartViewMapper;
|
||||||
import io.dataease.ext.ExtPanelGroupMapper;
|
import io.dataease.ext.ExtPanelGroupMapper;
|
||||||
import io.dataease.ext.ExtPanelViewMapper;
|
import io.dataease.ext.ExtPanelViewMapper;
|
||||||
@ -15,6 +16,7 @@ import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
|||||||
import io.dataease.plugins.common.base.domain.PanelGroupWithBLOBs;
|
import io.dataease.plugins.common.base.domain.PanelGroupWithBLOBs;
|
||||||
import io.dataease.plugins.common.base.domain.PanelView;
|
import io.dataease.plugins.common.base.domain.PanelView;
|
||||||
import io.dataease.plugins.common.base.domain.PanelViewExample;
|
import io.dataease.plugins.common.base.domain.PanelViewExample;
|
||||||
|
import io.dataease.plugins.common.base.mapper.PanelGroupMapper;
|
||||||
import io.dataease.plugins.common.base.mapper.PanelViewMapper;
|
import io.dataease.plugins.common.base.mapper.PanelViewMapper;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@ -45,6 +47,9 @@ public class PanelViewService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ExtChartViewMapper extChartViewMapper;
|
private ExtChartViewMapper extChartViewMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PanelGroupMapper panelGroupMapper;
|
||||||
|
|
||||||
private final static String SCENE_TYPE = "scene";
|
private final static String SCENE_TYPE = "scene";
|
||||||
|
|
||||||
public List<PanelViewDto> groups() {
|
public List<PanelViewDto> groups() {
|
||||||
@ -152,6 +157,11 @@ public class PanelViewService {
|
|||||||
return extPanelViewMapper.getPanelViewDetails(panelId);
|
return extPanelViewMapper.getPanelViewDetails(panelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PanelComponentDTO getComponentInfo(String panelId){
|
||||||
|
PanelGroupWithBLOBs panelGroup = panelGroupMapper.selectByPrimaryKey(panelId);
|
||||||
|
return new PanelComponentDTO(panelGroup.getPanelData(),detailList(panelId));
|
||||||
|
}
|
||||||
|
|
||||||
public List<PanelView> findPanelViews(String copyId) {
|
public List<PanelView> findPanelViews(String copyId) {
|
||||||
PanelViewExample panelViewExample = new PanelViewExample();
|
PanelViewExample panelViewExample = new PanelViewExample();
|
||||||
panelViewExample.createCriteria().andCopyIdEqualTo(copyId);
|
panelViewExample.createCriteria().andCopyIdEqualTo(copyId);
|
||||||
|
|||||||
@ -7,3 +7,11 @@ export function detailList(panelId) {
|
|||||||
loading: false
|
loading: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getComponentInfo(panelId) {
|
||||||
|
return request({
|
||||||
|
url: '/panel/view/getComponentInfo/' + panelId,
|
||||||
|
method: 'get',
|
||||||
|
loading: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -422,7 +422,7 @@ const data = {
|
|||||||
}
|
}
|
||||||
state.componentData[index] = element
|
state.componentData[index] = element
|
||||||
}
|
}
|
||||||
if (!element.type || element.type !== 'view') continue
|
if (!element.type || (element.type !== 'view' && element.type !== 'custom')) continue
|
||||||
const currentFilters = element.linkageFilters || [] // 当前联动filter
|
const currentFilters = element.linkageFilters || [] // 当前联动filter
|
||||||
// 联动的视图情况历史条件
|
// 联动的视图情况历史条件
|
||||||
// const currentFilters = []
|
// const currentFilters = []
|
||||||
@ -434,7 +434,7 @@ const data = {
|
|||||||
targetInfoList.forEach(targetInfo => {
|
targetInfoList.forEach(targetInfo => {
|
||||||
const targetInfoArray = targetInfo.split('#')
|
const targetInfoArray = targetInfo.split('#')
|
||||||
const targetViewId = targetInfoArray[0] // 目标视图
|
const targetViewId = targetInfoArray[0] // 目标视图
|
||||||
if (element.propValue.viewId === targetViewId) { // 如果目标视图 和 当前循环组件id相等 则进行条件增减
|
if (element.type === 'view' && element.propValue.viewId === targetViewId) { // 如果目标视图 和 当前循环组件id相等 则进行条件增减
|
||||||
const targetFieldId = targetInfoArray[1] // 目标视图列ID
|
const targetFieldId = targetInfoArray[1] // 目标视图列ID
|
||||||
const condition = new Condition('', targetFieldId, 'eq', [dimension.value], [targetViewId])
|
const condition = new Condition('', targetFieldId, 'eq', [dimension.value], [targetViewId])
|
||||||
condition.sourceViewId = viewId
|
condition.sourceViewId = viewId
|
||||||
@ -450,10 +450,23 @@ const data = {
|
|||||||
// !filterExist && vValid && currentFilters.push(condition)
|
// !filterExist && vValid && currentFilters.push(condition)
|
||||||
currentFilters.push(condition)
|
currentFilters.push(condition)
|
||||||
}
|
}
|
||||||
|
if (element.type === 'custom' && element.id === targetViewId) { // 过滤组件处理
|
||||||
|
element.options.value = dimension.value
|
||||||
|
// 去掉动态时间
|
||||||
|
if (element.options.manualModify) {
|
||||||
|
element.options.manualModify = false
|
||||||
|
}
|
||||||
|
// 去掉首选项
|
||||||
|
if (element.options?.attrs?.selectFirst) {
|
||||||
|
element.options.attrs.selectFirst = false
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
element.linkageFilters = currentFilters
|
if (element.type === 'view') {
|
||||||
|
element.linkageFilters = currentFilters
|
||||||
|
}
|
||||||
state.componentData[index] = element
|
state.componentData[index] = element
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -173,7 +173,7 @@
|
|||||||
<div class="select-filed">
|
<div class="select-filed">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="targetViewInfo.targetFieldId"
|
v-model="targetViewInfo.targetFieldId"
|
||||||
:disabled="viewIdFieldArrayMap[targetViewInfo.targetViewId]&&viewIdFieldArrayMap[targetViewInfo.targetViewId].length===1 && viewIdFieldArrayMap[targetViewInfo.targetViewId][0].id === 0"
|
:disabled="targetViewInfo.targetFieldId === 'empty'"
|
||||||
filterable
|
filterable
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -389,7 +389,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { queryPanelJumpInfo, queryWithViewId, updateJumpSet } from '@/api/panel/linkJump'
|
import { queryPanelJumpInfo, queryWithViewId, updateJumpSet } from '@/api/panel/linkJump'
|
||||||
import { groupTree } from '@/api/panel/panel'
|
import { groupTree } from '@/api/panel/panel'
|
||||||
import { detailList } from '@/api/panel/panelView'
|
import {detailList, getComponentInfo} from '@/api/panel/panelView'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
@ -627,16 +627,16 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取当前视图字段 关联仪表板的视图信息列表
|
// 获取当前视图字段 关联仪表板的视图信息列表
|
||||||
getPanelViewList(panelId) {
|
getPanelViewList(panelId) {
|
||||||
detailList(panelId).then(rsp => {
|
getComponentInfo(panelId).then(rsp => {
|
||||||
this.viewIdFieldArrayMap = {}
|
this.viewIdFieldArrayMap = {}
|
||||||
this.currentLinkPanelViewArray = rsp.data
|
this.currentLinkPanelViewArray = rsp.data.panelViewTables
|
||||||
if (this.currentLinkPanelViewArray) {
|
if (this.currentLinkPanelViewArray) {
|
||||||
this.currentLinkPanelViewArray.forEach(view => {
|
this.currentLinkPanelViewArray.forEach(view => {
|
||||||
this.viewIdFieldArrayMap[view.id] = view.tableFields
|
this.viewIdFieldArrayMap[view.id] = view.tableFields
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 增加过滤组件匹配
|
// 增加过滤组件匹配
|
||||||
this.componentData.forEach(componentItem => {
|
JSON.parse(rsp.data.bashComponentData).forEach(componentItem => {
|
||||||
if (componentItem.type === 'custom') {
|
if (componentItem.type === 'custom') {
|
||||||
this.currentLinkPanelViewArray.push({
|
this.currentLinkPanelViewArray.push({
|
||||||
id: componentItem.id,
|
id: componentItem.id,
|
||||||
@ -676,7 +676,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
viewInfoOnChange(targetViewInfo) {
|
viewInfoOnChange(targetViewInfo) {
|
||||||
targetViewInfo.targetFieldId = null
|
if (this.viewIdFieldArrayMap[targetViewInfo.targetViewId] && this.viewIdFieldArrayMap[targetViewInfo.targetViewId].length === 1 && this.viewIdFieldArrayMap[targetViewInfo.targetViewId][0].id === 'empty') {
|
||||||
|
targetViewInfo.targetFieldId = 'empty'
|
||||||
|
} else {
|
||||||
|
targetViewInfo.targetFieldId = null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sourceFieldCheckedChange(data) {
|
sourceFieldCheckedChange(data) {
|
||||||
if (data.checked) {
|
if (data.checked) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user