This commit is contained in:
taojinlong 2022-04-17 16:08:22 +08:00
commit 16e5641135
104 changed files with 2641 additions and 391 deletions

View File

@ -36,12 +36,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!--<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</exclusions>-->
</dependency>
<dependency>

View File

@ -30,6 +30,10 @@ public interface AuthApi {
@PostMapping("/useInitPwd")
Boolean useInitPwd();
@ApiOperation("用户初始密码")
@PostMapping("/defaultPwd")
String defaultPwd();
@ApiOperation("登出")
@PostMapping("/logout")
String logout();

View File

@ -154,6 +154,11 @@ public class AuthServer implements AuthApi {
return StringUtils.equals(AuthUtils.getUser().getPassword(), md5);
}
@Override
public String defaultPwd() {
return DEFAULT_PWD;
}
@Override
public String logout() {
String token = ServletUtils.getToken();

View File

@ -42,6 +42,7 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/index.html", ANON);
filterChainDefinitionMap.put("/link.html", ANON);
filterChainDefinitionMap.put("/board/**", ANON);
filterChainDefinitionMap.put("/websocket/**", "anon");
// 获取主题信息
filterChainDefinitionMap.put("/plugin/theme/themes", ANON);

View File

@ -0,0 +1,12 @@
package io.dataease.commons.constants;
public class RedisConstants {
public static final String GLOBAL_REDIS_TOPIC = "global_redis_topic";
public static final String PLUGIN_INSTALL_MSG = "pluginMsgService";
public static final String WEBSOCKET_MSG = "wsMsgService";
}

View File

@ -0,0 +1,13 @@
package io.dataease.commons.model;
import lombok.Data;
import java.io.Serializable;
@Data
public class RedisMessage<T> implements Serializable {
private String type;
private T data;
}

View File

@ -2,19 +2,24 @@ package io.dataease.config;
import io.dataease.commons.condition.RedisStatusCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
@Conditional({RedisStatusCondition.class})
@Configuration
public class RedisConfig {
@Conditional({RedisStatusCondition.class})
@Autowired
private RedisConnectionFactory redisConnectionFactory;
@Bean
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
@ -24,4 +29,11 @@ public class RedisConfig {
return redisTemplate;
}
@Bean
public RedisMessageListenerContainer redisContainer() {
final RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(redisConnectionFactory);
return container;
}
}

View File

@ -10,6 +10,7 @@ import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.controller.request.panel.PanelViewDetailsRequest;
import io.dataease.dto.PermissionProxy;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.panel.PanelGroupDTO;
@ -22,6 +23,8 @@ import org.apache.shiro.authz.annotation.Logical;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -100,4 +103,12 @@ public class PanelGroupController {
return panelGroupService.queryPanelComponents(id);
}
@ApiOperation("导出仪表板视图明细")
@PostMapping("/exportDetails")
@I18n
public void exportDetails(@RequestBody PanelViewDetailsRequest request, HttpServletResponse response) throws IOException {
panelGroupService.exportPanelViewDetails(request,response);
}
}

View File

@ -0,0 +1,28 @@
package io.dataease.controller.request.panel;
import lombok.Data;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/4/8
* Description:
*/
@Data
public class PanelViewDetailsRequest {
private String viewName;
private String[] header;
private List<String[]> details;
private String snapshot;
private int snapshotWidth;
private int snapshotHeight;
}

View File

@ -16,7 +16,7 @@
<select id="searchOne" resultMap="BaseResultMapDTO">
select
id, `name`, scene_id, data_source_id, `type`, `mode`,`info`, create_by, create_time,
get_auths(id,'dataset',#{userId}) as `privileges`
get_auths(id,'dataset',#{userId}) as `privileges`, scene_id as pid
from dataset_table
<where>
<if test="id != null">

View File

@ -29,7 +29,7 @@
WHERE
type &lt;= 1
AND (
sys_menu.menu_id != 61
sys_menu.menu_id != 100
OR EXISTS (
SELECT
1

View File

@ -0,0 +1,59 @@
package io.dataease.listener;
import com.google.gson.Gson;
import io.dataease.commons.condition.RedisStatusCondition;
import io.dataease.commons.constants.RedisConstants;
import io.dataease.commons.model.RedisMessage;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.LogUtil;
import io.dataease.service.redis.RedisMessageBroadcast;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.event.EventListener;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Conditional({RedisStatusCondition.class})
@Service
public class RedisMessageSubscriber implements MessageListener {
@Resource
private RedisMessageListenerContainer redisMessageListenerContainer;
private static final Gson json = new Gson();
@Autowired
private RedisTemplate redisTemplate;
/**
* 启动之后订阅 topic
*/
@EventListener
public void init(ApplicationReadyEvent event) {
String topic = RedisConstants.GLOBAL_REDIS_TOPIC;
LogUtil.info("Subscribe Topic: " + topic);
redisMessageListenerContainer.addMessageListener(new MessageListenerAdapter(this), new ChannelTopic(topic));
}
/**
* @param message 消息内容
* @param pattern 暂时用不到
*/
public void onMessage(final Message message, final byte[] pattern) {
RedisMessage redisMessage = json.fromJson(message.toString(), RedisMessage.class);
RedisMessageBroadcast service = (RedisMessageBroadcast)CommonBeanFactory.getBean(redisMessage.getType());
service.messageCallBack(redisMessage.getData());
}
}

View File

@ -38,7 +38,7 @@ public class CacheUtils {
if (getCacheManager() instanceof RedisCacheManager) {
RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate");
ValueOperations valueOperations = redisTemplate.opsForValue();
valueOperations.setIfPresent(cacheName + "::" + key , value );
valueOperations.set(cacheName + "::" + key , value );
return;
}
Element e = new Element(key, value);

View File

@ -2,11 +2,13 @@ package io.dataease.plugins.server;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.pool.PriorityThreadPoolExecutor;
import io.dataease.commons.utils.*;
import io.dataease.plugins.common.entity.GlobalTaskEntity;
import io.dataease.plugins.common.entity.GlobalTaskInstance;
import io.dataease.plugins.common.entity.XpackConditionEntity;
import io.dataease.plugins.common.entity.XpackGridRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.email.dto.request.XpackEmailCreate;
@ -25,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
@ -47,6 +50,18 @@ public class XEmailTaskServer {
@RequestBody XpackGridRequest request) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
CurrentUserDto user = AuthUtils.getUser();
if (!user.getIsAdmin()) {
Long userId = user.getUserId();
XpackConditionEntity condition = new XpackConditionEntity();
condition.setField("u.user_id");
condition.setOperator("eq");
condition.setValue(userId);
List<XpackConditionEntity> conditions = CollectionUtils.isEmpty(request.getConditions()) ? new ArrayList<>() : request.getConditions();
conditions.add(condition);
request.setConditions(conditions);
}
List<XpackTaskGridDTO> tasks = emailXpackService.taskGrid(request);
if (CollectionUtils.isNotEmpty(tasks)) {
tasks.forEach(item -> {

View File

@ -1026,7 +1026,11 @@ public class DorisQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*")) {
fieldName = DorisConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(DorisConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(DorisConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(DorisConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(DorisConstants.CAST, originField, y.getDeType() == 2 ? DorisConstants.DEFAULT_INT_FORMAT : DorisConstants.DEFAULT_FLOAT_FORMAT);
@ -1035,7 +1039,11 @@ public class DorisQueryProvider extends QueryProvider {
fieldName = String.format(DorisConstants.ROUND, cast1, "2");
} else {
String cast = String.format(DorisConstants.CAST, originField, y.getDeType() == 2 ? DorisConstants.DEFAULT_INT_FORMAT : DorisConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(DorisConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(DorisConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(DorisConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()
@ -1081,6 +1089,7 @@ public class DorisQueryProvider extends QueryProvider {
private String reflectFieldName(DatasetTableField field) {
return field.getDataeaseName();
}
private String calcFieldRegex(String originField, SQLObj tableObj) {
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]

View File

@ -1030,7 +1030,11 @@ public class MysqlQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*")) {
fieldName = MysqlConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(MysqlConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(MysqlConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(MysqlConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(MysqlConstants.CAST, originField, y.getDeType() == 2 ? MysqlConstants.DEFAULT_INT_FORMAT : MysqlConstants.DEFAULT_FLOAT_FORMAT);
@ -1039,7 +1043,11 @@ public class MysqlQueryProvider extends QueryProvider {
fieldName = String.format(MysqlConstants.ROUND, cast1, "2");
} else {
String cast = String.format(MysqlConstants.CAST, originField, y.getDeType() == 2 ? MysqlConstants.DEFAULT_INT_FORMAT : MysqlConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(MysqlConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(MysqlConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(MysqlConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -1039,7 +1039,11 @@ public class CKQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = CKConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(CKConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(CKConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(CKConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = y.getDeType() == 2 ? String.format(CKConstants.toInt64, originField) : String.format(CKConstants.toFloat64, originField);
@ -1047,7 +1051,11 @@ public class CKQueryProvider extends QueryProvider {
fieldName = String.format(CKConstants.toDecimal, agg);
} else {
String cast = y.getDeType() == 2 ? String.format(CKConstants.toInt64, originField) : String.format(CKConstants.toFloat64, originField);
fieldName = String.format(CKConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(CKConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(CKConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -993,7 +993,11 @@ public class Db2QueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = Db2Constants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(Db2Constants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(Db2Constants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(Db2Constants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(Db2Constants.CAST, originField, y.getDeType() == 2 ? Db2Constants.DEFAULT_INT_FORMAT : Db2Constants.DEFAULT_FLOAT_FORMAT);
@ -1001,7 +1005,11 @@ public class Db2QueryProvider extends QueryProvider {
fieldName = String.format(Db2Constants.CAST, agg, Db2Constants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(Db2Constants.CAST, originField, y.getDeType() == 2 ? Db2Constants.DEFAULT_INT_FORMAT : Db2Constants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(Db2Constants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(Db2Constants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(Db2Constants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -1032,7 +1032,11 @@ public class EsQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = EsSqlLConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(EsSqlLConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(EsSqlLConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? "bigint" : "double");
@ -1040,7 +1044,11 @@ public class EsQueryProvider extends QueryProvider {
fieldName = String.format(EsSqlLConstants.ROUND, agg, "2");
} else {
String cast = String.format(EsSqlLConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? "bigint" : "double");
fieldName = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(EsSqlLConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -1007,7 +1007,11 @@ public class HiveQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = HiveConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(HiveConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(HiveConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(HiveConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(HiveConstants.CAST, originField, y.getDeType() == 2 ? HiveConstants.DEFAULT_INT_FORMAT : HiveConstants.DEFAULT_FLOAT_FORMAT);
@ -1015,7 +1019,11 @@ public class HiveQueryProvider extends QueryProvider {
fieldName = String.format(HiveConstants.CAST, agg, HiveConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(HiveConstants.CAST, originField, y.getDeType() == 2 ? HiveConstants.DEFAULT_INT_FORMAT : HiveConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(HiveConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(HiveConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(HiveConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -975,7 +975,11 @@ public class ImpalaQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = ImpalaConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(ImpalaConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(ImpalaConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(ImpalaConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(ImpalaConstants.CAST, originField, y.getDeType() == 2 ? ImpalaConstants.DEFAULT_INT_FORMAT : ImpalaConstants.DEFAULT_FLOAT_FORMAT);
@ -983,7 +987,11 @@ public class ImpalaQueryProvider extends QueryProvider {
fieldName = String.format(ImpalaConstants.CAST, agg, ImpalaConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(ImpalaConstants.CAST, originField, y.getDeType() == 2 ? ImpalaConstants.DEFAULT_INT_FORMAT : ImpalaConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(ImpalaConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(ImpalaConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(ImpalaConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -7,6 +7,7 @@ import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.plugins.common.constants.MongoConstants;
import io.dataease.plugins.common.constants.MySQLConstants;
import io.dataease.plugins.common.constants.SQLConstants;
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
@ -915,9 +916,17 @@ public class MongoQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = MongoConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(MongoConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(MongoConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
}
}
return SQLObj.builder()
.fieldName(fieldName)

View File

@ -1011,7 +1011,11 @@ public class MysqlQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = MySQLConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(MySQLConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(MySQLConstants.CAST, originField, y.getDeType() == 2 ? MySQLConstants.DEFAULT_INT_FORMAT : MySQLConstants.DEFAULT_FLOAT_FORMAT);
@ -1019,7 +1023,11 @@ public class MysqlQueryProvider extends QueryProvider {
fieldName = String.format(MySQLConstants.CAST, agg, MySQLConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(MySQLConstants.CAST, originField, y.getDeType() == 2 ? MySQLConstants.DEFAULT_INT_FORMAT : MySQLConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(MySQLConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -1083,7 +1083,11 @@ public class OracleQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = OracleConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(OracleConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(OracleConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(OracleConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(OracleConstants.CAST, originField, y.getDeType() == 2 ? OracleConstants.DEFAULT_INT_FORMAT : OracleConstants.DEFAULT_FLOAT_FORMAT);
@ -1091,7 +1095,11 @@ public class OracleQueryProvider extends QueryProvider {
fieldName = String.format(OracleConstants.CAST, agg, OracleConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(OracleConstants.CAST, originField, y.getDeType() == 2 ? OracleConstants.DEFAULT_INT_FORMAT : OracleConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(OracleConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(OracleConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(OracleConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -8,6 +8,7 @@ import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.plugins.common.constants.PgConstants;
import io.dataease.plugins.common.constants.SQLConstants;
import io.dataease.plugins.common.constants.SqlServerSQLConstants;
import io.dataease.plugins.common.constants.SQLConstants;
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
@ -1000,7 +1001,11 @@ public class PgQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = PgConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(PgConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT);
@ -1008,7 +1013,11 @@ public class PgQueryProvider extends QueryProvider {
fieldName = String.format(PgConstants.CAST, agg, PgConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(PgConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -923,7 +923,11 @@ public class RedshiftQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = PgConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(PgConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT);
@ -931,7 +935,11 @@ public class RedshiftQueryProvider extends QueryProvider {
fieldName = String.format(PgConstants.CAST, agg, PgConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), cast);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(PgConstants.AGG_FIELD, "COUNT", "DISTINCT " + cast);
} else {
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), cast);
}
}
}
return SQLObj.builder()

View File

@ -1050,7 +1050,11 @@ public class SqlserverQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = SqlServerSQLConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, y.getSummary(), originField);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
} else {
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, y.getSummary(), originField);
}
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String convert = String.format(SqlServerSQLConstants.CONVERT, y.getDeType() == DeTypeConstants.DE_INT ? SqlServerSQLConstants.DEFAULT_INT_FORMAT : SqlServerSQLConstants.DEFAULT_FLOAT_FORMAT, originField);
@ -1058,7 +1062,11 @@ public class SqlserverQueryProvider extends QueryProvider {
fieldName = String.format(SqlServerSQLConstants.CONVERT, SqlServerSQLConstants.DEFAULT_FLOAT_FORMAT, agg);
} else {
String convert = String.format(SqlServerSQLConstants.CONVERT, y.getDeType() == 2 ? SqlServerSQLConstants.DEFAULT_INT_FORMAT : SqlServerSQLConstants.DEFAULT_FLOAT_FORMAT, originField);
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, y.getSummary(), convert);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, "COUNT", "DISTINCT " + convert);
} else {
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, y.getSummary(), convert);
}
}
}
return SQLObj.builder()

View File

@ -19,6 +19,7 @@ import io.dataease.provider.ProviderFactory;
import io.dataease.service.datasource.DatasourceService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -149,16 +150,12 @@ public class EngineService {
}
private void setDs(DeEngine engine) {
Datasource datasource = new Datasource();
BeanUtils.copyBean(datasource, engine);
CacheUtils.put("ENGINE", "engine", datasource, null, null);
CacheUtils.remove("ENGINE", "SimpleKey []");
}
@Cacheable(value = "ENGINE")
public Datasource getDeEngine() throws Exception {
Object catcheEngine = CacheUtils.get("ENGINE", "engine");
if (catcheEngine != null) {
return (Datasource) catcheEngine;
}
Datasource datasource = new Datasource();
if (isLocalMode()) {
JSONObject jsonObject = new JSONObject();
@ -176,7 +173,7 @@ public class EngineService {
engine.setDesc("doris");
engine.setType("engine_doris");
engine.setConfiguration(jsonObject.toJSONString());
setDs(engine);
BeanUtils.copyBean(datasource, engine);
}
if (isClusterMode()) {
DeEngineExample engineExample = new DeEngineExample();
@ -185,7 +182,7 @@ public class EngineService {
if (CollectionUtils.isEmpty(deEngines)) {
throw new Exception("未设置数据引擎");
}
setDs(deEngines.get(0));
BeanUtils.copyBean(datasource, deEngines.get(0));
}
if (isSimpleMode()) {
DeEngineExample engineExample = new DeEngineExample();
@ -194,9 +191,9 @@ public class EngineService {
if (CollectionUtils.isEmpty(deEngines)) {
throw new Exception("未设置数据引擎");
}
setDs(deEngines.get(0));
BeanUtils.copyBean(datasource, deEngines.get(0));
}
return getDeEngine();
return datasource;
}

View File

@ -9,12 +9,14 @@ import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.authModel.VAuthModelRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.controller.request.panel.PanelViewDetailsRequest;
import io.dataease.dto.PanelGroupExtendDataDTO;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
import io.dataease.excel.utils.EasyExcelExporter;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.*;
import io.dataease.i18n.Translator;
@ -26,13 +28,23 @@ import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.sys.SysAuthService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.pentaho.di.core.util.UUIDUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.Base64Utils;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;
@ -46,6 +58,7 @@ public class PanelGroupService {
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
private final static String DATA_URL_TITLE = "data:image/jpeg;base64,";
@Resource
private PanelGroupMapper panelGroupMapper;
@Resource
@ -105,7 +118,7 @@ public class PanelGroupService {
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
String userName = AuthUtils.getUser().getUsername();
String panelId = request.getId();
if(StringUtils.isNotEmpty(panelId)){
if (StringUtils.isNotEmpty(panelId)) {
panelViewService.syncPanelViews(request);
}
if (StringUtils.isEmpty(panelId)) { // 新建
@ -305,46 +318,46 @@ public class PanelGroupService {
return newPanelId;
}
public String newPanel(PanelGroupRequest request){
public String newPanel(PanelGroupRequest request) {
String newPanelId = UUIDUtil.getUUIDAsString();
String newFrom = request.getNewFrom();
String templateStyle = null;
String templateData = null;
String dynamicData = null;
if(PanelConstants.NEW_PANEL_FROM.NEW.equals(newFrom)){
if (PanelConstants.NEW_PANEL_FROM.NEW.equals(newFrom)) {
}else{
} else {
//内部模板新建
if(PanelConstants.NEW_PANEL_FROM.NEW_INNER_TEMPLATE.equals(newFrom)){
if (PanelConstants.NEW_PANEL_FROM.NEW_INNER_TEMPLATE.equals(newFrom)) {
PanelTemplateWithBLOBs panelTemplate = templateMapper.selectByPrimaryKey(request.getTemplateId());
templateStyle = panelTemplate.getTemplateStyle();
templateData = panelTemplate.getTemplateData();
dynamicData = panelTemplate.getDynamicData();
}else if(PanelConstants.NEW_PANEL_FROM.NEW_OUTER_TEMPLATE.equals(newFrom)){
} else if (PanelConstants.NEW_PANEL_FROM.NEW_OUTER_TEMPLATE.equals(newFrom)) {
templateStyle = request.getPanelStyle();
templateData = request.getPanelData();
dynamicData = request.getDynamicData();
}
Map<String,String> dynamicDataMap = JSON.parseObject(dynamicData,Map.class);
Map<String, String> dynamicDataMap = JSON.parseObject(dynamicData, Map.class);
List<PanelViewInsertDTO> panelViews = new ArrayList<>();
List<PanelGroupExtendDataDTO> viewsData = new ArrayList<>();
for(Map.Entry<String, String> entry : dynamicDataMap.entrySet()){
for (Map.Entry<String, String> entry : dynamicDataMap.entrySet()) {
String originViewId = entry.getKey();
String originViewData = entry.getValue();
ChartViewDTO chartView = JSON.parseObject(originViewData,ChartViewDTO.class);
ChartViewDTO chartView = JSON.parseObject(originViewData, ChartViewDTO.class);
String position = chartView.getPosition();
String newViewId = UUIDUtil.getUUIDAsString();
chartView.setId(newViewId);
chartView.setSceneId(newPanelId);
chartView.setDataFrom(CommonConstants.VIEW_DATA_FROM.TEMPLATE);
//TODO 数据处理 1.替换viewId 2.加入panelView 数据(数据来源为template) 3.加入模板view data数据
templateData = templateData.replaceAll(originViewId,newViewId);
panelViews.add(new PanelViewInsertDTO(newViewId,newPanelId,position));
viewsData.add(new PanelGroupExtendDataDTO(newPanelId,newViewId,originViewData));
templateData = templateData.replaceAll(originViewId, newViewId);
panelViews.add(new PanelViewInsertDTO(newViewId, newPanelId, position));
viewsData.add(new PanelGroupExtendDataDTO(newPanelId, newViewId, originViewData));
chartViewMapper.insertSelective(chartView);
extChartViewMapper.copyToCache(newViewId);
}
if(CollectionUtils.isNotEmpty(panelViews)){
if (CollectionUtils.isNotEmpty(panelViews)) {
extPanelViewMapper.savePanelView(panelViews);
extPanelGroupExtendDataMapper.savePanelExtendData(viewsData);
}
@ -434,10 +447,77 @@ public class PanelGroupService {
}
return null;
}
private void clearPermissionCache(){
private void clearPermissionCache() {
CacheUtils.removeAll(AuthConstants.USER_PANEL_NAME);
CacheUtils.removeAll(AuthConstants.ROLE_PANEL_NAME);
CacheUtils.removeAll(AuthConstants.DEPT_PANEL_NAME);
}
public void exportPanelViewDetails(PanelViewDetailsRequest request, HttpServletResponse response) throws IOException {
OutputStream outputStream = response.getOutputStream();
try {
String snapshot = request.getSnapshot();
List<String[]> details = request.getDetails();
details.add(0,request.getHeader());
HSSFWorkbook wb = new HSSFWorkbook();
//明细sheet
HSSFSheet detailsSheet = wb.createSheet("数据");
//给单元格设置样式
CellStyle cellStyle = wb.createCellStyle();
Font font = wb.createFont();
//设置字体大小
font.setFontHeightInPoints((short) 12);
//设置字体加粗
font.setBold(true);
//给字体设置样式
cellStyle.setFont(font);
//设置单元格背景颜色
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
//设置单元格填充样式(使用纯色背景颜色填充)
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
if (CollectionUtils.isNotEmpty(details)) {
for (int i = 0; i < details.size(); i++) {
HSSFRow row = detailsSheet.createRow(i);
String[] rowData = details.get(i);
if (rowData != null) {
for (int j = 0; j < rowData.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellValue(rowData[j]);
if(i==0){// 头部
cell.setCellStyle(cellStyle);
//设置列的宽度
detailsSheet.setColumnWidth(j, 255*20);
}
}
}
}
}
if(StringUtils.isNotEmpty(snapshot)){
//截图sheet 1px 2.33dx 0.48 dy 8*24 个单元格
HSSFSheet snapshotSheet = wb.createSheet("图表");
short reDefaultRowHeight = (short)Math.round(request.getSnapshotHeight()*3.5/8);
int reDefaultColumnWidth = (int)Math.round(request.getSnapshotWidth()*0.25/24);
snapshotSheet.setDefaultColumnWidth(reDefaultColumnWidth);
snapshotSheet.setDefaultRowHeight(reDefaultRowHeight);
//画图的顶级管理器一个sheet只能获取一个一定要注意这点i
HSSFPatriarch patriarch = snapshotSheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, reDefaultColumnWidth, reDefaultColumnWidth,(short) 0, 0, (short)8, 24);
anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_DO_RESIZE);
patriarch.createPicture(anchor, wb.addPicture(Base64Utils.decodeFromString(snapshot.replace(DATA_URL_TITLE,"")), HSSFWorkbook.PICTURE_TYPE_JPEG));
}
response.setContentType("application/vnd.ms-excel");
//文件名称
response.setHeader("Content-disposition", "attachment;filename=" + request.getViewName() + ".xls");
wb.write(outputStream);
outputStream.flush();
outputStream.close();
} catch (Exception e) {
DataEaseException.throwException(e);
}
}
}

View File

@ -34,7 +34,7 @@ public class PanelLinkService {
private static final String USERPARAM = "&user=";
private static final String SHORT_URL_PREFIX = "/link/";
@Value("${server.servlet.context-path}")
@Value("${server.servlet.context-path:#{null}}")
private String contextPath;
@Resource

View File

@ -0,0 +1,6 @@
package io.dataease.service.redis;
public interface RedisMessageBroadcast<T> {
void messageCallBack(T arg);
}

View File

@ -0,0 +1,13 @@
package io.dataease.service.redis.impl;
import io.dataease.service.redis.RedisMessageBroadcast;
import org.springframework.stereotype.Service;
@Service
public class PluginMsgService implements RedisMessageBroadcast {
@Override
public void messageCallBack(Object arg) {
}
}

View File

@ -0,0 +1,29 @@
package io.dataease.service.redis.impl;
import com.google.gson.Gson;
import io.dataease.service.redis.RedisMessageBroadcast;
import io.dataease.websocket.entity.WsMessage;
import io.dataease.websocket.service.impl.StandaloneWsService;
import io.dataease.websocket.util.WsUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class WsMsgService implements RedisMessageBroadcast<Map> {
private static Gson json = new Gson();
@Autowired
private StandaloneWsService standaloneWsService;
@Override
public void messageCallBack(Map arg) {
WsMessage message = json.fromJson(json.toJson(arg), WsMessage.class);
Long userId = message.getUserId();
if (WsUtil.isOnLine(userId)) {
standaloneWsService.releaseMessage(message);
}
}
}

View File

@ -1,13 +0,0 @@
package io.dataease.websocket;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;
public class ServerEndpointConfigurator extends ServerEndpointConfig.Configurator {
@Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
super.modifyHandshake(sec, request, response);
}
}

View File

@ -1,31 +0,0 @@
package io.dataease.websocket;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
@ServerEndpoint(value = "/socket", configurator = ServerEndpointConfigurator.class)
@Component
public class WebSocketServer {
@OnOpen
public void onOpen(Session session) throws IOException {
}
@OnMessage
public void onMessage(Session session, String message) throws IOException {
}
@OnClose
public void onClose(Session session) throws IOException {
}
@OnError
public void onError(Session session, Throwable throwable) {
throwable.printStackTrace();
}
}

View File

@ -0,0 +1,33 @@
package io.dataease.websocket.aop;
import io.dataease.websocket.entity.WsMessage;
import io.dataease.websocket.service.WsService;
import org.apache.commons.lang3.ArrayUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
@Aspect
@Component
public class WSTrigger {
@Autowired
private WsService wsService;
@AfterReturning(value = "execution(* io.dataease.service.message.service.strategy.SendStation.sendMsg(..))")
public void after(JoinPoint point) {
Object[] args = point.getArgs();
Optional.ofNullable(args).ifPresent(objs -> {
if (ArrayUtils.isEmpty(objs)) return;
Object arg = args[0];
Long userId = (Long) arg;
WsMessage message = new WsMessage(userId, "/web-msg-topic", "refresh");
wsService.releaseMessage(message);
});
}
}

View File

@ -0,0 +1,39 @@
package io.dataease.websocket.config;
import io.dataease.websocket.factory.DeWsHandlerFactory;
import io.dataease.websocket.handler.PrincipalHandshakeHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketTransportRegistration;
@Configuration
@EnableWebSocketMessageBroker
public class WsConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket")
.setAllowedOriginPatterns("*")
.setHandshakeHandler(new PrincipalHandshakeHandler())
.withSockJS();
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic", "/user");
registry.setUserDestinationPrefix("/user");
}
@Override
public void configureWebSocketTransport(WebSocketTransportRegistration registry) {
registry.addDecoratorFactory(new DeWsHandlerFactory());
registry.setMessageSizeLimit(8192) //设置消息字节数大小
.setSendBufferSizeLimit(8192)//设置消息缓存大小
.setSendTimeLimit(10000); //设置消息发送时间限制毫秒
}
}

View File

@ -0,0 +1,17 @@
package io.dataease.websocket.entity;
import java.security.Principal;
public class DePrincipal implements Principal {
public DePrincipal(String name) {
this.name = name;
}
private String name;
@Override
public String getName() {
return name;
}
}

View File

@ -0,0 +1,21 @@
package io.dataease.websocket.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WsMessage<T> implements Serializable {
private Long userId;
private String topic;
private T data;
}

View File

@ -0,0 +1,33 @@
package io.dataease.websocket.factory;
import io.dataease.websocket.util.WsUtil;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.WebSocketHandlerDecorator;
public class DeWebSocketHandlerDecorator extends WebSocketHandlerDecorator {
public DeWebSocketHandlerDecorator(WebSocketHandler delegate) {
super(delegate);
}
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
String name = session.getPrincipal().getName();
Long userId = Long.parseLong(name);
WsUtil.onLine(userId);
super.afterConnectionEstablished(session);
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
String name = session.getPrincipal().getName();
Long userId = Long.parseLong(name);
WsUtil.offLine(userId);
super.afterConnectionClosed(session, closeStatus);
}
}

View File

@ -0,0 +1,15 @@
package io.dataease.websocket.factory;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.handler.WebSocketHandlerDecorator;
import org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory;
public class DeWsHandlerFactory implements WebSocketHandlerDecoratorFactory {
@Override
public WebSocketHandler decorate(WebSocketHandler webSocketHandler) {
return new DeWebSocketHandlerDecorator(webSocketHandler);
}
}

View File

@ -0,0 +1,30 @@
package io.dataease.websocket.handler;
import io.dataease.websocket.entity.DePrincipal;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.Map;
public class PrincipalHandshakeHandler extends DefaultHandshakeHandler {
@Override
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler, Map<String, Object> attributes) {
if (request instanceof ServletServerHttpRequest) {
ServletServerHttpRequest servletServerHttpRequest = (ServletServerHttpRequest) request;
HttpServletRequest httpRequest = servletServerHttpRequest.getServletRequest();
final String userId = httpRequest.getParameter("userId");
if (StringUtils.isEmpty(userId)) {
return null;
}
return new DePrincipal(userId);
}
return null;
//return super.determineUser(request, wsHandler, attributes);
}
}

View File

@ -0,0 +1,11 @@
package io.dataease.websocket.service;
import io.dataease.websocket.entity.WsMessage;
public interface WsService {
void releaseMessage(WsMessage wsMessage);
}

View File

@ -0,0 +1,34 @@
package io.dataease.websocket.service.impl;
import io.dataease.commons.condition.RedisStatusCondition;
import io.dataease.commons.constants.RedisConstants;
import io.dataease.commons.model.RedisMessage;
import io.dataease.websocket.entity.WsMessage;
import io.dataease.websocket.service.WsService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@Component
@Conditional({RedisStatusCondition.class})
@Primary
public class DistributedWsService implements WsService {
@Autowired
private RedisTemplate redisTemplate;
public void releaseMessage(WsMessage wsMessage){
if(ObjectUtils.isEmpty(wsMessage) || ObjectUtils.isEmpty(wsMessage.getUserId()) || ObjectUtils.isEmpty(wsMessage.getTopic())) return;
RedisMessage<WsMessage> msg = new RedisMessage();
msg.setType(RedisConstants.WEBSOCKET_MSG);
msg.setData(wsMessage);
redisTemplate.convertAndSend(RedisConstants.GLOBAL_REDIS_TOPIC, msg);
}
}

View File

@ -0,0 +1,21 @@
package io.dataease.websocket.service.impl;
import io.dataease.websocket.entity.WsMessage;
import io.dataease.websocket.service.WsService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class StandaloneWsService implements WsService {
@Resource
private SimpMessagingTemplate messagingTemplate;
public void releaseMessage(WsMessage wsMessage){
if(ObjectUtils.isEmpty(wsMessage) || ObjectUtils.isEmpty(wsMessage.getUserId()) || ObjectUtils.isEmpty(wsMessage.getTopic())) return;
messagingTemplate.convertAndSendToUser(String.valueOf(wsMessage.getUserId()), wsMessage.getTopic(),wsMessage.getData());
}
}

View File

@ -0,0 +1,46 @@
package io.dataease.websocket.util;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.utils.AuthUtils;
import org.apache.commons.lang3.ObjectUtils;
import java.util.concurrent.CopyOnWriteArraySet;
public class WsUtil {
private static final CopyOnWriteArraySet<Long> ONLINE_USERS = new CopyOnWriteArraySet();
public static boolean onLine() {
CurrentUserDto user = AuthUtils.getUser();
if (ObjectUtils.isNotEmpty(user) && ObjectUtils.isNotEmpty(user.getUserId()))
return onLine(user.getUserId());
return false;
}
public static boolean onLine(Long userId) {
return ONLINE_USERS.add(userId);
}
public static boolean offLine() {
CurrentUserDto user = AuthUtils.getUser();
if (ObjectUtils.isNotEmpty(user) && ObjectUtils.isNotEmpty(user.getUserId()))
return offLine(user.getUserId());
return false;
}
public static boolean offLine(Long userId) {
return ONLINE_USERS.remove(userId);
}
public static boolean isOnLine(Long userId) {
return ONLINE_USERS.contains(userId);
}
/*public static void releaseMessage(WsMessage wsMessage){
if(ObjectUtils.isEmpty(wsMessage) || ObjectUtils.isEmpty(wsMessage.getUserId()) || ObjectUtils.isEmpty(wsMessage.getTopic())) return;
CommonBeanFactory.getBean()
}*/
}

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,8 @@
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"screenfull": "4.2.0",
"sockjs-client": "^1.6.0",
"stompjs": "^2.3.3",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.2",
"tinymce": "^5.8.2",

View File

@ -188,4 +188,14 @@ export function initViewCache(panelId) {
loading: false
})
}
export function exportDetails(data) {
// 初始化仪表板视图缓存
return request({
url: 'panel/group/exportDetails',
method: 'post',
data: data,
loading: true,
responseType: 'blob'
})
}

View File

@ -29,6 +29,13 @@ export function needModifyPwd() {
})
}
export function defaultPwd() {
return request({
url: '/api/auth/defaultPwd',
method: 'post'
})
}
export function validateUserName(data) {
return request({
url: '/api/auth/validateName',

View File

@ -1,7 +1,6 @@
<template>
<el-popover
v-model="visible"
width="350"
trigger="click"
@ -9,7 +8,7 @@
style="display: flex;align-items: center;"
class="international"
>
<div>
<div v-loading="loading">
<div style="height: 30px;">
<div style="float: left;font-size:16px;font-weight:bold;">
<span>{{ $t('webmsg.web_msg') }}</span>
@ -49,17 +48,10 @@
</div>
</div>
<div slot="reference">
<el-badge :value="count || paginationConfig.total" :hidden="!count && !paginationConfig.total" :max="99" class="item">
<el-badge :value="visible && !loading ? paginationConfig.total : count" :hidden="!count && !paginationConfig.total" :max="99" class="item">
<svg-icon class-name="notification" icon-class="notification" />
</el-badge>
<!-- <div>
<svg-icon
class-name="notification"
icon-class="notification"
/>
<span v-if="count || paginationConfig.total" class="msg-number">{{ count || paginationConfig.total }}</span>
</div>
</div> -->
</div></el-popover>
</template>
@ -81,7 +73,8 @@ export default {
total: 0
},
timer: null,
count: 0
count: 0,
loading: false
}
},
computed: {
@ -101,14 +94,23 @@ export default {
//
loadMsgTypes()
this.queryCount()
// this.search()
// 30s
this.timer = setInterval(() => {
/* this.timer = setInterval(() => {
this.queryCount()
}, 30000)
}, 30000) */
},
mounted() {
bus.$on('refresh-top-notification', () => {
this.search()
if (this.visible) this.search()
else this.queryCount()
})
bus.$on('web-msg-topic-call', msg => {
console.log('收到websocket消息')
this.count = (this.count || this.paginationConfig.total) + 1
// this.queryCount()
// this.search()
})
},
beforeDestroy() {
@ -195,6 +197,7 @@ export default {
})
},
search() {
this.loading = true
const param = {
status: false,
orders: [' create_time desc ']
@ -204,7 +207,9 @@ export default {
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
this.count = this.paginationConfig.total
this.loading = false
}).catch(() => {
this.loading = false
const token = getToken()
if (!token || token === 'null' || token === 'undefined') {
this.timer && clearInterval(this.timer)

View File

@ -0,0 +1,117 @@
<template>
<el-select v-model="selected" multiple v-bind="$attrsAll" v-on="$listenserAll" @change="onChange">
<el-option v-for="item in mdoptionsList" :key="item.key" :label="item.label" :value="item.value" />
<slot name="default" />
</el-select>
</template>
<script>
export default {
name: 'ElSelectAll',
props: {
value: {
type: Array,
default: () => {
return []
}
},
options: {
type: Array,
default: () => {
return []
}
}
},
data() {
const selected = this.value || []
return {
selected,
mdoptionsValue: [],
oldMdoptionsValue: [],
mdoptionsList: []
}
},
computed: {
$attrsAll() {
// const val = this.$vnode.data.model && this.$vnode.data.model.value;
const result = {
// value: val,
...this.$attrs
}
return result
},
$listenserAll() {
const _this = this
return Object.assign({}, this.$listeners, {
change: () => {
this.$emit('change', (_this.selected || []).filter(v => {
return v !== 'all'
}))
},
input: () => {
this.$emit('input', (_this.selected || []).filter(v => {
return v !== 'all'
}))
}
})
}
},
watch: {
selected: {
immediate: true,
deep: true,
handler(val) {
this.$emit('input', (val || []).filter(v => {
return v !== 'all'
}))
}
},
options: {
immediate: true,
deep: true,
handler(val) {
if ((!val || val.length === 0) && !this.$slots) {
this.mdoptionsList = []
} else {
this.mdoptionsList = [{
key: 'all',
value: 'all',
label: '全部'
}, ...val]
}
}
}
},
mounted() {
},
methods: {
onChange(val) {
// eslint-disable-next-line no-debugger
const allValues = []
//
for (const item of this.mdoptionsList) {
allValues.push(item.value)
}
//
const oldVal = this.oldMdoptionsValue.length === 1 ? [] : this.oldMdoptionsValue[1] || []
//
if (val.includes('all')) this.selected = allValues
//
if (oldVal.includes('all') && !val.includes('all')) this.selected = []
//
//
if (oldVal.includes('all') && val.includes('all')) {
const index = val.indexOf('all')
val.splice(index, 1) //
this.selected = val
}
//
if (!oldVal.includes('all') && !val.includes('all')) {
if (val.length === allValues.length - 1) this.selected = ['all'].concat(val)
}
//
this.oldMdoptionsValue[1] = this.selected
}
}
}
</script>

View File

@ -1,20 +1,20 @@
<template>
<svg class="grid" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<!-- <pattern id="smallGrid" width="5" height="5" patternUnits="userSpaceOnUse">-->
<!-- <path-->
<!-- d="M 5 0 L 0 0 0 5"-->
<!-- fill="none"-->
<!-- stroke="rgba(207, 207, 207, 0.3)"-->
<!-- stroke-width="1"-->
<!-- />-->
<!-- </pattern>-->
<pattern id="smallGrid" :width="smallGridW" :height="smallGridH" patternUnits="userSpaceOnUse">
<path
:d="smallGridPathD"
fill="none"
stroke="rgba(207, 207, 207, 0.6)"
stroke-width="1"
/>
</pattern>
<pattern id="grid" :width="matrixStyle.width" :height="matrixStyle.height" patternUnits="userSpaceOnUse">
<rect :width="matrixStyle.width" :height="matrixStyle.height" fill="url(#smallGrid)" />
<path
:d="pathD"
fill="none"
stroke="rgba(186, 186, 186, 0.5)"
stroke="rgba(64,158,255,0.8)"
stroke-width="1"
/>
</pattern>
@ -41,6 +41,15 @@ export default {
computed: {
pathD: function() {
return 'M ' + this.matrixStyle.width + ' 0 L 0 0 0 ' + this.matrixStyle.height
},
smallGridPathD: function() {
return 'M ' + this.smallGridW + ' 0 L 0 0 0 ' + this.smallGridH
},
smallGridW: function() {
return this.matrixStyle.width / 3
},
smallGridH: function() {
return this.matrixStyle.height / 3
}
}
}

View File

@ -37,7 +37,7 @@
{{ $t('chart.export_details') }}
</el-button>
</span>
<UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" />
<UserViewDialog v-if="chartDetailsVisible" ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" />
</el-dialog>
<!--手机视图详情-->

View File

@ -9,13 +9,14 @@
['parent_transform']:!dialogVisible
}
]"
:style="editStyle"
@mousedown="handleMouseDown"
@scroll="canvasScroll"
>
<!-- 网格线 -->
<Grid v-if="psDebug&&canvasStyleData.auxiliaryMatrix&&!linkageSettingStatus" :matrix-style="matrixStyle" />
<Grid v-if="showGrid" :matrix-style="matrixStyle" />
<!-- positionBox:{{positionBoxInfo}}-->
<PGrid v-if="psDebug" :position-box="positionBoxInfoArray" :matrix-style="matrixStyle" />
<!-- <PGrid v-if="psDebug" :position-box="positionBoxInfoArray" :matrix-style="matrixStyle" />-->
<!-- 仪表板联动清除按钮-->
<canvas-opt-bar />
@ -115,7 +116,9 @@
</de-drag>
<!--拖拽阴影部分-->
<!-- <drag-shadow v-if="(curComponent&&this.curComponent.optStatus.dragging)||dragComponentInfo" />-->
<drag-shadow v-if="(curComponent&&curComponent.auxiliaryMatrix&&(curComponent.optStatus.dragging||curComponent.optStatus.resizing))||(dragComponentInfo)" />
<drag-shadow
v-if="(curComponent&&curComponent.auxiliaryMatrix&&(curComponent.optStatus.dragging||curComponent.optStatus.resizing))||(dragComponentInfo)"
/>
<!-- 右击菜单 -->
<ContextMenu />
<!-- 标线 (临时去掉标线 吸附等功能)-->
@ -156,7 +159,12 @@
{{ $t('chart.export_details') }}
</el-button>
</span>
<UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" />
<UserViewDialog
v-if="chartDetailsVisible"
ref="userViewDialog"
:chart="showChartInfo"
:chart-table="showChartTableInfo"
/>
</el-dialog>
<el-dialog
@ -211,6 +219,12 @@ import { buildFilterMap } from '@/utils/conditionUtil'
import _ from 'lodash'
import $ from 'jquery'
import Background from '@/views/background/index'
import { ApplicationContext } from '@/utils/ApplicationContext'
import {
BASE_MOBILE_STYLE,
COMMON_BACKGROUND_NONE,
HYPERLINKS
} from '@/components/canvas/custom-component/component-list'
let positionBox = []
let coordinates = [] //
@ -255,9 +269,9 @@ function scrollScreen(e) {
}
/**
* 重置位置盒子
*
*/
* 重置位置盒子
*
*/
function resetPositionBox() {
//
itemMaxX = this.maxCell
@ -274,10 +288,10 @@ function resetPositionBox() {
}
/**
* 填充位置盒子
*
* @param {any} item
*/
* 填充位置盒子
*
* @param {any} item
*/
function addItemToPositionBox(item) {
const pb = positionBox
if (item.x <= 0 || item.y <= 0) return
@ -321,9 +335,9 @@ function removeItemFromPositionBox(item) {
}
/**
* 重新计算宽度使最小单元格能占满整个容器
*
*/
* 重新计算宽度使最小单元格能占满整个容器
*
*/
function recalcCellWidth() {
this.maxCell = this.matrixCount.x
}
@ -400,11 +414,11 @@ function resizePlayer(item, newSize) {
}
/**
* 检查移动的位置如果不合法会自动修改
*
* @param {any} item
* @param {any} position
*/
* 检查移动的位置如果不合法会自动修改
*
* @param {any} item
* @param {any} position
*/
function checkItemPosition(item, position) {
position = position || {}
position.x = position.x || item.x
@ -445,11 +459,11 @@ function checkItemPosition(item, position) {
}
/**
* 移动正在拖动的元素
*
* @param {any} item
* @param {any} position
*/
* 移动正在拖动的元素
*
* @param {any} item
* @param {any} position
*/
function movePlayer(item, position) {
const vm = this
removeItemFromPositionBox(item)
@ -532,10 +546,10 @@ function changeToCoord(left, top, width, height) {
}
/**
* 检测有无碰撞并作出处理
*
* @param {any} tCoord 比对对象的坐标
*/
* 检测有无碰撞并作出处理
*
* @param {any} tCoord 比对对象的坐标
*/
// eslint-disable-next-line no-unused-vars
function findClosetCoords(item, tCoord) {
if (isOverlay) return
@ -576,10 +590,10 @@ function findClosetCoords(item, tCoord) {
}
/**
* 生成坐标点
*
* @param {any} item
*/
* 生成坐标点
*
* @param {any} item
*/
// eslint-disable-next-line no-unused-vars
function makeCoordinate(item) {
const width = this.cellWidth * (item.sizex) - this.baseMarginLeft
@ -625,10 +639,10 @@ function changeItemCoord(item) {
}
/**
* 清空目标位置的元素
*
* @param {any} item
*/
* 清空目标位置的元素
*
* @param {any} item
*/
function emptyTargetCell(item) {
const vm = this
const belowItems = findBelowItems(item)
@ -643,11 +657,11 @@ function emptyTargetCell(item) {
}
/**
* 当前位置的item能否上浮
*
* @param {any} item
* @returns
*/
* 当前位置的item能否上浮
*
* @param {any} item
* @returns
*/
function canItemGoUp(item) {
let upperRows = 0
for (let row = item.y - 2; row >= 0; row--) {
@ -663,11 +677,11 @@ function canItemGoUp(item) {
}
/**
* 在移动之前找到当前下移的元素的下面的元素递归
*
* @param {any} items
* @param {any} size
*/
* 在移动之前找到当前下移的元素的下面的元素递归
*
* @param {any} items
* @param {any} size
*/
function moveItemDown(item, size) {
const vm = this
removeItemFromPositionBox(item)
@ -705,12 +719,12 @@ function setPlayerPosition(item, position) {
}
/**
* 寻找子元素到父元素的最大距离
*
* @param {any} parent
* @param {any} son
* @param {any} size
*/
* 寻找子元素到父元素的最大距离
*
* @param {any} parent
* @param {any} son
* @param {any} size
*/
function calcDiff(parent, son, size) {
const diffs = []
@ -771,13 +785,28 @@ function findBelowItems(item) {
return _.sortBy(_.values(belowItems), 'y')
}
// eslint-disable-next-line no-unused-vars
function getoPsitionBox() {
return positionBox
}
export default {
components: { Background, Shape, ContextMenu, MarkLine, Area, Grid, PGrid, DeDrag, UserViewDialog, DeOutWidget, CanvasOptBar, DragShadow, LinkJumpSet },
components: {
Background,
Shape,
ContextMenu,
MarkLine,
Area,
Grid,
PGrid,
DeDrag,
UserViewDialog,
DeOutWidget,
CanvasOptBar,
DragShadow,
LinkJumpSet
},
props: {
isEdit: {
type: Boolean,
@ -793,17 +822,20 @@ export default {
dragStart: {
required: false,
type: Function,
default: function() {}
default: function() {
}
},
dragging: {
required: false,
type: Function,
default: function() {}
default: function() {
}
},
dragEnd: {
required: false,
type: Function,
default: function() {}
default: function() {
}
},
resizable: {
required: false,
@ -813,17 +845,20 @@ export default {
resizeStart: {
required: false,
type: Function,
default: function() {}
default: function() {
}
},
resizing: {
required: false,
type: Function,
default: function() {}
default: function() {
}
},
resizeEnd: {
required: false,
type: Function,
default: function() {}
default: function() {
}
},
matrixCount: {
required: false,
@ -913,6 +948,18 @@ export default {
}
},
computed: {
showGrid() {
if (this.canvasStyleData && this.canvasStyleData.aidedDesign) {
return this.canvasStyleData.aidedDesign.showGrid
} else {
return false
}
},
editStyle() {
return {
height: this.outStyle.height + this.scrollTop + 'px !important'
}
},
dialogVisible() {
return this.chartDetailsVisible || this.linkJumpSetVisible
},
@ -965,6 +1012,12 @@ export default {
}
},
watch: {
matrixCount: {
handler(newVal, oldVal) {
const pointScale = newVal.x / oldVal.x
this.changeScale(pointScale)
}
},
customStyle: {
handler(newVal) {
//
@ -1186,10 +1239,19 @@ export default {
//
return value * scale / 100
},
changeScale() {
if (this.canvasStyleData.matrixCount) {
this.matrixCount = this.canvasStyleData.matrixCount
}
//
changeComponentSizePoint(pointScale) {
this.componentData.forEach((item, index) => {
item.x = (item.x - 1) * pointScale + 1
item.y = (item.y - 1) * pointScale + 1
item.sizex = item.sizex * pointScale
item.sizey = item.sizey * pointScale
// this.componentData[index] = item
})
},
changeScale(pointScale) {
this.changeComponentSizePoint(pointScale)
// 1.3 1600*900 scaleWidth
// scaleHeight = scaleWidth 128*72 12.5*12.5
@ -1226,7 +1288,10 @@ export default {
matrixStyleOriginWidth: this.matrixStyle.originWidth,
matrixStyleOriginHeight: this.matrixStyle.originHeight
})
this.$store.commit('setPreviewCanvasScale', { scaleWidth: this.scalePointWidth, scaleHeight: this.scalePointHeight })
this.$store.commit('setPreviewCanvasScale', {
scaleWidth: this.scalePointWidth,
scaleHeight: this.scalePointHeight
})
}
},
getShapeStyleIntDeDrag(style, prop) {
@ -1464,11 +1529,11 @@ export default {
},
/**
* 计算当前item的位置和大小
*
* @param {any} item
* @returns
*/
* 计算当前item的位置和大小
*
* @param {any} item
* @returns
*/
nowItemStyle(item, index) {
return {
width: (this.cellWidth * (item.sizex) - this.baseMarginLeft) + 'px',
@ -1491,20 +1556,20 @@ export default {
return finalList
},
/**
* 获取x最大值
*
* @returns
*/
* 获取x最大值
*
* @returns
*/
getMaxCell() {
// console.log('getMaxCell:')
return this.maxCell
},
/**
* 获取渲染状态
*
* @returns
*/
* 获取渲染状态
*
* @returns
*/
getRenderState() {
// console.log('getRenderState:')
@ -1576,55 +1641,63 @@ export default {
</script>
<style lang="scss" scoped>
.editor {
.editor {
width: 100%;
position: relative;
/*background: #fff;*/
margin: auto;
/*会影响设置组件不能出现在最高层*/
/*overflow-x: hidden;*/
background-size:100% 100% !important;
background-size: 100% 100% !important;
/*transform-style:preserve-3d;*/
.lock {
opacity: .5;
opacity: .5;
}
}
.parent_transform {
//transform transform 使z-index 使 transform-style
// transform-style dialog
transform-style:preserve-3d;
}
.edit {
}
.parent_transform {
//transform transform 使z-index 使 transform-style
// transform-style dialog
transform-style: preserve-3d;
}
.edit {
/*outline: 1px solid gainsboro;*/
.component {
outline: none;
width: 100%;
height: 100%;
outline: none;
width: 100%;
height: 100%;
}
}
}
.gap_class{
padding:3px;
}
.gap_class {
padding: 3px;
}
.ref-line {
position: absolute;
background-color: #70c0ff;;
z-index: 9999;
}
.v-line {
width: 1px;
}
.h-line {
height: 1px;
}
.dialog-css>>>.el-dialog__title {
font-size: 14px;
}
.dialog-css >>> .el-dialog__header {
padding: 20px 20px 0;
}
.dialog-css >>> .el-dialog__body {
padding: 10px 20px 20px;
}
.ref-line {
position: absolute;
background-color: #70c0ff;;
z-index: 9999;
}
.v-line {
width: 1px;
}
.h-line {
height: 1px;
}
.dialog-css > > > .el-dialog__title {
font-size: 14px;
}
.dialog-css > > > .el-dialog__header {
padding: 20px 20px 0;
}
.dialog-css > > > .el-dialog__body {
padding: 10px 20px 20px;
}
</style>

View File

@ -273,7 +273,15 @@ export default {
}
const components = deepCopy(this.componentData)
components.forEach(view => {
if (view.DetailAreaCode) { view.DetailAreaCode = null }
if (view.filters && view.filters.length > 0) { view.filters = [] }
if (view.type === 'de-tabs') {
view.options.tabList && view.options.tabList.length > 0 && view.options.tabList.forEach(tab => {
if (tab.content && tab.content.filters && tab.content.filters.length > 0) {
tab.content.filters = []
}
})
}
})
//
requestInfo.panelData = JSON.stringify(components)

View File

@ -609,9 +609,9 @@ export default {
const current = this.$refs[this.element.propValue.id]
if (this.chart.isPlugin) {
current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: null })
current && current.callPluginInner && this.setDetailMapCode(null) && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: null })
} else {
current && current.registerDynamicMap && current.registerDynamicMap(null)
current && current.registerDynamicMap && this.setDetailMapCode(null) && current.registerDynamicMap(null)
}
}
},
@ -639,12 +639,17 @@ export default {
this.currentAcreaNode = tempNode
const current = this.$refs[this.element.propValue.id]
if (this.chart.isPlugin) {
current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: this.currentAcreaNode.code })
current && current.callPluginInner && this.setDetailMapCode(this.currentAcreaNode.code) && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: this.currentAcreaNode.code })
} else {
current && current.registerDynamicMap && current.registerDynamicMap(this.currentAcreaNode.code)
current && current.registerDynamicMap && this.setDetailMapCode(this.currentAcreaNode.code) && current.registerDynamicMap(this.currentAcreaNode.code)
}
},
setDetailMapCode(code) {
this.element.DetailAreaCode = code
return true
},
//
sendToChildren(param) {
const length = param.data.dimensionList.length
@ -660,9 +665,9 @@ export default {
this.currentAcreaNode = nextNode
const current = this.$refs[this.element.propValue.id]
if (this.chart.isPlugin) {
nextNode && current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: nextNode.code })
nextNode && current && current.callPluginInner && this.setDetailMapCode(nextNode.code) && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: nextNode.code })
} else {
nextNode && current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
nextNode && current && current.registerDynamicMap && this.setDetailMapCode(nextNode.code) && current.registerDynamicMap(nextNode.code)
}
}
},

View File

@ -1,18 +1,21 @@
<template>
<de-container>
<de-aside-container v-if="chart.type !== 'table-normal' && chart.type !== 'table-info'" :style="customStyle">
<plugin-com
v-if="chart.isPlugin"
:component-name="chart.type + '-view'"
:obj="{chart}"
class="chart-class"
/>
<chart-component v-else-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'echarts'" class="chart-class" :chart="chart" />
<chart-component-g2 v-else-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
<chart-component-s2 v-else-if="chart.type === 'table-pivot' && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
<label-normal v-else-if="chart.type.includes('text')" :chart="chart" class="table-class" />
<label-normal-text v-else-if="chart.type === 'label'" :chart="chart" class="table-class" />
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<de-aside-container v-if="showChartCanvas">
<div id="chartCanvas" class="canvas-class" :style="customStyle">
<div class="canvas-class" :style="commonStyle">
<plugin-com
v-if="chart.isPlugin"
:component-name="chart.type + '-view'"
:obj="{chart: mapChart || chart}"
class="chart-class"
/>
<chart-component v-else-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'echarts'" class="chart-class" :chart="mapChart || chart" />
<chart-component-g2 v-else-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
<chart-component-s2 v-else-if="chart.type === 'table-pivot' && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
<label-normal v-else-if="chart.type.includes('text')" :chart="chart" class="table-class" />
<label-normal-text v-else-if="chart.type === 'label'" :chart="chart" class="table-class" />
</div>
</div>
</de-aside-container>
<de-main-container>
<table-normal :chart="chartTable" :show-summary="false" class="table-class" />
@ -28,12 +31,16 @@ import LabelNormal from '@/views/chart/components/normal/LabelNormal'
import DeMainContainer from '@/components/dataease/DeMainContainer'
import DeContainer from '@/components/dataease/DeContainer'
import DeAsideContainer from '@/components/dataease/DeAsideContainer'
import { export_json_to_excel } from '@/plugins/Export2Excel'
// import { export_json_to_excel } from '@/plugins/Export2Excel'
import { mapState } from 'vuex'
import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
import PluginCom from '@/views/system/plugin/PluginCom'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
import { exportDetails } from '@/api/panel/panel'
import html2canvas from 'html2canvasde'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { deepCopy } from '@/components/canvas/utils/utils'
export default {
name: 'UserView',
components: { LabelNormalText, ChartComponentS2, ChartComponentG2, DeMainContainer, DeContainer, DeAsideContainer, ChartComponent, TableNormal, LabelNormal, PluginCom },
@ -49,10 +56,15 @@ export default {
},
data() {
return {
refId: null
refId: null,
element: {}
}
},
computed: {
showChartCanvas() {
return !this.chart.type.includes('table')
},
customStyle() {
let style = {
}
@ -74,20 +86,81 @@ export default {
}
return style
},
commonStyle() {
const style = {}
if (this.element && this.element.commonBackground) {
style['padding'] = (this.element.commonBackground.innerPadding || 0) + 'px'
style['border-radius'] = (this.element.commonBackground.borderRadius || 0) + 'px'
if (this.element.commonBackground.enable) {
if (this.element.commonBackground.backgroundType === 'innerImage') {
const innerImage = this.element.commonBackground.innerImage.replace('svg', 'png')
style['background'] = `url(${innerImage}) no-repeat`
} else if (this.element.commonBackground.backgroundType === 'outerImage') {
style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat`
} else if (this.element.commonBackground.backgroundType === 'color') {
style['background-color'] = hexColorToRGBA(this.element.commonBackground.color, this.element.commonBackground.alpha)
}
}
style['overflow'] = 'hidden'
}
return style
},
...mapState([
'isClickComponent',
'curComponent',
'componentData',
'canvasStyleData'
])
]),
mapChart() {
if (this.chart.type && (this.chart.type === 'map' || this.chart.type === 'buddle-map')) {
const temp = JSON.parse(JSON.stringify(this.chart))
let DetailAreaCode = null
if (this.curComponent && this.curComponent.DetailAreaCode && this.curComponent.DetailAreaCode.length) {
DetailAreaCode = this.curComponent.DetailAreaCode
}
return { ...temp, ...{ DetailAreaCode: DetailAreaCode }}
}
return null
}
},
mounted() {
this.element = deepCopy(this.curComponent)
},
methods: {
exportExcel() {
const _this = this
if (this.showChartCanvas) {
html2canvas(document.getElementById('chartCanvas')).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 1) //
_this.exportExcelDownload(snapshot, canvas.width, canvas.height)
})
} else {
_this.exportExcelDownload()
}
},
exportExcelDownload(snapshot, width, height) {
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)
const excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i]))
const excelName = this.chart.name
export_json_to_excel(excelHeader, excelData, excelName)
const request = {
viewName: excelName,
header: excelHeader,
details: excelData,
snapshot: snapshot,
snapshotWidth: width,
snapshotHeight: height
}
exportDetails(request).then((res) => {
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const link = document.createElement('a')
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
link.download = excelName + '.xls' //
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
},
renderComponent() {
@ -115,4 +188,9 @@ export default {
.table-class{
height: 100%;
}
.canvas-class{
width: 100%;
height: 100%;
background-size: 100% 100% !important;
}
</style>

View File

@ -1,7 +1,13 @@
<template>
<de-container>
<de-main-container v-if="chart.type !== 'table-normal' && chart.type !== 'table-info'" :style="customStyle" class="full-div">
<chart-component v-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'echarts'" class="chart-class" :chart="chart" />
<plugin-com
v-if="chart.isPlugin"
:component-name="chart.type + '-view'"
:obj="{chart: mapChart || chart}"
class="chart-class"
/>
<chart-component v-else-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'echarts'" class="chart-class" :chart="mapChart || chart" />
<chart-component-g2 v-else-if="!chart.type.includes('text') && chart.type !== 'label' && !chart.type.includes('table') && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
<chart-component-s2 v-else-if="chart.type === 'table-pivot' && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
<label-normal v-else-if="chart.type.includes('text')" :chart="chart" class="table-class" />
@ -24,10 +30,10 @@ import DeMainContainer from '@/components/dataease/DeMainContainer'
import DeContainer from '@/components/dataease/DeContainer'
import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import PluginCom from '@/views/system/plugin/PluginCom'
export default {
name: 'UserViewMobileDialog',
components: { ChartComponentS2, LabelNormalText, DeContainer, DeMainContainer, ChartComponentG2, ChartComponent, TableNormal, LabelNormal },
components: { ChartComponentS2, LabelNormalText, DeContainer, DeMainContainer, ChartComponentG2, ChartComponent, TableNormal, LabelNormal, PluginCom },
props: {
chart: {
type: Object,
@ -44,6 +50,7 @@ export default {
}
},
computed: {
customStyle() {
let style = {
}
@ -70,7 +77,18 @@ export default {
'curComponent',
'componentData',
'canvasStyleData'
])
]),
mapChart() {
if (this.chart.type && (this.chart.type === 'map' || this.chart.type === 'buddle-map')) {
const temp = JSON.parse(JSON.stringify(this.chart))
let DetailAreaCode = null
if (this.curComponent && this.curComponent.DetailAreaCode && this.curComponent.DetailAreaCode.length) {
DetailAreaCode = this.curComponent.DetailAreaCode
}
return { ...temp, ...{ DetailAreaCode: DetailAreaCode }}
}
return null
}
},
methods: {

View File

@ -8,6 +8,7 @@ import {
} from '@/utils/ApplicationContext'
import { uuid } from 'vue-uuid'
import store from '@/store'
import { AIDED_DESIGN } from '@/views/panel/panel'
export function deepCopy(target) {
if (typeof target === 'object') {
@ -66,7 +67,7 @@ export function mobile2MainCanvas(mainSource, mobileSource) {
}
export function panelInit(componentData, componentStyle) {
componentData.forEach(item => {
componentData.forEach((item, index) => {
if (item.component && item.component === 'de-date') {
if (item.options.attrs &&
(!item.options.attrs.default || (item.serviceName === 'timeYearWidget' && item.options.attrs.default.dynamicInfill !== 'year') || (item.serviceName === 'timeMonthWidget' && item.options.attrs.default.dynamicInfill !== 'month'))) {
@ -94,11 +95,13 @@ export function panelInit(componentData, componentStyle) {
item.hyperlinks = (item.hyperlinks || HYPERLINKS)
}
item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE)
componentData[index] = item
})
// style初始化
componentStyle.refreshTime = (componentStyle.refreshTime || 5)
componentStyle.refreshViewLoading = (componentStyle.refreshViewLoading || false)
componentStyle.refreshUnit = (componentStyle.refreshUnit || 'minute')
componentStyle.aidedDesign = (componentStyle.aidedDesign || deepCopy(AIDED_DESIGN))
// 将data 和 style 数据设置到全局store中
store.commit('setComponentData', resetID(componentData))

View File

@ -10,6 +10,7 @@
:placeholder="$t(element.options.attrs.placeholder)"
:popper-append-to-body="inScreen"
:size="size"
:filterable="true"
@change="changeValue"
@focus="setOptionWidth"
@blur="onBlur"
@ -90,7 +91,7 @@ export default {
this.changeValue(value)
},
'element.options.attrs.fieldId': function(value, old) {
if (typeof value === 'undefined' || value === old) return
if (value === null || typeof value === 'undefined' || value === old) return
this.datas = []
let method = multFieldValues

View File

@ -131,6 +131,7 @@ export default {
default_login: 'Normal'
},
commons: {
default_pwd: 'Default Pwd',
stop: 'Stop',
first_login_tips: 'Please change the initial password',
roger_that: 'Roger That',
@ -1064,7 +1065,28 @@ export default {
total_pos_left: 'Left',
total_pos_right: 'Right',
chart_label: 'Label',
drag_block_label: 'Label'
drag_block_label: 'Label',
count_distinct: 'Distinct Count',
table_page_mode: 'Page Mode',
page_mode_page: 'Page',
page_mode_pull: 'Pull',
exp_can_not_empty: 'Condition can not be empty',
value_formatter: 'Value Formatter',
value_formatter_type: 'Formatter Type',
value_formatter_auto: 'Auto',
value_formatter_value: 'Value',
value_formatter_percent: 'Percent',
value_formatter_unit: 'Unit',
value_formatter_decimal_count: 'Decimal Count',
value_formatter_suffix: 'Unit Suffix',
value_formatter_thousand_separator: 'Thousand Separator',
value_formatter_example: 'Example',
unit_none: 'None',
unit_thousand: 'Thousand',
unit_ten_thousand: 'Ten Thousand',
unit_million: 'Million',
unit_hundred_million: 'Hundred Million',
formatter_decimal_count_error: 'Range 0-10'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
@ -1662,7 +1684,10 @@ export default {
themeDark: 'Dark',
themeCustom: 'Custom',
openHomePage: 'Show Home Page',
mobileBG: 'Mobile Login page BG'
mobileBG: 'Mobile Login page BG',
helpLink: 'Help Document Link',
homeLink: 'Home Link',
defaultHomeLink: 'Default is the system built-in home page'
},
auth: {

View File

@ -131,6 +131,7 @@ export default {
default_login: '普通登錄'
},
commons: {
default_pwd: '初始密碼',
stop: '停止',
first_login_tips: '您使用的是初始密碼,記得修改密碼哦',
roger_that: '知道了',
@ -1064,7 +1065,28 @@ export default {
total_pos_left: '左側',
total_pos_right: '右側',
chart_label: '文本卡',
drag_block_label: '標簽'
drag_block_label: '標簽',
count_distinct: '去重計數',
table_page_mode: '分頁模式',
page_mode_page: '翻頁',
page_mode_pull: '下拉',
exp_can_not_empty: '條件不能為空',
value_formatter: '數值格式',
value_formatter_type: '格式類型',
value_formatter_auto: '自動',
value_formatter_value: '數值',
value_formatter_percent: '百分比',
value_formatter_unit: '數量單位',
value_formatter_decimal_count: '小數位數',
value_formatter_suffix: '單位後綴',
value_formatter_thousand_separator: '千分符',
value_formatter_example: '示例',
unit_none: '無',
unit_thousand: '千',
unit_ten_thousand: '萬',
unit_million: '百萬',
unit_hundred_million: '億',
formatter_decimal_count_error: '請輸入0-10的整數'
},
dataset: {
sheet_warn: '有多個 Sheet 頁,默認抽取第一個',
@ -1672,7 +1694,10 @@ export default {
themeCustom: '自定義',
openHomePage: '顯示首頁',
mobileBG: '移動端登錄頁背景'
mobileBG: '移動端登錄頁背景',
helpLink: '幫助文檔鏈接',
homeLink: '首頁鏈接',
defaultHomeLink: '默認為系統內置首頁'
},
auth: {

View File

@ -131,6 +131,7 @@ export default {
default_login: '普通登录'
},
commons: {
default_pwd: '初始密码',
stop: '停止',
first_login_tips: '您使用的是初始密码,记得修改密码哦',
roger_that: '知道了',
@ -1067,7 +1068,28 @@ export default {
total_pos_left: '左侧',
total_pos_right: '右侧',
chart_label: '文本卡',
drag_block_label: '标签'
drag_block_label: '标签',
count_distinct: '去重计数',
table_page_mode: '分页模式',
page_mode_page: '翻页',
page_mode_pull: '下拉',
exp_can_not_empty: '条件不能为空',
value_formatter: '数值格式',
value_formatter_type: '格式类型',
value_formatter_auto: '自动',
value_formatter_value: '数值',
value_formatter_percent: '百分比',
value_formatter_unit: '数量单位',
value_formatter_decimal_count: '小数位数',
value_formatter_suffix: '单位后缀',
value_formatter_thousand_separator: '千分符',
value_formatter_example: '示例',
unit_none: '无',
unit_thousand: '千',
unit_ten_thousand: '万',
unit_million: '百万',
unit_hundred_million: '亿',
formatter_decimal_count_error: '请输入0-10的整数'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
@ -1680,7 +1702,10 @@ export default {
themeDark: '深色',
themeCustom: '自定义',
openHomePage: '显示首页',
mobileBG: '移动端登录页背景'
mobileBG: '移动端登录页背景',
helpLink: '帮助文档链接',
homeLink: '首页链接',
defaultHomeLink: '默认为系统内置首页'
},
auth: {

View File

@ -27,7 +27,7 @@
<lang-select class="right-menu-item hover-effect" />
<div style="height: 100%;padding: 0 8px;" class="right-menu-item hover-effect">
<a
href="https://dataease.io/docs/"
:href="helpLink"
target="_blank"
style="display: flex;height: 100%;width: 100%;justify-content: center;align-items: center;"
>
@ -151,6 +151,12 @@ export default {
}
return this.variables.topBarMenuTextActive
},
helpLink() {
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.helpLink'] && this.$store.getters.uiInfo['ui.helpLink'].paramValue) {
return this.$store.getters.uiInfo['ui.helpLink'].paramValue
}
return 'https://dataease.io/docs/'
},
/* topMenuColor() {
return this.$store.getters.uiInfo.topMenuColor
}, */

View File

@ -25,6 +25,7 @@ import '@/components/canvas/custom-component' // 注册自定义组件
import '@/utils/DateUtil'
import draggable from 'vuedraggable'
import deWebsocket from '@/websocket'
Vue.config.productionTip = false
Vue.use(VueClipboard)
Vue.use(widgets)
@ -113,6 +114,7 @@ Vue.prototype.checkPermission = function(pers) {
})
return hasPermission
}
Vue.use(deWebsocket)
new Vue({
router,

View File

@ -19,6 +19,8 @@ import {
import Layout from '@/layout/index'
// import bus from './utils/bus'
import { getSocket } from '@/websocket'
NProgress.configure({
showSpinner: false
}) // NProgress Configuration
@ -57,6 +59,8 @@ router.beforeEach(async(to, from, next) => {
if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
// get user info
store.dispatch('user/getInfo').then(() => {
const deWebsocket = getSocket()
deWebsocket && deWebsocket.reconnect && deWebsocket.reconnect()
store.dispatch('lic/getLicInfo').then(() => {
loadMenus(next, to)
}).catch(() => {

View File

@ -811,3 +811,9 @@ div:focus {
padding-top: 0px;
}
}
.pwd-tips > span {
font-weight: 800;
color: #F56C6C;
}

View File

@ -68,8 +68,8 @@
>
<i class="el-icon-plus" />
</el-upload>
<el-dialog top="25vh" width="600px" :modal-append-to-body="false" :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
<el-dialog top="25vh" width="600px" :append-to-body="true" :destroy-on-close="true" :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl">
</el-dialog>
</el-col>
</el-row>

View File

@ -277,7 +277,8 @@ export const DEFAULT_FUNCTION_CFG = {
sliderRange: [0, 10]
}
export const DEFAULT_THRESHOLD = {
gaugeThreshold: ''
gaugeThreshold: '',
labelThreshold: []
}
// chart config
export const BASE_BAR = {

View File

@ -0,0 +1,71 @@
export const formatterItem = {
type: 'auto', // auto,value,percent
unit: 1, // 换算单位
suffix: '', // 单位后缀
decimalCount: 2, // 小数位数
thousandSeparator: true// 千分符
}
// 单位list
export const unitList = [
{ name: 'unit_none', value: 1 },
{ name: 'unit_thousand', value: 1000 },
{ name: 'unit_ten_thousand', value: 10000 },
{ name: 'unit_million', value: 1000000 },
{ name: 'unit_hundred_million', value: 100000000 }
]
// 格式化方式
export const formatterType = [
{ name: 'value_formatter_auto', value: 'auto' },
{ name: 'value_formatter_value', value: 'value' },
{ name: 'value_formatter_percent', value: 'percent' }
]
export function valueFormatter(value, formatter) {
// 1.unit 2.decimal 3.thousand separator and suffix
let result
if (formatter.type === 'auto') {
result = transSeparatorAndSuffix(transUnit(value, formatter), formatter)
} else if (formatter.type === 'value') {
result = transSeparatorAndSuffix(transDecimal(transUnit(value, formatter), formatter), formatter)
} else if (formatter.type === 'percent') {
value = value * 100
result = transSeparatorAndSuffix(transDecimal(value, formatter), formatter)
} else {
result = value
}
return result
}
function transUnit(value, formatter) {
return value / formatter.unit
}
function transDecimal(value, formatter) {
return value.toFixed(formatter.decimalCount)
}
function transSeparatorAndSuffix(value, formatter) {
let str = value + ''
if (formatter.thousandSeparator) {
const thousandsReg = /(\d)(?=(\d{3})+$)/g
const numArr = str.split('.')
numArr[0] = numArr[0].replace(thousandsReg, '$1,')
str = numArr.join('.')
}
if (formatter.type === 'percent') {
str += '%'
} else {
if (formatter.unit === 1000) {
str += '千'
} else if (formatter.unit === 10000) {
str += '万'
} else if (formatter.unit === 1000000) {
str += '百万'
} else if (formatter.unit === 100000000) {
str += '亿'
}
}
return str + formatter.suffix.replace(/(^\s*)|(\s*$)/g, '')
}

View File

@ -1,6 +1,7 @@
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
export function baseTableInfo(s2, container, chart, action, tableData) {
const containerDom = document.getElementById(container)
@ -49,20 +50,50 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
name: drillField.name
})
} else {
const f = getCurrentField(chart.xaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (f.groupType === 'd') {
return value
} else {
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
return valueFormatter(value, formatterItem)
}
}
}
})
}
}
})
} else {
fields.forEach(ele => {
const f = getCurrentField(chart.xaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (f.groupType === 'd') {
return value
} else {
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
return valueFormatter(value, formatterItem)
}
}
}
})
})
}
@ -146,20 +177,42 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
name: drillField.name
})
} else {
const f = getCurrentField(chart.yaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
return valueFormatter(value, formatterItem)
}
}
})
}
}
})
} else {
fields.forEach(ele => {
const f = getCurrentField(chart.yaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
return valueFormatter(value, formatterItem)
}
}
})
})
}
@ -253,20 +306,42 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
name: drillField.name
})
} else {
const f = getCurrentField(chart.yaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
return valueFormatter(value, formatterItem)
}
}
})
}
}
})
} else {
fields.forEach(ele => {
const f = getCurrentField(chart.yaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
return valueFormatter(value, formatterItem)
}
}
})
})
}
@ -324,3 +399,21 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
return s2
}
function getCurrentField(valueFieldList, field) {
let list = []
let res = null
try {
list = JSON.parse(valueFieldList)
} catch (err) {
list = JSON.parse(JSON.stringify(valueFieldList))
}
for (let i = 0; i < list.length; i++) {
const f = list[i]
if (field.dataeaseName === f.dataeaseName) {
res = f
break
}
}
return res
}

View File

@ -229,7 +229,7 @@ export default {
this.myChart.clear()
return
}
const cCode = this.dynamicAreaCode || customAttr.areaCode
const cCode = this.chart.DetailAreaCode || this.dynamicAreaCode || customAttr.areaCode
if (this.$store.getters.geoMap[cCode]) {
const json = this.$store.getters.geoMap[cCode]
this.initMapChart(json, chart)

View File

@ -108,6 +108,7 @@
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
export default {
name: 'ChartDragItem',
@ -155,6 +156,7 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
},
methods: {
clickItem(param) {

View File

@ -89,6 +89,7 @@
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
export default {
name: 'DimensionExtItem',
@ -129,6 +130,7 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
},
methods: {
clickItem(param) {

View File

@ -77,6 +77,9 @@
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item v-if="chart.render === 'antv' && chart.type.includes('table')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
<span>{{ $t('chart.value_formatter') }}...</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
<span>{{ $t('chart.show_name_set') }}</span>
</el-dropdown-item>
@ -92,6 +95,8 @@
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
import { formatterItem } from '@/views/chart/chart/formatter'
export default {
name: 'DimensionItem',
@ -109,6 +114,10 @@ export default {
type: Number,
required: true
},
chart: {
type: Object,
required: true
},
dimensionData: {
type: Array,
required: true
@ -120,7 +129,8 @@ export default {
},
data() {
return {
tagType: 'success'
tagType: 'success',
formatterItem: formatterItem
}
},
watch: {
@ -132,8 +142,15 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
this.init()
},
methods: {
init() {
if (!this.item.formatterCfg) {
this.item.formatterCfg = JSON.parse(JSON.stringify(this.formatterItem))
}
},
clickItem(param) {
if (!param) {
return
@ -148,6 +165,9 @@ export default {
case 'filter':
this.editFilter()
break
case 'formatter':
this.valueFormatter()
break
default:
break
}
@ -203,6 +223,12 @@ export default {
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
},
valueFormatter() {
this.item.index = this.index
this.item.formatterType = 'dimension'
this.$emit('valueFormatter', this.item)
}
}
}

View File

@ -28,6 +28,7 @@
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
export default {
name: 'DrillItem',
@ -71,6 +72,7 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
},
methods: {
clickItem(param) {

View File

@ -29,6 +29,7 @@
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
export default {
name: 'FilterItem',
@ -72,6 +73,7 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
},
methods: {
clickItem(param) {

View File

@ -49,13 +49,14 @@
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="item.id === 'count' || item.deType === 0 || item.deType === 1" :command="beforeSummary('count')">{{ $t('chart.count') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('stddev_pop')">{{ $t('chart.stddev_pop') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('var_pop')">{{ $t('chart.var_pop') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('stddev_pop')">{{ $t('chart.stddev_pop') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('var_pop')">{{ $t('chart.var_pop') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('count')">{{ $t('chart.count') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('count_distinct')">{{ $t('chart.count_distinct') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
@ -98,6 +99,9 @@
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
<span>{{ $t('chart.filter') }}...</span>
</el-dropdown-item>
<el-dropdown-item v-if="chart.render === 'antv' && chart.type.includes('table')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
<span>{{ $t('chart.value_formatter') }}...</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
<span>{{ $t('chart.show_name_set') }}</span>
</el-dropdown-item>
@ -114,6 +118,8 @@
import { compareItem } from '@/views/chart/chart/compare'
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
import { formatterItem } from '@/views/chart/chart/formatter'
export default {
name: 'QuotaExtItem',
@ -148,7 +154,8 @@ export default {
return {
compareItem: compareItem,
disableEditCompare: false,
tagType: 'success'
tagType: 'success',
formatterItem: formatterItem
}
},
watch: {
@ -168,12 +175,17 @@ export default {
mounted() {
this.init()
this.isEnableCompare()
bus.$on('reset-change-table', () => this.getItemTagType())
},
methods: {
init() {
if (!this.item.compareCalc) {
this.item.compareCalc = JSON.parse(JSON.stringify(this.compareItem))
}
if (!this.item.formatterCfg) {
this.item.formatterCfg = JSON.parse(JSON.stringify(this.formatterItem))
}
},
isEnableCompare() {
let xAxis = null
@ -206,6 +218,9 @@ export default {
case 'filter':
this.editFilter()
break
case 'formatter':
this.valueFormatter()
break
default:
break
}
@ -290,6 +305,12 @@ export default {
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
},
valueFormatter() {
this.item.index = this.index
this.item.formatterType = 'quota'
this.$emit('valueFormatter', this.item)
}
}
}

View File

@ -49,13 +49,14 @@
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="item.id === 'count' || item.deType === 0 || item.deType === 1" :command="beforeSummary('count')">{{ $t('chart.count') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('stddev_pop')">{{ $t('chart.stddev_pop') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('var_pop')">{{ $t('chart.var_pop') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('stddev_pop')">{{ $t('chart.stddev_pop') }}</el-dropdown-item>
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1 && item.deType !== 5" :command="beforeSummary('var_pop')">{{ $t('chart.var_pop') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('count')">{{ $t('chart.count') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('count_distinct')">{{ $t('chart.count_distinct') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
@ -98,6 +99,9 @@
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
<span>{{ $t('chart.filter') }}...</span>
</el-dropdown-item>
<el-dropdown-item v-if="chart.render === 'antv' && chart.type.includes('table')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
<span>{{ $t('chart.value_formatter') }}...</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
<span>{{ $t('chart.show_name_set') }}</span>
</el-dropdown-item>
@ -114,6 +118,8 @@
import { compareItem } from '@/views/chart/chart/compare'
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
import { formatterItem } from '@/views/chart/chart/formatter'
export default {
name: 'QuotaItem',
@ -148,7 +154,8 @@ export default {
return {
compareItem: compareItem,
disableEditCompare: false,
tagType: 'success'
tagType: 'success',
formatterItem: formatterItem
}
},
watch: {
@ -165,12 +172,16 @@ export default {
mounted() {
this.init()
this.isEnableCompare()
bus.$on('reset-change-table', () => this.getItemTagType())
},
methods: {
init() {
if (!this.item.compareCalc) {
this.item.compareCalc = JSON.parse(JSON.stringify(this.compareItem))
}
if (!this.item.formatterCfg) {
this.item.formatterCfg = JSON.parse(JSON.stringify(this.formatterItem))
}
},
isEnableCompare() {
let xAxis = null
@ -203,6 +214,9 @@ export default {
case 'filter':
this.editFilter()
break
case 'formatter':
this.valueFormatter()
break
default:
break
}
@ -287,6 +301,12 @@ export default {
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
},
valueFormatter() {
this.item.index = this.index
this.item.formatterType = 'quota'
this.$emit('valueFormatter', this.item)
}
}
}

View File

@ -136,7 +136,8 @@ export default {
const customAttr = JSON.parse(this.chart.customAttr)
if (customAttr.color) {
this.label_class.color = customAttr.color.dimensionColor
this.label_content_class.color = customAttr.color.quotaColor
// color threshold
this.colorThreshold(customAttr.color.quotaColor)
}
if (customAttr.size) {
this.dimensionShow = customAttr.size.dimensionShow
@ -168,6 +169,57 @@ export default {
chartResize() {
//
this.calcHeight()
},
colorThreshold(valueColor) {
if (this.chart.senior) {
const senior = JSON.parse(this.chart.senior)
if (senior.threshold && senior.threshold.labelThreshold && senior.threshold.labelThreshold.length > 0) {
const value = this.chart.data.series[0].data[0]
for (let i = 0; i < senior.threshold.labelThreshold.length; i++) {
let flag = false
const t = senior.threshold.labelThreshold[i]
if (t.term === 'eq') {
if (value === t.value) {
this.label_content_class.color = t.color
flag = true
}
} else if (t.term === 'not_eq') {
if (value !== t.value) {
this.label_content_class.color = t.color
flag = true
}
} else if (t.term === 'lt') {
if (value < t.value) {
this.label_content_class.color = t.color
flag = true
}
} else if (t.term === 'gt') {
if (value > t.value) {
this.label_content_class.color = t.color
flag = true
}
} else if (t.term === 'le') {
if (value <= t.value) {
this.label_content_class.color = t.color
flag = true
}
} else if (t.term === 'ge') {
if (value >= t.value) {
this.label_content_class.color = t.color
flag = true
}
}
if (flag) {
break
} else if (i === senior.threshold.labelThreshold.length - 1) {
this.label_content_class.color = valueColor
}
}
} else {
this.label_content_class.color = valueColor
}
}
}
}
}

View File

@ -1,5 +1,6 @@
<template>
<div ref="tableContainer" :style="bg_class" style="padding: 8px;width: 100%;height: 100%;overflow: hidden;">
<view-track-bar ref="viewTrack" :track-menu="trackMenu" class="track-bar" :style="trackBarStyleTime" @trackClick="trackClick" />
<p v-show="title_show" ref="title" :style="title_class">{{ chart.title }}</p>
<div
v-if="chart.data && chart.data.series && chart.data.series.length > 0"
@ -7,7 +8,7 @@
:style="content_class"
>
<span :style="label_class">
<p v-if="chart.data.series[0].data && chart.data.series[0].data.length > 0" :style="label_content_class">
<p v-if="chart.data.series[0].data && chart.data.series[0].data.length > 0" ref="textData" :style="label_content_class" @click="textClick">
{{ chart.data.series[0].data[0] }}
</p>
</span>
@ -23,9 +24,11 @@
<script>
import { hexColorToRGBA } from '../../chart/util'
import eventBus from '@/components/canvas/utils/eventBus'
import ViewTrackBar from '@/components/canvas/components/Editor/ViewTrackBar'
export default {
name: 'LabelNormalText',
components: { ViewTrackBar },
props: {
chart: {
type: Object,
@ -37,6 +40,13 @@ export default {
default: function() {
return {}
}
},
trackMenu: {
type: Array,
required: false,
default: function() {
return []
}
}
},
data() {
@ -66,7 +76,8 @@ export default {
margin: 0
},
label_content_class: {
margin: 0
margin: 0,
cursor: 'pointer'
},
label_space: {
marginTop: '10px',
@ -76,10 +87,19 @@ export default {
background: hexColorToRGBA('#ffffff', 0)
},
title_show: true,
borderRadius: '0px'
borderRadius: '0px',
trackBarStyle: {
position: 'absolute',
left: '0px',
top: '0px'
},
pointParam: null
}
},
computed: {
trackBarStyleTime() {
return this.trackBarStyle
}
// bg_class() {
// return {
// background: hexColorToRGBA('#ffffff', 0),
@ -167,6 +187,63 @@ export default {
chartResize() {
//
this.calcHeight()
},
trackClick(trackAction) {
const param = this.pointParam
if (!param || !param.data || !param.data.dimensionList) {
//
if (this.chart.type === 'map') {
this.$warning(this.$t('panel.no_drill_field'))
}
return
}
const linkageParam = {
option: 'linkage',
viewId: this.chart.id,
dimensionList: this.pointParam.data.dimensionList,
quotaList: this.pointParam.data.quotaList
}
const jumpParam = {
option: 'jump',
viewId: this.chart.id,
dimensionList: this.pointParam.data.dimensionList,
quotaList: this.pointParam.data.quotaList
}
switch (trackAction) {
case 'drill':
this.$emit('onChartClick', this.pointParam)
break
case 'linkage':
this.$store.commit('addViewTrackFilter', linkageParam)
break
case 'jump':
this.$emit('onJumpClick', jumpParam)
break
default:
break
}
},
textClick() {
this.pointParam = {
data: {
category: this.chart.data.series[0].name,
dimensionList: [{ id: this.chart.data.fields[0].id, value: this.chart.data.series[0].data[0] }],
field: this.chart.data.series[0].data[0],
name: this.chart.data.series[0].data[0],
popSize: 0,
quotaList: [],
value: 0
}
}
console.log(this.pointParam)
this.$refs['textData'].offsetTop
if (this.trackMenu.length < 2) { //
this.trackClick(this.trackMenu[0])
} else { //
this.trackBarStyle.left = (this.$refs['textData'].offsetLeft + this.$refs['textData'].offsetWidth / 2) + 'px'
this.trackBarStyle.top = (this.$refs['textData'].offsetTop + this.$refs['textData'].offsetHeight + 10) + 'px'
this.$refs.viewTrack.trackButtonClick()
}
}
}
}

View File

@ -1,10 +1,11 @@
<template>
<div style="width: 100%">
<!--仪表盘-->
<el-col v-if="chart.type && chart.type === 'gauge'">
<el-form ref="thresholdForm" :model="thresholdForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.threshold_range')+'(%)'" class="form-item">
<span>0,</span>
<el-input v-model="thresholdForm.gaugeThreshold" style="width: 100px;margin: 0 10px;" :placeholder="$t('chart.threshold_range')" size="mini" clearable @change="changeThreshold" />
<el-input v-model="thresholdForm.gaugeThreshold" style="width: 100px;margin: 0 10px;" :placeholder="$t('chart.threshold_range')" size="mini" clearable @change="gaugeThresholdChange" />
<span>,100</span>
<el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content">
@ -17,14 +18,65 @@
</el-form-item>
</el-form>
</el-col>
<!--指标卡-->
<el-col v-if="chart.type && chart.type === 'text'">
<el-col>
<el-button
:title="$t('chart.edit')"
icon="el-icon-edit"
type="text"
size="small"
style="width: 24px;margin-left: 4px;"
@click="editLabelThreshold"
/>
<el-col style="padding: 0 18px;">
<el-row v-for="(item,index) in thresholdForm.labelThreshold" :key="index" class="line-style">
<el-col :span="8">
<span v-if="item.term === 'eq'" :title="$t('chart.filter_eq')">{{ $t('chart.filter_eq') }}</span>
<span v-else-if="item.term === 'not_eq'" :title="$t('chart.filter_not_eq')">{{ $t('chart.filter_not_eq') }}</span>
<span v-else-if="item.term === 'lt'" :title="$t('chart.filter_lt')">{{ $t('chart.filter_lt') }}</span>
<span v-else-if="item.term === 'gt'" :title="$t('chart.filter_gt')">{{ $t('chart.filter_gt') }}</span>
<span v-else-if="item.term === 'le'" :title="$t('chart.filter_le')">{{ $t('chart.filter_le') }}</span>
<span v-else-if="item.term === 'ge'" :title="$t('chart.filter_ge')">{{ $t('chart.filter_ge') }}</span>
</el-col>
<el-col :span="8">
<span :title="item.value">{{ item.value }}</span>
</el-col>
<el-col :span="8">
<span :style="{width:'14px', height:'14px', backgroundColor: item.color}" />
</el-col>
</el-row>
</el-col>
</el-col>
</el-col>
<!--编辑阈值-->
<el-dialog
v-if="editLabelThresholdDialog"
v-dialogDrag
:title="$t('chart.threshold')"
:visible="editLabelThresholdDialog"
:show-close="false"
width="50%"
class="dialog-css"
>
<text-threshold-edit :threshold="thresholdForm.labelThreshold" @onLabelThresholdChange="thresholdChange" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeLabelThreshold">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="changeLabelThreshold">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
import TextThresholdEdit from '@/views/chart/components/senior/dialog/TextThresholdEdit'
export default {
name: 'Threshold',
components: { TextThresholdEdit },
props: {
chart: {
type: Object,
@ -33,7 +85,9 @@ export default {
},
data() {
return {
thresholdForm: JSON.parse(JSON.stringify(DEFAULT_THRESHOLD))
thresholdForm: JSON.parse(JSON.stringify(DEFAULT_THRESHOLD)),
editLabelThresholdDialog: false,
thresholdArr: []
}
},
watch: {
@ -58,12 +112,18 @@ export default {
}
if (senior.threshold) {
this.thresholdForm = senior.threshold
if (!this.thresholdForm.labelThreshold) {
this.thresholdForm.labelThreshold = []
}
} else {
this.thresholdForm = JSON.parse(JSON.stringify(DEFAULT_THRESHOLD))
}
}
},
changeThreshold() {
this.$emit('onThresholdChange', this.thresholdForm)
},
gaugeThresholdChange() {
// check input
if (this.thresholdForm.gaugeThreshold) {
const arr = this.thresholdForm.gaugeThreshold.split(',')
@ -79,7 +139,49 @@ export default {
}
}
}
this.$emit('onThresholdChange', this.thresholdForm)
this.changeThreshold()
},
editLabelThreshold() {
this.editLabelThresholdDialog = true
},
closeLabelThreshold() {
this.editLabelThresholdDialog = false
},
changeLabelThreshold() {
// check line config
for (let i = 0; i < this.thresholdArr.length; i++) {
const ele = this.thresholdArr[i]
if (!ele.term || ele.term === '') {
this.$message({
message: this.$t('chart.exp_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (!ele.value) {
this.$message({
message: this.$t('chart.value_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (parseFloat(ele.value).toString() === 'NaN') {
this.$message({
message: this.$t('chart.value_error'),
type: 'error',
showClose: true
})
return
}
}
this.thresholdForm.labelThreshold = JSON.parse(JSON.stringify(this.thresholdArr))
this.changeThreshold()
this.closeLabelThreshold()
},
thresholdChange(val) {
this.thresholdArr = val
}
}
}
@ -120,4 +222,25 @@ span{
cursor: pointer;
z-index: 1003;
}
.line-style >>> span{
display: inline-block;
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
margin: 0 10px;
}
.dialog-css >>> .el-dialog__title {
font-size: 14px;
}
.dialog-css >>> .el-dialog__header {
padding: 20px 20px 0;
}
.dialog-css >>> .el-dialog__body {
padding: 10px 20px 20px;
}
</style>

View File

@ -0,0 +1,163 @@
<template>
<el-col>
<el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addThreshold" />
<div style="max-height: 50vh;overflow-y: auto;">
<el-row v-for="(item,index) in thresholdArr" :key="index" class="line-item">
<el-col :span="6">
<el-select v-model="item.term" size="mini" @change="changeThreshold">
<el-option-group
v-for="(group,idx) in valueOptions"
:key="idx"
:label="group.label"
>
<el-option
v-for="opt in group.options"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-option-group>
</el-select>
</el-col>
<el-col :span="10" style="text-align: center;">
<el-input v-model="item.value" class="value-item" :placeholder="$t('chart.drag_block_label_value')" size="mini" clearable @change="changeThreshold" />
</el-col>
<el-col :span="4" style="text-align: center;">
<el-color-picker v-model="item.color" show-alpha class="color-picker-style" :predefine="predefineColors" @change="changeThreshold" />
</el-col>
<el-col :span="4">
<el-button type="text" icon="el-icon-delete" circle style="float: right" @click="removeThreshold(index)" />
</el-col>
</el-row>
</div>
</el-col>
</template>
<script>
import { COLOR_PANEL } from '@/views/chart/chart/chart'
export default {
name: 'TextThresholdEdit',
props: {
threshold: {
type: Array,
required: true
}
},
data() {
return {
thresholdArr: [],
thresholdObj: {
term: 'eq',
field: '0',
value: '0',
color: '#ff0000ff'
},
valueOptions: [
{
label: '',
options: [{
value: 'eq',
label: this.$t('chart.filter_eq')
}, {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
},
{
label: '',
options: [{
value: 'lt',
label: this.$t('chart.filter_lt')
}, {
value: 'gt',
label: this.$t('chart.filter_gt')
}]
},
{
label: '',
options: [{
value: 'le',
label: this.$t('chart.filter_le')
}, {
value: 'ge',
label: this.$t('chart.filter_ge')
}]
}
],
predefineColors: COLOR_PANEL
}
},
mounted() {
this.init()
},
methods: {
init() {
this.thresholdArr = JSON.parse(JSON.stringify(this.threshold))
},
addThreshold() {
this.thresholdArr.push(JSON.parse(JSON.stringify(this.thresholdObj)))
this.changeThreshold()
},
removeThreshold(index) {
this.thresholdArr.splice(index, 1)
this.changeThreshold()
},
changeThreshold() {
this.$emit('onLabelThresholdChange', this.thresholdArr)
}
}
}
</script>
<style scoped>
.line-item {
width: 100%;
border-radius: 4px;
border: 1px solid #DCDFE6;
padding: 4px 14px;
margin-bottom: 10px;
display: flex;
justify-content: left;
align-items: center;
}
.form-item >>> .el-form-item__label {
font-size: 12px;
}
span {
font-size: 12px;
}
.value-item {
position: relative;
display: inline-block;
width: 200px !important;
}
.select-item {
position: relative;
display: inline-block;
width: 100px !important;
}
.el-select-dropdown__item {
padding: 0 20px;
font-size: 12px;
}
.color-picker-style{
cursor: pointer;
z-index: 1003;
width: 28px;
height: 28px;
margin-top: 6px;
}
.color-picker-style >>> .el-color-picker__trigger{
width: 28px;
height: 28px;
}
</style>

View File

@ -84,6 +84,16 @@
</el-form>
<el-form v-show="chart.type && chart.type.includes('table')" ref="sizeFormPie" :model="sizeForm" label-width="100px" size="mini">
<el-form-item v-show="chart.type && chart.type === 'table-info'" :label="$t('chart.table_page_size')" class="form-item">
<el-select v-model="sizeForm.tablePageSize" :placeholder="$t('chart.table_page_size')" @change="changeBarSizeCase">
<el-option
v-for="item in pageSizeOptions"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.table_title_fontsize')" class="form-item">
<el-select v-model="sizeForm.tableTitleFontSize" :placeholder="$t('chart.table_title_fontsize')" @change="changeBarSizeCase">
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
@ -100,16 +110,6 @@
<el-form-item :label="$t('chart.table_item_height')" class="form-item form-item-slider">
<el-slider v-model="sizeForm.tableItemHeight" :min="36" :max="100" show-input :show-input-controls="false" input-size="mini" @change="changeBarSizeCase" />
</el-form-item>
<el-form-item v-show="chart.type && chart.type === 'table-info'" :label="$t('chart.table_page_size')" class="form-item">
<el-select v-model="sizeForm.tablePageSize" :placeholder="$t('chart.table_page_size')" @change="changeBarSizeCase">
<el-option
v-for="item in pageSizeOptions"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<el-form v-show="chart.type && chart.type.includes('gauge')" ref="sizeFormGauge" :model="sizeForm" label-width="100px" size="mini">

View File

@ -0,0 +1,87 @@
<template>
<div>
<el-form ref="form" :model="formatterItem.formatterCfg" label-width="80px" size="mini" class="formatter-form">
<el-form-item :label="$t('chart.value_formatter_type')">
<el-radio-group v-model="formatterItem.formatterCfg.type" @change="getExampleValue">
<el-radio v-for="radio in typeList" :key="radio.value" :label="radio.value">{{ $t('chart.' + radio.name) }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-show="formatterItem.formatterCfg.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')">
<el-input-number v-model="formatterItem.formatterCfg.decimalCount" :min="0" :max="10" size="mini" @change="getExampleValue" />
</el-form-item>
<el-form-item v-show="formatterItem.formatterCfg.type !== 'percent'" :label="$t('chart.value_formatter_unit')">
<el-select v-model="formatterItem.formatterCfg.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="getExampleValue">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')">
<el-input v-model="formatterItem.formatterCfg.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="getExampleValue" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')">
<el-checkbox v-model="formatterItem.formatterCfg.thousandSeparator" @change="getExampleValue" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_example')">
<span>{{ exampleResult }}</span>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { formatterType, unitList, valueFormatter } from '@/views/chart/chart/formatter'
export default {
name: 'ValueFormatterEdit',
props: {
formatterItem: {
type: Object,
required: true
},
chart: {
type: Object,
required: true
}
},
data() {
return {
typeList: formatterType,
unitList: unitList,
exampleResult: '20000000'
}
},
mounted() {
this.getExampleValue()
},
methods: {
getExampleValue() {
this.exampleResult = valueFormatter(20000000, this.formatterItem.formatterCfg)
}
}
}
</script>
<style scoped>
.el-form-item{
margin-bottom: 10px!important;
}
.formatter-form >>> .el-form-item__label{
font-size: 12px!important;
font-weight: 400!important;
}
.formatter-form >>> .el-radio__label{
font-size: 12px!important;
font-weight: 400!important;
}
.el-select-dropdown__item >>> span{
font-size: 12px!important;
}
.exp-style{
color: #C0C4CC;
font-size: 12px;
}
</style>

View File

@ -366,10 +366,12 @@
:item="item"
:dimension-data="dimension"
:quota-data="quota"
:chart="chart"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@onNameEdit="showRename"
@valueFormatter="valueFormatter"
/>
</transition-group>
</draggable>
@ -445,6 +447,7 @@
@editItemFilter="showQuotaEditFilter"
@onNameEdit="showRename"
@editItemCompare="showQuotaEditCompare"
@valueFormatter="valueFormatter"
/>
</transition-group>
</draggable>
@ -877,7 +880,7 @@
@onLegendChange="onLegendChange"
/>
</el-collapse-item>
<el-collapse-item v-if="chart.customStyle && view.customStyle.background" name="background" :title="$t('chart.background')">
<el-collapse-item v-if="view.customStyle && view.customStyle.background" name="background" :title="$t('chart.background')">
<background-color-selector
:param="param"
class="attr-selector"
@ -893,7 +896,7 @@
<el-tab-pane :label="$t('chart.senior')" class="padding-tab" style="width: 300px;">
<el-row class="view-panel">
<div
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge'))"
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge')) || view.type === 'text'"
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
class="attr-style theme-border-class"
>
@ -913,7 +916,7 @@
</el-collapse>
</el-row>
<el-row
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge'))"
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text')"
>
<span class="padding-lr">{{ $t('chart.analyse_cfg') }}</span>
<el-collapse v-model="styleActiveNames" class="style-collapse">
@ -930,7 +933,7 @@
/>
</el-collapse-item>
<el-collapse-item
v-if="view.type && (view.type.includes('gauge'))"
v-if="view.type && (view.type.includes('gauge') || view.type === 'text')"
name="threshold"
:title="$t('chart.threshold')"
>
@ -1088,7 +1091,7 @@
width="70%"
class="dialog-css"
>
<table-selector @getTable="getTable" />
<table-selector :checked-table="table" @getTable="getTable" />
<p style="margin-top: 10px;color:#F56C6C;font-size: 12px;">{{ $t('chart.change_ds_tip') }}</p>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeChangeChart">{{ $t('chart.cancel') }}</el-button>
@ -1116,6 +1119,7 @@
</div>
</el-dialog>
<!--同环比设置-->
<el-dialog
v-if="showEditQuotaCompare"
v-dialogDrag
@ -1131,6 +1135,23 @@
<el-button type="primary" size="mini" @click="saveQuotaEditCompare">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
<!--数值格式-->
<el-dialog
v-if="showValueFormatter"
v-dialogDrag
:title="$t('chart.value_formatter') + ' - ' + valueFormatterItem.name"
:visible="showValueFormatter"
:show-close="false"
width="600px"
class="dialog-css"
>
<value-formatter-edit :formatter-item="valueFormatterItem" :chart="chart" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeValueFormatter">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="saveValueFormatter">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
</el-row>
</template>
@ -1213,9 +1234,11 @@ import Threshold from '@/views/chart/components/senior/Threshold'
import TotalCfg from '@/views/chart/components/shape-attr/TotalCfg'
import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
import { pluginTypes } from '@/api/chart/chart'
import ValueFormatterEdit from '@/views/chart/components/value-formatter/ValueFormatterEdit'
export default {
name: 'ChartEdit',
components: {
ValueFormatterEdit,
LabelNormalText,
TotalCfg,
Threshold,
@ -1366,7 +1389,9 @@ export default {
quotaItemCompare: {},
showEditQuotaCompare: false,
preChartId: '',
pluginRenderOptions: []
pluginRenderOptions: [],
showValueFormatter: false,
valueFormatterItem: {}
}
},
@ -1378,6 +1403,7 @@ export default {
return this.$store.state.panel.panelInfo
},
...mapState([
'curComponent',
'panelViewEditInfo'
])
/* pluginRenderOptions() {
@ -1468,11 +1494,11 @@ export default {
bus.$on('plugins-calc-style', this.calcStyle)
bus.$on('plugin-chart-click', this.chartClick)
},
initTableData(id) {
initTableData(id, optType) {
if (id != null) {
post('/dataset/table/getWithPermission/' + id, null).then(response => {
this.table = response.data
this.initTableField(id)
this.initTableField(id, optType)
}).catch(err => {
this.table = null
this.resetDatasetField()
@ -1482,7 +1508,7 @@ export default {
})
}
},
initTableField(id) {
initTableField(id, optType) {
if (this.table) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
this.dimension = response.data.dimension
@ -1490,7 +1516,15 @@ export default {
this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
this.quotaData = JSON.parse(JSON.stringify(this.quota))
this.fieldFilter(this.searchField)
if (optType === 'change') {
this.resetChangeTable()
this.$nextTick(() => {
bus.$emit('reset-change-table', 'change')
this.calcData()
})
}
}).catch(err => {
console.log(err)
this.resetView()
this.httpRequest.status = err.response.data.success
this.httpRequest.msg = err.response.data.message
@ -1500,6 +1534,35 @@ export default {
this.resetDatasetField()
}
},
resetChangeTable() {
const compareData = {}
this.dimensionData.forEach(deimension => {
compareData[deimension.originName] = deimension
})
this.quotaData.forEach(quota => {
compareData[quota.originName] = quota
})
const compareCols = ['xaxis', 'xaxisExt', 'yaxis', 'yaxisExt', 'customFilter', 'extStack', 'extBubble', 'drillFields']
this.viewFieldChange(compareData, compareCols)
},
viewFieldChange(compareData, compareCols) {
const _this = this
compareCols.forEach(compareCol => {
_this.view[compareCol].forEach(function(item, index) {
if (compareData[item.originName]) {
const itemTemp = {
...compareData[item.originName],
name: item.name,
deType: item.deType,
type: item.type,
groupType: item.groupType,
sort: item.sort
}
_this.view[compareCol][index] = itemTemp
}
})
})
},
buildParam(getData, trigger, needRefreshGroup = false, switchType = false) {
if (!this.view.resultCount ||
this.view.resultCount === '' ||
@ -2198,20 +2261,11 @@ export default {
//
changeChart() {
this.view.dataFrom = 'dataset'
if (this.view.tableId !== this.changeTable.id) {
this.view.tableId = this.changeTable.id
this.view.xaxis = []
this.view.xaxisExt = []
this.view.yaxis = []
this.view.yaxisExt = []
this.view.customFilter = []
this.view.extStack = []
this.view.extBubble = []
this.view.drillFields = []
}
const optType = this.view.tableId === this.changeTable.id ? 'same' : 'change'
// this.save(true, 'chart', false)
this.view.tableId = this.changeTable.id
this.calcData(true, 'chart', false)
this.initTableData(this.view.tableId)
this.initTableData(this.view.tableId, optType)
this.closeChangeChart()
},
@ -2273,11 +2327,11 @@ export default {
},
addXaxisExt(e) {
if (this.view.type !== 'table-info') {
this.dragCheckType(this.view.xaxis, 'd')
this.dragCheckType(this.view.xaxisExt, 'd')
}
this.dragMoveDuplicate(this.view.xaxis, e)
if ((this.view.type === 'map' || this.view.type === 'word-cloud') && this.view.xaxis.length > 1) {
this.view.xaxis = [this.view.xaxis[0]]
this.dragMoveDuplicate(this.view.xaxisExt, e)
if ((this.view.type === 'map' || this.view.type === 'word-cloud') && this.view.xaxisExt.length > 1) {
this.view.xaxisExt = [this.view.xaxisExt[0]]
}
this.calcData(true)
},
@ -2416,6 +2470,7 @@ export default {
this.backToParent(0, length)
this.currentAcreaNode = null
const current = this.$refs.dynamicChart
this.setDetailMapCode(null)
if (this.view.isPlugin) {
current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: null })
} else {
@ -2450,15 +2505,20 @@ export default {
// this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(this.currentAcreaNode.code)
const current = this.$refs.dynamicChart
if (this.view.isPlugin) {
current && current.callPluginInner && current.callPluginInner({
current && current.callPluginInner && this.setDetailMapCode(this.currentAcreaNode.code) && current.callPluginInner({
methodName: 'registerDynamicMap',
methodParam: this.currentAcreaNode.code
})
} else {
current && current.registerDynamicMap && current.registerDynamicMap(this.currentAcreaNode.code)
current && current.registerDynamicMap && this.setDetailMapCode(this.currentAcreaNode.code) && current.registerDynamicMap(this.currentAcreaNode.code)
}
},
setDetailMapCode(code) {
this.curComponent.DetailAreaCode = code
return true
},
//
sendToChildren(param) {
const length = param.data.dimensionList.length
@ -2477,12 +2537,12 @@ export default {
// this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(nextNode.code)
const current = this.$refs.dynamicChart
if (this.view.isPlugin) {
nextNode && current && current.callPluginInner && current.callPluginInner({
nextNode && current && current.callPluginInner && this.setDetailMapCode(nextNode.code) && current.callPluginInner({
methodName: 'registerDynamicMap',
methodParam: nextNode.code
})
} else {
nextNode && current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
nextNode && current && current.registerDynamicMap && this.setDetailMapCode(nextNode.code) && current.registerDynamicMap(nextNode.code)
}
return nextNode
}
@ -2544,6 +2604,35 @@ export default {
this.view.customAttr.label.position = 'middle'
}
}
},
valueFormatter(item) {
this.valueFormatterItem = JSON.parse(JSON.stringify(item))
this.showValueFormatter = true
},
closeValueFormatter() {
this.showValueFormatter = false
},
saveValueFormatter() {
const ele = this.valueFormatterItem.formatterCfg.decimalCount
if (ele === undefined || ele.toString().indexOf('.') > -1 || parseInt(ele).toString() === 'NaN' || parseInt(ele) < 0 || parseInt(ele) > 10) {
this.$message({
message: this.$t('chart.formatter_decimal_count_error'),
type: 'error',
showClose: true
})
return
}
//
if (this.valueFormatterItem.formatterType === 'quota') {
this.view.yaxis[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
} else if (this.valueFormatterItem.formatterType === 'quotaExt') {
this.view.yaxisExt[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
} else if (this.valueFormatterItem.formatterType === 'dimension') {
this.view.xaxis[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
}
this.calcData(true)
this.closeValueFormatter()
}
}
}
@ -2598,7 +2687,7 @@ export default {
.view-panel {
display: flex;
height: calc(100% - 80px);
height: 100%;
background-color: #f7f8fa;
}
@ -2717,6 +2806,7 @@ span {
}
.tab-header > > > .el-tabs__content {
height: calc(100% - 40px);
}
.draggable-group {

View File

@ -1,7 +1,7 @@
<template>
<de-container>
<de-aside-container>
<dataset-group-selector-tree :privileges="privileges" :mode="mode" :clear-empty-dir="clearEmptyDir" :type="type" :custom-type="customType" :show-mode="showMode" @getTable="getTable" />
<dataset-group-selector-tree :checked-table="checkedTable" :privileges="privileges" :mode="mode" :clear-empty-dir="clearEmptyDir" :type="type" :custom-type="customType" :show-mode="showMode" @getTable="getTable" />
</de-aside-container>
<de-main-container>
<dataset-table-data :table="table" />
@ -54,6 +54,11 @@ export default {
type: Boolean,
required: false,
default: false
},
checkedTable: {
type: Object,
required: false,
default: null
}
},
data() {
@ -65,6 +70,7 @@ export default {
created() {
},
mounted() {
this.getTable(this.checkedTable)
},
methods: {
getTable(table) {

View File

@ -38,6 +38,7 @@
<div class="block" :style="treeStyle">
<el-tree
ref="datasetTreeRef"
:current-node-key="checkedTable ? checkedTable.id : ''"
:default-expanded-keys="expandedArray"
:data="data"
node-key="id"
@ -133,6 +134,11 @@ export default {
type: Boolean,
required: false,
default: false
},
checkedTable: {
type: Object,
required: false,
default: null
}
},
data() {
@ -197,6 +203,7 @@ export default {
},
mounted() {
this.treeNode()
this.initExpand()
},
created() {
},
@ -218,6 +225,11 @@ export default {
name: ''
}
},
initExpand() {
if (this.checkedTable && this.checkedTable.pid) {
this.expandedArray.push(this.checkedTable.pid)
}
},
treeNode(cache) {
const modelInfo = localStorage.getItem('dataset-tree')
const userCache = (modelInfo && cache)

View File

@ -23,7 +23,7 @@
</el-link> -->
</el-col>
</el-row>
<el-row style="display: flex;">
<el-row style="display: flex;border-bottom: 1px solid;border-bottom-color:#E6E6E6;">
<el-col style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;font-size: 14px; width: 90px;">
<span>{{ $t('panel.share_to') }}</span>
</el-col>

View File

@ -347,6 +347,9 @@ export default {
targetViewInfo.targetFieldId = null
},
sourceFieldCheckedChange(data) {
if (data.checked) {
this.linkJump.checked = true
}
this.$nextTick(() => {
this.$refs.linkJumpInfoTree.setCurrentKey(data.sourceFieldId)
this.nodeClick(data)

View File

@ -204,7 +204,7 @@ export default {
currentFiledTreeNode: null,
defaultOuterParamsInfo: {
paramName: '',
checked: false,
checked: true,
targetViewInfoList: []
},
defaultTargetViewInfo: {
@ -322,12 +322,16 @@ export default {
targetViewInfo.targetFieldId = null
},
sourceFieldCheckedChange(data) {
if (data.checked) {
this.outerParams.checked = true
}
this.$nextTick(() => {
this.$refs.outerParamsInfoTree.setCurrentKey(data.paramsInfoId)
this.nodeClick(data)
})
},
addOuterParamsInfo() {
this.outerParams.checked = true
const outerParamsInfo = deepCopy(this.defaultOuterParamsInfo)
outerParamsInfo['paramsInfoId'] = uuid.v1()
this.outerParamsInfoArray.push(outerParamsInfo)

View File

@ -0,0 +1,96 @@
<template>
<div>
<div style="width: 100%;">
<el-popover
placement="right"
width="400"
trigger="click"
>
<el-col>
<el-form ref="aidedForm" label-width="110px" size="mini">
<el-form-item :label="'辅助网格'" class="form-item form-item-slider">
<el-checkbox v-model="aidedDesign.showGrid" size="mini" @change="onChangePanelStyle" />
</el-form-item>
<el-form-item :label="'矩阵密度'" class="form-item form-item-slider">
<el-radio-group v-model="aidedDesign.matrixBase" size="mini">
<el-radio-button :label="1">普通</el-radio-button>
<el-radio-button :label="2">适中</el-radio-button>
<el-radio-button :label="3">密集</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item">辅助设计 <i
class="el-icon-setting el-icon--right"
/></el-button>
</el-popover>
</div>
</div>
</template>
<script>
export default {
name: 'PanelAidedDesign',
props: {},
computed: {
aidedDesign() {
return this.$store.state.canvasStyleData.aidedDesign
}
},
created() {
},
methods: {
onChangePanelStyle() {
this.$store.state.styleChangeTimes++
}
}
}
</script>
<style scoped>
.avatar-uploader >>> .el-upload {
width: 100px;
height: 60px;
line-height: 70px;
}
.avatar-uploader >>> .el-upload-list li {
width: 100px !important;
height: 60px !important;
}
.disabled >>> .el-upload--picture-card {
display: none;
}
.shape-item {
padding: 6px;
border: none;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
/*.form-item-slider >>> .el-form-item__label {*/
/* font-size: 12px;*/
/* line-height: 38px;*/
/*}*/
.form-item >>> .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item {
padding: 0 20px;
}
span {
font-size: 12px
}
.el-form-item {
margin-bottom: 6px;
}
</style>

View File

@ -17,6 +17,7 @@
<el-collapse-item :title="$t('panel.panel')" name="panel">
<el-row class="selector-div">
<background-selector class="attr-selector" />
<panel-aided-design class="attr-selector" />
<component-gap class="attr-selector" />
<panel-refresh-time class="attr-selector" />
<panel-view-result class="attr-selector" />
@ -70,9 +71,11 @@ import { mapState } from 'vuex'
import { deepCopy } from '@/components/canvas/utils/utils'
import bus from '@/utils/bus'
import PanelViewResult from '@/views/panel/SubjectSetting/PanelStyle/PanelViewResult'
import PanelAidedDesign from '@/views/panel/SubjectSetting/PanelStyle/PanelAidedDesign'
export default {
components: {
PanelAidedDesign,
PanelViewResult,
slider,
BackgroundSelector,

View File

@ -168,7 +168,7 @@
@mouseup="deselectCurComponent"
@scroll="canvasScroll"
>
<Editor ref="canvasEditor" :matrix-count="pcMatrixCount" :out-style="outStyle" :scroll-top="scrollTop" />
<Editor ref="canvasEditor" :matrix-count="pcMatrixCountBase" :out-style="outStyle" :scroll-top="scrollTop" />
</div>
<!--移动端画布区域 保持宽高比2.5-->
<el-row v-if="mobileLayoutStatus" class="mobile_canvas_main">
@ -547,6 +547,16 @@ export default {
panelInfo() {
return this.$store.state.panel.panelInfo
},
pcMatrixCountBase() {
if (this.canvasStyleData.aidedDesign) {
return {
x: this.pcMatrixCount.x * this.canvasStyleData.aidedDesign.matrixBase,
y: this.pcMatrixCount.y * this.canvasStyleData.aidedDesign.matrixBase
}
} else {
return this.pcMatrixCount
}
},
...mapState([
'curComponent',
'curCanvasScale',

View File

@ -45,7 +45,7 @@
controls-position="right"
size="mini"
:min="1"
:max="12"
:max="100"
@change="dynamicPrefixChange"
/>
</el-form-item>

View File

@ -38,7 +38,7 @@
controls-position="right"
size="mini"
:min="0"
:max="10"
:max="100"
@change="sDynamicPrefixChange"
/>
</el-form-item>
@ -91,7 +91,7 @@
controls-position="right"
size="mini"
:min="0"
:max="10"
:max="100"
@change="eDynamicPrefixChange"
/>
</el-form-item>

View File

@ -39,7 +39,7 @@
:load="loadTree"
@node-click="handleNodeClick"
>
<div slot-scope="{ node, data }" class="custom-tree-node">
<span slot-scope="{ node, data }" style="display: flex;flex: 1;width: 0%;" class="custom-tree-node">
<span>
<svg-icon v-if="data.type === 'db'" icon-class="ds-db" class="ds-icon-db" />
<svg-icon v-if="data.type === 'sql'" icon-class="ds-sql" class="ds-icon-sql" />
@ -48,12 +48,14 @@
<svg-icon v-if="data.type === 'union'" icon-class="ds-union" class="ds-icon-union" />
<svg-icon v-if="data.type === 'api'" icon-class="ds-api" class="ds-icon-api" />
</span>
<el-tooltip class="item" effect="dark" placement="top">
<div slot="content">{{ node.label }}</div>
<span class="label-span">{{ node.label }}</span>
</el-tooltip>
<span v-if="data.modelInnerType === 'db' || data.modelInnerType === 'sql'">
<span v-if="data.mode === 0" style="margin-left: 6px"><i class="el-icon-s-operation" /></span>
<span v-if="data.mode === 1" style="margin-left: 6px"><i class="el-icon-alarm-clock" /></span>
</span>
</div>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="node.label">{{ node.label }}</span>
</span>
</el-tree>
<div v-if="showDomType === 'field'">
@ -67,13 +69,19 @@
>
<transition-group>
<div
v-for="item in fieldDatas.filter(item => !keyWord || (item.name && item.name.toLocaleLowerCase().includes(keyWord)))"
v-for="item in fieldDatas"
:key="item.id"
:class="myAttrs && myAttrs.fieldId && myAttrs.fieldId.includes(item.id) ? 'filter-db-row-checked' : 'filter-db-row'"
class="filter-db-row"
style="margin: 5px 0;"
>
<i class="el-icon-s-data" />
<span> {{ item.name }}</span>
<span style="display: flex;flex: 1;">
<span>
<i class="el-icon-s-data" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="item.name">{{ item.name }}</span>
</span>
</div>
</transition-group>
</draggable>
@ -122,8 +130,15 @@
<el-table-column prop="name" :label="$t('commons.name')">
<template v-if="comShowDomType === 'view'" :id="scope.row.id" slot-scope="scope">
<div class="filter-db-row" @click="comShowFieldDatas(scope.row)">
<i class="el-icon-s-data" />
<span> {{ scope.row.name }}</span>
<!-- <i class="el-icon-s-data" />
<span> {{ scope.row.name }}</span> -->
<span style="display: flex;flex: 1;">
<span>
<i class="el-icon-s-data" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="scope.row.name">{{ scope.row.name }}</span>
</span>
</div>
</template>
</el-table-column>
@ -140,13 +155,20 @@
>
<transition-group>
<div
v-for="item in comFieldDatas.filter(item => !viewKeyWord || item.name.toLocaleLowerCase().includes(viewKeyWord))"
v-for="item in comFieldDatas"
:key="item.id"
:class="myAttrs && myAttrs.fieldId && myAttrs.fieldId.includes(item.id) ? 'filter-db-row-checked' : 'filter-db-row'"
class="filter-db-row"
style="margin: 5px 0;"
>
<i class="el-icon-s-data" />
<span> {{ item.name }}</span>
<span style="display: flex;flex: 1;">
<span>
<i class="el-icon-s-data" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="item.name">{{ item.name }}</span>
</span>
</div>
</transition-group>
</draggable>
@ -237,7 +259,9 @@ export default {
sceneDatas: [],
// viewDatas: [],
fieldDatas: [],
originFieldDatas: [],
comFieldDatas: [],
originComFieldDatas: [],
defaultProps: {
label: 'name',
children: 'children',
@ -298,6 +322,11 @@ export default {
keyWord(val) {
this.expandedArray = []
if (this.showDomType === 'field') {
let results = this.originFieldDatas
if (val) {
results = this.originFieldDatas.filter(item => item.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()))
}
this.fieldDatas = JSON.parse(JSON.stringify(results))
return
}
if (this.timer) {
@ -306,6 +335,16 @@ export default {
this.timer = setTimeout(() => {
this.getTreeData(val)
}, (val && val !== '') ? 1000 : 0)
},
viewKeyWord(val) {
if (this.comShowDomType === 'field') {
let results = this.originComFieldDatas
if (val) {
results = this.originComFieldDatas.filter(item => item.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()))
}
this.comFieldDatas = JSON.parse(JSON.stringify(results))
}
}
},
created() {
@ -512,7 +551,8 @@ export default {
if (this.widget && this.widget.filterFieldMethod) {
datas = this.widget.filterFieldMethod(datas)
}
this.fieldDatas = datas
this.originFieldDatas = datas
this.fieldDatas = JSON.parse(JSON.stringify(datas))
})
},
comLoadField(tableId) {
@ -521,7 +561,8 @@ export default {
if (this.widget && this.widget.filterFieldMethod) {
datas = this.widget.filterFieldMethod(datas)
}
this.comFieldDatas = datas
this.originComFieldDatas = datas
this.comFieldDatas = JSON.parse(JSON.stringify(datas))
})
},
showFieldDatas(row) {

View File

@ -5,7 +5,7 @@
<div class="field-content">
<div class="field-content-right">
<el-row style="display:flex;height: 32px;">
<el-row style="display:inline-flex;height: 32px;width: auto;">
<draggable
v-model="element.options.attrs.dragItems"
group="dimension"
@ -78,7 +78,7 @@ export default {
<style lang="scss" scoped>
.filter-field {
border-radius: 4px;
height: 45px;
height: 40px;
.field-content {
position: relative;
@ -113,14 +113,15 @@ export default {
border-left: none;
color: #9ea6b2;
border: 1px solid var(--TableBorderColor, #E6E6E6);
width: 0%;
width: auto;
max-width: 0%;
position: relative;
display: table-cell;
display: inherit;
vertical-align: middle;
margin: 0px;
padding: 0 0 0 0;
padding: 4px 0 0 0;
height: 100%;
line-height: 100%;
}
}

View File

@ -1,5 +1,5 @@
// eslint-disable-next-line no-unused-vars
import { BASE_CHART, BASE_CHART_STRING } from '@/views/chart/chart/chart'
import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
import { deepCopy } from '@/components/canvas/utils/utils'
export const DEFAULT_PANEL_STYLE = {
@ -23,7 +23,13 @@ export const CANVAS_STYLE = {
panel: DEFAULT_PANEL_STYLE,
refreshViewLoading: true, // 仪表板视图loading提示
refreshUnit: 'minute', // 仪表板刷新时间带外 默认 分钟
refreshTime: 5 // 仪表板刷新时间 默认5分钟
refreshTime: 5, // 仪表板刷新时间 默认5分钟
aidedDesign: AIDED_DESIGN // 辅助设计
}
export const AIDED_DESIGN = {
showGrid: false,
matrixBase: 1 // 当前matrix的基数 是pcMatrixCount的几倍
}
export const DEFAULT_COMMON_CANVAS_STYLE_STRING = {

Some files were not shown because too many files have changed in this diff Show More