diff --git a/backend/src/main/java/io/dataease/auth/config/cas/CasStrategy.java b/backend/src/main/java/io/dataease/auth/config/cas/CasStrategy.java index 7a8693b428..82d5187a82 100644 --- a/backend/src/main/java/io/dataease/auth/config/cas/CasStrategy.java +++ b/backend/src/main/java/io/dataease/auth/config/cas/CasStrategy.java @@ -2,6 +2,7 @@ package io.dataease.auth.config.cas; import io.dataease.auth.service.impl.ShiroServiceImpl; import io.dataease.commons.utils.CommonBeanFactory; +import io.dataease.commons.utils.ServletUtils; import io.dataease.service.system.SystemParameterService; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.util.AntPathMatcher; @@ -17,7 +18,7 @@ import java.util.Set; public class CasStrategy implements UrlPatternMatcherStrategy { - private static Set releaseTypes = new HashSet<>(); + private static Set releaseTypes = new HashSet<>(); @PostConstruct public void init() { @@ -25,6 +26,7 @@ public class CasStrategy implements UrlPatternMatcherStrategy { releaseTypes.add("link"); releaseTypes.add("doc"); } + @Override public boolean matches(String s) { SystemParameterService service = CommonBeanFactory.getBean(SystemParameterService.class); @@ -35,10 +37,14 @@ public class CasStrategy implements UrlPatternMatcherStrategy { if ((beginIndex = s.indexOf(serverName)) != -1) { s = s.substring(beginIndex + serverName.length()); } - if (StringUtils.equals("/", s)) return false; + if (StringUtils.equals("/", s)) { + if (fromLink(serverName)) return true; + return false; + } if (StringUtils.equals("/login", s)) return false; if (StringUtils.startsWith(s, "/cas/callBack")) return false; if (StringUtils.equals("/api/auth/deLogout", s)) return true; + if (s.startsWith("/link.html")) return true; AntPathMatcher antPathMatcher = new AntPathMatcher(); ShiroServiceImpl shiroService = CommonBeanFactory.getBean(ShiroServiceImpl.class); Map stringStringMap = shiroService.loadFilterChainDefinitionMap(); @@ -57,4 +63,15 @@ public class CasStrategy implements UrlPatternMatcherStrategy { public void setPattern(String s) { } + + private Boolean fromLink(String serverName) { + String referrer = ServletUtils.request().getHeader("referer"); + if (StringUtils.isBlank(referrer)) return false; + int beginIndex = -1; + if ((beginIndex = referrer.indexOf(serverName)) != -1) { + referrer = referrer.substring(beginIndex + serverName.length()); + return referrer.startsWith("/link.html"); + } + return false; + } } diff --git a/backend/src/main/java/io/dataease/job/sechedule/strategy/impl/EmailTaskHandler.java b/backend/src/main/java/io/dataease/job/sechedule/strategy/impl/EmailTaskHandler.java index 4f9d1bced1..d293f49dca 100644 --- a/backend/src/main/java/io/dataease/job/sechedule/strategy/impl/EmailTaskHandler.java +++ b/backend/src/main/java/io/dataease/job/sechedule/strategy/impl/EmailTaskHandler.java @@ -25,6 +25,8 @@ import io.dataease.plugins.xpack.email.dto.response.XpackEmailTemplateDTO; import io.dataease.plugins.xpack.email.service.EmailXpackService; import io.dataease.plugins.xpack.lark.dto.entity.LarkMsgResult; import io.dataease.plugins.xpack.lark.service.LarkXpackService; +import io.dataease.plugins.xpack.larksuite.dto.response.LarksuiteMsgResult; +import io.dataease.plugins.xpack.larksuite.service.LarksuiteXpackService; import io.dataease.plugins.xpack.wecom.dto.entity.WecomMsgResult; import io.dataease.plugins.xpack.wecom.service.WecomXpackService; import io.dataease.service.chart.ViewExportExcel; @@ -297,6 +299,30 @@ public class EmailTaskHandler extends TaskHandler implements Job { } } + } + break; + case "larksuite": + if (SpringContextUtil.getBean(AuthUserService.class).supportLarksuite()) { + List larksuiteUsers = new ArrayList<>(); + for (int j = 0; j < reciLists.size(); j++) { + String reci = reciLists.get(j); + SysUserEntity userBySub = userService.getUserByName(reci); + if (ObjectUtils.isEmpty(userBySub)) continue; + Long userId = userBySub.getUserId(); + SysUserAssist sysUserAssist = sysUserService.assistInfo(userId); + if (ObjectUtils.isEmpty(sysUserAssist) || StringUtils.isBlank(sysUserAssist.getLarksuiteId())) + continue; + larksuiteUsers.add(sysUserAssist.getLarksuiteId()); + } + + if (CollectionUtils.isNotEmpty(larksuiteUsers)) { + LarksuiteXpackService larksuiteXpackService = SpringContextUtil.getBean(LarksuiteXpackService.class); + LarksuiteMsgResult larksuiteMsgResult = larksuiteXpackService.pushOaMsg(larksuiteUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files); + if (larksuiteMsgResult.getCode() != 0) { + errorMsgs.add("larksuite: " + larksuiteMsgResult.getMsg()); + } + } + } break; default: diff --git a/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java b/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java index 9554458b8d..a4c686349b 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java @@ -9,6 +9,8 @@ import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.DeLogUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.ServletUtils; +import io.dataease.exception.DataEaseException; +import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysUserAssist; import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.xpack.dingtalk.dto.response.DingQrResult; @@ -101,6 +103,8 @@ public class XDingtalkServer { sysUserService.validateExistUser(username, dingUserEntity.getName(), email); sysUserService.saveDingtalkCUser(dingUserEntity, email); sysUserEntity = authUserService.getUserByDingtalkId(username); + } else if (sysUserEntity.getEnabled() == 0) { + DataEaseException.throwException(Translator.get("i18n_user_is_disable")); } TokenInfo tokenInfo = TokenInfo.builder().userId(sysUserEntity.getUserId()).username(sysUserEntity.getUsername()).build(); String realPwd = sysUserEntity.getPassword(); diff --git a/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java b/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java index f473c6eed8..a71909fbcb 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java @@ -9,6 +9,8 @@ import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.DeLogUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.ServletUtils; +import io.dataease.exception.DataEaseException; +import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysUserAssist; import io.dataease.plugins.config.SpringContextUtil; @@ -102,6 +104,8 @@ public class XLarkServer { sysUserService.validateExistUser(username, larkUserInfo.getName(), email); sysUserService.saveLarkCUser(larkUserInfo, email); sysUserEntity = authUserService.getUserByLarkId(username); + } else if (sysUserEntity.getEnabled() == 0) { + DataEaseException.throwException(Translator.get("i18n_user_is_disable")); } TokenInfo tokenInfo = TokenInfo.builder().userId(sysUserEntity.getUserId()).username(sysUserEntity.getUsername()).build(); String realPwd = sysUserEntity.getPassword(); diff --git a/backend/src/main/java/io/dataease/plugins/server/XLarksuiteServer.java b/backend/src/main/java/io/dataease/plugins/server/XLarksuiteServer.java index 64d9506cfb..b4af287f4b 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XLarksuiteServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XLarksuiteServer.java @@ -9,6 +9,8 @@ import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.DeLogUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.ServletUtils; +import io.dataease.exception.DataEaseException; +import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysUserAssist; import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.xpack.display.dto.response.SysSettingDto; @@ -102,6 +104,8 @@ public class XLarksuiteServer { sysUserService.validateExistUser(username, larkUserInfo.getName(), email); sysUserService.saveLarksuiteCUser(larkUserInfo, email); sysUserEntity = authUserService.getUserByLarksuiteId(username); + } else if (sysUserEntity.getEnabled() == 0) { + DataEaseException.throwException(Translator.get("i18n_user_is_disable")); } TokenInfo tokenInfo = TokenInfo.builder().userId(sysUserEntity.getUserId()).username(sysUserEntity.getUsername()).build(); String realPwd = sysUserEntity.getPassword(); diff --git a/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java b/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java index 738f4f73bc..2c3df6f20f 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java @@ -10,6 +10,8 @@ import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.DeLogUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.ServletUtils; +import io.dataease.exception.DataEaseException; +import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysUserAssist; import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.xpack.display.dto.response.SysSettingDto; @@ -106,6 +108,8 @@ public class XWecomServer { sysUserService.validateExistUser(userId, userMap.get("name").toString(), email); sysUserService.saveWecomCUser(userMap, userId, email); sysUserEntity = authUserService.getUserByWecomId(userId); + } else if (sysUserEntity.getEnabled() == 0) { + DataEaseException.throwException(Translator.get("i18n_user_is_disable")); } TokenInfo tokenInfo = TokenInfo.builder().userId(sysUserEntity.getUserId()).username(sysUserEntity.getUsername()).build(); String realPwd = sysUserEntity.getPassword(); diff --git a/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java b/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java index 0a2e7f8800..6468accbd6 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java @@ -689,7 +689,7 @@ public class JdbcProvider extends DefaultJdbcProvider { if (StringUtils.isEmpty(sqlServerConfiguration.getSchema())) { throw new Exception(Translator.get("i18n_schema_is_empty")); } - return "SELECT TABLE_NAME FROM DATABASE.INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'DS_SCHEMA' ;" + return "SELECT TABLE_NAME FROM \"DATABASE\".INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'DS_SCHEMA' ;" .replace("DATABASE", sqlServerConfiguration.getDataBase()) .replace("DS_SCHEMA", sqlServerConfiguration.getSchema()); case oracle: diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index a3daa200d0..2324f62cb8 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -1054,24 +1054,25 @@ public class DataSetTableService { return sql; } - public String removeVariables(String sql, String dsType) throws Exception { + public String removeVariables(final String sql, String dsType) throws Exception { + String tmpSql = sql; Pattern pattern = Pattern.compile(regex); - Matcher matcher = pattern.matcher(sql); + Matcher matcher = pattern.matcher(tmpSql); boolean hasVariables = false; while (matcher.find()) { hasVariables = true; - sql = sql.replace(matcher.group(), SubstitutedParams); + tmpSql = tmpSql.replace(matcher.group(), SubstitutedParams); } - if (!hasVariables && !sql.contains(SubstitutedParams)) { - return sql; + if (!hasVariables && !tmpSql.contains(SubstitutedParams)) { + return tmpSql; } - CCJSqlParserUtil.parse(sql, parser -> parser.withSquareBracketQuotation(true)); - Statement statement = CCJSqlParserUtil.parse(sql); + CCJSqlParserUtil.parse(tmpSql, parser -> parser.withSquareBracketQuotation(true)); + Statement statement = CCJSqlParserUtil.parse(tmpSql); Select select = (Select) statement; if (select.getSelectBody() instanceof PlainSelect) { return handlePlainSelect((PlainSelect) select.getSelectBody(), select, dsType); - }else { + } else { String result = ""; SetOperationList setOperationList = (SetOperationList) select.getSelectBody(); for (int i = 0; i < setOperationList.getSelects().size(); i++) { @@ -1175,15 +1176,24 @@ public class DataSetTableService { } public Map getSQLPreview(DataSetTableRequest dataSetTableRequest) throws Exception { + DataTableInfoDTO dataTableInfo = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class); + String sql = dataTableInfo.isBase64Encryption() ? new String(java.util.Base64.getDecoder().decode(dataTableInfo.getSql())) : dataTableInfo.getSql(); Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId()); if (ds == null) { throw new Exception(Translator.get("i18n_invalid_ds")); } + String tmpSql = removeVariables(sql, ds.getType()); + if (dataSetTableRequest.getMode() == 1 && (tmpSql.contains(SubstitutedParams) || tmpSql.contains(SubstitutedSql.trim()))) { + throw new Exception(Translator.get("I18N_SQL_variable_direct_limit")); + } + if (tmpSql.contains(SubstitutedParams)) { + throw new Exception(Translator.get("I18N_SQL_variable_limit")); + } Provider datasourceProvider = ProviderFactory.getProvider(ds.getType()); DatasourceRequest datasourceRequest = new DatasourceRequest(); datasourceRequest.setDatasource(ds); - DataTableInfoDTO dataTableInfo = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class); - String sql = dataTableInfo.isBase64Encryption() ? new String(java.util.Base64.getDecoder().decode(dataTableInfo.getSql())) : dataTableInfo.getSql(); + + sql = handleVariableDefaultValue(sql, dataSetTableRequest.getSqlVariableDetails(), ds.getType()); if (StringUtils.isEmpty(sql)) { DataEaseException.throwException(Translator.get("i18n_sql_not_empty")); diff --git a/backend/src/main/java/io/dataease/service/message/service/strategy/SendLarksuite.java b/backend/src/main/java/io/dataease/service/message/service/strategy/SendLarksuite.java new file mode 100644 index 0000000000..d5f49cfc77 --- /dev/null +++ b/backend/src/main/java/io/dataease/service/message/service/strategy/SendLarksuite.java @@ -0,0 +1,39 @@ +package io.dataease.service.message.service.strategy; + + +import io.dataease.auth.service.AuthUserService; +import io.dataease.plugins.common.base.domain.SysUserAssist; +import io.dataease.plugins.config.SpringContextUtil; +import io.dataease.plugins.xpack.larksuite.service.LarksuiteXpackService; +import io.dataease.service.message.service.SendService; +import io.dataease.service.sys.SysUserService; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Service("sendLarksuite") +public class SendLarksuite implements SendService { + + @Autowired + private AuthUserService authUserService; + + @Resource + private SysUserService sysUserService; + + @Override + public void sendMsg(Long userId, Long typeId, String content, String param) { + SysUserAssist sysUserAssist = sysUserService.assistInfo(userId); + if (ObjectUtils.isNotEmpty(sysUserAssist) && StringUtils.isNotBlank(sysUserAssist.getLarksuiteId()) && authUserService.supportLarksuite()) { + String username = sysUserAssist.getLarksuiteId(); + LarksuiteXpackService larksuiteXpackService = SpringContextUtil.getBean(LarksuiteXpackService.class); + List userIds = new ArrayList<>(); + userIds.add(username); + larksuiteXpackService.pushMsg(userIds, content); + } + } +} \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V42__1.16.sql b/backend/src/main/resources/db/migration/V42__1.16.sql index d7cc55a7ab..d696b31259 100644 --- a/backend/src/main/resources/db/migration/V42__1.16.sql +++ b/backend/src/main/resources/db/migration/V42__1.16.sql @@ -42,3 +42,14 @@ INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `update_time`) VALUES (203, 0, 0, 1, '应用市场', 'app-template-market', 'panel/appTemplateMarket/index', 6, 'dashboard', '/appTemplateMarket', 0, 0, 0, NULL, NULL, NULL, NULL, 1620444227389); + +ALTER TABLE `dataset_table_field` CHANGE COLUMN `type` `type` VARCHAR(255) NOT NULL COMMENT '原始字段类型' ; + +INSERT INTO `my_plugin` (`name`, `store`, `free`, `cost`, `category`, `descript`, `version`, `creator`, `load_mybatis`, + `install_time`, `module_name`, `ds_type`) +VALUES ('Apache Kylin 数据源插件', 'default', '0', '0', 'datasource', 'Apache Kylin 数据源插件', '1.0-SNAPSHOT', 'DATAEASE', '0', + '1650765903630', 'kylin-backend', 'kylin'); + + + +INSERT INTO `sys_msg_channel` (`msg_channel_id`, `channel_name`, `service_name`) VALUES ('6', 'webmsg.channel_larksuite_msg', 'sendLarksuite'); diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index d3ba643e92..df1effdcd3 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -194,6 +194,7 @@ I18N_DATASOURCE_LEVEL_GRANT=Grant I18N_NO_PERMISSION=You do not have permission to I18N_PLEASE_CONCAT_ADMIN=Please contact the administrator for authorization I18N_SQL_variable_limit=SQL variables can only be used in where conditions +I18N_SQL_variable_direct_limit=SQL variables can only be used for direct connection I18N_EMAIL_CONFIG_ERROR=Email config error I18N_EMAIL_HOST_ERROR=Email host can not be empty I18N_EMAIL_PORT_ERROR=Email port can not be empty diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index bdaa67a794..a0972f0da7 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -194,6 +194,7 @@ I18N_DATASOURCE_LEVEL_GRANT=\u6388\u6743 I18N_NO_PERMISSION=\u5F53\u524D\u7528\u6237\u6CA1\u6709\u6743\u9650 I18N_PLEASE_CONCAT_ADMIN=\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u5F00\u901A I18N_SQL_variable_limit=SQL \u53D8\u91CF\u53EA\u80FD\u5728 WHERE \u6761\u4EF6\u4E2D\u4F7F\u7528 +I18N_SQL_variable_direct_limit=SQL变量只能用于直连 I18N_EMAIL_CONFIG_ERROR=\u90AE\u4EF6\u914D\u7F6E\u9519\u8BEF I18N_EMAIL_HOST_ERROR=\u90AE\u4EF6\u4E3B\u673A\u4E0D\u80FD\u4E3A\u7A7A I18N_EMAIL_PORT_ERROR=\u90AE\u4EF6\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 2003f5a638..fb269a8bda 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -190,6 +190,7 @@ I18N_DATASOURCE_LEVEL_GRANT=\u6388\u6B0A I18N_NO_PERMISSION=\u7576\u524D\u7528\u6236\u6C92\u6709\u6B0A\u9650 I18N_PLEASE_CONCAT_ADMIN=\u8ACB\u806F\u7CFB\u7BA1\u7406\u54E1\u958B\u901A I18N_SQL_variable_limit=SQL\u8B8A\u6578\u53EA\u80FD\u5728WHERE\u689D\u4EF6\u4E2D\u4F7F\u7528 +I18N_SQL_variable_direct_limit=SQL變數只能用於直連 I18N_EMAIL_CONFIG_ERROR=\u90F5\u4EF6\u914D\u7F6E\u932F\u8AA4 I18N_EMAIL_HOST_ERROR=\u90F5\u4EF6\u4E3B\u6A5F\u4E0D\u80FD\u70BA\u7A7A I18N_EMAIL_PORT_ERROR=\u90F5\u4EF6\u7AEF\u53E3\u4E0D\u80FD\u70BA\u7A7A diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 0ecc9460aa..2d38230a34 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -44,7 +44,6 @@ @resizeView="resizeView" @linkJumpSet="linkJumpSet" @boardSet="boardSet" - @fieldSelect="fieldSelect" /> - +
- +
@@ -386,7 +385,7 @@ export default { data: function() { return { contentDisplay: true, - //当画布在tab中是 宽度左右拓展的余量 + // 当画布在tab中是 宽度左右拓展的余量 parentWidthTabOffset: 40, canvasChangeTips: 'none', tabMoveInYOffset: 70, @@ -1427,7 +1426,6 @@ export default { // 如果辅助设计 需要最后调整矩阵 if (this.element.auxiliaryMatrix) { - const _this = this const historyTabMoveInActiveId = this.tabMoveInActiveId const historyTabMoveOutComponentId = this.tabMoveOutComponentId setTimeout(() => { @@ -1464,10 +1462,10 @@ export default { componentCanvasChange() { // 主画布移入Tab画布 if (this.tabMoveInActiveId) { - //从当前画布移除 + // 从当前画布移除 this.$emit('amRemoveItem') this.element.canvasPid = this.element.canvasId - //Tab内部的画布ID 为 tab组件id + '-' + tabActiveName + // Tab内部的画布ID 为 tab组件id + '-' + tabActiveName const targetCanvasId = this.tabMoveInActiveId + '-' + this.tabActiveTabNameMap[this.tabMoveInActiveId] const targetCanvasScale = this.curCanvasScaleMap[targetCanvasId] if (this.element.auxiliaryMatrix) { @@ -1489,11 +1487,11 @@ export default { } // Tab 画布 移入主画布 if (this.tabMoveOutComponentId) { - //从当前画布移除 + // 从当前画布移除 this.$emit('amRemoveItem') this.element.canvasPid = 0 this.element.canvasId = 'canvas-main' - //Tab内部的画布ID 为 tab组件id + '-' + tabActiveName + // Tab内部的画布ID 为 tab组件id + '-' + tabActiveName const targetCanvasScale = this.curCanvasScaleMap['canvas-main'] // 按照阴影位置定位 this.element.style.left = (this.mousePointShadowMap.mouseX - (this.mousePointShadowMap.width)) / targetCanvasScale.scalePointWidth @@ -1509,7 +1507,6 @@ export default { this.recordMatrixCurShadowStyle(targetCanvasScale) } } - }, // 设置属性(属性跟随所属canvas component类型 要做出改变) @@ -1979,7 +1976,6 @@ export default { } else if (this.tabMoveInActiveId === item.getAttribute('component-id')) { this.$store.commit('setTabMoveInActiveId', null) } - } } } diff --git a/frontend/src/components/DeDrag/pointShadow.vue b/frontend/src/components/DeDrag/pointShadow.vue index 2a6591b714..569c968315 100644 --- a/frontend/src/components/DeDrag/pointShadow.vue +++ b/frontend/src/components/DeDrag/pointShadow.vue @@ -4,8 +4,14 @@ :style="styleInfo" >
-
-
+
+
组件将被移出Tab
@@ -94,7 +100,6 @@ export default { background-color: rgba(179, 212, 252); } - .point-shadow-tips { left: 0px; top: 0px; diff --git a/frontend/src/components/DeDrag/shadow.vue b/frontend/src/components/DeDrag/shadow.vue index 26434ff922..a90e29a698 100644 --- a/frontend/src/components/DeDrag/shadow.vue +++ b/frontend/src/components/DeDrag/shadow.vue @@ -10,6 +10,7 @@ import { mapState } from 'vuex' export default { replace: true, + // eslint-disable-next-line name: 'Shadow', props: { canvasId: { @@ -18,7 +19,7 @@ export default { } }, computed: { - curCanvasScaleSelf(){ + curCanvasScaleSelf() { return this.curCanvasScaleMap[this.canvasId] }, styleInfo() { diff --git a/frontend/src/components/GradientColorSelector/base.js b/frontend/src/components/GradientColorSelector/base.js index 557047a9a5..bf88a65f75 100644 --- a/frontend/src/components/GradientColorSelector/base.js +++ b/frontend/src/components/GradientColorSelector/base.js @@ -86,7 +86,7 @@ export const colorCases = [ export const gradientColorCases = [ { name: '渐变色1', - value: 'gradient1', + value: 'gradient1_continuous_gradient', colors: [ ['rgba(144,202,249,0.5)', 'rgba(1,87,155,0.9)'], ['rgba(127,222,234,1)', 'rgba(0,77,65,1)'], @@ -101,3 +101,72 @@ export const gradientColorCases = [ export const isGradientValue = value => { return value && gradientColorCases.some(item => item.value === value) } + +export const getColorType = value => { + if (value.endsWith('_split_gradient')) { + return 'split_gradient' + } + const cloneColorCases = JSON.parse(JSON.stringify(colorCases)) + if (cloneColorCases.some(item => item.value === value)) { + return 'simple' + } + return 'gradient' +} + +export const getMapColorCases = () => { + const cloneColorCases = JSON.parse(JSON.stringify(colorCases)) + return cloneColorCases.map(colorItem => { + const curColors = colorItem.colors + const len = curColors.length + const start = curColors[0] + const end = curColors[len - 1] + const itemResult = { + name: colorItem.name, + value: colorItem.value + '_split_gradient', + baseColors: [start, end], + colors: stepsColor(start, end, 9, 1) + } + return itemResult + }) +} + +export function stepsColor(start, end, steps, gamma) { + var i; var j; var ms; var me; var output = []; var so = [] + gamma = gamma || 1 + var normalize = function(channel) { + return Math.pow(channel / 255, gamma) + } + start = parseColor(start).map(normalize) + end = parseColor(end).map(normalize) + for (i = 0; i < steps; i++) { + ms = (steps - 1) === 0 ? 0 : (i / (steps - 1)) + me = 1 - ms + for (j = 0; j < 3; j++) { + so[j] = pad( + Math.round( + Math.pow(start[j] * me + end[j] * ms, 1 / gamma) * 255 + ).toString(16) + ) + } + output.push('#' + so.join('')) + } + function parseColor(hexStr) { + return hexStr.length === 4 + ? hexStr + .substr(1) + .split('') + .map(function(s) { + return 0x11 * parseInt(s, 16) + }) + : [hexStr.substr(1, 2), hexStr.substr(3, 2), hexStr.substr(5, 2)].map( + function(s) { + return parseInt(s, 16) + } + ) + } + function pad(s) { + return s.length === 1 ? '0' + s : s + } + return output +} + diff --git a/frontend/src/components/GradientColorSelector/index.vue b/frontend/src/components/GradientColorSelector/index.vue index 48da711b0d..8bffc71dab 100644 --- a/frontend/src/components/GradientColorSelector/index.vue +++ b/frontend/src/components/GradientColorSelector/index.vue @@ -20,7 +20,7 @@ @@ -38,7 +38,7 @@
@@ -47,7 +47,7 @@ @tab-click="handleClick" > - + + @@ -132,7 +139,7 @@ diff --git a/frontend/src/components/canvas/components/Editor/DateFormat.vue b/frontend/src/components/canvas/components/Editor/DateFormat.vue index af04e16a9a..840b8c1154 100644 --- a/frontend/src/components/canvas/components/Editor/DateFormat.vue +++ b/frontend/src/components/canvas/components/Editor/DateFormat.vue @@ -130,7 +130,7 @@ export default { } }, computed: { - curCanvasScaleSelf(){ + curCanvasScaleSelf() { return this.curCanvasScaleMap[this.canvasId] }, ...mapState([ diff --git a/frontend/src/components/canvas/components/Editor/DeEditor.vue b/frontend/src/components/canvas/components/Editor/DeEditor.vue index 9e9bfa3c7d..eccbc53c7c 100644 --- a/frontend/src/components/canvas/components/Editor/DeEditor.vue +++ b/frontend/src/components/canvas/components/Editor/DeEditor.vue @@ -13,8 +13,15 @@ @scroll="canvasScroll" > - - + + - + - + - + [] }, canvasId: { type: String, @@ -893,18 +908,18 @@ export default { moveTabCollisionActive() { return this.tabCollisionActiveId }, - pointShadowShow(){ - return this.canvasId==='canvas-main' - && this.curComponent - && this.curComponent.canvasId !== 'canvas-main' - && this.tabMoveOutComponentId + pointShadowShow() { + return this.canvasId === 'canvas-main' && + this.curComponent && + this.curComponent.canvasId !== 'canvas-main' && + this.tabMoveOutComponentId }, shadowShow() { - return ((this.curComponent - && this.curComponent.auxiliaryMatrix - && this.curComponent.canvasId === this.canvasId - && (this.curComponent.optStatus.dragging || this.curComponent.optStatus.resizing)) - || (this.dragComponentInfo && this.dragComponentInfo.canvasId ===this.canvasId )) && !this.tabMoveInActive + return ((this.curComponent && + this.curComponent.auxiliaryMatrix && + this.curComponent.canvasId === this.canvasId && + (this.curComponent.optStatus.dragging || this.curComponent.optStatus.resizing)) || + (this.dragComponentInfo && this.dragComponentInfo.canvasId === this.canvasId)) && !this.tabMoveInActive }, tabMoveInActive() { return this.tabMoveInActiveId @@ -928,7 +943,9 @@ export default { } }, // 挤占式画布设计 + // eslint-disable-next-line coordinates() { + // eslint-disable-next-line return this.coordinates }, customStyle() { @@ -1419,7 +1436,7 @@ export default { matrixStyleOriginWidth: this.matrixStyle.originWidth, matrixStyleOriginHeight: this.matrixStyle.originHeight }) - if(this.canvasId === 'canvas-main'){ + if (this.canvasId === 'canvas-main') { this.$store.commit('setPreviewCanvasScale', { scaleWidth: this.scalePointWidth, scaleHeight: this.scalePointHeight diff --git a/frontend/src/components/canvas/components/Editor/EditBar.vue b/frontend/src/components/canvas/components/Editor/EditBar.vue index d111132bc2..e969bf1bfc 100644 --- a/frontend/src/components/canvas/components/Editor/EditBar.vue +++ b/frontend/src/components/canvas/components/Editor/EditBar.vue @@ -200,7 +200,7 @@ export default { }, sourceElement: { type: Object, - required: true + default: () => {} }, element: { type: Object, @@ -319,7 +319,7 @@ export default { miniWidth() { return this.mobileLayoutStatus ? 1 : 4 }, - curCanvasScaleSelf(){ + curCanvasScaleSelf() { return this.curCanvasScaleMap[this.canvasId] }, ...mapState([ diff --git a/frontend/src/components/canvas/components/Editor/PGrid.vue b/frontend/src/components/canvas/components/Editor/PGrid.vue index c2df81e89b..f1fba8b94c 100644 --- a/frontend/src/components/canvas/components/Editor/PGrid.vue +++ b/frontend/src/components/canvas/components/Editor/PGrid.vue @@ -6,8 +6,8 @@ class="outer-class" >
diff --git a/frontend/src/components/canvas/components/Editor/Preview.vue b/frontend/src/components/canvas/components/Editor/Preview.vue index 235c43e11b..3f36a04261 100644 --- a/frontend/src/components/canvas/components/Editor/Preview.vue +++ b/frontend/src/components/canvas/components/Editor/Preview.vue @@ -68,16 +68,14 @@ import { uuid } from 'vue-uuid' import { deepCopy, imgUrlTrans } from '@/components/canvas/utils/utils' import eventBus from '@/components/canvas/utils/eventBus' import elementResizeDetectorMaker from 'element-resize-detector' -import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog' import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar' -import UserViewMobileDialog from '@/components/canvas/custom-component/UserViewMobileDialog' import bus from '@/utils/bus' import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil' import { hasDataPermission } from '@/utils/permission' const erd = elementResizeDetectorMaker() export default { - components: { UserViewMobileDialog, ComponentWrapper, UserViewDialog, CanvasOptBar }, + components: { ComponentWrapper, CanvasOptBar }, model: { prop: 'show', event: 'change' @@ -142,10 +140,10 @@ export default { }, data() { return { - previewDomId: 'preview-'+this.canvasId, - previewRefId: 'preview-ref-'+this.canvasId, - previewTempDomId: 'preview-temp-'+this.canvasId, - previewTempRefId: 'preview-temp-ref-'+this.canvasId, + previewDomId: 'preview-' + this.canvasId, + previewRefId: 'preview-ref-' + this.canvasId, + previewTempDomId: 'preview-temp-' + this.canvasId, + previewTempRefId: 'preview-temp-ref-' + this.canvasId, isShowPreview: false, panelId: '', needToChangeHeight: [ @@ -441,7 +439,7 @@ export default { } else { this.scaleHeight = canvasHeight * 100 / this.canvasStyleData.height// 获取高度比 } - if(this.canvasId === 'canvas-main'){ + if (this.canvasId === 'canvas-main') { this.$store.commit('setPreviewCanvasScale', { scaleWidth: (this.scaleWidth / 100), scaleHeight: (this.scaleHeight / 100) }) } this.handleScaleChange() diff --git a/frontend/src/components/canvas/components/Editor/PreviewMobile.vue b/frontend/src/components/canvas/components/Editor/PreviewMobile.vue index 866a97716e..5a5eac8c9d 100644 --- a/frontend/src/components/canvas/components/Editor/PreviewMobile.vue +++ b/frontend/src/components/canvas/components/Editor/PreviewMobile.vue @@ -46,11 +46,10 @@ import { uuid } from 'vue-uuid' import { deepCopy, imgUrlTrans } from '@/components/canvas/utils/utils' import eventBus from '@/components/canvas/utils/eventBus' import elementResizeDetectorMaker from 'element-resize-detector' -import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog' import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar' export default { - components: { ComponentWrapper, UserViewDialog, CanvasOptBar }, + components: { ComponentWrapper, CanvasOptBar }, model: { prop: 'show', event: 'change' diff --git a/frontend/src/components/canvas/components/TextAttr.vue b/frontend/src/components/canvas/components/TextAttr.vue index ab657a25fa..7e3b2e874e 100644 --- a/frontend/src/components/canvas/components/TextAttr.vue +++ b/frontend/src/components/canvas/components/TextAttr.vue @@ -319,7 +319,10 @@ style="width: 20px;float: left;margin-top: 2px;margin-left: 10px;" > - +
@@ -601,7 +604,7 @@ export default { showVertical() { return !['textSelectGridWidget', 'numberSelectGridWidget'].includes(this.curComponent.serviceName) }, - curCanvasScaleSelf(){ + curCanvasScaleSelf() { return this.curCanvasScaleMap[this.canvasId] }, ...mapState([ diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 319232a686..d3ab9c2e14 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -136,7 +136,6 @@ export function panelDataPrepare(componentData, componentStyle, callback) { // 增加所属画布ID(canvasId)当前所在画布的父ID(canvasPid) 主画布ID为main-canvas, PID = 0 表示当前所属canvas为最顶层 item.canvasId = (item.canvasId || 'canvas-main') item.canvasPid = (item.canvasPid || '0') - }) // 初始化密度为最高密度 componentStyle.aidedDesign.matrixBase = 4 @@ -149,7 +148,7 @@ export function panelDataPrepare(componentData, componentStyle, callback) { export function resetID(data) { if (data) { data.forEach(item => { - item.type !== 'custom' && item.type !== 'de-tabs'&& (item.id = uuid.v1()) + item.type !== 'custom' && item.type !== 'de-tabs' && (item.id = uuid.v1()) }) } return data @@ -229,6 +228,6 @@ export function imgUrlTrans(url) { } } -export function getNowCanvasComponentData(canvasId){ - return store.state.componentData.filter(item => item.canvasId===canvasId) +export function getNowCanvasComponentData(canvasId) { + return store.state.componentData.filter(item => item.canvasId === canvasId) } diff --git a/frontend/src/components/dataease/DeOutWidget.vue b/frontend/src/components/dataease/DeOutWidget.vue index 4d567a5a60..ceec98763f 100644 --- a/frontend/src/components/dataease/DeOutWidget.vue +++ b/frontend/src/components/dataease/DeOutWidget.vue @@ -39,8 +39,8 @@ :is="element.component" v-if="element.type==='custom'" :id="'component' + element.id" - :canvas-id="canvasId" ref="deOutWidget" + :canvas-id="canvasId" class="component-custom" :out-style="element.style" :is-relation="isRelation" @@ -59,7 +59,6 @@