feat: 任务管理

This commit is contained in:
taojinlong 2021-07-08 14:11:59 +08:00
commit 00202fa718
97 changed files with 2766 additions and 661 deletions

View File

@ -46,6 +46,10 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/system/ui/**", ANON);
filterChainDefinitionMap.put("/**/*.js", ANON);
filterChainDefinitionMap.put("/**/*.css", ANON);
filterChainDefinitionMap.put("/**/*.map", ANON);
// filterChainDefinitionMap.put("/axios.map", ANON);
filterChainDefinitionMap.put("/api/auth/login", ANON);
filterChainDefinitionMap.put("/api/auth/logout", ANON);

View File

@ -0,0 +1,25 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class PanelView implements Serializable {
private String id;
private String panelId;
private String chartViewId;
private String createBy;
private Long createTime;
private String updateBy;
private Long updateTime;
private byte[] content;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,670 @@
package io.dataease.base.domain;
import java.util.ArrayList;
import java.util.List;
public class PanelViewExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public PanelViewExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andPanelIdIsNull() {
addCriterion("panel_id is null");
return (Criteria) this;
}
public Criteria andPanelIdIsNotNull() {
addCriterion("panel_id is not null");
return (Criteria) this;
}
public Criteria andPanelIdEqualTo(String value) {
addCriterion("panel_id =", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdNotEqualTo(String value) {
addCriterion("panel_id <>", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdGreaterThan(String value) {
addCriterion("panel_id >", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdGreaterThanOrEqualTo(String value) {
addCriterion("panel_id >=", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdLessThan(String value) {
addCriterion("panel_id <", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdLessThanOrEqualTo(String value) {
addCriterion("panel_id <=", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdLike(String value) {
addCriterion("panel_id like", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdNotLike(String value) {
addCriterion("panel_id not like", value, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdIn(List<String> values) {
addCriterion("panel_id in", values, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdNotIn(List<String> values) {
addCriterion("panel_id not in", values, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdBetween(String value1, String value2) {
addCriterion("panel_id between", value1, value2, "panelId");
return (Criteria) this;
}
public Criteria andPanelIdNotBetween(String value1, String value2) {
addCriterion("panel_id not between", value1, value2, "panelId");
return (Criteria) this;
}
public Criteria andChartViewIdIsNull() {
addCriterion("chart_view_id is null");
return (Criteria) this;
}
public Criteria andChartViewIdIsNotNull() {
addCriterion("chart_view_id is not null");
return (Criteria) this;
}
public Criteria andChartViewIdEqualTo(String value) {
addCriterion("chart_view_id =", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdNotEqualTo(String value) {
addCriterion("chart_view_id <>", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdGreaterThan(String value) {
addCriterion("chart_view_id >", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdGreaterThanOrEqualTo(String value) {
addCriterion("chart_view_id >=", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdLessThan(String value) {
addCriterion("chart_view_id <", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdLessThanOrEqualTo(String value) {
addCriterion("chart_view_id <=", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdLike(String value) {
addCriterion("chart_view_id like", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdNotLike(String value) {
addCriterion("chart_view_id not like", value, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdIn(List<String> values) {
addCriterion("chart_view_id in", values, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdNotIn(List<String> values) {
addCriterion("chart_view_id not in", values, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdBetween(String value1, String value2) {
addCriterion("chart_view_id between", value1, value2, "chartViewId");
return (Criteria) this;
}
public Criteria andChartViewIdNotBetween(String value1, String value2) {
addCriterion("chart_view_id not between", value1, value2, "chartViewId");
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
return (Criteria) this;
}
public Criteria andCreateByIsNotNull() {
addCriterion("create_by is not null");
return (Criteria) this;
}
public Criteria andCreateByEqualTo(String value) {
addCriterion("create_by =", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotEqualTo(String value) {
addCriterion("create_by <>", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByGreaterThan(String value) {
addCriterion("create_by >", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByGreaterThanOrEqualTo(String value) {
addCriterion("create_by >=", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLessThan(String value) {
addCriterion("create_by <", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLessThanOrEqualTo(String value) {
addCriterion("create_by <=", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLike(String value) {
addCriterion("create_by like", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotLike(String value) {
addCriterion("create_by not like", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByIn(List<String> values) {
addCriterion("create_by in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotIn(List<String> values) {
addCriterion("create_by not in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByBetween(String value1, String value2) {
addCriterion("create_by between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotBetween(String value1, String value2) {
addCriterion("create_by not between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateByIsNull() {
addCriterion("update_by is null");
return (Criteria) this;
}
public Criteria andUpdateByIsNotNull() {
addCriterion("update_by is not null");
return (Criteria) this;
}
public Criteria andUpdateByEqualTo(String value) {
addCriterion("update_by =", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotEqualTo(String value) {
addCriterion("update_by <>", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByGreaterThan(String value) {
addCriterion("update_by >", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByGreaterThanOrEqualTo(String value) {
addCriterion("update_by >=", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByLessThan(String value) {
addCriterion("update_by <", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByLessThanOrEqualTo(String value) {
addCriterion("update_by <=", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByLike(String value) {
addCriterion("update_by like", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotLike(String value) {
addCriterion("update_by not like", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByIn(List<String> values) {
addCriterion("update_by in", values, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotIn(List<String> values) {
addCriterion("update_by not in", values, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByBetween(String value1, String value2) {
addCriterion("update_by between", value1, value2, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotBetween(String value1, String value2) {
addCriterion("update_by not between", value1, value2, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,36 @@
package io.dataease.base.mapper;
import io.dataease.base.domain.PanelView;
import io.dataease.base.domain.PanelViewExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface PanelViewMapper {
long countByExample(PanelViewExample example);
int deleteByExample(PanelViewExample example);
int deleteByPrimaryKey(String id);
int insert(PanelView record);
int insertSelective(PanelView record);
List<PanelView> selectByExampleWithBLOBs(PanelViewExample example);
List<PanelView> selectByExample(PanelViewExample example);
PanelView selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") PanelView record, @Param("example") PanelViewExample example);
int updateByExampleWithBLOBs(@Param("record") PanelView record, @Param("example") PanelViewExample example);
int updateByExample(@Param("record") PanelView record, @Param("example") PanelViewExample example);
int updateByPrimaryKeySelective(PanelView record);
int updateByPrimaryKeyWithBLOBs(PanelView record);
int updateByPrimaryKey(PanelView record);
}

View File

@ -0,0 +1,304 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.dataease.base.mapper.PanelViewMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelView">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="panel_id" jdbcType="VARCHAR" property="panelId" />
<result column="chart_view_id" jdbcType="VARCHAR" property="chartViewId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.PanelView">
<result column="content" jdbcType="LONGVARBINARY" property="content" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, panel_id, chart_view_id, create_by, create_time, update_by, update_time
</sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.PanelViewExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from panel_view
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.dataease.base.domain.PanelViewExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from panel_view
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from panel_view
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from panel_view
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.PanelViewExample">
delete from panel_view
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.PanelView">
insert into panel_view (id, panel_id, chart_view_id,
create_by, create_time, update_by,
update_time, content)
values (#{id,jdbcType=VARCHAR}, #{panelId,jdbcType=VARCHAR}, #{chartViewId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelView">
insert into panel_view
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="panelId != null">
panel_id,
</if>
<if test="chartViewId != null">
chart_view_id,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="panelId != null">
#{panelId,jdbcType=VARCHAR},
</if>
<if test="chartViewId != null">
#{chartViewId,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARBINARY},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.PanelViewExample" resultType="java.lang.Long">
select count(*) from panel_view
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update panel_view
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.panelId != null">
panel_id = #{record.panelId,jdbcType=VARCHAR},
</if>
<if test="record.chartViewId != null">
chart_view_id = #{record.chartViewId,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateBy != null">
update_by = #{record.updateBy,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARBINARY},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update panel_view
set id = #{record.id,jdbcType=VARCHAR},
panel_id = #{record.panelId,jdbcType=VARCHAR},
chart_view_id = #{record.chartViewId,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update panel_view
set id = #{record.id,jdbcType=VARCHAR},
panel_id = #{record.panelId,jdbcType=VARCHAR},
chart_view_id = #{record.chartViewId,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.PanelView">
update panel_view
<set>
<if test="panelId != null">
panel_id = #{panelId,jdbcType=VARCHAR},
</if>
<if test="chartViewId != null">
chart_view_id = #{chartViewId,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARBINARY},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.PanelView">
update panel_view
set panel_id = #{panelId,jdbcType=VARCHAR},
chart_view_id = #{chartViewId,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelView">
update panel_view
set panel_id = #{panelId,jdbcType=VARCHAR},
chart_view_id = #{chartViewId,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -16,4 +16,6 @@ public interface ExtChartViewMapper {
@Select("select id from chart_view where table_id = #{tableId}")
List<String> allViewIds(@Param("tableId") String tableId);
String searchAdviceSceneId(@Param("userId") String userId,@Param("panelId") String panelId);
}

View File

@ -52,7 +52,7 @@
`scene_id`,
`table_id`,
`type`,
`title`,
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
`x_axis`,
`y_axis`,
`custom_attr`,
@ -68,4 +68,19 @@
WHERE
id = #{oldChartId}
</insert>
<select id="searchAdviceSceneId" resultType="String">
SELECT DISTINCT
( scene_id )
FROM
( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{userId}, 'chart' ) cids ) t,
panel_view
LEFT JOIN chart_view ON panel_view.chart_view_id = chart_view.id
LEFT JOIN chart_group ON chart_view.scene_id = chart_group.id
WHERE
FIND_IN_SET( chart_view.scene_id, cids ) and panel_view.panel_id =#{panelId}
ORDER BY
chart_group.create_time DESC
LIMIT 1
</select>
</mapper>

View File

@ -7,4 +7,6 @@ import java.util.List;
public interface ExtDataSetTableMapper {
List<DataSetTableDTO> search(DataSetTableRequest request);
DataSetTableDTO searchOne(DataSetTableRequest request);
}

View File

@ -7,6 +7,33 @@
<result column="privileges" property="privileges"/>
</resultMap>
<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`
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'dataset') cids) t,dataset_table
<where>
FIND_IN_SET(dataset_table.id,cids)
<if test="id != null">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="sceneId != null">
and scene_id = #{sceneId,jdbcType=VARCHAR}
</if>
<if test="mode != null">
and mode = #{mode,jdbcType=INTEGER}
</if>
<if test="typeFilter != null">
and type in
<foreach collection="typeFilter" item="item" open="(" separator="," close=")">
#{item,jdbcType=INTEGER}
</foreach>
</if>
</where>
<if test="sort != null">
order by ${sort}
</if>
</select>
<select id="search" resultMap="BaseResultMapDTO">
select
@ -34,7 +61,5 @@
<if test="sort != null">
order by ${sort}
</if>
</select>
</mapper>

View File

@ -12,6 +12,8 @@ public interface ExtPanelShareMapper {
int batchInsert(@Param("shares") List<PanelShare> shares);
int batchDelete(@Param("shareIds") List<Long> shareIds);
List<PanelSharePo> query(Map<String, Object> param);
List<PanelShare> queryWithResource(GridExample example);

View File

@ -16,6 +16,14 @@
</foreach>
</insert>
<delete id="batchDelete" parameterType="java.lang.Long" >
delete from panel_share
where share_id in
<foreach collection="shareIds" item="shareId" open="(" separator="," close=")" >
#{shareId}
</foreach>
</delete>
<select id="query" resultMap="treeNodeMap">
select distinct s.panel_group_id as id, g.create_by as creator, g.name
from panel_share s

View File

@ -1,6 +1,9 @@
package io.dataease.base.mapper.ext;
import io.dataease.base.domain.PanelView;
import io.dataease.dto.panel.PanelViewDto;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -9,4 +12,8 @@ public interface ExtPanelViewMapper {
List<PanelViewDto> groups(String userId);
List<PanelViewDto> views(String userId);
void deleteWithPanelId(String panelId);
void savePanelView(@Param("panelViews") List<PanelViewInsertDTO> panelViews);
}

View File

@ -31,6 +31,16 @@
</select>
<delete id="deleteWithPanelId">
delete from panel_view where panel_id =#{panelId}
</delete>
<insert id="savePanelView">
INSERT INTO `panel_view` (id,chart_view_id, panel_id) VALUES
<foreach collection="panelViews" item="panelView" index="index" separator=",">
(uuid(),#{panelView.chartViewId},#{panelView.panelId})
</foreach>
</insert>

View File

@ -1,14 +0,0 @@
package io.dataease.base.mapper.ext;
import io.dataease.base.domain.SysAuthDetail;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtSysAuthDetailMapper {
List<SysAuthDetail> searchAuthTypeModel(@Param("authTypeModel") String authTypeModel);
void copyAuthModel(@Param("authTypeModel") String authTypeModel,@Param("authId") String authId,@Param("createUser") String createUser);
void authDetailsChange(@Param("privilegeValue")Integer privilegeValue,@Param("privilegeType")Integer privilegeType,@Param("authIds")List<String> authIds);
}

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.dataease.base.mapper.ext.ExtSysAuthDetailMapper">
<select id="searchAuthTypeModel" resultMap="io.dataease.base.mapper.SysAuthDetailMapper.BaseResultMap">
select
sys_auth_detail.privilege_name ,
sys_auth_detail.privilege_type ,
sys_auth_detail.privilege_value
from sys_auth_detail where sys_auth_detail.auth_id =#{authTypeModel} order by sys_auth_detail.privilege_type desc
</select>
<insert id="copyAuthModel">
INSERT INTO sys_auth_detail (
id,
auth_id,
privilege_name,
privilege_type,
privilege_value,
privilege_extend,
remark,
create_user,
create_time
) SELECT
uuid() AS id,
#{authId} AS auth_id,
sys_auth_detail.privilege_name,
sys_auth_detail.privilege_type,
sys_auth_detail.privilege_value,
sys_auth_detail.privilege_extend,
sys_auth_detail.remark,
#{createUser} AS create_user,
unix_timestamp(now())* 1000 AS create_time
FROM
sys_auth_detail where auth_id =#{authTypeModel}
</insert>
<update id="authDetailsChange">
UPDATE sys_auth_detail
SET privilege_value = #{privilegeValue}
<where>
auth_id in
<foreach collection='authIds' item='authId' open='(' separator=',' close=')'>#{authId}</foreach>
<if test="privilegeValue == 1">
and privilege_type &lt;= #{privilegeType}
</if>
<if test="privilegeValue == 0">
and privilege_type &gt;= #{privilegeType}
</if>
</where>
</update>
</mapper>

View File

@ -1,20 +1,9 @@
package io.dataease.base.mapper.ext;
import io.dataease.controller.request.SysAuthRequest;
import io.dataease.dto.SysAuthDetailDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtSysAuthMapper {
List<SysAuthDetailDTO> searchAuth(SysAuthRequest request);
Boolean authExist(@Param("authSource") String authSource, @Param("authTarget") String authTarget);
String findAuthId(@Param("authSource") String authSource,
@Param("authSourceType") String authSourceType,
@Param("authTarget") String authTarget,
@Param("authTargetType") String authTargetType);
Boolean checkTreeNoManageCount(@Param("userId") Long userId , @Param("modelType") String modelType, @Param("nodeId") String nodeId);

View File

@ -10,66 +10,6 @@
<result column="auth_target_type" jdbcType="VARCHAR" property="authTargetType" />
</resultMap>
<select id="searchAuth" resultMap="BaseResultMapAuthDetailDTO">
select
sys_auth.id,
sys_auth.auth_source,
sys_auth.auth_source_type,
sys_auth.auth_target,
sys_auth.auth_target_type,
sys_auth.auth_time,
sys_auth.auth_details,
sys_auth.auth_user,
sys_auth.update_time,
sys_auth_detail.auth_id,
sys_auth_detail.auth_id ,
sys_auth_detail.privilege_name ,
sys_auth_detail.privilege_type ,
sys_auth_detail.privilege_value ,
sys_auth_detail.privilege_extend
from sys_auth left join sys_auth_detail on sys_auth.id = sys_auth_detail.auth_id
<where>
sys_auth_detail.auth_id is not null
<if test="authSources != null and authSources.size > 0">
and sys_auth.auth_source in
<foreach collection="authSources" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="authTargets != null and authTargets.size > 0">
and sys_auth.auth_target in
<foreach collection="authTargets" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="authSource != null">
and sys_auth.auth_source=#{authSource}
</if>
<if test="authSourceType != null">
and sys_auth.auth_source_type=#{authSourceType}
</if>
<if test="authTarget != null">
and sys_auth.auth_target=#{authTarget}
</if>
<if test="authTargetType != null">
and sys_auth.auth_target_type=#{authTargetType}
</if>
</where>
order by sys_auth_detail.privilege_type desc
</select>
<select id="authExist" resultType="Boolean">
select if(count(1)=0,0,1) from sys_auth where auth_source=#{authSource} and auth_target=#{authTarget}
</select>
<select id="findAuthId" resultType="String">
select id from sys_auth where auth_source=#{authSource} and auth_source_type=#{authSourceType} and auth_target=#{authTarget} and auth_target_type=#{authTargetType} limit 1
</select>
<select id="checkTreeNoManageCount" resultType="Boolean">
select if(CHECK_TREE_NO_MANAGE_PRIVILEGE(#{userId},#{modelType},#{nodeId})>0,1,0)
</select>

View File

@ -0,0 +1,36 @@
package io.dataease.base.mapper.ext;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface ExtSysMsgMapper {
@Update({
"<script>",
"update sys_msg set status = 1 where msg_id in ",
"<foreach collection='msgIds' item='msgId' open='(' separator=',' close=')' >",
" #{msgId}",
"</foreach>",
"</script>"
})
int batchStatus(@Param("msgIds") List<Long> msgIds);
@Delete({
"<script>",
"delete from sys_msg where msg_id in ",
"<foreach collection='msgIds' item='msgId' open='(' separator=',' close=')' >",
" #{msgId}",
"</foreach>",
"</script>"
})
int batchDelete(@Param("msgIds") List<Long> msgIds);
}

View File

@ -60,4 +60,9 @@ public class ChartViewController {
public String chartCopy(@PathVariable String id) {
return chartViewService.chartCopy(id);
}
@GetMapping("searchAdviceSceneId/{panelId}")
public String searchAdviceSceneId(@PathVariable String panelId){
return chartViewService.searchAdviceSceneId(panelId);
}
}

View File

@ -54,6 +54,11 @@ public class DataSetTableController {
return dataSetTableService.get(id);
}
@PostMapping("getWithPermission/{id}")
public DataSetTableDTO getWithPermission(@PathVariable String id) {
return dataSetTableService.getWithPermission(id);
}
@PostMapping("getFields")
public List<TableFiled> getFields(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getFields(dataSetTableRequest);

View File

@ -36,4 +36,15 @@ public class MsgController {
public void setReaded(@PathVariable Long msgId) {
sysMsgService.setReaded(msgId);
}
@PostMapping("/batchRead")
public void batchRead(@RequestBody List<Long> msgIds) {
sysMsgService.setBatchReaded(msgIds);
}
@PostMapping("/batchDelete")
public void batchDelete(@RequestBody List<Long> msgIds) {
sysMsgService.batchDelete(msgIds);
}
}

View File

@ -3,11 +3,16 @@ package io.dataease.controller.message.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class MsgRequest implements Serializable {
private static final long serialVersionUID = 1920091635946508658L;
private Integer type;
private Boolean status;
private List<String> orders;
}

View File

@ -1,6 +1,7 @@
package io.dataease.controller.panel.api;
import io.dataease.base.domain.PanelShare;
import io.dataease.controller.request.panel.PanelShareFineDto;
import io.dataease.controller.request.panel.PanelShareRequest;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.panel.PanelShareDto;
@ -31,5 +32,9 @@ public interface ShareApi {
@PostMapping("/queryWithResourceId")
List<PanelShare> queryWithResourceId(BaseGridRequest request);
@ApiOperation("优化创建分享")
@PostMapping("/fineSave")
void fineSave(PanelShareFineDto panelShareFineDto);
}

View File

@ -2,6 +2,7 @@ package io.dataease.controller.panel.server;
import io.dataease.base.domain.PanelShare;
import io.dataease.controller.panel.api.ShareApi;
import io.dataease.controller.request.panel.PanelShareFineDto;
import io.dataease.controller.request.panel.PanelShareRequest;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.panel.PanelShareDto;
@ -32,4 +33,11 @@ public class ShareServer implements ShareApi {
public List<PanelShare> queryWithResourceId(@RequestBody BaseGridRequest request) {
return shareService.queryWithResource(request);
}
@Override
public void fineSave(@RequestBody PanelShareFineDto panelShareFineDto) {
shareService.fineSave(panelShareFineDto);
}
}

View File

@ -0,0 +1,18 @@
package io.dataease.controller.request.panel;
import io.dataease.commons.model.AuthURD;
import lombok.Data;
import java.io.Serializable;
@Data
public class PanelShareFineDto implements Serializable {
private static final long serialVersionUID = -792964171742204428L;
private String resourceId;
private AuthURD authURD;
}

View File

@ -1,61 +0,0 @@
package io.dataease.controller.sys;
import io.dataease.base.domain.SysAuthDetail;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.BaseTreeRequest;
import io.dataease.controller.request.SysAuthRequest;
import io.dataease.dto.SysAuthDetailDTO;
import io.dataease.dto.VAuthModelDTO;
import io.dataease.service.sys.SysAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* Author: wangjiahao
* Date: 2021-05-11
* Description:
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "系统:权限管理")
@RequestMapping("/api/sys_auth")
public class SysAuthController {
@Resource
private SysAuthService sysAuthService;
@ApiOperation("查询视图")
@PostMapping("/authModels")
@I18n
public List<VAuthModelDTO> authModels(@RequestBody BaseTreeRequest request){
return sysAuthService.searchAuthModelTree(request);
}
@ApiOperation("查询授权")
@PostMapping("/authDetails")
public Map<String,List<SysAuthDetailDTO>> authDetails(@RequestBody SysAuthRequest request){
return sysAuthService.searchAuthDetails(request);
}
@ApiOperation("查询授权模板")
@GetMapping("/authDetailsModel/{authType}")
@I18n
public List<SysAuthDetail>authDetailsModel(@PathVariable String authType){
return sysAuthService.searchAuthDetailsModel(authType);
}
@ApiOperation("修改权限")
@PostMapping("/authChange")
public void authChange(@RequestBody SysAuthRequest request){
sysAuthService.authChange(request);
}
}

View File

@ -0,0 +1,21 @@
package io.dataease.dto.panel.po;
import io.dataease.base.domain.PanelView;
/**
* Author: wangjiahao
* Date: 2021-07-06
* Description:
*/
public class PanelViewInsertDTO extends PanelView {
public PanelViewInsertDTO() {
}
public PanelViewInsertDTO(String chartViewId,String panelGroupId) {
super();
super.setChartViewId(chartViewId);
super.setPanelId(panelGroupId);
}
}

View File

@ -193,11 +193,14 @@ public class DorisQueryProvider extends QueryProvider {
filter.append(" AND ").append(x.getDataeaseName());
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND ").append(x.getDataeaseName()).append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -229,11 +232,16 @@ public class DorisQueryProvider extends QueryProvider {
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName());
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null)");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
// filter.append(" AND _")
// .append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName())
// .append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -310,11 +318,16 @@ public class DorisQueryProvider extends QueryProvider {
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName());
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null)");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
// filter.append(" AND _")
// .append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName())
// .append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -349,7 +362,7 @@ public class DorisQueryProvider extends QueryProvider {
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields){
public String createRawQuerySQL(String table, List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
@ -393,7 +406,7 @@ public class DorisQueryProvider extends QueryProvider {
case "not like":
return " NOT LIKE ";
case "null":
return " IS NULL ";
return " IN ";
case "not_null":
return " IS NOT NULL ";
case "between":
@ -424,7 +437,10 @@ public class DorisQueryProvider extends QueryProvider {
filter.append(" ")
.append(transMysqlFilterTerm(request.getTerm()))
.append(" ");
if (StringUtils.containsIgnoreCase(request.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
filter.append(" AND ").append(field.getDataeaseName()).append(" <> ''");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {

View File

@ -198,11 +198,14 @@ public class MysqlQueryProvider extends QueryProvider {
filter.append(" AND `").append(x.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `").append(x.getOriginName()).append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -235,11 +238,16 @@ public class MysqlQueryProvider extends QueryProvider {
filter.append(" AND `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -316,11 +324,16 @@ public class MysqlQueryProvider extends QueryProvider {
filter.append(" AND `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -355,7 +368,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields){
public String createRawQuerySQL(String table, List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
@ -392,7 +405,7 @@ public class MysqlQueryProvider extends QueryProvider {
case "not like":
return " NOT LIKE ";
case "null":
return " IS NULL ";
return " IN ";
case "not_null":
return " IS NOT NULL ";
case "between":
@ -423,7 +436,10 @@ public class MysqlQueryProvider extends QueryProvider {
filter.append(" ")
.append(transMysqlFilterTerm(request.getTerm()))
.append(" ");
if (StringUtils.containsIgnoreCase(request.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
filter.append(" AND `").append(field.getOriginName()).append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {

View File

@ -1,12 +1,10 @@
package io.dataease.provider.oracle;
import com.google.gson.Gson;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.provider.QueryProvider;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -93,9 +91,9 @@ public class OracleQueryProvider extends QueryProvider {
// 如果原始类型为时间
if (f.getDeExtractType() == TIME) {
if (f.getDeType() == INT || f.getDeType() == FLOAT) { //日期转数值
if(f.getType().equalsIgnoreCase("DATE")){
if (f.getType().equalsIgnoreCase("DATE")) {
stringBuilder.append("TO_NUMBER( ").append(f.getOriginName()).append(" - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 * 1000 AS ").append(f.getDataeaseName());
}else {
} else {
stringBuilder.append("TO_NUMBER(to_date(to_char( ").append(f.getOriginName()).append(" ,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 * 1000 AS ").append(f.getDataeaseName());
}
} else {
@ -123,9 +121,9 @@ public class OracleQueryProvider extends QueryProvider {
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table);
}
private String sqlColumn(List<DatasetTableField> fields){
private String sqlColumn(List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
return f.getDataeaseName();
return f.getDataeaseName();
}).toArray(String[]::new);
return StringUtils.join(array, ",");
}
@ -184,17 +182,17 @@ public class OracleQueryProvider extends QueryProvider {
// 如果原始类型为时间
if (x.getDeExtractType() == TIME) {
if (x.getDeType() == INT || x.getDeType() == FLOAT) { //时间转数值
if(x.getType().equalsIgnoreCase("DATE")){
if (x.getType().equalsIgnoreCase("DATE")) {
stringBuilder.append("TO_NUMBER( ").append(x.getOriginName()).append(" - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 * 1000 AS \"_").append(x.getDataeaseName()).append("\" ");
}else {
} else {
stringBuilder.append("TO_NUMBER(to_date(to_char( ").append(x.getOriginName()).append(" ,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 * 1000 AS ")
.append(x.getDataeaseName()).append("\" ");
}
} else if (x.getDeType() == TIME) { //格式化显示时间
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if(x.getType().equalsIgnoreCase("DATE")){
if (x.getType().equalsIgnoreCase("DATE")) {
stringBuilder.append("to_char( ").append(x.getOriginName()).append(" ,'").append(format).append("') AS \"_").append(x.getOriginName()).append("\" ");
}else {
} else {
stringBuilder.append("to_char(to_date(to_char( ").append(x.getOriginName()).append(" ,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss'), '").append(format).append("') AS \"_").append(x.getOriginName()).append("\" ");
}
} else {
@ -206,7 +204,7 @@ public class OracleQueryProvider extends QueryProvider {
if (x.getDeExtractType() == STRING) { //字符串转时间
stringBuilder.append("to_char(to_date(").append(x.getOriginName()).append(" , 'yyyy-MM-dd hh24:mi:ss'), '").append(format).append("') AS \"_").append(x.getOriginName()).append("\" ");
} else { //数值转时间
stringBuilder.append("to_char(").append(x.getOriginName()) .append("/ (1000 * 60 * 60 * 24) + TO_DATE('1970-01-01 08:00:00', 'YYYY-MM-DD HH24:MI:SS'), '").append(format).append("') AS \"_").append(x.getOriginName()).append("\" ");
stringBuilder.append("to_char(").append(x.getOriginName()).append("/ (1000 * 60 * 60 * 24) + TO_DATE('1970-01-01 08:00:00', 'YYYY-MM-DD HH24:MI:SS'), '").append(format).append("') AS \"_").append(x.getOriginName()).append("\" ");
}
} else {
stringBuilder.append(" ").append(x.getOriginName()).append(" AS \"_").append(x.getOriginName()).append("\" ");
@ -234,11 +232,14 @@ public class OracleQueryProvider extends QueryProvider {
filter.append(" AND ").append(x.getOriginName()).append(" ");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND ").append(x.getOriginName()).append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -271,11 +272,16 @@ public class OracleQueryProvider extends QueryProvider {
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append(" ");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND _")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -352,11 +358,16 @@ public class OracleQueryProvider extends QueryProvider {
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append(" ");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND _")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append(" ")
.append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
filter.append("'%").append(f.getValue()).append("%'");
} else {
filter.append("'").append(f.getValue()).append("'");
}
@ -391,7 +402,7 @@ public class OracleQueryProvider extends QueryProvider {
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields){
public String createRawQuerySQL(String table, List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(" ").append(f.getOriginName()).append(" AS ").append(f.getDataeaseName());
@ -428,7 +439,7 @@ public class OracleQueryProvider extends QueryProvider {
case "not like":
return " NOT LIKE ";
case "null":
return " IS NULL ";
return " IN ";
case "not_null":
return " IS NOT NULL ";
case "between":
@ -459,7 +470,10 @@ public class OracleQueryProvider extends QueryProvider {
filter.append(" ")
.append(transMysqlFilterTerm(request.getTerm()))
.append(" ");
if (StringUtils.containsIgnoreCase(request.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
filter.append(" AND `").append(field.getOriginName()).append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {

View File

@ -6,31 +6,31 @@ import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.provider.QueryProvider;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @Author gin
* @Date 2021/5/17 2:43 下午
*/
@Service("sqlserverQuery")
@Service("sqlServerQuery")
public class SqlserverQueryProvider extends QueryProvider {
@Override
public Integer transFieldType(String field) {
switch (field.toUpperCase()) {
switch (field) {
case "CHAR":
case "VARCHAR":
case "TEXT":
case "TINYTEXT":
case "MEDIUMTEXT":
case "LONGTEXT":
case "NCHAR":
case "NVARCHAR":
case "NTEXT":
case "ENUM":
return 0;// 文本
case "DATE":
@ -59,7 +59,7 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override
public String createQueryCountSQL(String table) {
return MessageFormat.format("SELECT count(*) FROM {0}", table);
return MessageFormat.format("SELECT COUNT(*) FROM {0}", table);
}
@Override
@ -69,7 +69,7 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override
public String createSQLPreview(String sql, String orderBy) {
return "SELECT * FROM (" + sqlFix(sql) + ") AS tmp ORDER BY " + orderBy + " LIMIT 0,1000";
return "SELECT * FROM (" + sqlFix(sql) + ") AS tmp ORDER BY null " + " LIMIT 0,1000";
}
@Override
@ -79,21 +79,30 @@ public class SqlserverQueryProvider extends QueryProvider {
// 如果原始类型为时间
if (f.getDeExtractType() == 1) {
if (f.getDeType() == 2 || f.getDeType() == 3) {
stringBuilder.append("unix_timestamp(").append(f.getOriginName()).append(")*1000 as ").append(f.getOriginName());
stringBuilder.append("UNIX_TIMESTAMP(`").append(f.getOriginName()).append("`)*1000 AS ").append(f.getDataeaseName());
} else {
stringBuilder.append(f.getOriginName());
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
}
} else if (f.getDeExtractType() == 0) {
if (f.getDeType() == 2) {
stringBuilder.append("CAST(`").append(f.getOriginName()).append("` AS DECIMAL(20,0)) AS ").append(f.getDataeaseName());
} else if (f.getDeType() == 3) {
stringBuilder.append("CAST(`").append(f.getOriginName()).append("` AS DECIMAL(20,2)) AS ").append(f.getDataeaseName());
} else if (f.getDeType() == 1) {
stringBuilder.append("DATE_FORMAT(`").append(f.getOriginName()).append("`,'%Y-%m-%d %H:%i:%S') AS _").append(f.getDataeaseName());
} else {
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
}
} else {
if (f.getDeType() == 1) {
stringBuilder.append("FROM_UNIXTIME(cast(").append(f.getOriginName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(f.getOriginName());
stringBuilder.append("FROM_UNIXTIME(CAST(`").append(f.getOriginName()).append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') AS ").append(f.getDataeaseName());
} else {
stringBuilder.append(f.getOriginName());
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
}
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY " + (fields.size() > 0 ? fields.get(0).getOriginName() : "null"), StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY null", StringUtils.join(array, ","), table);
}
@Override
@ -103,7 +112,7 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
return createQuerySQL(table, fields) + " offset " + (page - 1) * pageSize + " rows fetch next " + realSize + " rows only";
return createQuerySQL(table, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
}
@Override
@ -132,15 +141,15 @@ public class SqlserverQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
f.append("CAST(")
.append(y.getSummary()).append("(")
.append("CAST(").append(y.getOriginName()).append(" AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append("CAST(`").append(y.getOriginName()).append("` AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append(") AS DECIMAL(20,2)").append(")");
} else {
f.append(y.getSummary()).append("(")
.append("CAST(").append(y.getOriginName()).append(" AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append("CAST(`").append(y.getOriginName()).append("` AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append(")");
}
}
f.append(" AS _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName());
f.append(" AS `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
return f.toString();
}).toArray(String[]::new);
String[] groupField = xAxis.stream().map(x -> {
@ -148,24 +157,32 @@ public class SqlserverQueryProvider extends QueryProvider {
// 如果原始类型为时间
if (x.getDeExtractType() == 1) {
if (x.getDeType() == 2 || x.getDeType() == 3) {
stringBuilder.append("unix_timestamp(").append(x.getOriginName()).append(")*1000 as ").append(x.getOriginName());
stringBuilder.append("UNIX_TIMESTAMP(`").append(x.getOriginName()).append("`)*1000 AS `_").append(x.getOriginName()).append("`");
} else if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
stringBuilder.append("DATE_FORMAT(`").append(x.getOriginName()).append("`,'").append(format).append("') AS `_").append(x.getOriginName()).append("`");
} else {
stringBuilder.append(x.getOriginName());
stringBuilder.append("`").append(x.getOriginName()).append("` AS `_").append(x.getOriginName()).append("`");
}
} else {
if (x.getDeType() == 1) {
stringBuilder.append("FROM_UNIXTIME(cast(").append(x.getOriginName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(x.getOriginName());
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == 0) {
stringBuilder.append("DATE_FORMAT(`").append(x.getOriginName()).append("`,'").append(format).append("') AS `_").append(x.getOriginName()).append("`");
} else {
stringBuilder.append("DATE_FORMAT(").append("FROM_UNIXTIME(CAST(`").append(x.getOriginName()).append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S')").append(",'").append(format).append("') AS `_").append(x.getOriginName()).append("`");
}
} else {
stringBuilder.append(x.getOriginName());
stringBuilder.append("`").append(x.getOriginName()).append("` AS `_").append(x.getOriginName()).append("`");
}
}
return stringBuilder.toString();
}).toArray(String[]::new);
String[] group = xAxis.stream().map(ChartViewFieldDTO::getOriginName).toArray(String[]::new);
String[] group = xAxis.stream().map(x -> "`_" + x.getOriginName() + "`").toArray(String[]::new);
String[] xOrder = xAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
.map(f -> f.getOriginName() + " " + f.getSort()).toArray(String[]::new);
.map(f -> "`_" + f.getOriginName() + "` " + f.getSort()).toArray(String[]::new);
String[] yOrder = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
.map(f -> "_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getOriginName(), "*") ? "" : f.getOriginName()) + " " + f.getSort()).toArray(String[]::new);
.map(f -> "`_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getOriginName(), "*") ? "" : f.getOriginName()) + "` " + f.getSort()).toArray(String[]::new);
String[] order = Arrays.copyOf(xOrder, xOrder.length + yOrder.length);
System.arraycopy(yOrder, 0, order, xOrder.length, yOrder.length);
@ -174,14 +191,17 @@ public class SqlserverQueryProvider extends QueryProvider {
String[] s = x.getFilter().stream().map(f -> {
StringBuilder filter = new StringBuilder();
if (x.getDeType() == 1 && x.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(cast(")
filter.append(" AND FROM_UNIXTIME(cast(`")
.append(x.getOriginName())
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
.append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND ").append(x.getOriginName());
filter.append(" AND `").append(x.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `").append(x.getOriginName()).append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
@ -211,14 +231,19 @@ public class SqlserverQueryProvider extends QueryProvider {
StringBuilder filter = new StringBuilder();
// 原始类型不是时间在de中被转成时间的字段做处理
if (y.getDeType() == 1 && y.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(cast(_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
filter.append(" AND FROM_UNIXTIME(CAST(`_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`")
.append(" AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName());
filter.append(" AND `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
@ -233,9 +258,10 @@ public class SqlserverQueryProvider extends QueryProvider {
if (resultFilter.length == 0) {
return sql;
} else {
String filterSql = MessageFormat.format("SELECT * FROM {0} WHERE 1=1 {1}",
String filterSql = MessageFormat.format("SELECT * FROM {0} WHERE 1=1 {1} ORDER BY {2}",
"(" + sql + ") AS tmp",
StringUtils.join(resultFilter, " "));
StringUtils.join(resultFilter, " "),
ObjectUtils.isNotEmpty(yOrder) ? StringUtils.join(yOrder, ",") : "null");
return filterSql;
}
}
@ -252,12 +278,83 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override
public String getSQLSummary(String table, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
return null;
// 字段汇总 排序等
String[] field = yAxis.stream().map(y -> {
StringBuilder f = new StringBuilder();
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
f.append(y.getSummary()).append("(").append(y.getOriginName()).append(")");
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
f.append("CAST(")
.append(y.getSummary()).append("(")
.append("CAST(`").append(y.getOriginName()).append("` AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append(") AS DECIMAL(20,2)").append(")");
} else {
f.append(y.getSummary()).append("(")
.append("CAST(`").append(y.getOriginName()).append("` AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append(")");
}
}
f.append(" AS `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
return f.toString();
}).toArray(String[]::new);
String[] order = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
.map(f -> "`_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getOriginName(), "*") ? "" : f.getOriginName()) + "` " + f.getSort()).toArray(String[]::new);
String sql = MessageFormat.format("SELECT {0} FROM {1} WHERE 1=1 {2} ORDER BY null,{3}",
StringUtils.join(field, ","),
table,
transCustomFilter(customFilter) + transExtFilter(extFilterRequestList),// origin field filter and panel field filter
StringUtils.join(order, ","));
if (sql.endsWith(",")) {
sql = sql.substring(0, sql.length() - 1);
}
// 如果是对结果字段过滤则再包裹一层sql
String[] resultFilter = yAxis.stream().filter(y -> CollectionUtils.isNotEmpty(y.getFilter()) && y.getFilter().size() > 0)
.map(y -> {
String[] s = y.getFilter().stream().map(f -> {
StringBuilder filter = new StringBuilder();
// 原始类型不是时间在de中被转成时间的字段做处理
if (y.getDeType() == 1 && y.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(CAST(`_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`")
.append(" AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
filter.append("%").append(f.getValue()).append("%");
} else {
filter.append("'").append(f.getValue()).append("'");
}
return filter.toString();
}).toArray(String[]::new);
return StringUtils.join(s, " ");
}).toArray(String[]::new);
if (resultFilter.length == 0) {
return sql;
} else {
String filterSql = MessageFormat.format("SELECT * FROM {0} WHERE 1=1 {1} ORDER BY {2}",
"(" + sql + ") AS tmp",
StringUtils.join(resultFilter, " "),
ObjectUtils.isNotEmpty(order) ? StringUtils.join(order, ",") : "null");
return filterSql;
}
}
@Override
public String getSQLSummaryAsTmp(String table, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
return null;
public String getSQLSummaryAsTmp(String sql, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
return getSQLSummary(" (" + sqlFix(sql) + ") AS tmp ", yAxis, customFilter, extFilterRequestList);
}
@Override
@ -271,7 +368,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields){
public String createRawQuerySQL(String table, List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
@ -308,9 +405,11 @@ public class SqlserverQueryProvider extends QueryProvider {
case "not like":
return " NOT LIKE ";
case "null":
return " IS NULL ";
return " IN ";
case "not_null":
return " IS NOT NULL ";
case "between":
return " BETWEEN ";
default:
return "";
}
@ -324,17 +423,24 @@ public class SqlserverQueryProvider extends QueryProvider {
for (ChartCustomFilterDTO request : requestList) {
String value = request.getValue();
DatasetTableField field = request.getField();
if (ObjectUtils.isEmpty(field)) {
continue;
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(cast(")
filter.append(" AND FROM_UNIXTIME(CAST(`")
.append(field.getOriginName())
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
.append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND ").append(field.getOriginName());
filter.append(" AND `").append(field.getOriginName()).append("`");
}
filter.append(" ")
.append(transMysqlFilterTerm(request.getTerm()))
.append(" ");
if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
filter.append(" AND `").append(field.getOriginName()).append("`").append(" <> ''");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {
filter.append("'%").append(value).append("%'");
@ -357,11 +463,11 @@ public class SqlserverQueryProvider extends QueryProvider {
}
DatasetTableField field = request.getDatasetTableField();
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(cast(")
filter.append(" AND FROM_UNIXTIME(CAST(`")
.append(field.getOriginName())
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
.append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND ").append(field.getOriginName());
filter.append(" AND `").append(field.getOriginName()).append("`");
}
filter.append(" ")
.append(transMysqlFilterTerm(request.getOperator()))
@ -370,6 +476,11 @@ public class SqlserverQueryProvider extends QueryProvider {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
filter.append("'%").append(value.get(0)).append("%'");
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
filter.append("'").append(startTime).append("' AND '").append(endTime).append("'");
} else {
filter.append("'").append(value.get(0)).append("'");
}
@ -383,4 +494,30 @@ public class SqlserverQueryProvider extends QueryProvider {
}
return sql;
}
private String transDateFormat(String dateStyle, String datePattern) {
String split = "-";
if (StringUtils.equalsIgnoreCase(datePattern, "date_sub")) {
split = "-";
} else if (StringUtils.equalsIgnoreCase(datePattern, "date_split")) {
split = "/";
}
switch (dateStyle) {
case "y":
return "%Y";
case "y_M":
return "%Y" + split + "%m";
case "y_M_d":
return "%Y" + split + "%m" + split + "%d";
case "H_m_s":
return "%H:%i:%S";
case "y_M_d_H_m":
return "%Y" + split + "%m" + split + "%d" + " %H:%i";
case "y_M_d_H_m_s":
return "%Y" + split + "%m" + split + "%d" + " %H:%i:%S";
default:
return "%Y-%m-%d %H:%i:%S";
}
}
}

View File

@ -10,6 +10,7 @@ import io.dataease.commons.constants.JdbcConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.LogUtil;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartGroupRequest;
@ -239,7 +240,23 @@ public class ChartViewService {
else {
data = (List<String[]>) cache;
}*/
data = cacheViewData(datasourceProvider, datasourceRequest, id);
// 仪表板有参数不实用缓存
if (CollectionUtils.isNotEmpty(requestList.getFilter())) {
data = datasourceProvider.getData(datasourceRequest);
}else {
try{
data = cacheViewData(datasourceProvider, datasourceRequest, id);
}catch (Exception e) {
LogUtil.error(e);
}finally {
// 如果当前对象被锁 当前线程冲入次数 > 0 则释放锁
if (lock.isLocked() && lock.getHoldCount() > 0) {
lock.unlock();
}
}
}
}
if (StringUtils.containsIgnoreCase(view.getType(), "pie") && data.size() > 1000) {
data = data.subList(0, 1000);
@ -320,11 +337,17 @@ public class ChartViewService {
Object cache = CacheUtils.get(JdbcConstants.VIEW_CACHE_KEY, viewId);
if (cache == null) {
if (lock.tryLock()) {// 获取锁成功
result = datasourceProvider.getData(datasourceRequest);
if (result != null) {
CacheUtils.put(JdbcConstants.VIEW_CACHE_KEY, viewId, result, null, null);
try{
result = datasourceProvider.getData(datasourceRequest);
if (result != null) {
CacheUtils.put(JdbcConstants.VIEW_CACHE_KEY, viewId, result, null, null);
}
}catch (Exception e) {
LogUtil.error(e);
throw e;
}finally {
lock.unlock();
}
lock.unlock();
}else {//获取锁失败
Thread.sleep(100);//避免CAS自旋频率过大 占用cpu资源过高
result = cacheViewData(datasourceProvider, datasourceRequest, viewId);
@ -382,4 +405,8 @@ public class ChartViewService {
extChartViewMapper.chartCopy(newChartId,id);
return newChartId;
}
public String searchAdviceSceneId(String panelId){
return extChartViewMapper.searchAdviceSceneId(AuthUtils.getUser().getUserId().toString(),panelId);
}
}

View File

@ -215,6 +215,14 @@ public class DataSetTableService {
return datasetTableMapper.selectByPrimaryKey(id);
}
public DataSetTableDTO getWithPermission(String id) {
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
dataSetTableRequest.setId(id);
dataSetTableRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
dataSetTableRequest.setTypeFilter(dataSetTableRequest.getTypeFilter());
return extDataSetTableMapper.searchOne(dataSetTableRequest);
}
public List<TableFiled> getFields(DataSetTableRequest dataSetTableRequest) throws Exception {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
@ -282,52 +290,101 @@ public class DataSetTableService {
realSize = Integer.parseInt(dataSetTableRequest.getRow()) % pageSize;
}
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "db")) {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ObjectUtils.isEmpty(ds)) {
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
if (datasetTable.getMode() == 0) {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ObjectUtils.isEmpty(ds)) {
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
}
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
String table = dataTableInfoDTO.getTable();
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
try {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
}
} else {
// check doris table
if (!checkDorisTableIsExists(dataSetTableRequest.getId())) {
throw new RuntimeException(Translator.get("i18n_data_not_sync"));
}
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
try {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
}
}
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
String table = dataTableInfoDTO.getTable();
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
try {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ObjectUtils.isEmpty(ds)) {
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
}
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
if (datasetTable.getMode() == 0) {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ObjectUtils.isEmpty(ds)) {
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
}
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
String sql = dataTableInfoDTO.getSql();
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
System.out.println(datasourceRequest.getQuery());
try {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow())));
String sql = dataTableInfoDTO.getSql();
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
System.out.println(datasourceRequest.getQuery());
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
try {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
}
} else {
// check doris table
if (!checkDorisTableIsExists(dataSetTableRequest.getId())) {
throw new RuntimeException(Translator.get("i18n_data_not_sync"));
}
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
try {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
}
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
if (StringUtils.isEmpty(datasetTable.getSyncStatus()) || datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
@ -357,13 +414,12 @@ public class DataSetTableService {
e.printStackTrace();
}
try {
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
} catch (Exception e) {
e.printStackTrace();
}
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
@ -379,7 +435,7 @@ public class DataSetTableService {
}
try {
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
} catch (Exception e) {
e.printStackTrace();

View File

@ -4,7 +4,9 @@ package io.dataease.service.message;
import io.dataease.base.domain.SysMsg;
import io.dataease.base.domain.SysMsgExample;
import io.dataease.base.mapper.SysMsgMapper;
import io.dataease.base.mapper.ext.ExtSysMsgMapper;
import io.dataease.controller.message.dto.MsgRequest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -16,12 +18,20 @@ public class SysMsgService {
@Resource
private SysMsgMapper sysMsgMapper;
@Resource
private ExtSysMsgMapper extSysMsgMapper;
public List<SysMsg> query(Long userId, MsgRequest msgRequest) {
String orderClause = "";
String orderClause = " create_time desc";
SysMsgExample example = new SysMsgExample();
SysMsgExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
List<String> orders = msgRequest.getOrders();
if (CollectionUtils.isNotEmpty(orders)) {
orderClause = String.join(", ", orders);
}
if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
criteria.andTypeEqualTo(msgRequest.getType());
@ -29,11 +39,8 @@ public class SysMsgService {
if (ObjectUtils.isNotEmpty(msgRequest.getStatus())) {
criteria.andStatusEqualTo(msgRequest.getStatus());
}else {
orderClause += " status asc ,";
}
orderClause += " create_time desc";
example.setOrderByClause(orderClause);
List<SysMsg> sysMsgs = sysMsgMapper.selectByExample(example);
return sysMsgs;
@ -43,18 +50,20 @@ public class SysMsgService {
SysMsg sysMsg = new SysMsg();
sysMsg.setMsgId(msgId);
sysMsg.setStatus(true);
sysMsg.setReadTime(System.currentTimeMillis());
sysMsgMapper.updateByPrimaryKeySelective(sysMsg);
}
public void save(SysMsg sysMsg) {
// sysMsg.setStatus(false);
// sysMsg.setCreateTime(System.currentTimeMillis());
sysMsgMapper.insert(sysMsg);
public void setBatchReaded(List<Long> msgIds) {
extSysMsgMapper.batchStatus(msgIds);
}
public void update(SysMsg sysMsg) {
public void batchDelete(List<Long> msgIds) {
extSysMsgMapper.batchDelete(msgIds);
}
sysMsgMapper.updateByPrimaryKey(sysMsg);
public void save(SysMsg sysMsg) {
sysMsgMapper.insert(sysMsg);
}

View File

@ -53,6 +53,8 @@ public class PanelGroupService {
private PanelLinkService panelLinkService;
@Resource
private SysAuthService sysAuthService;
@Resource
private PanelViewService panelViewService;
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
@ -72,6 +74,12 @@ public class PanelGroupService {
@Transactional
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
try{
panelViewService.syncPanelViews(request);
}catch (Exception e){
e.printStackTrace();
LOGGER.error("更新panelView出错panelId{}" ,request.getId());
}
String panelId = request.getId();
if (StringUtils.isEmpty(panelId)) {
// 新建
@ -163,4 +171,5 @@ public class PanelGroupService {
});
return chartViewDTOList;
}
}

View File

@ -1,15 +1,27 @@
package io.dataease.service.panel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.dataease.base.domain.PanelGroup;
import io.dataease.base.domain.PanelGroupWithBLOBs;
import io.dataease.base.mapper.PanelViewMapper;
import io.dataease.base.mapper.ext.ExtPanelViewMapper;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.dto.panel.PanelViewDto;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
import io.dataease.dto.panel.po.PanelViewPo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -22,6 +34,7 @@ public class PanelViewService {
@Autowired(required = false)
private ExtPanelViewMapper extPanelViewMapper;
private final static String SCENE_TYPE = "scene";
public List<PanelViewDto> groups(){
@ -63,4 +76,25 @@ public class PanelViewService {
// 最后 没有孩子的老东西淘汰
return roots.stream().filter(item -> CollectionUtils.isNotEmpty(item.getChildren())).collect(Collectors.toList());
}
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void syncPanelViews(PanelGroupWithBLOBs panelGroup){
String panelId = panelGroup.getId();
Assert.notNull(panelId, "panelId cannot be null");
String panelData = panelGroup.getPanelData();
if(StringUtils.isNotEmpty(panelData)){
JSONArray dataArray = JSON.parseArray(panelData);
List<PanelViewInsertDTO> panelViewInsertDTOList = new ArrayList<>();
for(int i=0;i<dataArray.size();i++){
JSONObject jsonObject = dataArray.getJSONObject(i);
if("view".equals(jsonObject.getString("type"))){
panelViewInsertDTOList.add(new PanelViewInsertDTO(jsonObject.getJSONObject("propValue").getString("viewId"),panelId));
}
}
extPanelViewMapper.deleteWithPanelId(panelId);
if(CollectionUtils.isNotEmpty(panelViewInsertDTOList)){
extPanelViewMapper.savePanelView(panelViewInsertDTOList);
}
}
}
}

View File

@ -14,11 +14,13 @@ import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.controller.request.panel.PanelShareFineDto;
import io.dataease.controller.request.panel.PanelShareRequest;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.panel.PanelShareDto;
import io.dataease.dto.panel.PanelSharePo;
import io.dataease.service.message.DeMsgutil;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,6 +43,176 @@ public class ShareService {
@Resource
private ExtPanelShareMapper extPanelShareMapper;
/**
* 1.查询当前节点已经分享给了哪些目标
* 2.过滤出新增的目标
* 3.过滤出减少的目标
* 4.批量删除
* 5.批量新增
* 6.发送取消分享消息
* 7.发送新增分享消息
* @param panelShareFineDto
*/
@Transactional
public void fineSave(PanelShareFineDto panelShareFineDto) {
List<PanelShare> addShares = new ArrayList<>();//新增的分享
List<Long> redShareIdLists = new ArrayList<>();//取消的分享
String panelGroupId = panelShareFineDto.getResourceId();
AuthURD authURD = panelShareFineDto.getAuthURD();
AuthURD sharedAuthURD = new AuthURD();
AuthURD addAuthURD = new AuthURD();
Map<Integer, List<Long>> authURDMap = new HashMap<>();
authURDMap.put(0, authURD.getUserIds());
authURDMap.put(1, authURD.getRoleIds());
authURDMap.put(2, authURD.getDeptIds());
PanelShareExample example = new PanelShareExample();
example.createCriteria().andPanelGroupIdEqualTo(panelGroupId);
List<PanelShare> panelShares = mapper.selectByExample(example);
/*if (CollectionUtils.isEmpty(panelShares)) {
return;
}*/
Map<Integer, List<TempShareNode>> typeSharedMap = panelShares.stream().map(this::convertNode).collect(Collectors.groupingBy(TempShareNode::getType));
for (Map.Entry<Integer, List<Long>> entry : authURDMap.entrySet()) {
Integer key = entry.getKey();
List<TempShareNode> shareNodes = null;
if (null == typeSharedMap || null == typeSharedMap.get(key)) {
shareNodes = new ArrayList<>();
}else{
shareNodes = typeSharedMap.get(key);
}
if (null != authURDMap.get(key)) {
Map<String, Object> dataMap = filterData(authURDMap.get(key), shareNodes);
List<Long> newIds = (List<Long>)dataMap.get("add");
for (int i = 0; i < newIds.size(); i++) {
Long id = newIds.get(i);
PanelShare share = new PanelShare();
share.setCreateTime(System.currentTimeMillis());
share.setPanelGroupId(panelGroupId);
share.setTargetId(id);
share.setType(key);
addShares.add(share);
}
List<TempShareNode> redNodes = (List<TempShareNode>)dataMap.get("red");
List<Long> redIds = redNodes.stream().map(TempShareNode::getShareId).distinct().collect(Collectors.toList());
redShareIdLists.addAll(redIds);
buildRedAuthURD(key, redNodes.stream().map(TempShareNode::getTargetId).distinct().collect(Collectors.toList()) , sharedAuthURD);
buildRedAuthURD(key, newIds, addAuthURD);
}
}
if (CollectionUtils.isNotEmpty(redShareIdLists)){
extPanelShareMapper.batchDelete(redShareIdLists);
}
if (CollectionUtils.isNotEmpty(addShares)){
extPanelShareMapper.batchInsert(addShares);
}
// 以上是业务代码
// 下面是消息发送
Set<Long> addUserIdSet = AuthUtils.userIdsByURD(addAuthURD);
Set<Long> redUserIdSet = AuthUtils.userIdsByURD(sharedAuthURD);
PanelGroup panelGroup = panelGroupMapper.selectByPrimaryKey(panelGroupId);;
CurrentUserDto user = AuthUtils.getUser();
Gson gson = new Gson();
String msg = panelGroup.getName();
List<String> msgParam = new ArrayList<String>();
msgParam.add(panelGroupId);
addUserIdSet.forEach(userId -> {
if (!redUserIdSet.contains(userId)){
DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
}
});
redUserIdSet.forEach(userId -> {
if (!addUserIdSet.contains(userId)){
DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 取消分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
}
});
}
private void buildRedAuthURD(Integer type, List<Long> redIds , AuthURD authURD) {
if (type == 0) {
authURD.setUserIds(redIds);
}
if (type == 1) {
authURD.setRoleIds(redIds);
}
if (type == 2) {
authURD.setDeptIds(redIds);
}
}
/**
*
* @param newTargets 新的分享目标
* @param shareNodes 已景分享目标
* @return
*/
private Map<String, Object> filterData(List<Long> newTargets, List<TempShareNode> shareNodes) {
Map<String, Object> result = new HashMap<>();
/*if (null == newTargets) {
result.put("add", new ArrayList<>());
result.put("red", new ArrayList<>());
return result;
}*/
List<Long> newUserIds = new ArrayList<>();
for (int i = 0; i < newTargets.size(); i++) {
Long newTargetId = newTargets.get(i);
Boolean isNew = true;
for (int j = 0; j < shareNodes.size(); j++) {
TempShareNode shareNode = shareNodes.get(j);
Long sharedId = shareNode.getTargetId();
if (newTargetId == sharedId) {
shareNode.setMatched(true); // 已分享 重新命中
isNew = false;
}
}
if (isNew) {
// 获取新增的
newUserIds.add(newTargetId);
}
}
//获取需要取消分享的
List<TempShareNode> missNodes = shareNodes.stream().filter(item -> !item.getMatched()).collect(Collectors.toList());
result.put("add", newUserIds);
result.put("red", missNodes);
return result;
}
@Data
private class TempShareNode {
private Long shareId;
private Integer type;
private Long targetId;
private Boolean matched = false;
public boolean targetMatch(Long tid) {
return targetId == tid;
}
}
private TempShareNode convertNode(PanelShare panelShare) {
return BeanUtils.copyBean(new TempShareNode(), panelShare);
}
@Transactional
public void save(PanelShareRequest request){
List<PanelGroup> panelGroups = queryGroup(request.getPanelIds());

View File

@ -1,144 +1,19 @@
package io.dataease.service.sys;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.base.domain.SysAuth;
import io.dataease.base.domain.SysAuthDetail;
import io.dataease.base.mapper.SysAuthMapper;
import io.dataease.base.mapper.ext.ExtSysAuthDetailMapper;
import io.dataease.base.mapper.ext.ExtSysAuthMapper;
import io.dataease.base.mapper.ext.ExtVAuthModelMapper;
import io.dataease.commons.constants.SystemConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.request.BaseTreeRequest;
import io.dataease.controller.request.SysAuthRequest;
import io.dataease.dto.SysAuthDetailDTO;
import io.dataease.dto.VAuthModelDTO;
import io.dataease.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
@Service
public class SysAuthService {
@Resource
private ExtSysAuthMapper extSysAuthMapper;
@Resource
private SysAuthMapper sysAuthMapper;
@Resource
private ExtSysAuthDetailMapper extSysAuthDetailMapper;
@Resource
private ExtVAuthModelMapper extVAuthModelMapper;
private static List<String> PRI_MODEL_TYPE = Arrays.asList("link", "dataset", "chart", "panel", "menu");
/**
* @Description: 查询可见授权数据的数据如果是管理员IsAdmin = true且modelType 为link dataset chart panel menu可以查询到所有的数据
* 如果是普通用户只能查询到自己的数据但是 node_type 为spine 节点也会返回
**/
public List<VAuthModelDTO> searchAuthModelTree(BaseTreeRequest request) {
CurrentUserDto currentUserDto = AuthUtils.getUser();
request.setCreateBy(String.valueOf(currentUserDto.getUserId()));
if (PRI_MODEL_TYPE.contains(request.getModelType()) && (currentUserDto.getIsAdmin() == null || !currentUserDto.getIsAdmin())) {
request.setWithAuth("1");
} else {
request.setWithAuth("0");
}
return extVAuthModelMapper.searchTree(request);
}
/**
* @Description: 查询授权明细map
**/
public Map<String, List<SysAuthDetailDTO>> searchAuthDetails(SysAuthRequest request) {
List<SysAuthDetailDTO> authDetailDTOList = extSysAuthMapper.searchAuth(request);
return Optional.ofNullable(authDetailDTOList).orElse(new ArrayList<>()).stream()
.collect(groupingBy(SysAuthDetailDTO::getAuthSource));
}
/**
* @Description: 每个类型的授权都会在表中预制各个授权项的模板 存在auth_id
**/
public List<SysAuthDetail> searchAuthDetailsModel(String authType) {
return extSysAuthDetailMapper.searchAuthTypeModel(authType);
}
public void authChange(SysAuthRequest request) {
SysAuthDetail sysAuthDetail = request.getAuthDetail();
//TODO 获取需要授权的资源id(当前节点和所有权限的下级节点)
List<String> authSources = getAuthModels(request.getAuthSource(), request.getAuthSourceType());
if (CollectionUtils.isEmpty(authSources)) {
throw new RuntimeException(Translator.get("i18n_auth_source_be_canceled"));
}
//TODO 获取需要被授权的目标id(部门当前节点和所有权限的下级节点)
List<String> authTargets = getAuthModels(request.getAuthTarget(), request.getAuthTargetType());
if (CollectionUtils.isNotEmpty(authSources) && CollectionUtils.isNotEmpty(authTargets)) {
List<String> authIdChange = new ArrayList<>();
authTargets.stream().forEach(authTarget -> {
authSources.forEach(authSource -> {
String authId = checkAuth(authSource, request.getAuthSourceType(), authTarget, request.getAuthTargetType());
authIdChange.add(authId);
});
});
// 授权修改
if (sysAuthDetail.getPrivilegeValue() == SystemConstants.PRIVILEGE_VALUE.ON) {
//当前为开启1 >>> 关闭0 需要将权限级别PrivilegeType大于当前级别的全新都修改为关闭 0
extSysAuthDetailMapper.authDetailsChange(SystemConstants.PRIVILEGE_VALUE.OFF, sysAuthDetail.getPrivilegeType(), authIdChange);
} else {
//当前为关闭0 >>> 开启1 需要将权限级别PrivilegeType小于当前级别的全新都修改为开启 1
extSysAuthDetailMapper.authDetailsChange(SystemConstants.PRIVILEGE_VALUE.ON, sysAuthDetail.getPrivilegeType(), authIdChange);
}
}
}
private List<String> getAuthModels(String id, String type) {
List<VAuthModelDTO> vAuthModelDTOS = searchAuthModelTree(new BaseTreeRequest(id, type, SystemConstants.WITH_EXTEND.CHILDREN));
List<String> authSources = Optional.ofNullable(vAuthModelDTOS).orElse(new ArrayList<>()).stream().map(VAuthModelDTO::getId)
.collect(Collectors.toList());
return authSources;
}
/**
* @Description: 查询当前target 是否有存在授权 不存在 增加权限 并复制权限模板
**/
private String checkAuth(String authSource, String authSourceType, String authTarget, String authTargetType) {
String authId = extSysAuthMapper.findAuthId(authSource, authSourceType, authTarget, authTargetType);
if (StringUtils.isEmpty(authId)) {
authId = UUID.randomUUID().toString();
//TODO 插入权限
SysAuth sysAuthRecord = new SysAuth();
sysAuthRecord.setId(authId);
sysAuthRecord.setAuthSource(authSource);
sysAuthRecord.setAuthSourceType(authSourceType);
sysAuthRecord.setAuthTarget(authTarget);
sysAuthRecord.setAuthTargetType(authTargetType);
sysAuthRecord.setAuthTime(System.currentTimeMillis());
sysAuthRecord.setAuthUser(AuthUtils.getUser().getUsername());
sysAuthMapper.insertSelective(sysAuthRecord);
//TODO 复制权限模板
extSysAuthDetailMapper.copyAuthModel(authSourceType, authId, AuthUtils.getUser().getUsername());
}
return authId;
}
public void checkTreeNoManageCount(String modelType,String nodeId){
if(extSysAuthMapper.checkTreeNoManageCount(AuthUtils.getUser().getUserId(),modelType,nodeId)){
throw new RuntimeException(Translator.get("i18n_no_all_delete_privilege_folder"));

View File

@ -16,4 +16,16 @@ CREATE TABLE `sys_msg` (
KEY `inx_msg_userid` (`user_id`) USING BTREE,
KEY `inx_msg_type` (`type`) USING BTREE,
KEY `inx_msg_status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='消息通知表';
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='消息通知表';
BEGIN;
INSERT INTO `sys_menu` VALUES (53, 1, 3, 1, '站内消息', 'sys-msg-web', 'msg/index', 1000, 'all-msg', 'system-msg-web', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (54, 53, 0, 1, '所有消息', 'sys-msg-web-all', 'msg/all', 1, 'web-msg', 'all', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (55, 53, 0, 1, '未读消息', 'sys-msg-web-unread', 'msg/unread', 2, 'unread-msg', 'unread', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (56, 53, 0, 1, '已读消息', 'sys-msg-web-readed', 'msg/readed', 3, 'readed-msg', 'readed', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
COMMIT;
BEGIN;
UPDATE `sys_menu` SET permission = null WHERE menu_id = 1;
COMMIT;

View File

@ -0,0 +1,12 @@
DROP TABLE IF EXISTS `panel_view`;
CREATE TABLE `panel_view` (
`id` varchar(50) NOT NULL,
`panel_id` varchar(50) DEFAULT NULL COMMENT 'panel_id',
`chart_view_id` varchar(50) DEFAULT NULL COMMENT 'chart_view_id',
`content` blob COMMENT '内容',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`create_time` bigint(13) DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(255) DEFAULT NULL COMMENT '更新人',
`update_time` bigint(13) DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -261,4 +261,9 @@ i18n_sql_delete_not_matching=The data column of incremental delete SQL does not
i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display
i18n_no_all_delete_privilege_folder=This folder have sources which have no manage or view privilege,Can Not Be Deleted.
i18n_excel_field_repeat=Excel exists repeat fieldplease fix and upload again.
i18n_schema_is_empty=Database schema is empty
i18n_schema_is_empty=Database schema is empty
站内消息=Internal Messages
所有消息=All Messages
未读消息=Unread Messages
已读消息=Read Messages
i18n_data_not_sync=Please sync data first

View File

@ -261,3 +261,8 @@ i18n_cst_ds_tb_or_field_deleted=自定义数据集所关联数据被删除或字
i18n_no_all_delete_privilege_folder=该目录下存在没有管理权限或查看权限的资源,无法删除
i18n_excel_field_repeat=Excel存在重复字段请修改后重新上传
i18n_schema_is_empty=数据库 Schema 为空
站内消息=站内消息
所有消息=所有消息
未读消息=未读消息
已读消息=已读消息
i18n_data_not_sync=请先完成数据同步

View File

@ -263,4 +263,9 @@ i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配,
i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示
i18n_no_all_delete_privilege_folder=該目錄下存在沒有管理權限或查看權限的資源,無法刪除
i18n_excel_field_repeat=Excel存在重復字段請修改後重新上傳
i18n_schema_is_empty=數據庫 Schema 為空
i18n_schema_is_empty=數據庫 Schema 為空
站内消息=站內消息
所有消息=所有消息
未读消息=未讀消息
已读消息=已讀消息
i18n_data_not_sync=請先完成數據同步

View File

@ -35,3 +35,19 @@ export function chartCopy(id) {
loading: true
})
}
export function chartGroupTree(data) {
return request({
url: '/chart/group/tree',
method: 'post',
loading: true,
data
})
}
export function searchAdviceSceneId(panelId) {
return request({
url: '/chart/view/searchAdviceSceneId/' + panelId,
method: 'get',
loading: true
})
}

View File

@ -27,3 +27,12 @@ export function loadTree(data) {
})
}
export function fineSave(data) {
return request({
url: '/api/share/fineSave',
method: 'post',
loading: true,
data
})
}

View File

@ -4,7 +4,7 @@ export function query(pageIndex, pageSize, data) {
return request({
url: '/api/sys_msg/list/' + pageIndex + '/' + pageSize,
method: 'post',
loading: true,
loading: false,
data
})
}
@ -17,3 +17,12 @@ export function updateStatus(msgId) {
})
}
export function batchRead(data) {
return request({
url: '/api/sys_msg/batchRead',
method: 'post',
loading: true,
data
})
}

View File

@ -41,9 +41,9 @@
</template>
</el-table-column>
</el-table>
<div class="msg-foot-class">
<div class="msg-foot-class" @click="showMore">
<el-row style="padding: 5px 0;margin-bottom: -5px;cursor:point;" @click="showMore">
<span @click="showMore">{{ $t('webmsg.show_more') }}</span>
<span>{{ $t('webmsg.show_more') }}</span>
</el-row>
</div>
@ -62,6 +62,8 @@
<script>
import { query, updateStatus } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import { mapGetters } from 'vuex'
import bus from '@/utils/bus'
export default {
data() {
return {
@ -73,28 +75,49 @@ export default {
currentPage: 1,
pageSize: 5,
total: 0
}
},
timer: null
}
},
computed: {
...mapGetters([
'permission_routes'
])
},
created() {
this.search()
// 30s
setInterval(() => {
this.timer = setInterval(() => {
this.search()
}, 30000)
},
mounted() {
bus.$on('refresh-top-notification', () => {
this.search()
})
},
beforeDestroy() {
this.timer && clearInterval(this.timer)
},
destroyed() {
this.timer && clearInterval(this.timer)
},
methods: {
handClick(lang) {
console.log(lang)
},
// handClick(lang) {
// console.log(lang)
// },
showDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
this.visible = false
this.$router.push({ name: row.router, params: param })
this.setReaded(row.msgId)
if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
bus.$emit('to-msg-share', param)
} else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
bus.$emit('to-msg-dataset', param)
} else {
this.$router.push({ name: row.router, params: param })
}
row.status || this.setReaded(row.msgId)
},
remove(row) {
@ -106,11 +129,24 @@ export default {
const routerName = 'sys-msg-web-all'
this.visible = false
this.$router.push({ name: routerName })
this.$emit('refresh-top-bar')
this.openSystem()
},
openSystem() {
const path = '/system'
let route = this.permission_routes.find(
item => item.path === '/' + path.split('/')[1]
)
//
if (!route) {
route = this.permission_routes.find(item => item.path === '/')
}
this.$store.commit('permission/SET_CURRENT_ROUTES', route)
// this.setSidebarHide(route)
},
search() {
const param = {
status: false
status: false,
orders: [' create_time desc ']
}
const { currentPage, pageSize } = this.paginationConfig
query(currentPage, pageSize, param).then(response => {

View File

@ -51,7 +51,7 @@ export default {
if (this.curComponent.type === 'view') {
this.$store.dispatch('chart/setViewId', null)
this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId)
bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId }})
bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }})
}
if (this.curComponent.type === 'custom') {
bus.$emit('component-dialog-edit')

View File

@ -58,6 +58,16 @@
<script>
import { mapState } from 'vuex'
export default {
props: {
scrollLeft: {
type: Number,
default: 0
},
scrollTop: {
type: Number,
default: 0
}
},
data() {
return {
lineStyle: [{
@ -113,8 +123,8 @@ export default {
mainStyle() {
const style = {
left: this.getPositionX(this.curComponent.style.left) + 'px',
top: (this.getPositionY(this.curComponent.style.top) - 3) + 'px'
left: this.getPositionX(this.curComponent.style.left - this.scrollLeft) + 'px',
top: (this.getPositionY(this.curComponent.style.top) - this.scrollTop - 3) + 'px'
}
return style
},
@ -139,7 +149,7 @@ export default {
if (this.canvasStyleData.selfAdaption) {
return (x * this.curCanvasScale.scaleWidth / 100) + 60
} else {
return x + 190
return x + 60
}
},
getPositionY(y) {

View File

@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1625194186074" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5368" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M542.865473 179.373297c-11.667737-5.553483-25.564235-3.748371-35.536354 4.592598l-191.97122 160.771637-153.038512-0.632403-0.141216 0c-8.810666 0-17.328667 3.467985-23.538089 9.771551-6.291287 6.28003-9.853415 14.809287-9.853415 23.736611l-0.704035 268.632203c0 8.904811 3.479241 17.48114 9.760295 23.784706 6.26775 6.349615 14.774495 9.864672 23.654746 9.864672l154.842601 0 190.986799 160.16277c6.139837 5.131881 13.766538 7.756661 21.383006 7.756661 4.802376 0 9.619078-1.031493 14.152325-3.186576 11.7056-5.482875 19.21462-17.339924 19.21462-30.369681L562.077024 209.742978C562.104653 196.784852 554.617122 184.927803 542.865473 179.373297zM495.321644 742.55498l-0.022513 0L349.757361 620.517529c-6.010901-4.991688-13.568017-7.733125-21.35947-7.733125L194.938296 612.784404l0.550539-201.38052 131.750673 0.562818 0.116657 0c7.814989 0 15.394618-2.717901 21.370727-7.756661l146.594753-122.786511L495.321644 742.55498zM776.185426 248.66443c-15.349593-9.958816-35.805484-5.41329-45.834908 10.051937-10.004865 15.418154-5.600555 36.20355 9.677407 46.373167 3.609201 2.412956 89.137133 60.994166 89.137133 206.910467 0 146.195663-82.013899 204.871017-85.282339 207.120244-15.383362 10.310833-19.507286 31.142278-9.268084 46.583968 6.4192 9.700943 17.036002 14.926968 27.815509 14.926968 6.374174 0 12.793374-1.852184 18.48705-5.624091 4.686742-3.139503 114.996081-79.225389 114.996081-263.008112C895.950114 327.842747 781.130042 251.827469 776.185426 248.66443zM672.284031 347.292728c-16.448624-7.826246-35.991726-0.704035-44.00626 15.770172-7.990998 16.542768-1.077541 36.531008 15.255449 44.802392 2.084475 1.101077 52.114938 27.228131 52.114938 101.673657 0 79.531358-46.795792 105.891725-48.307216 106.759489-16.48444 8.29492-23.186072 28.493961-14.938224 45.084824 5.881964 11.762905 17.643845 18.582217 29.933753 18.582217 4.968152 0 10.077519-1.14815 14.869662-3.538593 3.467985-1.780553 85.22401-44.358277 85.22401-166.887938C762.383072 391.322523 675.962817 349.026208 672.284031 347.292728z" p-id="5369"></path></svg>
<svg t="1625568065890" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3115" width="128" height="128"><path d="M844.8 650.24v-256c0-66.56-28.16-176.64-79.36-227.84-48.64-48.64-135.68-97.28-199.68-99.84v-25.6c0-23.04-17.92-40.96-40.96-40.96h-5.12c-23.04 0-40.96 17.92-40.96 40.96v25.6c-64 7.68-138.24 53.76-184.32 99.84-51.2 51.2-71.68 161.28-71.68 227.84v256l-151.04 148.48v56.32h304.64c0 87.04 71.68 158.72 158.72 158.72 87.04 0 156.16-71.68 158.72-158.72h281.6v-56.32L844.8 650.24zM535.04 949.76c-51.2 0-92.16-43.52-92.16-94.72h186.88c-2.56 53.76-43.52 94.72-94.72 94.72z" fill="" p-id="3116"></path></svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 652 B

View File

@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1625193768947" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1789" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M862.528 225.536c29.12 0 52.864 23.68 52.864 52.8v467.264a52.992 52.992 0 0 1-52.864 52.864H161.472a52.992 52.992 0 0 1-52.864-52.864V278.336c0-29.12 23.744-52.8 52.864-52.8h701.056m0-64H161.472A116.864 116.864 0 0 0 44.608 278.336v467.264c0 64.64 52.288 116.864 116.864 116.864h700.992a116.8 116.8 0 0 0 116.864-116.864V278.336a116.8 116.8 0 0 0-116.8-116.8z" fill="#231815" p-id="1790"></path><path d="M512 607.872a32.064 32.064 0 0 1-19.52-6.592L83.584 287.36a32 32 0 0 1 38.976-50.752L512 535.552l388.288-298.88a32 32 0 0 1 38.976 50.688L531.52 601.28A32.064 32.064 0 0 1 512 607.872z" fill="#231815" p-id="1791"></path></svg>
<svg t="1625568559172" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1218" width="200" height="200"><path d="M756.684831 0 267.312611 0C119.891353 0 0.382658 119.508695 0.382658 266.929953L0.382658 533.859906c0 147.421258 119.508695 266.929953 266.929953 266.929953l133.465616 0-37.933868-44.488965-95.531748 0c-122.852114 0-222.442267-99.591432-222.442267-222.442267L44.870344 266.929953c0-122.849556 99.588874-222.442267 222.442267-222.442267l489.37222 0c122.849556 0 222.442267 99.591432 222.442267 222.442267L979.127098 533.859906c0 122.849556-99.591432 222.442267-222.442267 222.442267L616.24715 756.302173l-15.270499 44.488965 155.709459 0c147.421258 0 266.929953-119.508695 266.929953-266.929953L1023.616063 266.929953C1023.614784 119.508695 904.106089 0 756.684831 0z" p-id="1219"></path><path d="M289.556454 355.906604c24.570423 0 44.488965 19.917263 44.488965 44.488965s-19.917263 44.488965-44.488965 44.488965-44.488965-19.917263-44.488965-44.488965S264.986031 355.906604 289.556454 355.906604z" p-id="1220"></path><path d="M511.998721 355.906604c24.570423 0 44.488965 19.917263 44.488965 44.488965s-19.917263 44.488965-44.488965 44.488965-44.488965-19.917263-44.488965-44.488965S487.428298 355.906604 511.998721 355.906604z" p-id="1221"></path><path d="M734.440988 355.906604c24.570423 0 44.488965 19.917263 44.488965 44.488965s-19.917263 44.488965-44.488965 44.488965-44.488965-19.917263-44.488965-44.488965S709.869286 355.906604 734.440988 355.906604z" p-id="1222"></path><path d="M616.24715 756.302173l-15.270499 44.488965c-60.488518 177.953302-222.442267 177.953302-222.442267 177.953302 18.365784-43.912116 34.329524-92.745992 31.970968-141.052901-0.841611-17.223598-6.219988-33.970112-14.625861-48.966896-5.904064-10.534201-18.841588-32.42247-33.035132-32.42247-0.002558 0-55.420949 0-55.420949 0s147.13859 76.676091-17.866957 266.929953c0 0 306.513787 28.837311 378.150447-266.929953L616.24715 756.302173z" p-id="1223"></path></svg>

Before

Width:  |  Height:  |  Size: 1007 B

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -708,6 +708,8 @@ export default {
area_mode: 'Area',
rose_radius: 'Fillet',
view_name: 'Chart Title',
belong_group: 'Belong Group',
select_group: 'Select Group',
name_can_not_empty: 'Name cannot be empty',
template_can_not_empty: 'Please check a Template',
custom_count: 'Number of records',
@ -747,8 +749,8 @@ export default {
chart_funnel: 'Funnel',
chart_radar: 'Radar',
chart_gauge: 'Gauge',
dateStyle: '日期顯示',
datePattern: '日期格式',
dateStyle: 'Date Style',
datePattern: 'Date Format',
y: 'Year',
y_M: 'Year Month',
y_M_d: 'Year Month Day',
@ -788,7 +790,11 @@ export default {
label_fontsize: 'Label Fontsize',
split_line: 'Split Line',
split_color: 'Split Color',
shadow: 'Shadow'
shadow: 'Shadow',
condition: 'Filter Value',
filter_value_can_null: 'Filter value can not empty',
filter_like: 'Contain',
filter_not_like: 'Not Contain'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
@ -1215,6 +1221,13 @@ export default {
show_more: 'View more',
all_type: 'All type',
panel_type: 'Panel Share',
dataset_type: 'Dataset sync'
dataset_type: 'Dataset sync',
content: 'Content',
sned_time: 'Send Time',
read_time: 'Read Time',
type: 'Type',
mark_readed: 'Mark As Read',
please_select: 'Please select at least one message',
mark_success: 'Mark read successfully'
}
}

View File

@ -708,6 +708,8 @@ export default {
area_mode: '面積',
rose_radius: '園角',
view_name: '視圖標題',
belong_group: '所属分组',
select_group: '选择分组',
name_can_not_empty: '名稱不能為空',
template_can_not_empty: '請選擇儀表板',
custom_count: '記錄數',
@ -788,7 +790,11 @@ export default {
label_fontsize: '標簽大小',
split_line: '分割線',
split_color: '分割顏色',
shadow: '陰影'
shadow: '陰影',
condition: '過濾值',
filter_value_can_null: '過濾值不能為空',
filter_like: '包含',
filter_not_like: '不包含'
},
dataset: {
sheet_warn: '有多個sheet頁面默認抽取第一個',
@ -962,7 +968,7 @@ export default {
oracle_service_name: '服務名',
get_schema: '獲取 Schema',
schema: '數據庫 Schema',
please_choose_schema: '請選擇數據庫 Schema',
please_choose_schema: '請選擇數據庫 Schema'
},
pblink: {
key_pwd: '請輸入密碼打開鏈接',
@ -1215,6 +1221,13 @@ export default {
show_more: '查看更多',
all_type: '全部類型',
panel_type: '儀表板分享',
dataset_type: '數據集同步'
dataset_type: '數據集同步',
content: '消息內容',
sned_time: '提交時間',
read_time: '查看時間',
type: '類型',
mark_readed: '標記已讀',
please_select: '請至少選擇一條消息',
mark_success: '標記已讀成功'
}
}

View File

@ -708,6 +708,8 @@ export default {
area_mode: '面积',
rose_radius: '圆角',
view_name: '视图标题',
belong_group: '所属分组',
select_group: '选择分组',
name_can_not_empty: '名称不能为空',
template_can_not_empty: '请选择仪表版',
custom_count: '记录数',
@ -788,7 +790,11 @@ export default {
label_fontsize: '标签大小',
split_line: '分割线',
split_color: '分割颜色',
shadow: '阴影'
shadow: '阴影',
condition: '过滤值',
filter_value_can_null: '过滤值不能为空',
filter_like: '包含',
filter_not_like: '不包含'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
@ -1217,6 +1223,13 @@ export default {
show_more: '查看更多',
all_type: '全部类型',
panel_type: '仪表板分享',
dataset_type: '数据集同步'
dataset_type: '数据集同步',
content: '消息内容',
sned_time: '提交时间',
read_time: '查看时间',
type: '类型',
mark_readed: '标记已读',
please_select: '请至少选择一条消息',
mark_success: '标记已读成功'
}
}

View File

@ -35,7 +35,7 @@
<!-- <el-tooltip :content="$t('navbar.size')" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> -->
<notification class="right-menu-item hover-effect" @refresh-top-bar="initCurrentRoutes" />
<notification class="right-menu-item hover-effect" />
<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/" target="_blank" style="display: flex;height: 100%;width: 100%;justify-content: center;align-items: center;">

View File

@ -76,7 +76,7 @@ export const loadMenus = (next, to) => {
buildMenus().then(res => {
const filterDatas = filterRouter(res.data)
const asyncRouter = filterAsyncRouter(filterDatas)
addMsgMenu(asyncRouter)
// addMsgMenu(asyncRouter)
asyncRouter.push({ path: '*', redirect: '/404', hidden: true })
store.dispatch('permission/GenerateRoutes', asyncRouter).then(() => { // 存储路由
router.addRoutes(asyncRouter)

View File

@ -58,6 +58,16 @@
<script>
import { mapState } from 'vuex'
export default {
props: {
scrollLeft: {
type: Number,
default: 0
},
scrollTop: {
type: Number,
default: 0
}
},
data() {
return {
lineStyle: [{
@ -113,8 +123,8 @@ export default {
mainStyle() {
const style = {
left: this.getPositionX(this.curComponent.style.left) + 'px',
top: (this.getPositionY(this.curComponent.style.top) - 3) + 'px'
left: this.getPositionX(this.curComponent.style.left - this.scrollLeft) + 'px',
top: (this.getPositionY(this.curComponent.style.top) - this.scrollTop - 3) + 'px'
}
return style
},
@ -139,7 +149,7 @@ export default {
if (this.canvasStyleData.selfAdaption) {
return (x * this.curCanvasScale.scaleWidth / 100) + 60
} else {
return x + 190
return x + 60
}
},
getPositionY(y) {

View File

@ -67,6 +67,16 @@
<script>
import { mapState } from 'vuex'
export default {
props: {
scrollLeft: {
type: Number,
default: 0
},
scrollTop: {
type: Number,
default: 0
}
},
data() {
return {
textAlignOptions: [
@ -106,8 +116,8 @@ export default {
mainStyle() {
const style = {
left: this.getPositionX(this.curComponent.style.left) + 'px',
top: (this.getPositionY(this.curComponent.style.top) - 3) + 'px'
left: (this.getPositionX(this.curComponent.style.left) - this.scrollLeft) + 'px',
top: (this.getPositionY(this.curComponent.style.top) - this.scrollTop - 3) + 'px'
}
return style
},
@ -132,7 +142,7 @@ export default {
if (this.canvasStyleData.selfAdaption) {
return (x * this.curCanvasScale.scaleWidth / 100) + 60
} else {
return x + 190
return x + 60
}
},
getPositionY(y) {
@ -164,8 +174,9 @@ export default {
padding: 0px!important;
}
::v-deep .el-radio-button__inner{
padding: 5px;
width: 30px;
padding: 5px!important;
width: 30px!important;
}
</style>

View File

@ -17,7 +17,7 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item">{{ $t('chart.background') }}<i class="el-icon-setting el-icon--right" /></el-button>
<el-button slot="reference" :disabled="param && !hasDataPermission('manage',param.privileges)" size="mini" class="shape-item">{{ $t('chart.background') }}<i class="el-icon-setting el-icon--right" /></el-button>
</el-popover>
</div>
</div>
@ -29,6 +29,10 @@ import { DEFAULT_BACKGROUND_COLOR } from '../../chart/chart'
export default {
name: 'BackgroundColorSelector',
props: {
param: {
type: Object,
required: false
},
chart: {
type: Object,
required: true

View File

@ -53,10 +53,11 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item" :disabled="!legendForm.show">
<el-button slot="reference" size="mini" class="shape-item" :disabled="!legendForm.show || !hasDataPermission('manage',param.privileges)">
{{ $t('chart.legend') }}<i class="el-icon-setting el-icon--right" />
<el-switch
v-model="legendForm.show"
:disabled="!hasDataPermission('manage',param.privileges)"
class="switch-style"
@click.stop.native
@change="changeLegendStyle"
@ -73,6 +74,10 @@ import { DEFAULT_LEGEND_STYLE } from '../../chart/chart'
export default {
name: 'LegendSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -48,7 +48,7 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item">
<el-button slot="reference" :disabled="!hasDataPermission('manage',param.privileges)" size="mini" class="shape-item">
{{ $t('chart.split') }}<i class="el-icon-setting el-icon--right" />
</el-button>
</el-popover>
@ -62,6 +62,10 @@ import { DEFAULT_SPLIT } from '../../chart/chart'
export default {
name: 'SplitSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -51,10 +51,11 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item" :disabled="!titleForm.show">
<el-button slot="reference" size="mini" class="shape-item" :disabled="!titleForm.show || !hasDataPermission('manage',param.privileges)">
{{ $t('chart.title') }}<i class="el-icon-setting el-icon--right" />
<el-switch
v-model="titleForm.show"
:disabled="!hasDataPermission('manage',param.privileges)"
class="switch-style"
@click.stop.native
@change="changeTitleStyle"
@ -71,6 +72,10 @@ import { DEFAULT_TITLE_STYLE } from '../../chart/chart'
export default {
name: 'TitleSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -72,10 +72,11 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item" :disabled="!axisForm.show">
<el-button slot="reference" size="mini" class="shape-item" :disabled="!axisForm.show || !hasDataPermission('manage',param.privileges)">
{{ $t('chart.xAxis') }}<i class="el-icon-setting el-icon--right" />
<el-switch
v-model="axisForm.show"
:disabled="!hasDataPermission('manage',param.privileges)"
class="switch-style"
@click.stop.native
@change="changeXAxisStyle"
@ -92,6 +93,10 @@ import { DEFAULT_XAXIS_STYLE } from '../../chart/chart'
export default {
name: 'XAxisSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -72,10 +72,11 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item" :disabled="!axisForm.show">
<el-button slot="reference" size="mini" class="shape-item" :disabled="!axisForm.show || !hasDataPermission('manage',param.privileges)">
{{ $t('chart.yAxis') }}<i class="el-icon-setting el-icon--right" />
<el-switch
v-model="axisForm.show"
:disabled="!hasDataPermission('manage',param.privileges)"
class="switch-style"
@click.stop.native
@change="changeYAxisStyle"
@ -92,6 +93,10 @@ import { DEFAULT_YAXIS_STYLE } from '../../chart/chart'
export default {
name: 'YAxisSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -1,6 +1,10 @@
<template>
<span>
<el-dropdown trigger="click" size="mini" @command="clickItem">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis">
<span>{{ item.name }}</span>
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis">
{{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
@ -80,6 +84,10 @@
export default {
name: 'DimensionItem',
props: {
param: {
type: Object,
required: true
},
item: {
type: Object,
required: true

View File

@ -1,6 +1,10 @@
<template>
<span>
<el-dropdown trigger="click" size="mini" @command="clickItem">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis">
<span>{{ item.name }}</span>
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis">
<span>{{ item.name }}</span>
@ -81,6 +85,10 @@
export default {
name: 'QuotaItem',
props: {
param: {
type: Object,
required: true
},
item: {
type: Object,
required: true

View File

@ -23,7 +23,7 @@
</el-select>
</el-col>
<el-col :span="6">
<el-input v-show="!f.term.includes('null')" v-model="f.value" class="value-item" :placeholder="$t('chart.no_limit')" size="mini" clearable />
<el-input v-show="!f.term.includes('null')" v-model="f.value" class="value-item" :placeholder="$t('chart.condition')" size="mini" clearable />
</el-col>
<el-col :span="6">
<el-button type="text" icon="el-icon-delete" circle style="float: right" @click="removeFilter(index)" />
@ -53,7 +53,18 @@ export default {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
}, {
},
{
label: '',
options: [{
value: 'like',
label: this.$t('chart.filter_like')
}, {
value: 'not like',
label: this.$t('chart.filter_not_like')
}]
},
{
label: '',
options: [{
value: 'lt',

View File

@ -23,7 +23,7 @@
</el-select>
</el-col>
<el-col :span="6">
<el-input v-show="!f.term.includes('null')" v-model="f.value" class="value-item" :placeholder="$t('chart.no_limit')" size="mini" clearable />
<el-input v-show="!f.term.includes('null')" v-model="f.value" class="value-item" :placeholder="$t('chart.condition')" size="mini" clearable />
</el-col>
<el-col :span="6">
<el-button type="text" icon="el-icon-delete" circle style="float: right" @click="removeFilter(index)" />
@ -53,7 +53,18 @@ export default {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
}, {
},
{
label: '',
options: [{
value: 'like',
label: this.$t('chart.filter_like')
}, {
value: 'not like',
label: this.$t('chart.filter_not_like')
}]
},
{
label: '',
options: [{
value: 'lt',

View File

@ -37,7 +37,7 @@
</el-select>
</el-col>
<el-col :span="6">
<el-input v-show="!f.term.includes('null')" v-model="f.value" class="value-item" :placeholder="$t('chart.no_limit')" size="mini" clearable />
<el-input v-show="!f.term.includes('null')" v-model="f.value" class="value-item" :placeholder="$t('chart.condition')" size="mini" clearable />
</el-col>
<el-col :span="6">
<el-button type="text" icon="el-icon-delete" circle style="float: right" @click="removeFilter(index)" />
@ -69,7 +69,18 @@ export default {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
}, {
},
{
label: '',
options: [{
value: 'like',
label: this.$t('chart.filter_like')
}, {
value: 'not like',
label: this.$t('chart.filter_not_like')
}]
},
{
label: '',
options: [{
value: 'lt',

View File

@ -49,7 +49,7 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item">{{ $t('chart.color') }}<i class="el-icon-setting el-icon--right" /></el-button>
<el-button slot="reference" :disabled="param && !hasDataPermission('manage',param.privileges)" size="mini" class="shape-item">{{ $t('chart.color') }}<i class="el-icon-setting el-icon--right" /></el-button>
</el-popover>
</div>
</div>
@ -61,6 +61,10 @@ import { DEFAULT_COLOR_CASE } from '../../chart/chart'
export default {
name: 'ColorSelector',
props: {
param: {
type: Object,
required: false
},
chart: {
type: Object,
required: true

View File

@ -34,7 +34,7 @@
<span>{{ $t('chart.content_formatter') }}</span>
<el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content">
字符串支持用 \n 换行<br>字符串模板 模板变量有<br>{a}系列名<br>{b}数据名<br>{c}数据值<br>{d}百分比用于饼图等
字符串模板 模板变量有<br>{a}系列名<br>{b}数据名<br>{c}数据值<br>{d}百分比用于饼图等
</div>
<i class="el-icon-info" style="cursor: pointer;" />
</el-tooltip>
@ -67,10 +67,11 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item" :disabled="!labelForm.show">
<el-button slot="reference" size="mini" class="shape-item" :disabled="!labelForm.show || !hasDataPermission('manage',param.privileges)">
{{ $t('chart.label') }}<i class="el-icon-setting el-icon--right" />
<el-switch
v-model="labelForm.show"
:disabled="!hasDataPermission('manage',param.privileges)"
class="switch-style"
@click.stop.native
@change="changeLabelAttr"
@ -87,6 +88,10 @@ import { DEFAULT_LABEL } from '../../chart/chart'
export default {
name: 'LabelSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -143,7 +143,7 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item">{{ $t('chart.size') }}<i class="el-icon-setting el-icon--right" /></el-button>
<el-button slot="reference" :disabled="!hasDataPermission('manage',param.privileges)" size="mini" class="shape-item">{{ $t('chart.size') }}<i class="el-icon-setting el-icon--right" /></el-button>
</el-popover>
</div>
</div>
@ -154,6 +154,10 @@ import { DEFAULT_SIZE } from '../../chart/chart'
export default {
name: 'SizeSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -55,10 +55,11 @@
</el-form>
</el-col>
<el-button slot="reference" size="mini" class="shape-item" :disabled="!tooltipForm.show">
<el-button slot="reference" size="mini" class="shape-item" :disabled="!tooltipForm.show || !hasDataPermission('manage',param.privileges)">
{{ $t('chart.tooltip') }}<i class="el-icon-setting el-icon--right" />
<el-switch
v-model="tooltipForm.show"
:disabled="!hasDataPermission('manage',param.privileges)"
class="switch-style"
@click.stop.native
@change="changeTooltipAttr"
@ -75,6 +76,10 @@ import { DEFAULT_TOOLTIP } from '../../chart/chart'
export default {
name: 'TooltipSelector',
props: {
param: {
type: Object,
required: true
},
chart: {
type: Object,
required: true

View File

@ -268,17 +268,29 @@
class="dialog-css"
:destroy-on-close="true"
>
<el-row style="width: 400px;">
<el-row style="width: 800px;">
<el-form ref="form" :model="table" label-width="80px" size="mini" class="form-item">
<el-form-item :label="$t('chart.view_name')">
<el-input v-model="chartName" size="mini" />
</el-form-item>
<el-col :span="12">
<el-form-item :label="$t('chart.view_name')">
<el-input v-model="chartName" style="height: 34px" size="mini" />
</el-form-item>
</el-col>
<el-col :span="12" v-if="optFrom==='panel'">
<el-form-item :label="$t('chart.belong_group')">
<treeselect
v-model="currGroup.id"
:options="chartGroupTreeAvailable"
:normalizer="normalizer"
:placeholder="$t('chart.select_group')"
/>
</el-form-item>
</el-col>
</el-form>
</el-row>
<table-selector @getTable="getTable" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeCreateChart">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" :disabled="!table.id" @click="createChart">{{ $t('chart.confirm') }}</el-button>
<el-button type="primary" size="mini" :disabled="!table.id || !currGroup.id" @click="createChart">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
@ -305,7 +317,7 @@
</template>
<script>
import { post } from '@/api/chart/chart'
import { post, chartGroupTree } from '@/api/chart/chart'
import { authModel } from '@/api/system/sysAuth'
import TableSelector from '../view/TableSelector'
import GroupMoveSelector from '../components/TreeSelector/GroupMoveSelector'
@ -331,6 +343,17 @@ export default {
type: Object,
required: false,
default: null
},
// 'panel'
optFrom: {
type: String,
required: false,
default: null
},
adviceGroupId: {
type: String,
required: false,
default: null
}
},
data() {
@ -394,7 +417,8 @@ export default {
groupMoveConfirmDisabled: true,
dsMoveConfirmDisabled: true,
moveDialogTitle: '',
isTreeSearch: false
isTreeSearch: false,
chartGroupTreeAvailable: []
}
},
computed: {
@ -422,12 +446,19 @@ export default {
},
saveStatus() {
this.refreshNodeBy(this.saveStatus.sceneId)
},
adviceGroupId() {
//
if (this.optFrom === 'panel') {
this.currGroup['id'] = this.adviceGroupId
}
}
},
mounted() {
this.treeNode(this.groupForm)
this.refresh()
// this.chartTree()
this.getChartGroupTree()
},
methods: {
clickAdd(param) {
@ -636,7 +667,7 @@ export default {
nodeClick(data, node) {
if (data.type !== 'group') {
this.$emit('switchComponent', { name: 'ChartEdit', param: { 'id': data.id }})
this.$emit('switchComponent', { name: 'ChartEdit', param: data })
}
},
@ -718,8 +749,15 @@ export default {
this.closeCreateChart()
this.$store.dispatch('chart/setTableId', null)
this.$store.dispatch('chart/setTableId', this.table.id)
this.$emit('switchComponent', { name: 'ChartEdit', param: { 'id': response.data.id }})
this.refreshNodeBy(view.sceneId)
// this.$router.push('/chart/chart-edit')
if (this.optFrom === 'panel') {
this.$emit('newViewInfo', { 'id': response.data.id })
} else {
this.$emit('switchComponent', { name: 'ChartEdit', param: { 'id': response.data.id }})
// this.$store.dispatch('chart/setViewId', response.data.id)
// this.chartTree()
this.refreshNodeBy(view.sceneId)
}
})
},
@ -909,6 +947,18 @@ export default {
this.isTreeSearch = false
this.treeNode(this.groupForm)
}
},
getChartGroupTree() {
chartGroupTree({}).then(res => {
this.chartGroupTreeAvailable = res.data
})
},
normalizer(node) {
// children=null
if (node.children === null || node.children === 'null') {
delete node.children
}
}
}
}
@ -1003,4 +1053,11 @@ export default {
height: 100%;
overflow-y: auto;
}
/deep/ .vue-treeselect__control{
height: 28px;
}
/deep/ .vue-treeselect__single-value{
color:#606266;
line-height: 28px!important;
}
</style>

View File

@ -13,7 +13,7 @@
<span slot="reference" style="line-height: 40px;cursor: pointer;">{{ view.name }}</span>
</el-popover>
<span style="float: right;line-height: 40px;">
<el-button size="mini" @click="changeDs">
<el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="changeDs">
{{ $t('chart.change_ds') }}
</el-button>
<el-button size="mini" @click="closeEdit">
@ -29,19 +29,30 @@
<el-col
style="height: 100%;width: 20%;min-width: 180px;max-width:220px;border: 1px solid #E6E6E6;border-left: 0 solid;"
>
<div style="height: 50%;border-bottom: 1px solid #E6E6E6;" class="padding-lr">
<div style="display: flex;align-items: center;justify-content: center;padding: 6px;">
<el-input
v-model="searchField"
size="mini"
:placeholder="$t('chart.search')"
prefix-icon="el-icon-search"
clearable
/>
<el-button :disabled="!table || !hasDataPermission('manage',table.privileges)" icon="el-icon-setting" type="text" size="mini" style="float: right;width: 20px;margin-left: 6px;" @click="editField" />
</div>
<div style="border-bottom: 1px solid #E6E6E6;" class="padding-lr field-height">
<span>{{ $t('chart.dimension') }}</span>
<draggable
v-model="dimension"
v-model="dimensionData"
:options="{group:{name: 'dimension',pull:'clone'},sort: true}"
animation="300"
:move="onMove"
class="drag-list"
:disabled="!hasDataPermission('manage',param.privileges)"
@end="end1"
@start="start1"
>
<transition-group>
<span v-for="item in dimension" :key="item.id" class="item" :title="item.name">
<span v-for="item in dimensionData" :key="item.id" class="item" :title="item.name">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
@ -50,19 +61,20 @@
</transition-group>
</draggable>
</div>
<div style="height: 50%;" class="padding-lr">
<div class="padding-lr field-height">
<span>{{ $t('chart.quota') }}</span>
<draggable
v-model="quota"
v-model="quotaData"
:options="{group:{name: 'quota',pull:'clone'},sort: true}"
animation="300"
:move="onMove"
class="drag-list"
:disabled="!hasDataPermission('manage',param.privileges)"
@end="end1"
@start="start1"
>
<transition-group>
<span v-for="item in quota" :key="item.id" class="item" :title="item.name">
<span v-for="item in quotaData" :key="item.id" class="item" :title="item.name">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
@ -101,6 +113,7 @@
<el-radio-group
v-model="view.type"
style="width: 100%"
:disabled="!hasDataPermission('manage',param.privileges)"
@change="save(true,'chart',true)"
>
<div style="width: 100%;display: flex;display: -webkit-flex;justify-content: space-between;flex-direction: row;flex-wrap: wrap;">
@ -197,7 +210,7 @@
<el-row class="padding-lr">
<span>{{ $t('chart.style_priority') }}</span>
<el-row>
<el-radio-group v-model="view.stylePriority" size="mini" @change="save">
<el-radio-group v-model="view.stylePriority" :disabled="!hasDataPermission('manage',param.privileges)" size="mini" @change="save">
<el-radio label="view"><span>{{ $t('chart.chart') }}</span></el-radio>
<el-radio label="panel"><span>{{ $t('chart.dashboard') }}</span></el-radio>
</el-radio-group>
@ -205,24 +218,24 @@
</el-row>
<el-tabs type="card" :stretch="true" class="tab-header">
<el-tab-pane :label="$t('chart.shape_attr')" class="padding-lr">
<color-selector class="attr-selector" :chart="chart" @onColorChange="onColorChange" />
<size-selector class="attr-selector" :chart="chart" @onSizeChange="onSizeChange" />
<label-selector v-show="!view.type.includes('table') && !view.type.includes('text')" class="attr-selector" :chart="chart" @onLabelChange="onLabelChange" />
<tooltip-selector v-show="!view.type.includes('table') && !view.type.includes('text')" class="attr-selector" :chart="chart" @onTooltipChange="onTooltipChange" />
<color-selector :param="param" class="attr-selector" :chart="chart" @onColorChange="onColorChange" />
<size-selector :param="param" class="attr-selector" :chart="chart" @onSizeChange="onSizeChange" />
<label-selector v-show="!view.type.includes('table') && !view.type.includes('text')" :param="param" class="attr-selector" :chart="chart" @onLabelChange="onLabelChange" />
<tooltip-selector v-show="!view.type.includes('table') && !view.type.includes('text')" :param="param" class="attr-selector" :chart="chart" @onTooltipChange="onTooltipChange" />
</el-tab-pane>
<el-tab-pane :label="$t('chart.module_style')" class="padding-lr">
<x-axis-selector v-show="view.type.includes('bar') || view.type.includes('line')" class="attr-selector" :chart="chart" @onChangeXAxisForm="onChangeXAxisForm" />
<y-axis-selector v-show="view.type.includes('bar') || view.type.includes('line')" class="attr-selector" :chart="chart" @onChangeYAxisForm="onChangeYAxisForm" />
<split-selector v-show="view.type.includes('radar')" class="attr-selector" :chart="chart" @onChangeSplitForm="onChangeSplitForm" />
<title-selector class="attr-selector" :chart="chart" @onTextChange="onTextChange" />
<legend-selector v-show="!view.type.includes('table') && !view.type.includes('text')" class="attr-selector" :chart="chart" @onLegendChange="onLegendChange" />
<background-color-selector class="attr-selector" :chart="chart" @onChangeBackgroundForm="onChangeBackgroundForm" />
<x-axis-selector v-show="view.type.includes('bar') || view.type.includes('line')" :param="param" class="attr-selector" :chart="chart" @onChangeXAxisForm="onChangeXAxisForm" />
<y-axis-selector v-show="view.type.includes('bar') || view.type.includes('line')" :param="param" class="attr-selector" :chart="chart" @onChangeYAxisForm="onChangeYAxisForm" />
<split-selector v-show="view.type.includes('radar')" :param="param" class="attr-selector" :chart="chart" @onChangeSplitForm="onChangeSplitForm" />
<title-selector :param="param" class="attr-selector" :chart="chart" @onTextChange="onTextChange" />
<legend-selector v-show="!view.type.includes('table') && !view.type.includes('text')" :param="param" class="attr-selector" :chart="chart" @onLegendChange="onLegendChange" />
<background-color-selector :param="param" class="attr-selector" :chart="chart" @onChangeBackgroundForm="onChangeBackgroundForm" />
</el-tab-pane>
</el-tabs>
</div>
<div style="height:60px;overflow:auto;border-top: 1px solid #e6e6e6" class="padding-lr filter-class">
<span>{{ $t('chart.result_filter') }}</span>
<el-button size="mini" class="filter-btn-class" @click="showResultFilter">
<el-button :disabled="!hasDataPermission('manage',param.privileges)" size="mini" class="filter-btn-class" @click="showResultFilter">
{{ $t('chart.filter_condition') }}<i class="el-icon-setting el-icon--right" />
</el-button>
</div>
@ -235,6 +248,7 @@
<span style="line-height: 32px;width: 80px;text-align: right;">{{ $t('chart.dimension') }}</span>
<draggable
v-model="view.xaxis"
:disabled="!hasDataPermission('manage',param.privileges)"
group="dimension"
animation="300"
:move="onMove"
@ -242,7 +256,7 @@
@end="end2"
>
<transition-group class="draggable-group">
<dimension-item v-for="(item,index) in view.xaxis" :key="item.id" :index="index" :item="item" @onDimensionItemChange="dimensionItemChange" @onDimensionItemRemove="dimensionItemRemove" @editItemFilter="showDimensionEditFilter" @onNameEdit="showRename" />
<dimension-item v-for="(item,index) in view.xaxis" :key="item.id" :param="param" :index="index" :item="item" @onDimensionItemChange="dimensionItemChange" @onDimensionItemRemove="dimensionItemRemove" @editItemFilter="showDimensionEditFilter" @onNameEdit="showRename" />
</transition-group>
</draggable>
</el-row>
@ -250,6 +264,7 @@
<span style="line-height: 32px;width: 80px;text-align: right;">{{ $t('chart.quota') }}</span>
<draggable
v-model="view.yaxis"
:disabled="!hasDataPermission('manage',param.privileges)"
group="quota"
animation="300"
:move="onMove"
@ -257,7 +272,7 @@
@end="end2"
>
<transition-group class="draggable-group">
<quota-item v-for="(item,index) in view.yaxis" :key="item.id" :index="index" :item="item" @onQuotaItemChange="quotaItemChange" @onQuotaItemRemove="quotaItemRemove" @editItemFilter="showQuotaEditFilter" @onNameEdit="showRename" />
<quota-item v-for="(item,index) in view.yaxis" :key="item.id" :param="param" :index="index" :item="item" @onQuotaItemChange="quotaItemChange" @onQuotaItemRemove="quotaItemRemove" @editItemFilter="showQuotaEditFilter" @onNameEdit="showRename" />
</transition-group>
</draggable>
</el-row>
@ -338,7 +353,7 @@
<!--视图更换数据集-->
<el-dialog
v-dialogDrag
:title="$t('chart.change_ds')+'['+table.name+']'"
:title="changeDsTitle"
:visible="selectTableFlag"
:show-close="false"
width="70%"
@ -349,9 +364,21 @@
<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>
<el-button type="primary" size="mini" :disabled="!table.id" @click="changeChart">{{ $t('chart.confirm') }}</el-button>
<el-button type="primary" size="mini" :disabled="!table || !table.id" @click="changeChart">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
<!--编辑视图使用的数据集的字段-->
<el-dialog
v-dialogDrag
:visible="editDsField"
:show-close="false"
class="dialog-css"
:destroy-on-close="true"
:fullscreen="true"
>
<field-edit :param="{table:table}" @switchComponent="closeEditDsField" />
</el-dialog>
</el-row>
</template>
@ -393,10 +420,11 @@ import TableNormal from '../components/table/TableNormal'
import LabelNormal from '../components/normal/LabelNormal'
import html2canvas from 'html2canvas'
import TableSelector from './TableSelector'
import FieldEdit from '../../dataset/data/FieldEdit'
export default {
name: 'ChartEdit',
components: { SplitSelector, TableSelector, ResultFilterEditor, LabelNormal, DimensionFilterEditor, TableNormal, DatasetChartDetail, QuotaFilterEditor, BackgroundColorSelector, XAxisSelector, YAxisSelector, TooltipSelector, LabelSelector, LegendSelector, TitleSelector, SizeSelector, ColorSelector, ChartComponent, QuotaItem, DimensionItem, draggable },
components: { FieldEdit, SplitSelector, TableSelector, ResultFilterEditor, LabelNormal, DimensionFilterEditor, TableNormal, DatasetChartDetail, QuotaFilterEditor, BackgroundColorSelector, XAxisSelector, YAxisSelector, TooltipSelector, LabelSelector, LegendSelector, TitleSelector, SizeSelector, ColorSelector, ChartComponent, QuotaItem, DimensionItem, draggable },
props: {
param: {
type: Object,
@ -409,6 +437,8 @@ export default {
table: {},
dimension: [],
quota: [],
dimensionData: [],
quotaData: [],
view: {
xaxis: [],
yaxis: [],
@ -458,7 +488,10 @@ export default {
msg: ''
},
selectTableFlag: false,
changeTable: {}
changeTable: {},
searchField: '',
editDsField: false,
changeDsTitle: ''
}
},
computed: {
@ -467,11 +500,17 @@ export default {
// this.getData(this.$store.state.chart.viewId)
// return this.$store.state.chart.viewId
// }
},
watch: {
'param': function() {
this.getData(this.param.id)
if(this.param.optType === 'new'){
}else{
this.getData(this.param.id)
}
},
searchField(val) {
this.fieldFilter(val)
}
},
created() {
@ -487,7 +526,7 @@ export default {
methods: {
initTableData(id) {
if (id != null) {
post('/dataset/table/get/' + id, null).then(response => {
post('/dataset/table/getWithPermission/' + id, null).then(response => {
this.table = response.data
this.initTableField(id)
}).catch(err => {
@ -503,6 +542,9 @@ export default {
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
this.dimension = response.data.dimension
this.quota = response.data.quota
this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
this.quotaData = JSON.parse(JSON.stringify(this.quota))
this.fieldFilter(this.searchField)
}).catch(err => {
this.resetView()
this.httpRequest.status = err.response.data.success
@ -878,6 +920,17 @@ export default {
this.dimensionFilterEdit = false
},
saveDimensionFilter() {
for (let i = 0; i < this.dimensionItem.filter.length; i++) {
const f = this.dimensionItem.filter[i]
if (!f.term.includes('null') && (!f.value || f.value === '')) {
this.$message({
message: this.$t('chart.filter_value_can_null'),
type: 'error',
showClose: true
})
return
}
}
this.view.xaxis[this.dimensionItem.index].filter = this.dimensionItem.filter
this.save(true)
this.closeDimensionFilter()
@ -891,6 +944,17 @@ export default {
this.quotaFilterEdit = false
},
saveQuotaFilter() {
for (let i = 0; i < this.quotaItem.filter.length; i++) {
const f = this.quotaItem.filter[i]
if (!f.term.includes('null') && (!f.value || f.value === '')) {
this.$message({
message: this.$t('chart.filter_value_can_null'),
type: 'error',
showClose: true
})
return
}
}
this.view.yaxis[this.quotaItem.index].filter = this.quotaItem.filter
this.save(true)
this.closeQuotaFilter()
@ -914,6 +978,14 @@ export default {
})
return
}
if (!f.term.includes('null') && (!f.value || f.value === '')) {
this.$message({
message: this.$t('chart.filter_value_can_null'),
type: 'error',
showClose: true
})
return
}
}
this.view.customFilter = this.chartForFilter.customFilter
this.save(true)
@ -972,6 +1044,7 @@ export default {
},
changeDs() {
this.changeDsTitle = this.$t('chart.change_ds') + '[' + this.table.name + ']'
this.selectTableFlag = true
},
@ -985,6 +1058,25 @@ export default {
this.view.yaxis = []
this.view.customFilter = []
this.save(true, 'chart', false)
},
fieldFilter(val) {
if (val && val !== '') {
this.dimensionData = JSON.parse(JSON.stringify(this.dimension.filter(ele => { return ele.name.includes(val) })))
this.quotaData = JSON.parse(JSON.stringify(this.quota.filter(ele => { return ele.name.includes(val) })))
} else {
this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
this.quotaData = JSON.parse(JSON.stringify(this.quota))
}
},
editField() {
this.editDsField = true
},
closeEditDsField() {
this.editDsField = false
this.initTableField()
}
}
}
@ -1178,4 +1270,7 @@ export default {
justify-content: center;
background-color: #ece7e7;
}
.field-height{
height: calc(50% - 20px);
}
</style>

View File

@ -77,6 +77,10 @@ export default {
type: Object,
required: true
},
param: {
type: Object,
required: true
},
fields: {
type: Array,
required: true

View File

@ -1,6 +1,6 @@
<template>
<el-row>
<el-button size="mini" @click="showUnionEdit">{{ $t('dataset.add_union') }}</el-button>
<el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="showUnionEdit">{{ $t('dataset.add_union') }}</el-button>
<el-row>
<el-table
size="mini"
@ -34,8 +34,8 @@
:label="$t('dataset.operate')"
>
<template slot-scope="scope">
<el-button type="text" size="mini" @click="edit(scope.row)">{{ $t('dataset.edit') }}</el-button>
<el-button type="text" size="mini" @click="deleteUnion(scope.row)">{{ $t('dataset.delete') }}</el-button>
<el-button v-if="hasDataPermission('manage',param.privileges)" type="text" size="mini" @click="edit(scope.row)">{{ $t('dataset.edit') }}</el-button>
<el-button v-if="hasDataPermission('manage',param.privileges)" type="text" size="mini" @click="deleteUnion(scope.row)">{{ $t('dataset.delete') }}</el-button>
</template>
</el-table-column>
</el-table>
@ -143,6 +143,10 @@ export default {
table: {
type: Object,
required: true
},
param: {
type: Object,
required: true
}
},
data() {

View File

@ -1,7 +1,7 @@
<template>
<el-col>
<el-row>
<el-button icon="el-icon-setting" size="mini" @click="showConfig">
<el-button v-if="hasDataPermission('manage',param.privileges)" icon="el-icon-setting" size="mini" @click="showConfig">
{{ $t('dataset.update_setting') }}
</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="refreshLog">
@ -302,6 +302,10 @@ export default {
table: {
type: Object,
default: null
},
param: {
type: Object,
required: true
}
},
data() {

View File

@ -1,6 +1,6 @@
<template>
<el-row style="height: 100%;overflow-y: hidden;width: 100%;">
<span v-show="false">{{ tableRefresh }}</span>
<!-- <span v-show="false">{{ tableRefresh }}</span>-->
<el-row style="height: 26px;">
<el-popover
placement="right-start"
@ -14,7 +14,7 @@
{{ table.name }}
</span>
</el-popover>
<el-row style="float: right">
<el-row v-if="hasDataPermission('manage',param.privileges)" style="float: right">
<el-dropdown v-if="table.type ==='excel'" style="margin-right: 10px;" size="small" trigger="click" @command="clickEditExcel">
<el-button size="mini">
{{ $t('dataset.edit_excel') }}
@ -46,13 +46,13 @@
<el-tabs v-model="tabActive">
<el-tab-pane :label="$t('dataset.data_preview')" name="dataPreview">
<tab-data-preview :table="table" :fields="fields" :data="data" :page="page" :form="tableViewRowForm" @reSearch="reSearch" />
<tab-data-preview :param="param" :table="table" :fields="fields" :data="data" :page="page" :form="tableViewRowForm" @reSearch="reSearch" />
</el-tab-pane>
<el-tab-pane v-if="table.type !== 'custom' && table.mode === 1" :label="$t('dataset.join_view')" name="joinView">
<union-view :table="table" />
<union-view :param="param" :table="table" />
</el-tab-pane>
<el-tab-pane v-if="table.mode === 1 && (table.type === 'db' || table.type === 'sql')" :label="$t('dataset.update_info')" name="updateInfo">
<update-info :table="table" />
<update-info :param="param" :table="table" />
</el-tab-pane>
</el-tabs>
</el-row>
@ -70,7 +70,7 @@ export default {
components: { UnionView, DatasetChartDetail, UpdateInfo, TabDataPreview },
props: {
param: {
type: String,
type: Object,
required: true
}
},
@ -94,21 +94,21 @@ export default {
}
},
computed: {
tableRefresh() {
this.initTable(this.param)
return this.$store.state.dataset.table
}
// tableRefresh() {
// this.initTable(this.param)
// return this.$store.state.dataset.table
// }
},
watch: {
'param': function() {
this.initTable(this.param)
this.initTable(this.param.id)
}
},
created() {
},
mounted() {
this.initTable(this.param)
this.initTable(this.param.id)
},
methods: {
initTable(id) {

View File

@ -672,7 +672,7 @@ export default {
// }
if (data.type !== 'group') {
this.$emit('switchComponent', { name: 'ViewTable', param: data.id })
this.$emit('switchComponent', { name: 'ViewTable', param: data })
}
// if (node.expanded) {
// this.expandedArray.push(data.id)

View File

@ -26,7 +26,7 @@ import AddExcel from './add/AddExcel'
import AddCustom from './add/AddCustom'
import FieldEdit from './data/FieldEdit'
import { removeClass } from '@/utils'
import bus from '@/utils/bus'
export default {
name: 'DataSet',
components: { DeMainContainer, DeContainer, DeAsideContainer, Group, DataHome, ViewTable, AddDB, AddSQL, AddExcel, AddCustom },
@ -39,27 +39,31 @@ export default {
},
mounted() {
removeClass(document.body, 'showRightPanel')
bus.$on('to-msg-dataset', params => {
this.toMsgShare(params)
})
},
created() {
this.$store.dispatch('app/toggleSideBarHide', true)
let routerParam
if ((routerParam = this.$router.currentRoute.params) !== null && routerParam.msgNotification) {
//
if (routerParam.msgType === 1) { //
if (routerParam.sourceParam) {
try {
const msgParam = JSON.parse(routerParam.sourceParam)
this.param = msgParam.tableId
this.component = ViewTable
this.$nextTick(() => {
this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
})
} catch (error) {
console.error(error)
}
}
}
}
const routerParam = this.$router.currentRoute.params
this.toMsgShare(routerParam)
// if ((routerParam = this.$router.currentRoute.params) !== null && routerParam.msgNotification) {
// //
// if (routerParam.msgType === 1) { //
// if (routerParam.sourceParam) {
// try {
// const msgParam = JSON.parse(routerParam.sourceParam)
// this.param = msgParam.tableId
// this.component = ViewTable
// this.$nextTick(() => {
// this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
// })
// } catch (error) {
// console.error(error)
// }
// }
// }
// }
},
methods: {
switchComponent(c) {
@ -91,6 +95,26 @@ export default {
saveSuccess(val) {
this.saveStatus = val
},
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
//
if (routerParam.msgType === 1) { //
if (routerParam.sourceParam) {
try {
const msgParam = JSON.parse(routerParam.sourceParam)
this.param = msgParam.tableId
this.component = ViewTable
this.$nextTick(() => {
this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
})
} catch (error) {
console.error(error)
}
}
}
}
}
}
}

View File

@ -11,10 +11,11 @@
:pagination-config="paginationConfig"
@select="select"
@search="search"
@sort-change="sortChange"
>
<el-table-column prop="content" :label="$t('commons.name')">
<template v-slot:default="scope">
<el-table-column prop="content" :label="$t('webmsg.content')">
<template slot-scope="scope">
<span style="display: flex;flex: 1;">
<span>
@ -29,13 +30,13 @@
</template>
</el-table-column>
<el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template v-slot:default="scope">
<el-table-column prop="createTime" sortable="custom" :label="$t('webmsg.sned_time')" width="180">
<template slot-scope="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="type" :label="$t('datasource.type')" width="120">
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
<template slot-scope="scope">
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
</template>
@ -52,6 +53,8 @@ import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query, updateStatus } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import bus from '@/utils/bus'
import { addOrder, formatOrders } from '@/utils/index'
export default {
components: {
LayoutContent,
@ -75,7 +78,8 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0
}
},
orderConditions: []
}
},
mounted() {
@ -91,6 +95,13 @@ export default {
if (this.selectType >= 0) {
param.type = this.selectType
}
if (this.orderConditions.length === 0) {
param.orders = [' status asc ', 'create_time desc ']
} else {
param.orders = formatOrders(this.orderConditions)
}
const { currentPage, pageSize } = this.paginationConfig
query(currentPage, pageSize, param).then(response => {
this.data = response.data.listObject
@ -106,13 +117,26 @@ export default {
toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param })
this.setReaded(row)
row.status || this.setReaded(row)
},
//
setReaded(row) {
updateStatus(row.msgId).then(res => {
bus.$emit('refresh-top-notification')
this.search()
})
},
sortChange({ column, prop, order }) {
this.orderConditions = []
if (!order) {
this.search()
return
}
if (prop === 'createTime') {
prop = 'create_time'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
}
}

View File

@ -11,10 +11,11 @@
:pagination-config="paginationConfig"
@select="select"
@search="search"
@sort-change="sortChange"
>
<el-table-column prop="content" :label="$t('commons.name')">
<template v-slot:default="scope">
<el-table-column prop="content" :label="$t('webmsg.content')">
<template slot-scope="scope">
<span style="display: flex;flex: 1;">
<span>
@ -29,13 +30,19 @@
</template>
</el-table-column>
<el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template v-slot:default="scope">
<el-table-column prop="createTime" sortable="custom" :label="$t('webmsg.sned_time')" width="180">
<template slot-scope="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="type" :label="$t('datasource.type')" width="120">
<el-table-column prop="readTime" sortable="custom" :label="$t('webmsg.read_time')" width="180">
<template slot-scope="scope">
<span>{{ scope.row.readTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
<template slot-scope="scope">
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
</template>
@ -52,6 +59,7 @@ import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import { addOrder, formatOrders } from '@/utils/index'
export default {
components: {
LayoutContent,
@ -70,6 +78,7 @@ export default {
allTypes: [{ name: 'mysql', type: 'jdbc' }, { name: 'sqlServer', type: 'jdbc' }],
columns: [],
orderConditions: [],
paginationConfig: {
currentPage: 1,
@ -91,6 +100,13 @@ export default {
if (this.selectType >= 0) {
param.type = this.selectType
}
if (this.orderConditions.length === 0) {
param.orders = [' create_time desc ']
} else {
param.orders = formatOrders(this.orderConditions)
}
const { currentPage, pageSize } = this.paginationConfig
query(currentPage, pageSize, param).then(response => {
this.data = response.data.listObject
@ -106,6 +122,21 @@ export default {
toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param })
},
sortChange({ column, prop, order }) {
this.orderConditions = []
if (!order) {
this.search()
return
}
if (prop === 'createTime') {
prop = 'create_time'
}
if (prop === 'readTime') {
prop = 'read_time'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
}
}

View File

@ -9,12 +9,22 @@
:data="data"
:columns="columns"
:pagination-config="paginationConfig"
:search-config="searchConfig"
@select="select"
@search="search"
@selection-change="handleSelectionChange"
@sort-change="sortChange"
>
<el-table-column prop="content" :label="$t('commons.name')">
<template v-slot:default="scope">
<template #toolbar>
<el-button :disabled="multipleSelection.length === 0" @click="markReaded">{{ $t('webmsg.mark_readed') }}</el-button>
<!-- <fu-table-button v-permission="['user:add']" icon="el-icon-circle-plus-outline" :label="$t('user.create')" @click="create" /> -->
</template>
<el-table-column
type="selection"
width="55"
/>
<el-table-column prop="content" :label="$t('webmsg.content')">
<template slot-scope="scope">
<span style="display: flex;flex: 1;">
<span>
@ -29,13 +39,13 @@
</template>
</el-table-column>
<el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template v-slot:default="scope">
<el-table-column prop="createTime" sortable="custom" :label="$t('webmsg.sned_time')" width="180">
<template slot-scope="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="type" :label="$t('datasource.type')" width="120">
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
<template slot-scope="scope">
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
</template>
@ -50,8 +60,11 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query, updateStatus } from '@/api/system/msg'
import { query, updateStatus, batchRead } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import bus from '@/utils/bus'
import { addOrder, formatOrders } from '@/utils/index'
export default {
components: {
LayoutContent,
@ -75,7 +88,13 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0
}
},
searchConfig: {
useQuickSearch: false,
useComplexSearch: false
},
multipleSelection: [],
orderConditions: []
}
},
mounted() {
@ -91,6 +110,13 @@ export default {
if (this.selectType >= 0) {
param.type = this.selectType
}
if (this.orderConditions.length === 0) {
param.orders = [' create_time desc ']
} else {
param.orders = formatOrders(this.orderConditions)
}
const { currentPage, pageSize } = this.paginationConfig
query(currentPage, pageSize, param).then(response => {
this.data = response.data.listObject
@ -111,9 +137,37 @@ export default {
//
setReaded(row) {
updateStatus(row.msgId).then(res => {
bus.$emit('refresh-top-notification')
this.search()
})
},
markReaded() {
if (this.multipleSelection.length === 0) {
this.$warning(this.$t('webmsg.please_select'))
return
}
const param = this.multipleSelection.map(item => item.msgId)
batchRead(param).then(res => {
this.$success('webmsg.mark_success')
this.search()
})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
sortChange({ column, prop, order }) {
this.orderConditions = []
if (!order) {
this.search()
return
}
if (prop === 'createTime') {
prop = 'create_time'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
}
}
}

View File

@ -158,6 +158,12 @@ export default {
return roots
},
getSelected() {
return {
deptIds: this.$refs.table.store.states.selection.map(item => item.deptId)
}
},
save(msg) {
const rows = this.$refs.table.store.states.selection
const request = this.buildRequest(rows)

View File

@ -26,6 +26,7 @@
import GrantDept from './dept'
import GrantRole from './role'
import GrantUser from './user'
import { fineSave } from '@/api/panel/share'
export default {
name: 'GrantAuth',
components: { GrantDept, GrantRole, GrantUser },
@ -58,8 +59,27 @@ export default {
this.showSearchInput = false
},
save() {
this.$refs[this.activeName].save(this.$t('commons.share_success'))
this.$emit('close-grant', 0)
// this.$refs[this.activeName].save(this.$t('commons.share_success'))
// this.$emit('close-grant', 0)
this.fineSave()
},
fineSave() {
let targetDto = {}
this.tabNames.forEach(tabName => {
if (this.$refs[tabName] && this.$refs[tabName].getSelected) {
const tempSelected = this.$refs[tabName].getSelected()
targetDto = Object.assign({}, targetDto, tempSelected)
}
})
const resourceId = this.resourceId
const param = {
resourceId,
authURD: targetDto
}
fineSave(param).then(res => {
this.$success(this.$t('commons.share_success'))
this.$emit('close-grant', 0)
})
},
cancel() {
this.$refs[this.activeName].cancel()

View File

@ -78,6 +78,13 @@ export default {
this.setCheckNodes()
})
},
getSelected() {
return {
roleIds: this.$refs.table.store.states.selection.map(item => item.roleId)
}
},
save(msg) {
const rows = this.$refs.table.store.states.selection
const request = this.buildRequest(rows)

View File

@ -71,7 +71,7 @@ export default {
return data
},
expandMsgNode(panelIds) {
console.log(panelIds)
// console.log(panelIds)
this.$nextTick(() => {
this.getMsgNodes(panelIds)
})

View File

@ -86,6 +86,12 @@ export default {
})
},
getSelected() {
return {
userIds: this.$refs.table.store.states.selection.map(item => item.userId)
}
},
save(msg) {
const rows = this.$refs.table.store.states.selection
const request = this.buildRequest(rows)

View File

@ -2,13 +2,19 @@
<el-col v-loading="loading">
<el-row style="margin-top: 5px">
<el-row style="margin-left: 5px;margin-right: 5px">
<el-input
v-model="templateFilterText"
:placeholder="$t('panel.filter_keywords')"
size="mini"
clearable
prefix-icon="el-icon-search"
/>
<el-col :span="16">
<el-input
v-model="templateFilterText"
:placeholder="$t('panel.filter_keywords')"
size="mini"
clearable
prefix-icon="el-icon-search"
/>
</el-col>
<el-col :span="7">
<el-button type="primary" size="mini" style="float: right" @click="newChart">新建 </el-button>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-tree
@ -117,6 +123,9 @@ export default {
},
allowDrop(draggingNode, dropNode, type) {
return false
},
newChart() {
this.$emit('newChart')
}
}

View File

@ -9,6 +9,7 @@
<!--横向工具栏-->
<el-col :span="16">
<Toolbar
ref="toolbar"
:style-button-active="show&&showIndex===2"
:aided-button-active="aidedButtonActive"
@showPanel="showPanel"
@ -87,7 +88,7 @@
:close-on-press-escape="false"
:modal-append-to-body="true"
>
<view-select v-show=" show && showIndex===0" />
<view-select v-show=" show && showIndex===0" @newChart="newChart" />
<filter-group v-show=" show &&showIndex===1" />
<subject-setting v-show=" show &&showIndex===2" />
<assist-component v-show=" show &&showIndex===3" />
@ -100,6 +101,7 @@
@dragover="handleDragOver"
@mousedown="handleMouseDown"
@mouseup="deselectCurComponent"
@scroll="canvasScroll"
>
<Editor v-if="!previewVisible" :out-style="outStyle" />
</div>
@ -157,8 +159,17 @@
<input id="input" ref="files" type="file" accept="image/*" hidden @change="handleFileChange">
<!--矩形样式组件-->
<RectangleAttr v-if="curComponent&&curComponent.type==='rect-shape'" />
<TextAttr v-if="curComponent&&curComponent.type==='v-text'" />
<RectangleAttr v-if="curComponent&&curComponent.type==='rect-shape'" :scroll-left="scrollLeft" :scroll-top="scrollTop" />
<TextAttr v-if="curComponent&&curComponent.type==='v-text'" :scroll-left="scrollLeft" :scroll-top="scrollTop" />
<!--复用ChartGroup组件 不做显示-->
<ChartGroup
ref="chartGroup"
:opt-from="'panel'"
:advice-group-id="adviceGroupId"
style="height: 0px;width:0px;padding:0px;overflow: hidden"
@newViewInfo="newViewInfo"
/>
</el-row>
</template>
@ -187,6 +198,8 @@ import AttrListExtend from '@/components/canvas/components/AttrListExtend'
import elementResizeDetectorMaker from 'element-resize-detector'
import AssistComponent from '@/views/panel/AssistComponent'
import PanelTextEditor from '@/components/canvas/custom-component/PanelTextEditor'
import ChartGroup from '@/views/chart/group/Group'
import { searchAdviceSceneId } from '@/api/chart/chart'
//
import '@/components/canvas/assets/iconfont/iconfont.css'
@ -220,7 +233,8 @@ export default {
AssistComponent,
PanelTextEditor,
RectangleAttr,
TextAttr
TextAttr,
ChartGroup
},
data() {
return {
@ -255,7 +269,10 @@ export default {
},
beforeDialogValue: [],
styleDialogVisible: false,
currentDropElement: null
currentDropElement: null,
adviceGroupId: null,
scrollLeft: 0,
scrollTop: 0
}
},
@ -293,6 +310,8 @@ export default {
// this.restore()
//
listenGlobalKeyDown()
this.$store.commit('setCurComponent', { component: null, index: null })
},
mounted() {
// this.insertToBody()
@ -605,6 +624,54 @@ export default {
} else {
return y
}
},
newChart() {
this.adviceGroupId = null
this.show = false
searchAdviceSceneId(this.panelInfo.id).then(res => {
this.adviceGroupId = res.data
this.$refs['chartGroup'].selectTable()
})
},
newViewInfo(newViewInfo) {
debugger
let component
const newComponentId = uuid.v1()
//
componentList.forEach(componentTemp => {
if (componentTemp.type === 'view') {
component = deepCopy(componentTemp)
const propValue = {
id: newComponentId,
viewId: newViewInfo.id
}
component.propValue = propValue
component.filters = []
}
})
// position = absolution
component.style.top = 0
component.style.left = 600
component.id = newComponentId
this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot')
this.clearCurrentInfo()
this.$store.commit('setCurComponent', { component: component, index: this.componentData.length - 1 })
//
this.$store.dispatch('panel/setComponentDataTemp', JSON.stringify(this.componentData))
this.$store.dispatch('panel/setCanvasStyleDataTemp', JSON.stringify(this.canvasStyleData))
if (this.curComponent.type === 'view') {
this.$store.dispatch('chart/setViewId', null)
this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId)
bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }})
}
},
canvasScroll(event) {
debugger
this.scrollLeft = event.target.scrollLeft
this.scrollTop = event.target.scrollTop
}
}
}

View File

@ -27,7 +27,17 @@ export default {
param: {}
}
},
watch: {
$route(to, from) {
console.log(to)
console.log(from)
// ...
}
},
mounted() {
bus.$on('to-msg-share', params => {
this.toMsgShare(params)
})
bus.$on('PanelSwitchComponent', (c) => {
this.param = c.param
this.componentName = c.name
@ -50,18 +60,30 @@ export default {
},
created() {
this.$store.dispatch('app/toggleSideBarHide', true)
let routerParam
if ((routerParam = this.$router.currentRoute.params) !== null && routerParam.msgNotification) {
//
if (routerParam.msgType === 0) { //
this.componentName = 'PanelMain'
this.$nextTick(() => {
this.$refs.panel_main.msg2Current(routerParam.sourceParam)
})
}
}
const routerParam = this.$router.currentRoute.params
// if ((routerParam = this.$router.currentRoute.params) !== null && routerParam.msgNotification) {
// //
// if (routerParam.msgType === 0) { //
// this.componentName = 'PanelMain'
// this.$nextTick(() => {
// this.$refs.panel_main.msg2Current(routerParam.sourceParam)
// })
// }
// }
this.toMsgShare(routerParam)
},
methods: {
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
//
if (routerParam.msgType === 0) { //
this.componentName = 'PanelMain'
this.$nextTick(() => {
this.$refs.panel_main.msg2Current(routerParam.sourceParam)
})
}
}
}
}
}

View File

@ -8,7 +8,7 @@
</el-tab-pane>
<el-tab-pane name="panels_star" :lazy="true">
<span slot="label"><i class="el-icon-star-off" />{{ $t('panel.store') }}</span>
<enshrine v-if="showEnshrine" />
<enshrine v-if="activeName==='panels_star'" />
</el-tab-pane>
<el-tab-pane name="panels_share" :lazy="true">
<span slot="label"><i class="el-icon-share" />{{ $t('panel.share') }}</span>
@ -17,7 +17,7 @@
</el-tabs>
</de-aside-container>
<de-main-container>
<PanelViewShow v-if="mainActiveName==='PanelMain'" />
<PanelViewShow v-if="mainActiveName==='PanelMain'" :active-tab="activeName" />
</de-main-container>
</de-container>
</template>

View File

@ -83,6 +83,12 @@ import bus from '@/utils/bus'
export default {
name: 'PanelViewShow',
components: { Preview, SaveToTemplate },
props: {
activeTab: {
type: String,
required: false
}
},
data() {
return {
showMain: true,
@ -194,7 +200,9 @@ export default {
})
},
refreshStarList(isStar) {
bus.$emit('panle_start_list_refresh', isStar)
if (this.activeTab !== 'PanelList') {
bus.$emit('panle_start_list_refresh', isStar)
}
}
}

View File

@ -114,7 +114,7 @@ export default {
},
mounted() {
this.queryTreeDatas()
console.log('permis:' + JSON.stringify(this.$store.getters.permissions))
// console.log('permis:' + JSON.stringify(this.$store.getters.permissions))
},
methods: {
filterNode(value, data) {
@ -154,7 +154,7 @@ export default {
return 'MySQL'
} else if (type === 'sqlServer') {
return 'SQL Server'
}else if (type === 'oracle') {
} else if (type === 'oracle') {
return 'Oracle'
}
},

View File

@ -52,8 +52,8 @@
</el-button>
</el-form-item>
<el-form-item :label="$t('datasource.schema')" v-if="form.type=='oracle'">
<el-select v-model="form.configuration.schema" :placeholder="$t('datasource.please_choose_schema')" class="select-width" :disabled="formType=='modify'" >
<el-form-item v-if="form.type=='oracle'" :label="$t('datasource.schema')">
<el-select v-model="form.configuration.schema" :placeholder="$t('datasource.please_choose_schema')" class="select-width" :disabled="formType=='modify'">
<el-option
v-for="item in schemas"
:key="item"
@ -78,7 +78,7 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import {addDs, editDs, getSchema, validateDs} from '@/api/system/datasource'
import { addDs, editDs, getSchema, validateDs } from '@/api/system/datasource'
export default {
name: 'DsForm',
components: { LayoutContent },
@ -148,7 +148,7 @@ export default {
this.$refs.dsForm.resetFields()
},
save() {
if(!this.form.configuration.schema){
if (!this.form.configuration.schema) {
this.$message.error(this.$t('datasource.please_choose_schema'))
return
}
@ -167,7 +167,7 @@ export default {
}
})
},
getSchema(){
getSchema() {
this.$refs.dsForm.validate(valid => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.form))