提交 1be1faf4 authored 作者: taojinlong's avatar taojinlong

Merge branch 'dev' of github.com:dataease/dataease into dev

package io.dataease.base.mapper.ext;
import io.dataease.dto.panel.outerParams.PanelOuterParamsDTO;
import io.dataease.dto.panel.outerParams.PanelOuterParamsInfoDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtPanelOuterParamsMapper {
PanelOuterParamsDTO queryWithPanelId(@Param("panelId") String panelId);
......@@ -14,4 +16,6 @@ public interface ExtPanelOuterParamsMapper {
void deleteOuterParamsWithPanelId(@Param("panelId") String panelId);
List<PanelOuterParamsInfoDTO> getPanelOuterParamsInfo(@Param("panelId") String panelId);
}
......@@ -17,6 +17,13 @@
</collection>
</resultMap>
<resultMap id="AllOuterParamsMap" type="io.dataease.dto.panel.outerParams.PanelOuterParamsInfoDTO">
<result column="sourceInfo" jdbcType="VARCHAR" property="sourceInfo"/>
<collection property="targetInfoList" ofType="String">
<result column="targetInfo" jdbcType="VARCHAR"/>
</collection>
</resultMap>
<select id="getOuterParamsInfo" resultMap="OuterParamsInfoMap">
SELECT
pop.panel_id,
......@@ -76,6 +83,17 @@
pop.panel_id = #{panelId}
</delete>
<select id="getPanelOuterParamsInfo" resultMap="AllOuterParamsMap">
SELECT DISTINCT
param_name AS sourceInfo,
CONCAT( poptvi.target_view_id, '#', poptvi.target_field_id ) AS targetInfo
FROM
panel_outer_params pop
LEFT JOIN panel_outer_params_info popi ON pop.params_id = popi.params_id
LEFT JOIN panel_outer_params_target_view_info poptvi ON popi.params_info_id = poptvi.params_info_id
WHERE
pop.panel_id = #{panelId}
</select>
</mapper>
package io.dataease.config;
/**
* Author: wangjiahao
* Date: 2022/3/27
* Description:
*/
public class WebSecurityConfig {
}
......@@ -7,12 +7,15 @@ import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.service.panel.PanelLinkService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
......@@ -59,6 +62,12 @@ public class IndexController {
}
HttpServletResponse response = ServletUtils.response();
try {
// TODO 增加仪表板外部参数
HttpServletRequest request = ServletUtils.request();
String attachParams = request.getParameter("attachParams");
if(StringUtils.isNotEmpty(attachParams)){
url = url+"&attachParams="+attachParams;
}
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage());
......
package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.dto.panel.outerParams.PanelOuterParamsBaseResponse;
import io.dataease.dto.panel.outerParams.PanelOuterParamsDTO;
import io.dataease.service.panel.PanelOuterParamsService;
import io.swagger.annotations.Api;
......@@ -34,4 +35,10 @@ public class PanelOuterParamsController {
public void updateOuterParamsSet(@RequestBody PanelOuterParamsDTO OuterParamsDTO) {
panelOuterParamsService.updateOuterParamsSet(OuterParamsDTO);
}
@ApiOperation("仪表板外部参数映射关系")
@GetMapping("/getOuterParamsInfo/{panelId}")
public PanelOuterParamsBaseResponse getOuterParamsInfo(@PathVariable("panelId") String panelId){
return panelOuterParamsService.getOuterParamsInfo(panelId);
}
}
......@@ -18,10 +18,12 @@ public class ChartExtRequest {
@ApiModelProperty("视图额外过滤条件集合")
private List<ChartExtFilterRequest> filter;
// 联动过滤条件
@ApiModelProperty("联动过滤条件集合")
private List<ChartExtFilterRequest> linkageFilters;
@ApiModelProperty("外部参数过滤条件集合")
private List<ChartExtFilterRequest> outerParamsFilters;
@ApiModelProperty("下钻维度集合")
private List<ChartDrillRequest> drill;
......
package io.dataease.dto.panel.outerParams;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* Author: wangjiahao
* Date: 2022/3/25
* Description:
*/
@Data
public class PanelOuterParamsBaseResponse {
// 获取仪表板外部参数映射信息
private Map<String, List<String>> outerParamsInfoMap;
public PanelOuterParamsBaseResponse(Map<String, List<String>> outerParamsInfoMap) {
this.outerParamsInfoMap = outerParamsInfoMap;
}
public PanelOuterParamsBaseResponse() {
}
}
......@@ -18,4 +18,10 @@ public class PanelOuterParamsInfoDTO extends PanelOuterParamsInfo {
private String panelId;
private List<PanelOuterParamsTargetViewInfo> targetViewInfoList=new ArrayList<>();
//仪表板外部参数信息 panelId#paramName
private String sourceInfo;
//目标联动参数 targetViewId#targetFieldId
private List<String> targetInfoList;
}
......@@ -426,9 +426,20 @@ public class ChartViewService {
}
}
//联动过滤条件联动条件全部加上
if (ObjectUtils.isNotEmpty(requestList.getLinkageFilters())) {
for (ChartExtFilterRequest request : requestList.getLinkageFilters()) {
List<ChartExtFilterRequest> filters = new ArrayList<>();
// 联动条件
if(ObjectUtils.isNotEmpty(requestList.getLinkageFilters())){
filters.addAll(requestList.getLinkageFilters());
}
// 外部参数条件
if(ObjectUtils.isNotEmpty(requestList.getOuterParamsFilters())){
filters.addAll(requestList.getOuterParamsFilters());
}
//联动过滤条件和外部参数过滤条件全部加上
if (ObjectUtils.isNotEmpty(filters)) {
for (ChartExtFilterRequest request : filters) {
DatasetTableField datasetTableField = dataSetTableFieldsService.get(request.getFieldId());
if (!desensitizationList.contains(datasetTableField.getDataeaseName()) && dataeaseNames.contains(datasetTableField.getDataeaseName())) {
request.setDatasetTableField(datasetTableField);
......
......@@ -5,6 +5,7 @@ import io.dataease.base.domain.DatasetGroup;
import io.dataease.base.domain.DatasetGroupExample;
import io.dataease.base.mapper.DatasetGroupMapper;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
......@@ -14,6 +15,7 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.i18n.Translator;
import io.dataease.listener.util.CacheUtils;
import io.dataease.service.sys.SysAuthService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
......@@ -49,6 +51,8 @@ public class DataSetGroupService {
datasetGroup.setCreateBy(AuthUtils.getUser().getUsername());
datasetGroup.setCreateTime(System.currentTimeMillis());
datasetGroupMapper.insert(datasetGroup);
// 清理权限缓存
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
} else {
datasetGroupMapper.updateByPrimaryKeySelective(datasetGroup);
}
......
......@@ -24,6 +24,7 @@ import io.dataease.dto.dataset.union.UnionParamDTO;
import io.dataease.dto.datasource.TableField;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.loader.ClassloaderResponsity;
import io.dataease.provider.ProviderFactory;
......@@ -115,6 +116,10 @@ public class DataSetTableService {
public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
for (DataSetTableRequest table : datasetTable) {
save(table);
// 清理权限缓存
CacheUtils.removeAll(AuthConstants.USER_DATASET_NAME);
CacheUtils.removeAll(AuthConstants.ROLE_DATASET_NAME);
CacheUtils.removeAll(AuthConstants.DEPT_DATASET_NAME);
}
}
......
......@@ -6,6 +6,7 @@ import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.*;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.PanelConstants;
......@@ -24,6 +25,7 @@ import io.dataease.dto.panel.linkJump.PanelLinkJumpBaseRequest;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.listener.util.CacheUtils;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.sys.SysAuthService;
......@@ -119,6 +121,8 @@ public class PanelGroupService {
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType());
panelId = newPanel(request);
panelGroupMapper.insert(request);
// 清理权限缓存
clearPermissionCache();
} else if ("toDefaultPanel".equals(request.getOptType())) {
panelId = UUID.randomUUID().toString();
// 转存为默认仪表板
......@@ -133,8 +137,12 @@ public class PanelGroupService {
newDefaultPanel.setCreateBy(AuthUtils.getUser().getUsername());
checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId(), newDefaultPanel.getNodeType());
panelGroupMapper.insertSelective(newDefaultPanel);
// 清理权限缓存
clearPermissionCache();
} else if ("copy".equals(request.getOptType())) {
panelId = this.panelGroupCopy(request, null, true);
// 清理权限缓存
clearPermissionCache();
} else if ("move".equals(request.getOptType())) {
PanelGroupWithBLOBs panelInfo = panelGroupMapper.selectByPrimaryKey(request.getId());
if (panelInfo.getPid().equalsIgnoreCase(request.getPid())) {
......@@ -431,9 +439,10 @@ public class PanelGroupService {
}
return null;
}
public void findPanelAttachInfo(String panelId) {
private void clearPermissionCache(){
CacheUtils.removeAll(AuthConstants.USER_PANEL_NAME);
CacheUtils.removeAll(AuthConstants.ROLE_PANEL_NAME);
CacheUtils.removeAll(AuthConstants.DEPT_PANEL_NAME);
}
......
......@@ -5,15 +5,19 @@ import io.dataease.base.mapper.PanelOuterParamsMapper;
import io.dataease.base.mapper.PanelOuterParamsTargetViewInfoMapper;
import io.dataease.base.mapper.ext.ExtPanelOuterParamsMapper;
import io.dataease.dto.panel.linkJump.PanelLinkJumpDTO;
import io.dataease.dto.panel.outerParams.PanelOuterParamsBaseResponse;
import io.dataease.dto.panel.outerParams.PanelOuterParamsDTO;
import io.dataease.dto.panel.outerParams.PanelOuterParamsInfoDTO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Author: wangjiahao
......@@ -67,4 +71,9 @@ public class PanelOuterParamsService {
});
}
public PanelOuterParamsBaseResponse getOuterParamsInfo(String panelId){
List<PanelOuterParamsInfoDTO> result = extPanelOuterParamsMapper.getPanelOuterParamsInfo(panelId);
return new PanelOuterParamsBaseResponse(Optional.ofNullable(result).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(PanelOuterParamsInfoDTO::getSourceInfo, PanelOuterParamsInfoDTO::getTargetInfoList)));
}
}
......@@ -89,4 +89,162 @@ INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUE
UPDATE `demo_gdp_district_top100` set `province` = '新疆维吾尔自治区' WHERE `province` = '新疆维吾尔族自治区';
ALTER TABLE `sys_auth`
ADD COLUMN `copy_from` varchar(255) NULL COMMENT '复制来源' AFTER `update_time`,
ADD COLUMN `copy_id` varchar(255) NULL COMMENT '复制ID' AFTER `copy_from`;
ALTER TABLE `sys_auth_detail`
ADD COLUMN `copy_from` varchar(255) NULL COMMENT '复制来源' AFTER `update_time`,
ADD COLUMN `copy_id` varchar(255) NULL COMMENT '复制ID' AFTER `copy_from`;
-- ----------------------------
-- Function structure for copy_auth
-- ----------------------------
DROP FUNCTION IF EXISTS `copy_auth`;
delimiter ;;
CREATE FUNCTION `copy_auth`(authSource varchar(255),authSourceType varchar(255),authUser varchar(255))
RETURNS varchar(255) CHARSET utf8mb4
READS SQL DATA
BEGIN
DECLARE authId varchar(255);
DECLARE userId varchar(255);
DECLARE copyId varchar(255);
select uuid() into authId;
select uuid() into copyId;
select max(sys_user.user_id) into userId from sys_user where username= authUser;
delete from sys_auth_detail where auth_id in (
select id from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType
);
delete from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType;
INSERT INTO sys_auth (
id,
auth_source,
auth_source_type,
auth_target,
auth_target_type,
auth_time,
auth_user
)
VALUES
(
authId,
authSource,
authSourceType,
userId,
'user',
unix_timestamp(
now())* 1000,'auto');
INSERT INTO sys_auth_detail (
id,
auth_id,
privilege_name,
privilege_type,
privilege_value,
privilege_extend,
remark,
create_user,
create_time
) SELECT
uuid() AS id,
authId AS auth_id,
sys_auth_detail.privilege_name,
sys_auth_detail.privilege_type,
1,
sys_auth_detail.privilege_extend,
sys_auth_detail.remark,
'auto' AS create_user,
unix_timestamp(now())* 1000 AS create_time
FROM
sys_auth_detail where auth_id =authSourceType;
/**继承第一父级权限**/
insert into sys_auth(
id,
auth_source,
auth_source_type,
auth_target,
auth_target_type,
auth_time,
auth_user,
copy_from,
copy_id
)
SELECT
uuid() as id,
authSource as auth_source,
authSourceType as auth_source_type,
auth_target,
auth_target_type,
NOW()* 1000 as auth_time,
'auto' as auth_user,
id as copy_from,
copyId as copy_id
FROM
sys_auth
WHERE
auth_source IN (
SELECT
pid
FROM
v_auth_model
WHERE
id = authSource
AND model_type = authSourceType
)
AND auth_source_type = authSourceType;
INSERT INTO sys_auth_detail (
id,
auth_id,
privilege_name,
privilege_type,
privilege_value,
privilege_extend,
remark,
create_user,
create_time,
copy_from,
copy_id
) SELECT
uuid() AS id,
sa_copy.t_id AS auth_id,
sys_auth_detail.privilege_name,
sys_auth_detail.privilege_type,
sys_auth_detail.privilege_value,
sys_auth_detail.privilege_extend,
sys_auth_detail.remark,
'auto' AS create_user,
unix_timestamp(
now())* 1000 AS create_time,
id AS copy_from,
copyId AS copy_id
FROM
sys_auth_detail
INNER JOIN (
SELECT
id AS t_id,
copy_from AS s_id
FROM
sys_auth
WHERE
copy_id = copyId
) sa_copy ON sys_auth_detail.auth_id = sa_copy.s_id;
RETURN 'success';
END
;;
delimiter ;
INSERT INTO `my_plugin`(`plugin_id`, `name`, `store`, `free`, `cost`, `category`, `descript`, `version`, `install_type`, `creator`, `load_mybatis`, `release_time`, `install_time`, `module_name`, `icon`) VALUES (3, 'tabs插件', 'default', 0, 20000, 'panel', 'tabs插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'dataease-extensions-tabs-backend', NULL);
\ No newline at end of file
......@@ -54,6 +54,7 @@
"vue-axios": "3.2.4",
"vue-clipboard2": "0.3.1",
"vue-codemirror": "^4.0.6",
"vue-friendly-iframe": "^0.20.0",
"vue-fullscreen": "^2.5.2",
"vue-i18n": "7.3.2",
"vue-proportion-directive": "^1.1.0",
......
......@@ -32,6 +32,7 @@
const link = getQueryVariable('link')
const user = getQueryVariable('user')
const terminal = getQueryVariable('terminal')
const attachParams = getQueryVariable('attachParams')
let url = "/#/delink?link=" + encodeURIComponent(link)
if (terminal) {
url += '&terminal=' + terminal
......@@ -39,6 +40,9 @@
if (user) {
url += '&user=' + user
}
if (attachParams) {
url += '&attachParams=' + attachParams
}
window.location.href = url
</script>
......
......@@ -7,8 +7,6 @@ export function queryWithPanelId(panelId) {
})
}
export function updateOuterParamsSet(requestInfo) {
return request({
url: '/outerParams/updateOuterParamsSet',
......@@ -17,3 +15,11 @@ export function updateOuterParamsSet(requestInfo) {
loading: true
})
}
export function getOuterParamsInfo(panelId) {
return request({
url: '/outerParams/getOuterParamsInfo/' + panelId,
method: 'get',
loading: true
})
}
<template>
<el-popover
ref="popover"
width="400"
trigger="click"
>
<el-row>
<el-form ref="form" size="mini" label-width="70px">
<el-form-item :label="'Tips:'">
<span style="color: #909399; font-size: 8px;margin-left: 3px">
{{ $t('panel.web_set_tips') }}
</span>
</el-form-item>
<el-form-item :label="$t('panel.web_url')">
<el-input v-model="linkInfoTemp.src" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">{{ $t('panel.confirm') }}</el-button>
<el-button @click="onClose">{{ $t('panel.cancel') }}</el-button>
</el-form-item>
</el-form>
</el-row>
<i slot="reference" class="icon iconfont icon-chaolianjie" />
</el-popover>
</template>
<script>
import { mapState } from 'vuex'
import { deepCopy } from '@/components/canvas/utils/utils'
export default {
props: {
linkInfo: {
type: Object,
required: true
}
},
data() {
return {
linkInfoTemp: null,
componentType: null,
linkageActiveStatus: false,
editFilter: [
'view',
'custom'
]
}
},
watch: {
linkInfo: {
handler: function() {
this.init()
},
deep: true
}
},
created() {
this.init()
},
mounted() {
},
computed: {
...mapState([
'curComponent'
])
},
methods: {
init() {
this.linkInfoTemp = deepCopy(this.linkInfo)
},
onSubmit() {
this.curComponent.frameLinks = this.linkInfoTemp
this.$store.state.styleChangeTimes++
this.popoverClose()
},
onClose() {
this.$emit('close')
this.popoverClose()
},
popoverClose() {
this.$refs.popover.showPopper = false
}
}
}
</script>
<style lang="scss" scoped>
.slot-class{
color: white;
}
.bottom {
margin-top: 20px;
text-align: center;
}
.ellip{
/*width: 100%;*/
margin-left: 10px;
margin-right: 10px;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
background-color: #f7f8fa;
color: #3d4d66;
font-size: 12px;
line-height: 24px;
height: 24px;
border-radius: 3px;
}
.select-filed{
/*width: 100%;*/
margin-left: 10px;
margin-right: 10px;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
color: #3d4d66;
font-size: 12px;
line-height: 35px;
height: 35px;
border-radius: 3px;
}
>>>.el-popover{
height: 200px;
overflow: auto;
}
</style>
......@@ -9,6 +9,7 @@ import { uuid } from 'vue-uuid'
import { initPanelData } from '@/api/panel/panel'
import { queryTargetPanelJumpInfo } from '@/api/panel/linkJump'
import { proxyInitPanelData } from '@/api/panel/shareProxy'
import { getOuterParamsInfo } from '@/api/panel/outerParams'
export default {
components: { Preview },
......@@ -75,9 +76,33 @@ export default {
},
initCallBack() {
this.dataLoading = false
this.dataLoading = true
let loadingCount = 0
// 如果含有跳转参数 进行触发
const tempParam = localStorage.getItem('jumpInfoParam')
// 添加外部参数
const attachParamsEncode = this.$route.query.attachParams
tempParam && loadingCount++
attachParamsEncode && loadingCount++
if (attachParamsEncode) {
try {
const Base64 = require('js-base64').Base64
const attachParam = JSON.parse(Base64.decode(attachParamsEncode))
getOuterParamsInfo(this.panelId).then(rsp => {
if (--loadingCount === 0) {
this.dataLoading = false
}
this.$store.commit('setNowPanelOuterParamsInfo', rsp.data)
this.$store.commit('addOuterParamsFilter', attachParam)
})
} catch (e) {
if (--loadingCount === 0) {
this.dataLoading = false
}
console.log('outerParams Deocode error:', e)
}
}
if (tempParam) {
localStorage.removeItem('jumpInfoParam')
const jumpParam = JSON.parse(tempParam)
......@@ -87,13 +112,24 @@ export default {
sourceFieldId: jumpParam.sourceFieldId,
targetPanelId: this.panelId
}
this.dataLoading = true
try {
// 刷新跳转目标仪表板联动信息
queryTargetPanelJumpInfo(jumpRequestParam).then(rsp => {
if (--loadingCount === 0) {
this.dataLoading = false
}
this.$store.commit('setNowTargetPanelJumpInfo', rsp.data)
this.$store.commit('addViewTrackFilter', jumpParam)
})
} catch (e) {
if (--loadingCount === 0) {
this.dataLoading = false
}
console.log('queryTargetPanelJumpInfo error:', e)
}
}
if (loadingCount === 0) {
this.dataLoading = false
}
},
resetID(data) {
......
......@@ -134,6 +134,11 @@
</el-tooltip>
</div>
<div v-if="attrShow('frameLinks')" style="width: 20px;float: left;margin-top: 2px;margin-left: 2px;">
<el-tooltip content="网页地址">
<FrameLinks :link-info="curComponent.frameLinks" />
</el-tooltip>
</div>
<div v-if="attrShow('date-format')" style="width: 20px;float: left;margin-top: 2px;margin-left: 10px;">
<el-tooltip content="日期格式">
<date-format :format-info="curComponent.formatInfo" />
......@@ -156,9 +161,10 @@ import Hyperlinks from '@/components/canvas/components/Editor/Hyperlinks'
import VideoLinks from '@/components/canvas/components/Editor/VideoLinks'
import DateFormat from '@/components/canvas/components/Editor/DateFormat'
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import FrameLinks from '@/components/canvas/components/Editor/FrameLinks'
export default {
components: { Hyperlinks, DateFormat, VideoLinks },
components: { FrameLinks, Hyperlinks, DateFormat, VideoLinks },
props: {
scrollLeft: {
type: Number,
......@@ -292,6 +298,10 @@ export default {
'de-video': [
'opacity',
'videoLinks'
],
'de-frame': [
'opacity',
'frameLinks'
]
}
},
......
<template>
<el-row class="main-frame">
<div v-if="element.frameLinks.src" class="main-frame">
<iframe id="iframe" :src="element.frameLinks.src" scrolling="auto" frameborder="0" class="main-frame" />
<div v-if="editMode==='edit'" class="frame-mask">
<span style="opacity: 1;">
<span style="font-weight: bold;color: lawngreen;">{{ $t('panel.edit_web_tips') }}</span>
</span>
</div>
</div>
<div v-else class="info-class">
{{ $t('panel.web_add_tips') }}
</div>
</el-row>
</template>
<script>
import { mapState } from 'vuex'
import NProgress from 'nprogress'
export default {
name: 'DeVideo',
props: {
propValue: {
type: String,
require: true
},
element: {
type: Object
},
editMode: {
type: String,
require: false,
default: 'edit'
},
active: {
type: Boolean,
require: false,
default: false
}
},
data() {
return {
pOption: {}
}
},
computed: {
...mapState([
'componentGap',
'canvasStyleData'
])
},
watch: {
h(newVal, oldVla) {
}
},
created() {
},
mounted() {
this.init()
},
methods: {
init() {
const iframe = document.getElementById('iframe')
NProgress.start()
iframe.onload = function() {
NProgress.done()
}
}
}
}
</script>
<style>
.info-class{
text-align: center;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: #FFFFFF;
font-size: 12px;
color: #9ea6b2;
}
.main-frame{
height: 100%;
width: 100%;
}
.frame-mask {
display: flex;
height: 100%!important;
width: 100% !important;
background-color: #5c5e61;
opacity: 0.5;
position:absolute;
top:0px;
left: 0px;
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
}
</style>
......@@ -213,6 +213,7 @@ export default {
const filter = {}
filter.filter = this.isFirstLoad ? this.filters : this.cfilters
filter.linkageFilters = this.element.linkageFilters
filter.outerParamsFilters = this.element.outerParamsFilters
filter.drill = this.drillClickDimensionList
filter.resultCount = this.resultCount
filter.resultMode = this.resultMode
......
......@@ -86,6 +86,11 @@ export const VIDEOLINKS = {
}
// 嵌套页面信息
export const FRAMELINKS = {
src: ''
}
export const assistList = [
{
id: '10001',
......@@ -133,7 +138,7 @@ export const pictureList = [
}
]
export const dateList = [
export const otherList = [
{
id: '30001',
component: 'de-show-date',
......@@ -141,6 +146,14 @@ export const dateList = [
label: '时间',
icon: 'iconfont icon-shijian',
defaultClass: 'text-filter'
},
{
id: '30002',
component: 'de-frame',
type: 'de-frame',
label: '网页',
icon: 'iconfont icon-iframe',
defaultClass: 'text-filter'
}
]
......@@ -353,6 +366,27 @@ const list = [
miniSizex: 1,
miniSizey: 1
},
{
id: '30002',
component: 'de-frame',
type: 'de-frame',
label: '',
icon: 'iconfont icon-iframe',
defaultClass: 'text-filter',
mobileStyle: BASE_MOBILE_STYLE,
style: {
width: 400,
height: 200,
borderRadius: ''
},
frameLinks: FRAMELINKS,
x: 1,
y: 1,
sizex: 10,
sizey: 5,
miniSizex: 1,
miniSizey: 1
},
{
id: '20001',
component: 'picture-add',
......
......@@ -7,6 +7,7 @@ import Group from '@/components/canvas/custom-component/Group'
import RectShape from '@/components/canvas/custom-component/RectShape'
import UserView from '@/components/canvas/custom-component/UserView'
import DeVideo from '@/components/canvas/custom-component/DeVideo'
import DeFrame from '@/components/canvas/custom-component/DeFrame'
Vue.component('Picture', Picture)
Vue.component('VText', VText)
......@@ -15,4 +16,5 @@ Vue.component('Group', Group)
Vue.component('RectShape', RectShape)
Vue.component('UserView', UserView)
Vue.component('DeVideo', DeVideo)
Vue.component('DeFrame', DeFrame)
......@@ -1390,6 +1390,8 @@ export default {
sure_bt: 'Confirm'
},
panel: {
web_set_tips: 'Some Websites Cannot Be Displayed Because Of Cross Domain Problems ',
repeat_params: 'Repeat Params Exist',
enable_outer_param_set: 'Enable Outer Param Set',
select_param: 'Please Select Param...',
add_param_link_field: "Add Params' Linked Field",
......@@ -1400,6 +1402,7 @@ export default {
input_param_name: "Please Input Param's Name",
params_setting: 'Outer Params Setting',
template_view_tips: "Template's Views. Please Change",
edit_web_tips: 'The Inner Event Can Be Used When Then Panel Not In Edit Status',
no_auth_role: 'Unshared roles',
auth_role: 'Shared roles',
picture_limit: 'Only pictures can be inserted',
......@@ -1599,7 +1602,9 @@ export default {
play_once: 'Once',
play_circle: 'Circle',
video_links: 'Video Links',
web_url: 'Web URL',
video_add_tips: 'Please Add Video Info...',
web_add_tips: 'Please Add Web Url Info...',
panel_view_result_show: 'View Result Show',
panel_view_result_tips: 'Chose "Panel" Will Overwrite View`s Result,Range 1~10000',
timeout_refresh: 'Timeout,Will Refresh...',
......
......@@ -1391,6 +1391,8 @@ export default {
sure_bt: '確定'
},
panel: {
web_set_tips: '部分网站可能存在跨域问题无法显示',
repeat_params: '存在名称重复的参数',
enable_outer_param_set: '启用外部参数设置',
select_param: '请选择参数...',
add_param_link_field: '添加参数联动字段',
......@@ -1401,6 +1403,7 @@ export default {
input_param_name: '请输入参数名称',
params_setting: '外部参数设置',
template_view_tips: '当前是模板视图,请点击更换数据集',
edit_web_tips: '编辑状态不可操作网页内部',
no_auth_role: '未分享角色',
auth_role: '已分享角色',
picture_limit: '只能插入圖片',
......@@ -1600,7 +1603,9 @@ export default {
play_once: '播放一次',
play_circle: '循環播放',
video_links: '視頻鏈接',
web_url: '网页地址',
video_add_tips: '請點擊添加配置視頻信息...',
web_add_tips: '請點擊添加网页信息...',
panel_view_result_show: '視圖結果展示',
panel_view_result_tips: '選擇儀錶闆會覆蓋視圖的結果展示數量,取值範圍1~10000',
timeout_refresh: '請求超時,稍後刷新...',
......
......@@ -1399,6 +1399,8 @@ export default {
sure_bt: '确定'
},
panel: {
web_set_tips: '部分网站可能存在跨域问题无法显示',
repeat_params: '存在名称重复的参数',
enable_outer_param_set: '启用外部参数设置',
select_param: '请选择参数...',
add_param_link_field: '添加参数联动字段',
......@@ -1409,6 +1411,7 @@ export default {
input_param_name: '请输入参数名称',
params_setting: '外部参数设置',
template_view_tips: '当前是模板视图,请点击更换数据集',
edit_web_tips: '编辑状态不可操作网页内部',
no_auth_role: '未分享角色',
auth_role: '已分享角色',
picture_limit: '只能插入图片',
......@@ -1609,7 +1612,9 @@ export default {
play_once: '播放一次',
play_circle: '循环播放',
video_links: '视频链接',
web_url: '网页地址',
video_add_tips: '请点击添加配置视频信息...',
web_add_tips: '请点击添加网页信息...',
panel_view_result_show: '视图结果展示',
panel_view_result_tips: '选择仪表板会覆盖视图的结果展示数量,取值范围1~10000',
timeout_refresh: '请求超时,稍后刷新...',
......
......@@ -45,6 +45,10 @@ Vue.use(vcolorpicker)
import fullscreen from 'vue-fullscreen'
Vue.use(fullscreen)
import VueFriendlyIframe from 'vue-friendly-iframe'
Vue.use(VueFriendlyIframe)
// import TEditor from '@/components/Tinymce/index.vue'
// Vue.component('TEditor', TEditor)
......
......@@ -79,6 +79,8 @@ const data = {
nowPanelJumpInfo: {},
// 当前仪表板的跳转信息(只包括仪表板)
nowPanelJumpInfoTargetPanel: {},
// 当前仪表板的外部参数信息
nowPanelOuterParamsInfo: {},
// 拖拽的组件信息
dragComponentInfo: null,
// 仪表板组件间隙大小 px
......@@ -293,6 +295,50 @@ const data = {
state.componentData[index] = element
}
},
// 添加外部参数的过滤条件
addOuterParamsFilter(state, params) {
// params 结构 {key1:value1,key2:value2}
if (params) {
const trackInfo = state.nowPanelOuterParamsInfo
for (let index = 0; index < state.componentData.length; index++) {
const element = state.componentData[index]
if (!element.type || element.type !== 'view') continue
const currentFilters = element.outerParamsFilters || [] // 外部参数信息
// 外部参数 可能会包含多个参数
Object.keys(params).forEach(function(sourceInfo) {
// 获取外部参数的值 sourceInfo 是外部参数名称
const paramValue = params[sourceInfo]
// 获取所有目标联动信息
const targetInfoList = trackInfo[sourceInfo] || []
targetInfoList.forEach(targetInfo => {
const targetInfoArray = targetInfo.split('#')
const targetViewId = targetInfoArray[0] // 目标视图
if (element.propValue.viewId === targetViewId) { // 如果目标视图 和 当前循环组件id相等 则进行条件增减
const targetFieldId = targetInfoArray[1] // 目标视图列ID
const condition = new Condition('', targetFieldId, 'eq', [paramValue], [targetViewId])
let j = currentFilters.length
while (j--) {
const filter = currentFilters[j]
// 兼容性准备 viewIds 只会存放一个值
if (targetFieldId === filter.fieldId && filter.viewIds.includes(targetViewId)) {
currentFilters.splice(j, 1)
}
}
// 不存在该条件 且 条件有效 直接保存该条件
// !filterExist && vValid && currentFilters.push(condition)
currentFilters.push(condition)
}
})
element.outerParamsFilters = currentFilters
state.componentData[index] = element
})
}
}
},
setComponentWithId(state, component) {
for (let index = 0; index < state.componentData.length; index++) {
const element = state.componentData[index]
......@@ -338,6 +384,9 @@ const data = {
setNowTargetPanelJumpInfo(state, jumpInfo) {
state.nowPanelJumpInfoTargetPanel = jumpInfo.baseJumpInfoPanelMap
},
setNowPanelOuterParamsInfo(state, outerParamsInfo) {
state.nowPanelOuterParamsInfo = outerParamsInfo.outerParamsInfoMap
},
clearPanelLinkageInfo(state) {
state.componentData.forEach(item => {
if (item.linkageFilters && item.linkageFilters.length > 0) {
......
......@@ -54,6 +54,12 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe6de;</span>
<div class="name">iframe</div>
<div class="code-name">&amp;#xe6de;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6d7;</span>
<div class="name">参数</div>
......@@ -516,9 +522,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1647483965100') format('woff2'),
url('iconfont.woff?t=1647483965100') format('woff'),
url('iconfont.ttf?t=1647483965100') format('truetype');
src: url('iconfont.woff2?t=1648367037728') format('woff2'),
url('iconfont.woff?t=1648367037728') format('woff'),
url('iconfont.ttf?t=1648367037728') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
......@@ -544,6 +550,15 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-iframe"></span>
<div class="name">
iframe
</div>
<div class="code-name">.icon-iframe
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-canshu"></span>
<div class="name">
......@@ -1237,6 +1252,14 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-iframe"></use>
</svg>
<div class="name">iframe</div>
<div class="code-name">#icon-iframe</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-canshu"></use>
......
@font-face {
font-family: "iconfont"; /* Project id 2459092 */
src: url('iconfont.woff2?t=1647483965100') format('woff2'),
url('iconfont.woff?t=1647483965100') format('woff'),
url('iconfont.ttf?t=1647483965100') format('truetype');
src: url('iconfont.woff2?t=1648367037728') format('woff2'),
url('iconfont.woff?t=1648367037728') format('woff'),
url('iconfont.ttf?t=1648367037728') format('truetype');
}
.iconfont {
......@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-iframe:before {
content: "\e6de";
}
.icon-canshu:before {
content: "\e6d7";
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "4920096",
"name": "iframe",
"font_class": "iframe",
"unicode": "e6de",
"unicode_decimal": 59102
},
{
"icon_id": "19610186",
"name": "参数",
......
export function checkRepeat(arrayData, key) {
for (let i = 0; i < arrayData.length; i++) {
for (let j = i + 1; j < arrayData.length; j++) {
if (arrayData[i][key] === arrayData[j][key]) {
return true
}
}
}
return false
}
......@@ -11,6 +11,7 @@ import Preview from '@/components/canvas/components/Editor/Preview'
import { getPanelAllLinkageInfo } from '@/api/panel/linkage'
import { queryPanelJumpInfo, queryTargetPanelJumpInfo } from '@/api/panel/linkJump'
import { panelInit } from '@/components/canvas/utils/utils'
import { getOuterParamsInfo } from '@/api/panel/outerParams'
export default {
name: 'LinkView',
......@@ -37,6 +38,8 @@ export default {
methods: {
setPanelInfo() {
loadResource(this.resourceId).then(res => {
this.show = false
let loadingCount = 0
this.$store.dispatch('panel/setPanelInfo', {
id: res.data.id,
name: res.data.name,
......@@ -54,9 +57,36 @@ export default {
queryPanelJumpInfo(this.resourceId).then(rsp => {
this.$store.commit('setNowPanelJumpInfo', rsp.data)
})
// 如果含有跳转参数 进行触发
const tempParam = localStorage.getItem('jumpInfoParam')
// 添加外部参数
const attachParamsEncode = this.$route.query.attachParams
tempParam && loadingCount++
attachParamsEncode && loadingCount++
if (attachParamsEncode) {
try {
const Base64 = require('js-base64').Base64
const attachParam = JSON.parse(Base64.decode(attachParamsEncode))
getOuterParamsInfo(this.resourceId).then(rsp => {
if (--loadingCount === 0) {
this.show = true
}
this.$store.commit('setNowPanelOuterParamsInfo', rsp.data)
this.$store.commit('addOuterParamsFilter', attachParam)
})
} catch (e) {
if (--loadingCount === 0) {
this.show = true
}
console.log('outerParams Decode error:', e)
}
}
if (tempParam) {
try {
localStorage.removeItem('jumpInfoParam')
const jumpParam = JSON.parse(tempParam)
const jumpRequestParam = {
......@@ -65,14 +95,21 @@ export default {
sourceFieldId: jumpParam.sourceFieldId,
targetPanelId: this.resourceId
}
this.show = false
// 刷新跳转目标仪表板联动信息
queryTargetPanelJumpInfo(jumpRequestParam).then(rsp => {
this.show = true
this.$store.commit('setNowTargetPanelJumpInfo', rsp.data)
this.$store.commit('addViewTrackFilter', jumpParam)
})
} else {
} catch (e) {
if (--loadingCount === 0) {
this.show = true
}
console.log('tempParam error:', e)
}
}
if (loadingCount === 0) {
this.show = true
}
})
......
......@@ -57,7 +57,7 @@
<div class="filter-widget-content">
<div
v-for="(item, index) in dateList"
v-for="(item, index) in otherList"
:key="index"
:data-id="item.id"
:data-index="index"
......@@ -79,7 +79,7 @@
</template>
<script>
import componentList, { assistList, pictureList, dateList } from '@/components/canvas/custom-component/component-list'
import componentList, { assistList, pictureList, otherList } from '@/components/canvas/custom-component/component-list'
import toast from '@/components/canvas/utils/toast'
import { commonStyle, commonAttr } from '@/components/canvas/custom-component/component-list'
import generateID from '@/components/canvas/utils/generateID'
......@@ -93,7 +93,7 @@ export default {
return {
assistList,
pictureList,
dateList
otherList
}
},
computed: {
......
......@@ -173,6 +173,7 @@ import { mapState } from 'vuex'
import { queryWithPanelId, updateOuterParamsSet } from '@/api/panel/outerParams'
import { uuid } from 'vue-uuid'
import { deepCopy } from '@/components/canvas/utils/utils'
import { checkRepeat } from '@/utils/check'
export default {
name: 'OuterParamsSet',
......@@ -258,9 +259,17 @@ export default {
this.$emit('outerParamsSetVisibleChange', false)
},
save() {
if (checkRepeat(this.outerParams.outerParamsInfoArray, 'name')) {
this.$message({
message: this.$t('panel.repeat_params'),
type: 'warn',
showClose: true
})
return
}
updateOuterParamsSet(this.outerParams).then(rsp => {
this.$message({
message: '保存成功',
message: this.$t('commons.save_success'),
type: 'success',
showClose: true
})
......@@ -329,6 +338,10 @@ export default {
const children = parent.data.children || parent.data
const index = children.findIndex(d => d.paramsInfoId === data.paramsInfoId)
children.splice(index, 1)
if (data.paramsInfoId === this.outerParamsInfo.paramsInfoId) {
delete this.mapOuterParamsInfoArray[data.paramsInfoId]
this.outerParamsInfo = null
}
}
}
}
......
......@@ -441,7 +441,8 @@ export default {
'de-tabs',
'rect-shape',
'de-show-date',
'de-video'
'de-video',
'de-frame'
],
enableSureButton: false,
filterFromDrag: false,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论