Merge branch 'dev' into pr@dev@feat_theme_switch

This commit is contained in:
fit2cloud-chenyw 2021-09-03 14:48:43 +08:00 committed by GitHub
commit b68888bc27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 1681 additions and 233 deletions

View File

@ -0,0 +1,21 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class PanelPdfTemplate implements Serializable {
private String id;
private String name;
private Long createTime;
private String createUser;
private Integer sort;
private String templateContent;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,530 @@
package io.dataease.base.domain;
import java.util.ArrayList;
import java.util.List;
public class PanelPdfTemplateExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public PanelPdfTemplateExample() {
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 andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
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 andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
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.PanelPdfTemplate;
import io.dataease.base.domain.PanelPdfTemplateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface PanelPdfTemplateMapper {
long countByExample(PanelPdfTemplateExample example);
int deleteByExample(PanelPdfTemplateExample example);
int deleteByPrimaryKey(String id);
int insert(PanelPdfTemplate record);
int insertSelective(PanelPdfTemplate record);
List<PanelPdfTemplate> selectByExampleWithBLOBs(PanelPdfTemplateExample example);
List<PanelPdfTemplate> selectByExample(PanelPdfTemplateExample example);
PanelPdfTemplate selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") PanelPdfTemplate record, @Param("example") PanelPdfTemplateExample example);
int updateByExampleWithBLOBs(@Param("record") PanelPdfTemplate record, @Param("example") PanelPdfTemplateExample example);
int updateByExample(@Param("record") PanelPdfTemplate record, @Param("example") PanelPdfTemplateExample example);
int updateByPrimaryKeySelective(PanelPdfTemplate record);
int updateByPrimaryKeyWithBLOBs(PanelPdfTemplate record);
int updateByPrimaryKey(PanelPdfTemplate record);
}

View File

@ -0,0 +1,270 @@
<?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.PanelPdfTemplateMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelPdfTemplate">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.PanelPdfTemplate">
<result column="template_content" jdbcType="LONGVARCHAR" property="templateContent" />
</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, `name`, create_time, create_user, sort
</sql>
<sql id="Blob_Column_List">
template_content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.PanelPdfTemplateExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from panel_pdf_template
<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.PanelPdfTemplateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from panel_pdf_template
<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_pdf_template
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from panel_pdf_template
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.PanelPdfTemplateExample">
delete from panel_pdf_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.PanelPdfTemplate">
insert into panel_pdf_template (id, `name`, create_time,
create_user, sort, template_content
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{templateContent,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelPdfTemplate">
insert into panel_pdf_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
`name`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="sort != null">
sort,
</if>
<if test="templateContent != null">
template_content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="templateContent != null">
#{templateContent,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.PanelPdfTemplateExample" resultType="java.lang.Long">
select count(*) from panel_pdf_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update panel_pdf_template
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.templateContent != null">
template_content = #{record.templateContent,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update panel_pdf_template
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
template_content = #{record.templateContent,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update panel_pdf_template
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.PanelPdfTemplate">
update panel_pdf_template
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="templateContent != null">
template_content = #{templateContent,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.PanelPdfTemplate">
update panel_pdf_template
set `name` = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
template_content = #{templateContent,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelPdfTemplate">
update panel_pdf_template
set `name` = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -17,7 +17,7 @@
<where> <where>
FIND_IN_SET(chart_group.id,cids) FIND_IN_SET(chart_group.id,cids)
</where> </where>
order by create_time desc order by `type` desc,name asc
</select> </select>
@ -27,7 +27,7 @@
<where> <where>
FIND_IN_SET(chart_view.id,cids) FIND_IN_SET(chart_view.id,cids)
</where> </where>
order by create_time desc order by `type` desc,name asc
</select> </select>

View File

@ -7,6 +7,7 @@ public class DeTypeConstants {
public final static Integer DE_INT = 2; public final static Integer DE_INT = 2;
public final static Integer DE_FLOAT = 3; public final static Integer DE_FLOAT = 3;
public final static Integer DE_BOOL = 4; public final static Integer DE_BOOL = 4;
public final static Integer DE_Binary = 5; public final static Integer DE_LOCATION = 5;
public final static Integer DE_BINARY = 6;
} }

View File

@ -0,0 +1,33 @@
package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.PanelPdfTemplate;
import io.dataease.service.panel.PanelPdfTemplateService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2021-03-05
* Description:
*/
@Api(tags = "仪表板PDF导出模板")
@ApiSupport(order = 170)
@RestController
@RequestMapping("pdf-template")
public class PanelPdfTemplateController {
@Resource
private PanelPdfTemplateService panelPdfTemplateService;
@GetMapping("queryAll")
public List<PanelPdfTemplate> queryAll(){
return panelPdfTemplateService.queryAll();
}
}

View File

@ -528,6 +528,9 @@ public class JdbcProvider extends DatasourceProvider {
return "show tables;"; return "show tables;";
case sqlServer: case sqlServer:
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class); SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class);
if(StringUtils.isEmpty(sqlServerConfigration.getSchema())){
throw new Exception(Translator.get("i18n_schema_is_empty"));
}
return "SELECT TABLE_NAME FROM DATABASE.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'DS_SCHEMA' ;" return "SELECT TABLE_NAME FROM DATABASE.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'DS_SCHEMA' ;"
.replace("DATABASE", sqlServerConfigration.getDataBase()) .replace("DATABASE", sqlServerConfigration.getDataBase())
.replace("DS_SCHEMA", sqlServerConfigration.getSchema()); .replace("DS_SCHEMA", sqlServerConfigration.getSchema());

View File

@ -19,6 +19,8 @@ public class DorisConstants extends SQLConstants {
public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')"; public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')";
public static final String STR_TO_DATE = "STR_TO_DATE(%s,'%s')";
public static final String CAST = "CAST(%s AS %s)"; public static final String CAST = "CAST(%s AS %s)";
public static final String DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%i:%S"; public static final String DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%i:%S";

View File

@ -686,9 +686,14 @@ public class DorisQueryProvider extends QueryProvider {
originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName()); originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000"; if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT); whereName = String.format(DorisConstants.STR_TO_DATE, originName, DorisConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
}
} else if (field.getDeType() == 0) { } else if (field.getDeType() == 0) {
whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR); whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR);
} else { } else {
@ -738,9 +743,14 @@ public class DorisQueryProvider extends QueryProvider {
originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName()); originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000"; if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT); whereName = String.format(DorisConstants.STR_TO_DATE, originName, DorisConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
}
} else if (field.getDeType() == 0) { } else if (field.getDeType() == 0) {
whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR); whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR);
} else { } else {

View File

@ -19,6 +19,8 @@ public class MySQLConstants extends SQLConstants {
public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')"; public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')";
public static final String STR_TO_DATE = "STR_TO_DATE(%s,'%s')";
public static final String CAST = "CAST(%s AS %s)"; public static final String CAST = "CAST(%s AS %s)";
public static final String DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%i:%S"; public static final String DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%i:%S";

View File

@ -671,9 +671,14 @@ public class MysqlQueryProvider extends QueryProvider {
} else { } else {
originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000"; if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT); whereName = String.format(MySQLConstants.STR_TO_DATE, originName, MySQLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
}
} else { } else {
whereName = originName; whereName = originName;
} }
@ -721,9 +726,14 @@ public class MysqlQueryProvider extends QueryProvider {
originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000"; if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT); whereName = String.format(MySQLConstants.STR_TO_DATE, originName, MySQLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
}
} else { } else {
whereName = originName; whereName = originName;
} }

View File

@ -645,7 +645,7 @@ public class OracleQueryProvider extends QueryProvider {
stringBuilder.append(" \"").append(f.getOriginName()).append("\""); stringBuilder.append(" \"").append(f.getOriginName()).append("\"");
return stringBuilder.toString(); return stringBuilder.toString();
}).toArray(String[]::new); }).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY null", StringUtils.join(array, ","), " (" + sqlFix(sql) + ") DE_TMP " ); return MessageFormat.format("SELECT {0} FROM {1} ORDER BY null", StringUtils.join(array, ","), " (" + sqlFix(sql) + ") DE_TMP ");
} }
public String transMysqlFilterTerm(String term) { public String transMysqlFilterTerm(String term) {
@ -706,9 +706,14 @@ public class OracleQueryProvider extends QueryProvider {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000"; if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, OracleConstants.DEFAULT_DATE_FORMAT); whereName = String.format(OracleConstants.TO_DATE, originName, OracleConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, OracleConstants.DEFAULT_DATE_FORMAT);
}
} else { } else {
whereName = originName; whereName = originName;
} }
@ -721,7 +726,11 @@ public class OracleQueryProvider extends QueryProvider {
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) { } else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {
whereValue = "'%" + value + "%'"; whereValue = "'%" + value + "%'";
} else { } else {
whereValue = String.format(OracleConstants.WHERE_VALUE_VALUE, value); if (field.getDeType() == 1) {
whereValue = String.format(OracleConstants.TO_DATE, "'" + value + "'", OracleConstants.DEFAULT_DATE_FORMAT);
} else {
whereValue = String.format(OracleConstants.WHERE_VALUE_VALUE, value);
}
} }
list.add(SQLObj.builder() list.add(SQLObj.builder()
.whereField(whereName) .whereField(whereName)
@ -756,9 +765,14 @@ public class OracleQueryProvider extends QueryProvider {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000"; if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, OracleConstants.DEFAULT_DATE_FORMAT); whereName = String.format(OracleConstants.TO_DATE, originName, OracleConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, OracleConstants.DEFAULT_DATE_FORMAT);
}
} else { } else {
whereName = originName; whereName = originName;
} }
@ -772,7 +786,9 @@ public class OracleQueryProvider extends QueryProvider {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0)))); String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1)))); String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
whereValue = String.format(OracleConstants.WHERE_BETWEEN, startTime, endTime); String st = String.format(OracleConstants.TO_DATE, "'" + startTime + "'", OracleConstants.DEFAULT_DATE_FORMAT);
String et = String.format(OracleConstants.TO_DATE, "'" + endTime + "'", OracleConstants.DEFAULT_DATE_FORMAT);
whereValue = st + " AND " + et;
} else { } else {
whereValue = String.format(OracleConstants.WHERE_BETWEEN, value.get(0), value.get(1)); whereValue = String.format(OracleConstants.WHERE_BETWEEN, value.get(0), value.get(1));
} }

View File

@ -19,6 +19,8 @@ public class PgConstants extends SQLConstants {
public static final String FROM_UNIXTIME = "to_timestamp(%s)"; public static final String FROM_UNIXTIME = "to_timestamp(%s)";
public static final String TO_DATE = "to_date(%s,'%s')";
public static final String CAST = "CAST(%s AS %s)"; public static final String CAST = "CAST(%s AS %s)";
public static final String DEFAULT_DATE_FORMAT = "'YYYY-MM-DD HH24:MI:SS'"; public static final String DEFAULT_DATE_FORMAT = "'YYYY-MM-DD HH24:MI:SS'";

View File

@ -32,7 +32,6 @@ import java.util.regex.Pattern;
import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX; import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
@Service("pgQuery") @Service("pgQuery")
public class PgQueryProvider extends QueryProvider { public class PgQueryProvider extends QueryProvider {
@Resource @Resource
@ -86,7 +85,7 @@ public class PgQueryProvider extends QueryProvider {
case "TINYINT": case "TINYINT":
return DeTypeConstants.DE_BOOL;// 布尔 return DeTypeConstants.DE_BOOL;// 布尔
case "bytea": case "bytea":
return DeTypeConstants.DE_Binary;// 二进制 return DeTypeConstants.DE_BINARY;// 二进制
default: default:
return DeTypeConstants.DE_STRING; return DeTypeConstants.DE_STRING;
} }
@ -100,11 +99,11 @@ public class PgQueryProvider extends QueryProvider {
@Override @Override
public String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup, Datasource ds) { public String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup, Datasource ds) {
SQLObj tableObj = SQLObj.builder() SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format( PgConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(fields)) { if (CollectionUtils.isNotEmpty(fields)) {
for (int i = 0; i < fields.size(); i++) { for (int i = 0; i < fields.size(); i++) {
@ -114,35 +113,35 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(f.getOriginName(), tableObj); originField = calcFieldRegex(f.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
String fieldName = ""; String fieldName = "";
// 处理横轴字段 // 处理横轴字段
if (f.getDeExtractType() == DeTypeConstants.DE_TIME) { if (f.getDeExtractType() == DeTypeConstants.DE_TIME) {
if (f.getDeType() == DeTypeConstants.DE_INT || f.getDeType() == DeTypeConstants.DE_FLOAT) { if (f.getDeType() == DeTypeConstants.DE_INT || f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format( PgConstants.UNIX_TIMESTAMP, originField); fieldName = String.format(PgConstants.UNIX_TIMESTAMP, originField);
} else { } else {
fieldName = originField; fieldName = originField;
} }
} else if (f.getDeExtractType() == DeTypeConstants.DE_STRING) { } else if (f.getDeExtractType() == DeTypeConstants.DE_STRING) {
if (f.getDeType() == DeTypeConstants.DE_INT) { if (f.getDeType() == DeTypeConstants.DE_INT) {
fieldName = String.format( PgConstants.CAST, originField, PgConstants.DEFAULT_INT_FORMAT); fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_INT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) { } else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format( PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT); fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) { } else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format( PgConstants.CAST, originField, "timestamp"); fieldName = String.format(PgConstants.CAST, originField, "timestamp");
} else { } else {
fieldName = originField; fieldName = originField;
} }
} else { } else {
if (f.getDeType() == DeTypeConstants.DE_TIME) { if (f.getDeType() == DeTypeConstants.DE_TIME) {
String cast = String.format( PgConstants.CAST, originField, "bigint"); String cast = String.format(PgConstants.CAST, originField, "bigint");
fieldName = String.format( PgConstants.FROM_UNIXTIME, cast ); fieldName = String.format(PgConstants.FROM_UNIXTIME, cast);
} else if (f.getDeType() == DeTypeConstants.DE_INT) { } else if (f.getDeType() == DeTypeConstants.DE_INT) {
fieldName = String.format( PgConstants.CAST, originField, PgConstants.DEFAULT_INT_FORMAT); fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_INT_FORMAT);
} else { } else {
fieldName = originField; fieldName = originField;
} }
@ -190,10 +189,10 @@ public class PgQueryProvider extends QueryProvider {
@Override @Override
public String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds) { public String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds) {
SQLObj tableObj = SQLObj.builder() SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format( PgConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>(); List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>(); List<SQLObj> xOrders = new ArrayList<>();
@ -205,9 +204,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj); originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段 // 处理横轴字段
@ -235,9 +234,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj); originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段 // 处理纵轴字段
@ -285,7 +284,7 @@ public class PgQueryProvider extends QueryProvider {
ST st = stg.getInstanceOf("querySql"); ST st = stg.getInstanceOf("querySql");
SQLObj tableSQL = SQLObj.builder() SQLObj tableSQL = SQLObj.builder()
.tableName(String.format( PgConstants.BRACKETS, sql)) .tableName(String.format(PgConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build(); .build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres); if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
@ -303,10 +302,10 @@ public class PgQueryProvider extends QueryProvider {
@Override @Override
public String getSQLStack(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extStack, Datasource ds) { public String getSQLStack(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extStack, Datasource ds) {
SQLObj tableObj = SQLObj.builder() SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format( PgConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>(); List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>(); List<SQLObj> xOrders = new ArrayList<>();
@ -321,9 +320,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj); originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段 // 处理横轴字段
@ -351,9 +350,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj); originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段 // 处理纵轴字段
@ -401,7 +400,7 @@ public class PgQueryProvider extends QueryProvider {
ST st = stg.getInstanceOf("querySql"); ST st = stg.getInstanceOf("querySql");
SQLObj tableSQL = SQLObj.builder() SQLObj tableSQL = SQLObj.builder()
.tableName(String.format( PgConstants.BRACKETS, sql)) .tableName(String.format(PgConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build(); .build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres); if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
@ -418,10 +417,10 @@ public class PgQueryProvider extends QueryProvider {
@Override @Override
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds) { public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds) {
SQLObj tableObj = SQLObj.builder() SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format( PgConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>(); List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>(); List<SQLObj> xOrders = new ArrayList<>();
@ -433,9 +432,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj); originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段 // 处理横轴字段
@ -466,9 +465,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj); originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段 // 处理纵轴字段
@ -516,7 +515,7 @@ public class PgQueryProvider extends QueryProvider {
ST st = stg.getInstanceOf("querySql"); ST st = stg.getInstanceOf("querySql");
SQLObj tableSQL = SQLObj.builder() SQLObj tableSQL = SQLObj.builder()
.tableName(String.format( PgConstants.BRACKETS, sql)) .tableName(String.format(PgConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build(); .build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres); if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
@ -539,7 +538,7 @@ public class PgQueryProvider extends QueryProvider {
public String getSQLSummary(String table, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) { public String getSQLSummary(String table, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
// 字段汇总 排序等 // 字段汇总 排序等
SQLObj tableObj = SQLObj.builder() SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format( PgConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
List<SQLObj> yFields = new ArrayList<>(); List<SQLObj> yFields = new ArrayList<>();
@ -553,9 +552,9 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj); originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else { } else {
originField = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()); originField = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} }
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i); String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段 // 处理纵轴字段
@ -598,7 +597,7 @@ public class PgQueryProvider extends QueryProvider {
ST st = stg.getInstanceOf("querySql"); ST st = stg.getInstanceOf("querySql");
SQLObj tableSQL = SQLObj.builder() SQLObj tableSQL = SQLObj.builder()
.tableName(String.format( PgConstants.BRACKETS, sql)) .tableName(String.format(PgConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build(); .build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres); if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
@ -629,11 +628,11 @@ public class PgQueryProvider extends QueryProvider {
stringBuilder.append("\"").append(f.getOriginName()).append("\" AS ").append(f.getDataeaseName()); stringBuilder.append("\"").append(f.getOriginName()).append("\" AS ").append(f.getDataeaseName());
return stringBuilder.toString(); return stringBuilder.toString();
}).toArray(String[]::new); }).toArray(String[]::new);
if(ds != null){ if (ds != null) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcDTO.class).getSchema(); String schema = new Gson().fromJson(ds.getConfiguration(), JdbcDTO.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table); String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema); return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema);
}else { } else {
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table); return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table);
} }
} }
@ -695,18 +694,23 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj); originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else { } else {
originName = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format( PgConstants.CAST, originName, "bigint"); if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format( PgConstants.FROM_UNIXTIME, cast); whereName = String.format(PgConstants.TO_DATE, originName, PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
whereName = String.format(PgConstants.FROM_UNIXTIME, cast);
}
} else { } else {
whereName = originName; whereName = originName;
} }
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) { if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
whereValue = PgConstants.WHERE_VALUE_NULL; whereValue = PgConstants.WHERE_VALUE_NULL;
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) { } else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
whereTerm = String.format(whereTerm, originName); whereTerm = String.format(whereTerm, originName);
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) { } else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
@ -714,7 +718,7 @@ public class PgQueryProvider extends QueryProvider {
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) { } else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {
whereValue = "'%" + value + "%'"; whereValue = "'%" + value + "%'";
} else { } else {
whereValue = String.format( PgConstants.WHERE_VALUE_VALUE, value); whereValue = String.format(PgConstants.WHERE_VALUE_VALUE, value);
} }
list.add(SQLObj.builder() list.add(SQLObj.builder()
.whereField(whereName) .whereField(whereName)
@ -744,14 +748,19 @@ public class PgQueryProvider extends QueryProvider {
// 解析origin name中有关联的字段生成sql表达式 // 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj); originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) { } else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else { } else {
originName = String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); originName = String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} }
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format( PgConstants.CAST, originName, "bigint"); if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format( PgConstants.FROM_UNIXTIME, cast); whereName = String.format(PgConstants.TO_DATE, originName, PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
whereName = String.format(PgConstants.FROM_UNIXTIME, cast);
}
} else { } else {
whereName = originName; whereName = originName;
} }
@ -765,12 +774,12 @@ public class PgQueryProvider extends QueryProvider {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0)))); String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1)))); String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
whereValue = String.format( PgConstants.WHERE_BETWEEN, startTime, endTime); whereValue = String.format(PgConstants.WHERE_BETWEEN, startTime, endTime);
} else { } else {
whereValue = String.format( PgConstants.WHERE_BETWEEN, value.get(0), value.get(1)); whereValue = String.format(PgConstants.WHERE_BETWEEN, value.get(0), value.get(1));
} }
} else { } else {
whereValue = String.format( PgConstants.WHERE_VALUE_VALUE, value.get(0)); whereValue = String.format(PgConstants.WHERE_VALUE_VALUE, value.get(0));
} }
list.add(SQLObj.builder() list.add(SQLObj.builder()
.whereField(whereName) .whereField(whereName)
@ -817,10 +826,10 @@ public class PgQueryProvider extends QueryProvider {
String fieldName = ""; String fieldName = "";
if (x.getDeExtractType() == DeTypeConstants.DE_TIME) { if (x.getDeExtractType() == DeTypeConstants.DE_TIME) {
if (x.getDeType() == 2 || x.getDeType() == 3) { if (x.getDeType() == 2 || x.getDeType() == 3) {
fieldName = String.format( PgConstants.UNIX_TIMESTAMP, originField); fieldName = String.format(PgConstants.UNIX_TIMESTAMP, originField);
} else if (x.getDeType() == DeTypeConstants.DE_TIME) { } else if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
fieldName = String.format( PgConstants.DATE_FORMAT, originField, format); fieldName = String.format(PgConstants.DATE_FORMAT, originField, format);
} else { } else {
fieldName = originField; fieldName = originField;
} }
@ -828,11 +837,11 @@ public class PgQueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) { if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) { if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
fieldName = String.format( PgConstants.DATE_FORMAT, originField, format); fieldName = String.format(PgConstants.DATE_FORMAT, originField, format);
} else { } else {
String cast = String.format( PgConstants.CAST, originField, "bigint"); String cast = String.format(PgConstants.CAST, originField, "bigint");
String from_unixtime = String.format( PgConstants.FROM_UNIXTIME, cast); String from_unixtime = String.format(PgConstants.FROM_UNIXTIME, cast);
fieldName = String.format( PgConstants.DATE_FORMAT, from_unixtime, format); fieldName = String.format(PgConstants.DATE_FORMAT, from_unixtime, format);
} }
} else { } else {
fieldName = originField; fieldName = originField;
@ -847,17 +856,17 @@ public class PgQueryProvider extends QueryProvider {
private SQLObj getYFields(ChartViewFieldDTO y, String originField, String fieldAlias) { private SQLObj getYFields(ChartViewFieldDTO y, String originField, String fieldAlias) {
String fieldName = ""; String fieldName = "";
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) { if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = PgConstants.AGG_COUNT; fieldName = PgConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) { } else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format( PgConstants.AGG_FIELD, y.getSummary(), originField); fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
} else { } else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) { if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format( PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT); String cast = String.format(PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT);
String agg = String.format( PgConstants.AGG_FIELD, y.getSummary(), cast); String agg = String.format(PgConstants.AGG_FIELD, y.getSummary(), cast);
fieldName = String.format( PgConstants.CAST, agg, PgConstants.DEFAULT_FLOAT_FORMAT); fieldName = String.format(PgConstants.CAST, agg, PgConstants.DEFAULT_FLOAT_FORMAT);
} else { } else {
String cast = String.format( PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT); String cast = String.format(PgConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? PgConstants.DEFAULT_INT_FORMAT : PgConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format( PgConstants.AGG_FIELD, y.getSummary(), cast); fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), cast);
} }
} }
return SQLObj.builder() return SQLObj.builder()
@ -874,7 +883,7 @@ public class PgQueryProvider extends QueryProvider {
String whereValue = ""; String whereValue = "";
// 原始类型不是时间在de中被转成时间的字段做处理 // 原始类型不是时间在de中被转成时间的字段做处理
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) { if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
whereValue = PgConstants.WHERE_VALUE_NULL; whereValue = PgConstants.WHERE_VALUE_NULL;
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) { } else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
whereTerm = String.format(whereTerm, originField); whereTerm = String.format(whereTerm, originField);
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
@ -882,7 +891,7 @@ public class PgQueryProvider extends QueryProvider {
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
whereValue = "'%" + f.getValue() + "%'"; whereValue = "'%" + f.getValue() + "%'";
} else { } else {
whereValue = String.format( PgConstants.WHERE_VALUE_VALUE, f.getValue()); whereValue = String.format(PgConstants.WHERE_VALUE_VALUE, f.getValue());
} }
list.add(SQLObj.builder() list.add(SQLObj.builder()
.whereField(fieldAlias) .whereField(fieldAlias)
@ -913,7 +922,7 @@ public class PgQueryProvider extends QueryProvider {
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample); List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
for (DatasetTableField ele : calcFields) { for (DatasetTableField ele : calcFields) {
originField = originField.replaceAll("\\[" + ele.getId() + "]", originField = originField.replaceAll("\\[" + ele.getId() + "]",
String.format( PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName())); String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
} }
return originField; return originField;
} }

View File

@ -13,6 +13,7 @@ import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj; import io.dataease.dto.sqlObj.SQLObj;
import io.dataease.provider.QueryProvider; import io.dataease.provider.QueryProvider;
import io.dataease.provider.SQLConstants; import io.dataease.provider.SQLConstants;
import io.dataease.provider.mysql.MySQLConstants;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -73,7 +74,7 @@ public class SqlserverQueryProvider extends QueryProvider {
case "TINYINT": case "TINYINT":
return DeTypeConstants.DE_BOOL;// 布尔 return DeTypeConstants.DE_BOOL;// 布尔
case "TIMESTAMP": case "TIMESTAMP":
return DeTypeConstants.DE_Binary;// 二进制 return DeTypeConstants.DE_BINARY;// 二进制
default: default:
return DeTypeConstants.DE_STRING; return DeTypeConstants.DE_STRING;
} }
@ -91,7 +92,7 @@ public class SqlserverQueryProvider extends QueryProvider {
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(fields)) { if (CollectionUtils.isNotEmpty(fields)) {
@ -159,12 +160,12 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override @Override
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit, boolean isGroup, Datasource ds) { public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit, boolean isGroup, Datasource ds) {
return createQuerySQL(table, fields, isGroup, ds) + " ORDER BY \"" + fields.get(0).getOriginName() + "\" offset 0 rows fetch next " + limit + " rows only"; return createQuerySQL(table, fields, isGroup, ds) + " ORDER BY \"" + fields.get(0).getOriginName() + "\" offset 0 rows fetch next " + limit + " rows only";
} }
@Override @Override
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit, boolean isGroup) { public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
return createQuerySQLAsTmp(sql, fields, isGroup) + " ORDER BY \"" + fields.get(0).getOriginName() + "\" offset 0 rows fetch next " + limit + " rows only"; return createQuerySQLAsTmp(sql, fields, isGroup) + " ORDER BY \"" + fields.get(0).getOriginName() + "\" offset 0 rows fetch next " + limit + " rows only";
} }
@Override @Override
@ -173,7 +174,7 @@ public class SqlserverQueryProvider extends QueryProvider {
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>(); List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>(); List<SQLObj> xOrders = new ArrayList<>();
@ -270,7 +271,7 @@ public class SqlserverQueryProvider extends QueryProvider {
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>(); List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>(); List<SQLObj> xOrders = new ArrayList<>();
@ -388,7 +389,7 @@ public class SqlserverQueryProvider extends QueryProvider {
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table)) .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build(); .build();
setSchema(tableObj,ds); setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>(); List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>(); List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>(); List<SQLObj> xOrders = new ArrayList<>();
@ -588,11 +589,11 @@ public class SqlserverQueryProvider extends QueryProvider {
stringBuilder.append("\"").append(f.getOriginName()).append("\" AS ").append(f.getDataeaseName()); stringBuilder.append("\"").append(f.getOriginName()).append("\" AS ").append(f.getDataeaseName());
return stringBuilder.toString(); return stringBuilder.toString();
}).toArray(String[]::new); }).toArray(String[]::new);
if(ds != null){ if (ds != null) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcDTO.class).getSchema(); String schema = new Gson().fromJson(ds.getConfiguration(), JdbcDTO.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table); String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema); return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema);
}else { } else {
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table); return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table);
} }
} }
@ -651,9 +652,15 @@ public class SqlserverQueryProvider extends QueryProvider {
String whereTerm = transMysqlFilterTerm(request.getTerm()); String whereTerm = transMysqlFilterTerm(request.getTerm());
String whereValue = ""; String whereValue = "";
String originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); String originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
if (field.getDeType() == DeTypeConstants.DE_TIME && field.getDeExtractType() != DeTypeConstants.DE_TIME) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000"); if (field.getDeType() == 1) {
whereName = String.format(SqlServerSQLConstants.FROM_UNIXTIME, cast); if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
whereName = String.format(SqlServerSQLConstants.FROM_UNIXTIME, cast);
}
} else { } else {
whereName = originName; whereName = originName;
} }
@ -692,9 +699,14 @@ public class SqlserverQueryProvider extends QueryProvider {
String whereValue = ""; String whereValue = "";
String originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName()); String originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
if (field.getDeType() == 1 && field.getDeExtractType() != 1) { if (field.getDeType() == 1) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000"); if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(SqlServerSQLConstants.FROM_UNIXTIME, cast); whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
whereName = String.format(SqlServerSQLConstants.FROM_UNIXTIME, cast);
}
} else { } else {
whereName = originName; whereName = originName;
} }
@ -744,30 +756,30 @@ public class SqlserverQueryProvider extends QueryProvider {
case "y": case "y":
return "CONVERT(varchar(100), datepart(yy, " + originField + "))"; return "CONVERT(varchar(100), datepart(yy, " + originField + "))";
case "y_M": case "y_M":
if(split.equalsIgnoreCase("-")){ if (split.equalsIgnoreCase("-")) {
return "substring( convert(varchar," + originField + ",120),1,7)"; return "substring( convert(varchar," + originField + ",120),1,7)";
}else { } else {
return "replace("+ "substring( convert(varchar," + originField + ",120),1,7), '-','/')"; return "replace(" + "substring( convert(varchar," + originField + ",120),1,7), '-','/')";
} }
case "y_M_d": case "y_M_d":
if(split.equalsIgnoreCase("-")){ if (split.equalsIgnoreCase("-")) {
return "CONVERT(varchar(100), " + originField + ", 23)"; return "CONVERT(varchar(100), " + originField + ", 23)";
}else { } else {
return "CONVERT(varchar(100), " + originField + ", 111)"; return "CONVERT(varchar(100), " + originField + ", 111)";
} }
case "H_m_s": case "H_m_s":
return "CONVERT(varchar(100), " + originField + ", 8)"; return "CONVERT(varchar(100), " + originField + ", 8)";
case "y_M_d_H_m": case "y_M_d_H_m":
if(split.equalsIgnoreCase("-")){ if (split.equalsIgnoreCase("-")) {
return "substring( convert(varchar," + originField + ",120),1,16)"; return "substring( convert(varchar," + originField + ",120),1,16)";
}else { } else {
return "replace("+ "substring( convert(varchar," + originField + ",120),1,16), '-','/')"; return "replace(" + "substring( convert(varchar," + originField + ",120),1,16), '-','/')";
} }
case "y_M_d_H_m_s": case "y_M_d_H_m_s":
if(split.equalsIgnoreCase("-")){ if (split.equalsIgnoreCase("-")) {
return "convert(varchar," + originField + ",120)"; return "convert(varchar," + originField + ",120)";
}else { } else {
return "replace("+ "convert(varchar," + originField + ",120), '-','/')"; return "replace(" + "convert(varchar," + originField + ",120), '-','/')";
} }
default: default:
return "convert(varchar," + originField + ",120)"; return "convert(varchar," + originField + ",120)";
@ -790,7 +802,7 @@ public class SqlserverQueryProvider extends QueryProvider {
String cast = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField); String cast = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField);
fieldName = transDateFormat(x.getDateStyle(), x.getDatePattern(), cast); fieldName = transDateFormat(x.getDateStyle(), x.getDatePattern(), cast);
} else {// 数值转时间 } else {// 数值转时间
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originField+ "/1000"); String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originField + "/1000");
fieldName = transDateFormat(x.getDateStyle(), x.getDatePattern(), cast); fieldName = transDateFormat(x.getDateStyle(), x.getDatePattern(), cast);
} }
} else { } else {

View File

@ -103,7 +103,19 @@ public class PanelGroupService {
newDefaultPanel.setCreateBy(AuthUtils.getUser().getUsername()); newDefaultPanel.setCreateBy(AuthUtils.getUser().getUsername());
checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId()); checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId());
panelGroupMapper.insertSelective(newDefaultPanel); panelGroupMapper.insertSelective(newDefaultPanel);
} else { } else if ("copy".equals(request.getOptType())) {
panelId = UUID.randomUUID().toString();
// 复制模板
PanelGroupWithBLOBs newPanel = panelGroupMapper.selectByPrimaryKey(request.getId());
// 插入校验
if (StringUtils.isNotEmpty(request.getName())) {
checkPanelName(request.getName(), newPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, request.getId());
}
newPanel.setName(request.getName());
newPanel.setId(panelId);
newPanel.setCreateBy(AuthUtils.getUser().getUsername());
panelGroupMapper.insertSelective(newPanel);
}else {
// 更新 // 更新
if (StringUtils.isNotEmpty(request.getName())) { if (StringUtils.isNotEmpty(request.getName())) {
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_UPDATE, request.getId()); checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_UPDATE, request.getId());

View File

@ -0,0 +1,27 @@
package io.dataease.service.panel;
import io.dataease.base.domain.PanelPdfTemplate;
import io.dataease.base.domain.PanelPdfTemplateExample;
import io.dataease.base.mapper.PanelPdfTemplateMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Author: wangjiahao
* Date: 9/1/21
* Description:
*/
@Service
public class PanelPdfTemplateService {
@Resource
private PanelPdfTemplateMapper panelPdfTemplateMapper;
public List<PanelPdfTemplate> queryAll(){
PanelPdfTemplateExample example = new PanelPdfTemplateExample();
example.setOrderByClause("sort asc");
return panelPdfTemplateMapper.selectByExampleWithBLOBs(example);
}
}

View File

@ -383,3 +383,72 @@ INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_typ
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dc1d32ff-064a-11ec-a2b0-0242ac130003', 'd78c6e77-9cc7-44f8-a730-32ca6ca33f60', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1629967913000, NULL); INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dc1d32ff-064a-11ec-a2b0-0242ac130003', 'd78c6e77-9cc7-44f8-a730-32ca6ca33f60', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1629967913000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dc1d3358-064a-11ec-a2b0-0242ac130003', 'd78c6e77-9cc7-44f8-a730-32ca6ca33f60', 'i18n_auth_manage', 5, 0, 'manage', '基础权限-管理', 'admin', 1629967913000, NULL); INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dc1d3358-064a-11ec-a2b0-0242ac130003', 'd78c6e77-9cc7-44f8-a730-32ca6ca33f60', 'i18n_auth_manage', 5, 0, 'manage', '基础权限-管理', 'admin', 1629967913000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dc1d33a4-064a-11ec-a2b0-0242ac130003', 'd78c6e77-9cc7-44f8-a730-32ca6ca33f60', 'i18n_auth_view', 1, 1, 'view', '基础权限-查看', 'admin', 1629967913000, NULL); INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dc1d33a4-064a-11ec-a2b0-0242ac130003', 'd78c6e77-9cc7-44f8-a730-32ca6ca33f60', 'i18n_auth_view', 1, 1, 'view', '基础权限-查看', 'admin', 1629967913000, NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('00590a7c-8e7b-45f4-8428-55532be07602', '10', 'menu', '1', 'role', 1630482462199, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('06ba0edb-143d-4b51-a864-8cfcf2b5d71e', '1', 'menu', '1', 'role', 1630482426344, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('1a18aa12-8daa-4f47-b5eb-999e473273df', '6', 'menu', '1', 'role', 1630482450994, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('1bf39d8d-7fe9-4832-8df3-f74b21a69288', '4', 'menu', '1', 'role', 1630482450458, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('359771bb-95b8-40ad-a6c5-b5c39c93cb10', '24', 'menu', '1', 'role', 1630482459156, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('5960fd93-013c-4636-8f6b-2e6b49b7e869', '5', 'menu', '1', 'role', 1630482450626, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('5e0a9ad5-81ed-4f83-91f6-a74be724bda7', '23', 'menu', '1', 'role', 1630482452131, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('5ec5c9a7-04c0-4655-9b63-9ca5a439e2f3', '18', 'menu', '1', 'role', 1630482451166, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('60b3644b-2493-4805-8204-90880cfac9c6', '8', 'menu', '1', 'role', 1630482460538, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('74ff225f-2a79-4221-9b32-c6eb9bcadd61', '19', 'menu', '1', 'role', 1630482451329, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('7823499e-dbb6-42a9-a28f-22377de18a39', '40', 'menu', '1', 'role', 1630482427369, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('88c778e6-ede3-4397-af4c-375e1feac8ef', '41', 'menu', '1', 'role', 1630482452340, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('998e402b-6f15-48dc-ae4d-2cd04460a3f3', '15', 'menu', '1', 'role', 1630482426695, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('9f01c7ef-753b-4dea-97d4-c199f84c2c74', '17', 'menu', '1', 'role', 1630482427049, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('a6837d68-80a6-4a26-a7c0-e84001dfc817', '34', 'menu', '1', 'role', 1630482458991, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('b319dc39-c499-423b-8e99-22e9a0caba6f', '58', 'menu', '1', 'role', 1630482427545, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('bdd3bed8-35d4-4aa8-84c2-85e2412d6cbb', '2', 'menu', '1', 'role', 1630482426513, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('c18b47e9-aa22-4f17-b12c-a3459ca4dd90', '28', 'menu', '1', 'role', 1630482427208, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('d3d558e5-b0b1-4475-bb69-f20fa5c47f4f', '22', 'menu', '1', 'role', 1630482451962, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('d400c00f-9c18-4eb6-a70f-9c8caf8dddfe', '21', 'menu', '1', 'role', 1630482451749, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('d8d18115-c7b9-4e99-96a8-fd1bbfddf543', '16', 'menu', '1', 'role', 1630482426857, NULL, 'admin', NULL);
INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`, `auth_target_type`, `auth_time`, `auth_details`, `auth_user`, `update_time`) VALUES ('f17dc7f3-c97a-41b4-a2f4-1a04a857ae8a', '20', 'menu', '1', 'role', 1630482451497, NULL, 'admin', NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf3c570c-0af8-11ec-a2b0-0242ac130003', '06ba0edb-143d-4b51-a864-8cfcf2b5d71e', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482428000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf3c59d1-0af8-11ec-a2b0-0242ac130003', '06ba0edb-143d-4b51-a864-8cfcf2b5d71e', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482428000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf573296-0af8-11ec-a2b0-0242ac130003', 'bdd3bed8-35d4-4aa8-84c2-85e2412d6cbb', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482428000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf57354a-0af8-11ec-a2b0-0242ac130003', 'bdd3bed8-35d4-4aa8-84c2-85e2412d6cbb', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482428000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf705f77-0af8-11ec-a2b0-0242ac130003', '998e402b-6f15-48dc-ae4d-2cd04460a3f3', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf7061d1-0af8-11ec-a2b0-0242ac130003', '998e402b-6f15-48dc-ae4d-2cd04460a3f3', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf8b490d-0af8-11ec-a2b0-0242ac130003', 'd8d18115-c7b9-4e99-96a8-fd1bbfddf543', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cf8b4b35-0af8-11ec-a2b0-0242ac130003', 'd8d18115-c7b9-4e99-96a8-fd1bbfddf543', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cfa66a8d-0af8-11ec-a2b0-0242ac130003', '9f01c7ef-753b-4dea-97d4-c199f84c2c74', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cfa66ca4-0af8-11ec-a2b0-0242ac130003', '9f01c7ef-753b-4dea-97d4-c199f84c2c74', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cfbf0608-0af8-11ec-a2b0-0242ac130003', 'c18b47e9-aa22-4f17-b12c-a3459ca4dd90', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cfbf0839-0af8-11ec-a2b0-0242ac130003', 'c18b47e9-aa22-4f17-b12c-a3459ca4dd90', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cfd814bc-0af8-11ec-a2b0-0242ac130003', '7823499e-dbb6-42a9-a28f-22377de18a39', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cfd816d7-0af8-11ec-a2b0-0242ac130003', '7823499e-dbb6-42a9-a28f-22377de18a39', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cff28219-0af8-11ec-a2b0-0242ac130003', 'b319dc39-c499-423b-8e99-22e9a0caba6f', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('cff28507-0af8-11ec-a2b0-0242ac130003', 'b319dc39-c499-423b-8e99-22e9a0caba6f', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482429000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dd9ba5c6-0af8-11ec-a2b0-0242ac130003', '1bf39d8d-7fe9-4832-8df3-f74b21a69288', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482452000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dd9ba7e8-0af8-11ec-a2b0-0242ac130003', '1bf39d8d-7fe9-4832-8df3-f74b21a69288', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482452000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('ddb3094b-0af8-11ec-a2b0-0242ac130003', '5960fd93-013c-4636-8f6b-2e6b49b7e869', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482452000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('ddb30bd2-0af8-11ec-a2b0-0242ac130003', '5960fd93-013c-4636-8f6b-2e6b49b7e869', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482452000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('ddec6eab-0af8-11ec-a2b0-0242ac130003', '1a18aa12-8daa-4f47-b5eb-999e473273df', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('ddeccfa8-0af8-11ec-a2b0-0242ac130003', '1a18aa12-8daa-4f47-b5eb-999e473273df', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de0719cb-0af8-11ec-a2b0-0242ac130003', '5ec5c9a7-04c0-4655-9b63-9ca5a439e2f3', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de071bd9-0af8-11ec-a2b0-0242ac130003', '5ec5c9a7-04c0-4655-9b63-9ca5a439e2f3', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de202758-0af8-11ec-a2b0-0242ac130003', '74ff225f-2a79-4221-9b32-c6eb9bcadd61', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de202961-0af8-11ec-a2b0-0242ac130003', '74ff225f-2a79-4221-9b32-c6eb9bcadd61', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de42f5ec-0af8-11ec-a2b0-0242ac130003', 'f17dc7f3-c97a-41b4-a2f4-1a04a857ae8a', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de42f8b4-0af8-11ec-a2b0-0242ac130003', 'f17dc7f3-c97a-41b4-a2f4-1a04a857ae8a', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482453000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de65f6d9-0af8-11ec-a2b0-0242ac130003', 'd400c00f-9c18-4eb6-a70f-9c8caf8dddfe', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de65fa72-0af8-11ec-a2b0-0242ac130003', 'd400c00f-9c18-4eb6-a70f-9c8caf8dddfe', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de80ddc9-0af8-11ec-a2b0-0242ac130003', 'd3d558e5-b0b1-4475-bb69-f20fa5c47f4f', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de80e001-0af8-11ec-a2b0-0242ac130003', 'd3d558e5-b0b1-4475-bb69-f20fa5c47f4f', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de9f30cd-0af8-11ec-a2b0-0242ac130003', '5e0a9ad5-81ed-4f83-91f6-a74be724bda7', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('de9f32d3-0af8-11ec-a2b0-0242ac130003', '5e0a9ad5-81ed-4f83-91f6-a74be724bda7', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dec15e1b-0af8-11ec-a2b0-0242ac130003', '88c778e6-ede3-4397-af4c-375e1feac8ef', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('dec16031-0af8-11ec-a2b0-0242ac130003', '88c778e6-ede3-4397-af4c-375e1feac8ef', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482454000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e2b029b9-0af8-11ec-a2b0-0242ac130003', 'a6837d68-80a6-4a26-a7c0-e84001dfc817', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482461000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e2b02bcb-0af8-11ec-a2b0-0242ac130003', 'a6837d68-80a6-4a26-a7c0-e84001dfc817', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482461000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e2c9aba7-0af8-11ec-a2b0-0242ac130003', '359771bb-95b8-40ad-a6c5-b5c39c93cb10', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482461000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e2c9adc8-0af8-11ec-a2b0-0242ac130003', '359771bb-95b8-40ad-a6c5-b5c39c93cb10', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482461000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e39cb3fe-0af8-11ec-a2b0-0242ac130003', '60b3644b-2493-4805-8204-90880cfac9c6', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482462000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e39cb619-0af8-11ec-a2b0-0242ac130003', '60b3644b-2493-4805-8204-90880cfac9c6', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482462000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e49bef48-0af8-11ec-a2b0-0242ac130003', '00590a7c-8e7b-45f4-8428-55532be07602', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1630482464000, NULL);
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`) VALUES ('e49bf17e-0af8-11ec-a2b0-0242ac130003', '00590a7c-8e7b-45f4-8428-55532be07602', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1630482464000, NULL);

View File

@ -6,25 +6,6 @@ INSERT INTO `sys_msg_type` VALUES (7, 0, 'i18n_msg_type_ds_invalid', 'datasource
INSERT INTO `sys_msg_type` VALUES (8, 7, 'i18n_msg_type_ds_invalid', 'datasource', 'to-msg-ds'); INSERT INTO `sys_msg_type` VALUES (8, 7, 'i18n_msg_type_ds_invalid', 'datasource', 'to-msg-ds');
COMMIT; COMMIT;
-- ---------------------------- -- ----------------------------
-- Table structure for system_parameter -- Table structure for system_parameter
-- ---------------------------- -- ----------------------------
@ -54,4 +35,19 @@ INSERT INTO `system_parameter` VALUES ('ui.topMenuActiveColor', NULL, 'text', 8)
INSERT INTO `system_parameter` VALUES ('ui.topMenuColor', NULL, 'text', 7); INSERT INTO `system_parameter` VALUES ('ui.topMenuColor', NULL, 'text', 7);
INSERT INTO `system_parameter` VALUES ('ui.topMenuTextActiveColor', NULL, 'text', 10); INSERT INTO `system_parameter` VALUES ('ui.topMenuTextActiveColor', NULL, 'text', 10);
INSERT INTO `system_parameter` VALUES ('ui.topMenuTextColor', NULL, 'text', 9); INSERT INTO `system_parameter` VALUES ('ui.topMenuTextColor', NULL, 'text', 9);
COMMIT; COMMIT;
-- ----------------------------
-- Table structure for panel_pdf_template
-- ----------------------------
DROP TABLE IF EXISTS `panel_pdf_template`;
CREATE TABLE `panel_pdf_template` (
`id` varchar(50) NOT NULL COMMENT 'id',
`name` varchar(255) DEFAULT NULL COMMENT '模板名称',
`create_time` bigint(13) DEFAULT NULL COMMENT '创建时间',
`create_user` varchar(255) DEFAULT NULL COMMENT '创建人',
`template_content` longtext COMMENT '模板内容',
`sort` int(8) DEFAULT NULL COMMENT '排序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -64,7 +64,7 @@
<!--要生成的数据库表 --> <!--要生成的数据库表 -->
<table tableName="datasource"/> <table tableName="panel_pdf_template"/>
<!-- <table tableName="sys_dict_item"/>--> <!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>--> <!-- <table tableName="dataset_table_field"/>-->
<!-- <table tableName="v_chart">--> <!-- <table tableName="v_chart">-->

View File

@ -42,9 +42,10 @@
"vue-axios": "3.2.4", "vue-axios": "3.2.4",
"vue-clipboard2": "0.3.1", "vue-clipboard2": "0.3.1",
"vue-codemirror": "^4.0.6", "vue-codemirror": "^4.0.6",
"vue-fullscreen": "^2.5.1", "vue-fullscreen": "^2.5.2",
"vue-i18n": "7.3.2", "vue-i18n": "7.3.2",
"vue-router": "3.0.6", "vue-router": "3.0.6",
"vue-to-pdf": "^1.0.0",
"vue-uuid": "2.0.2", "vue-uuid": "2.0.2",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"vuex": "3.1.0", "vuex": "3.1.0",

View File

@ -0,0 +1,11 @@
import request from '@/utils/request'
export function queryAll() {
return request({
url: '/pdf-template/queryAll',
method: 'get',
loading: true,
timeout: 30000
})
}

View File

@ -1176,7 +1176,7 @@ export default {
if (this.canvasStyleData.auxiliaryMatrix) { if (this.canvasStyleData.auxiliaryMatrix) {
this.recordMatrixCurStyle() this.recordMatrixCurStyle()
} }
this.hasMove && this.$store.commit('recordSnapshot') this.hasMove && this.$store.commit('recordSnapshot', 'handleUp')
// snapshot false // snapshot false
this.hasMove = false this.hasMove = false

View File

@ -87,13 +87,13 @@ export default {
paste() { paste() {
this.$store.commit('paste', true) this.$store.commit('paste', true)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'paste')
}, },
deleteComponent() { deleteComponent() {
this.deleteCurCondition() this.deleteCurCondition()
this.$store.commit('deleteComponent') this.$store.commit('deleteComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'deleteComponent')
this.$store.commit('setCurComponent', { component: null, index: null }) this.$store.commit('setCurComponent', { component: null, index: null })
}, },
@ -106,22 +106,22 @@ export default {
upComponent() { upComponent() {
this.$store.commit('upComponent') this.$store.commit('upComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'upComponent')
}, },
downComponent() { downComponent() {
this.$store.commit('downComponent') this.$store.commit('downComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'downComponent')
}, },
topComponent() { topComponent() {
this.$store.commit('topComponent') this.$store.commit('topComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'topComponent')
}, },
bottomComponent() { bottomComponent() {
this.$store.commit('bottomComponent') this.$store.commit('bottomComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'bottomComponent')
} }
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown"> <div id="canvasInfoTemp" ref="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown">
<el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position"> <el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position">
{{ $t('panel.panelNull') }} {{ $t('panel.panelNull') }}
</el-row> </el-row>

View File

@ -86,13 +86,13 @@ export default {
paste() { paste() {
this.$store.commit('paste', true) this.$store.commit('paste', true)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','paste')
}, },
deleteComponent() { deleteComponent() {
this.deleteCurCondition() this.deleteCurCondition()
this.$store.commit('deleteComponent') this.$store.commit('deleteComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','deleteComponent')
this.$store.commit('setCurComponent', { component: null, index: null }) this.$store.commit('setCurComponent', { component: null, index: null })
}, },
@ -105,22 +105,22 @@ export default {
upComponent() { upComponent() {
this.$store.commit('upComponent') this.$store.commit('upComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','upComponent')
}, },
downComponent() { downComponent() {
this.$store.commit('downComponent') this.$store.commit('downComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','downComponent')
}, },
topComponent() { topComponent() {
this.$store.commit('topComponent') this.$store.commit('topComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','topComponent')
}, },
bottomComponent() { bottomComponent() {
this.$store.commit('bottomComponent') this.$store.commit('bottomComponent')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','bottomComponent')
}, },
linkageSetting() { linkageSetting() {
debugger debugger

View File

@ -292,17 +292,17 @@ export default {
}, },
deep: true deep: true
}, },
canvasStyleData: { // canvasStyleData: {
handler(newVal, oldVla) { // handler(newVal, oldVla) {
// // //
if (this.changeIndex++ > 0) { // if (this.changeIndex++ > 0) {
this.resizeParentBounds() // // this.resizeParentBounds()
this.$store.state.styleChangeTimes++ // this.$store.state.styleChangeTimes++
} // }
// this.changeScale() // // this.changeScale()
}, // },
deep: true // deep: true
}, // },
componentData: { componentData: {
handler(newVal, oldVla) { handler(newVal, oldVla) {
// console.log('11111') // console.log('11111')

View File

@ -154,8 +154,7 @@ export default {
} }
}, },
styleChange() { styleChange() {
debugger this.$store.commit('recordStyleChange')
this.$store.state.styleChangeTimes++
} }
} }
} }

View File

@ -206,7 +206,7 @@ export default {
} }
}, },
styleChange() { styleChange() {
this.$store.state.styleChangeTimes++ this.$store.commit('recordStyleChange')
} }
} }
} }

View File

@ -189,7 +189,7 @@ export default {
} }
}, },
styleChange() { styleChange() {
this.$store.state.styleChangeTimes++ this.$store.commit('recordStyleChange')
} }
} }
} }

View File

@ -214,12 +214,12 @@ export default {
compose() { compose() {
this.$store.commit('compose') this.$store.commit('compose')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','compose')
}, },
decompose() { decompose() {
this.$store.commit('decompose') this.$store.commit('decompose')
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','decompose')
}, },
undo() { undo() {
@ -267,7 +267,7 @@ export default {
} }
}) })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','handleFileChange')
} }
img.src = fileResult img.src = fileResult
@ -306,7 +306,7 @@ export default {
clearCanvas() { clearCanvas() {
this.$store.commit('setComponentData', []) this.$store.commit('setComponentData', [])
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE_STRING) this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE_STRING)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','clearCanvas')
}, },
handlePreviewChange() { handlePreviewChange() {

View File

@ -67,6 +67,7 @@ export default {
methods: { methods: {
handleInput(e) { handleInput(e) {
this.$emit('input', this.element, e.target.innerHTML) this.$emit('input', this.element, e.target.innerHTML)
this.$store.commit('recordStyleChange')
}, },
handleKeydown(e) { handleKeydown(e) {

View File

@ -96,7 +96,7 @@ export default {
component.style.left = e.offsetX component.style.left = e.offsetX
component.id = generateID() component.id = generateID()
this.$store.commit('addComponent', { component }) this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','handleDrop')
}, },
handleDragOver(e) { handleDragOver(e) {

View File

@ -52,6 +52,11 @@ export default {
refreshSaveStatus(state) { refreshSaveStatus(state) {
state.changeTimes = 0 state.changeTimes = 0
state.lastSaveSnapshotIndex = deepCopy(state.snapshotIndex) state.lastSaveSnapshotIndex = deepCopy(state.snapshotIndex)
},
recordStyleChange(state) {
if (state.curComponent) {
state.styleChangeTimes++
}
} }
} }
} }

View File

@ -86,7 +86,7 @@ export default {
} }
}, },
styleChange() { styleChange() {
this.$store.state.styleChangeTimes++ this.$store.commit('recordStyleChange')
} }
} }
} }

View File

@ -142,7 +142,7 @@ export default {
} }
this.setCondition() this.setCondition()
this.styleChange() this.$store.commit('recordStyleChange')
}) })
}, },
setCondition() { setCondition() {
@ -177,7 +177,7 @@ export default {
} }
}, },
styleChange() { styleChange() {
this.$store.state.styleChangeTimes++ this.$store.commit('recordStyleChange')
} }
} }
} }

View File

@ -104,7 +104,7 @@ export default {
this.inDraw && this.$store.commit('addViewFilter', param) this.inDraw && this.$store.commit('addViewFilter', param)
}, },
styleChange() { styleChange() {
this.$store.state.styleChangeTimes++ this.$store.commit('recordStyleChange')
} }
} }

View File

@ -211,7 +211,7 @@ export default {
// return data[this.defaultProp.label].indexOf(value) !== -1 // return data[this.defaultProp.label].indexOf(value) !== -1
// }, // },
styleChange() { styleChange() {
this.$store.state.styleChangeTimes++ this.$store.commit('recordStyleChange')
} }
} }

View File

@ -0,0 +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="1630573390175" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2229" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M1024 140.8V128c0-19.2-25.6-38.4-44.8-38.4H608V0h-70.4L0 96v832c179.2 32 352 64 531.2 96h70.4v-96h352c19.2 0 44.8 0 57.6-12.8 12.8-19.2 12.8-44.8 12.8-70.4v-704zM326.4 537.6c-25.6 12.8-51.2 12.8-83.2 12.8v128l-64-6.4V313.6c57.6 0 128-25.6 179.2 19.2 51.2 64 38.4 172.8-32 204.8zM985.6 896h-384V128h384v768z" fill="#A33639" p-id="2230"></path><path d="M953.6 832v-51.2h-352V832zM652.8 697.6h300.8v44.8H652.8z m0-160h300.8v44.8H652.8z m0 83.2h300.8v44.8H652.8z m128-332.8c-6.4 25.6-19.2 57.6-32 83.2-64 25.6-64 44.8-64 51.2 0 6.4 6.4 12.8 12.8 19.2h12.8c19.2 0 38.4-19.2 57.6-57.6 25.6-12.8 51.2-19.2 76.8-25.6 12.8 12.8 32 19.2 51.2 19.2 12.8 0 32 0 32-25.6 0-6.4-6.4-25.6-32-25.6-12.8 0-25.6 0-38.4 6.4-19.2-12.8-32-32-38.4-51.2 12.8-38.4 12.8-64 6.4-70.4-6.4-6.4-12.8-6.4-19.2-6.4-6.4 0-19.2 6.4-19.2 12.8-32 19.2-12.8 57.6-6.4 70.4zM704 422.4c6.4-6.4 12.8-12.8 25.6-19.2-6.4 6.4-19.2 12.8-25.6 19.2zM883.2 352c12.8 0 19.2 6.4 19.2 6.4h-12.8c-6.4 0-12.8 0-19.2-6.4h12.8z m-70.4-6.4c-12.8 6.4-25.6 6.4-38.4 12.8 6.4-12.8 12.8-25.6 19.2-44.8 6.4 12.8 12.8 25.6 19.2 32zM787.2 224s6.4 0 0 0c6.4 12.8 6.4 25.6 6.4 32-6.4-12.8-6.4-19.2-6.4-32z m-544 153.6v115.2c19.2 0 51.2 0 64-25.6 12.8-25.6 12.8-51.2 0-76.8-12.8-19.2-38.4-12.8-64-12.8z" fill="#A33639" p-id="2231"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -849,7 +849,12 @@ export default {
custom_case: 'Custom', custom_case: 'Custom',
last_layer: 'This Is The Last Layer', last_layer: 'This Is The Last Layer',
radar_size: 'Size', radar_size: 'Size',
chart_mix: 'Mix' chart_mix: 'Mix',
axis_value: 'Axis Value',
axis_value_min: 'Min',
axis_value_max: 'Max',
axis_value_split: 'Split',
axis_auto: 'Auto'
}, },
dataset: { dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',

View File

@ -848,7 +848,12 @@ export default {
custom_case: '自定義', custom_case: '自定義',
last_layer: '當前已經是最後一級', last_layer: '當前已經是最後一級',
radar_size: '大小', radar_size: '大小',
chart_mix: '組合圖' chart_mix: '組合圖',
axis_value: '軸值',
axis_value_min: '最小值',
axis_value_max: '最大值',
axis_value_split: '間隔',
axis_auto: '自動'
}, },
dataset: { dataset: {
sheet_warn: '有多個sheet頁面默認抽取第一個', sheet_warn: '有多個sheet頁面默認抽取第一個',

View File

@ -848,7 +848,12 @@ export default {
custom_case: '自定义', custom_case: '自定义',
last_layer: '当前已经是最后一级', last_layer: '当前已经是最后一级',
radar_size: '大小', radar_size: '大小',
chart_mix: '组合图' chart_mix: '组合图',
axis_value: '轴值',
axis_value_min: '最小值',
axis_value_max: '最大值',
axis_value_split: '间隔',
axis_auto: '自动'
}, },
dataset: { dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个', sheet_warn: '有多个 Sheet 页,默认抽取第一个',

View File

@ -77,6 +77,9 @@ Vue.component('DeComplexInput', DeComplexInput)
Vue.component('DeComplexSelect', DeComplexSelect) Vue.component('DeComplexSelect', DeComplexSelect)
Vue.config.productionTip = false Vue.config.productionTip = false
import vueToPdf from 'vue-to-pdf'
Vue.use(vueToPdf)
Vue.prototype.hasDataPermission = function(pTarget, pSource) { Vue.prototype.hasDataPermission = function(pTarget, pSource) {
if (this.$store.state.user.user.isAdmin) { if (this.$store.state.user.user.isAdmin) {
return true return true

View File

@ -277,6 +277,14 @@ div:focus {
margin: 0 2px 1px 0; margin: 0 2px 1px 0;
} }
.ds-icon-pdf {
width: 20px;
height: 20px;
margin-right: 5px;
color: #0a7be0;
}
.ds-icon-scene { .ds-icon-scene {
width: 13px; width: 13px;
height: 13px; height: 13px;

View File

@ -0,0 +1,7 @@
// 替换所有 标准模板格式 为 $panelName$
export function pdfTemplateReplaceAll(content, source, target) {
const pattern = '\\$' + source + '\\$'
content = content.replace(new RegExp(pattern, 'gm'), target)
return content
}

View File

@ -107,6 +107,12 @@ export const DEFAULT_XAXIS_STYLE = {
width: 1, width: 1,
style: 'solid' style: 'solid'
} }
},
axisValue: {
auto: true,
min: null,
max: null,
split: null
} }
} }
export const DEFAULT_YAXIS_STYLE = { export const DEFAULT_YAXIS_STYLE = {
@ -131,6 +137,12 @@ export const DEFAULT_YAXIS_STYLE = {
width: 1, width: 1,
style: 'solid' style: 'solid'
} }
},
axisValue: {
auto: true,
min: null,
max: null,
split: null
} }
} }
export const DEFAULT_BACKGROUND_COLOR = { export const DEFAULT_BACKGROUND_COLOR = {

View File

@ -65,6 +65,18 @@ export function componentStyle(chart_option, chart) {
if (!customStyle.xAxis.show) { if (!customStyle.xAxis.show) {
chart_option.xAxis.axisLabel.show = false chart_option.xAxis.axisLabel.show = false
} }
// 轴值设置
delete chart_option.xAxis.min
delete chart_option.xAxis.max
delete chart_option.xAxis.split
if (chart.type.includes('horizontal')) {
if (customStyle.xAxis.axisValue && !customStyle.xAxis.axisValue.auto) {
customStyle.xAxis.axisValue.min && (chart_option.xAxis.min = parseFloat(customStyle.xAxis.axisValue.min))
customStyle.xAxis.axisValue.max && (chart_option.xAxis.max = parseFloat(customStyle.xAxis.axisValue.max))
customStyle.xAxis.axisValue.split && (chart_option.xAxis.interval = parseFloat(customStyle.xAxis.axisValue.split))
}
}
} }
if (customStyle.yAxis && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('scatter') || chart.type === 'chart-mix')) { if (customStyle.yAxis && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('scatter') || chart.type === 'chart-mix')) {
chart_option.yAxis.show = customStyle.yAxis.show chart_option.yAxis.show = customStyle.yAxis.show
@ -80,6 +92,18 @@ export function componentStyle(chart_option, chart) {
if (!customStyle.yAxis.show) { if (!customStyle.yAxis.show) {
chart_option.yAxis.axisLabel.show = false chart_option.yAxis.axisLabel.show = false
} }
// 轴值设置
delete chart_option.yAxis.min
delete chart_option.yAxis.max
delete chart_option.yAxis.split
if (!chart.type.includes('horizontal')) {
if (customStyle.yAxis.axisValue && !customStyle.yAxis.axisValue.auto) {
customStyle.yAxis.axisValue.min && (chart_option.yAxis.min = parseFloat(customStyle.yAxis.axisValue.min))
customStyle.yAxis.axisValue.max && (chart_option.yAxis.max = parseFloat(customStyle.yAxis.axisValue.max))
customStyle.yAxis.axisValue.split && (chart_option.yAxis.interval = parseFloat(customStyle.yAxis.axisValue.split))
}
}
} }
if (customStyle.split && chart.type.includes('radar')) { if (customStyle.split && chart.type.includes('radar')) {
chart_option.radar.name = customStyle.split.name chart_option.radar.name = customStyle.split.name

View File

@ -155,7 +155,7 @@ export default {
} else if (chart.type === 'chart-mix') { } else if (chart.type === 'chart-mix') {
chart_option = baseMixOption(JSON.parse(JSON.stringify(BASE_MIX)), chart) chart_option = baseMixOption(JSON.parse(JSON.stringify(BASE_MIX)), chart)
} }
console.log(JSON.stringify(chart_option)) // console.log(JSON.stringify(chart_option))
if (chart.type === 'map') { if (chart.type === 'map') {
const customAttr = JSON.parse(chart.customAttr) const customAttr = JSON.parse(chart.customAttr)
@ -241,7 +241,10 @@ export default {
trackClick(trackAction) { trackClick(trackAction) {
const param = this.pointParam const param = this.pointParam
if (!param || !param.data || !param.data.dimensionList) { if (!param || !param.data || !param.data.dimensionList) {
this.$warning(this.$t('panel.no_drill_field')) //
if (this.chart.type === 'map') {
this.$warning(this.$t('panel.no_drill_field'))
}
return return
} }
const linkageParam = { const linkageParam = {

View File

@ -23,6 +23,36 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && chart.type.includes('horizontal')">
<el-divider />
<el-form-item class="form-item">
<span slot="label">
<span class="span-box">
<span>{{ $t('chart.axis_value') }}</span>
<el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content">
最小值最大值间隔均为数值类型若不填则该项视为自动
<br>
请确保填写数值能正确计算否则将无法正常显示轴值
</div>
<i class="el-icon-info" style="cursor: pointer;" />
</el-tooltip>
</span>
</span>
<el-checkbox v-model="axisForm.axisValue.auto" @change="changeXAxisStyle">{{ $t('chart.axis_auto') }}</el-checkbox>
</el-form-item>
<span v-show="!axisForm.axisValue.auto">
<el-form-item :label="$t('chart.axis_value_min')" class="form-item">
<el-input v-model="axisForm.axisValue.min" @blur="changeXAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.axis_value_max')" class="form-item">
<el-input v-model="axisForm.axisValue.max" @blur="changeXAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.axis_value_split')" class="form-item">
<el-input v-model="axisForm.axisValue.split" @blur="changeXAxisStyle" />
</el-form-item>
</span>
</span>
<el-divider /> <el-divider />
<el-form-item :label="$t('chart.axis_show')" class="form-item"> <el-form-item :label="$t('chart.axis_show')" class="form-item">
<el-checkbox v-model="axisForm.splitLine.show" @change="changeXAxisStyle">{{ $t('chart.axis_show') }}</el-checkbox> <el-checkbox v-model="axisForm.splitLine.show" @change="changeXAxisStyle">{{ $t('chart.axis_show') }}</el-checkbox>
@ -120,6 +150,9 @@ export default {
if (!this.axisForm.nameTextStyle) { if (!this.axisForm.nameTextStyle) {
this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.nameTextStyle)) this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.nameTextStyle))
} }
if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisValue))
}
} }
} }
}, },

View File

@ -23,6 +23,36 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && !chart.type.includes('horizontal')">
<el-divider />
<el-form-item class="form-item">
<span slot="label">
<span class="span-box">
<span>{{ $t('chart.axis_value') }}</span>
<el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content">
最小值最大值间隔均为数值类型若不填则该项视为自动
<br>
请确保填写数值能正确计算否则将无法正常显示轴值
</div>
<i class="el-icon-info" style="cursor: pointer;" />
</el-tooltip>
</span>
</span>
<el-checkbox v-model="axisForm.axisValue.auto" @change="changeYAxisStyle">{{ $t('chart.axis_auto') }}</el-checkbox>
</el-form-item>
<span v-show="!axisForm.axisValue.auto">
<el-form-item :label="$t('chart.axis_value_min')" class="form-item">
<el-input v-model="axisForm.axisValue.min" @blur="changeYAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.axis_value_max')" class="form-item">
<el-input v-model="axisForm.axisValue.max" @blur="changeYAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.axis_value_split')" class="form-item">
<el-input v-model="axisForm.axisValue.split" @blur="changeYAxisStyle" />
</el-form-item>
</span>
</span>
<el-divider /> <el-divider />
<el-form-item :label="$t('chart.axis_show')" class="form-item"> <el-form-item :label="$t('chart.axis_show')" class="form-item">
<el-checkbox v-model="axisForm.splitLine.show" @change="changeYAxisStyle">{{ $t('chart.axis_show') }}</el-checkbox> <el-checkbox v-model="axisForm.splitLine.show" @change="changeYAxisStyle">{{ $t('chart.axis_show') }}</el-checkbox>
@ -120,6 +150,9 @@ export default {
if (!this.axisForm.nameTextStyle) { if (!this.axisForm.nameTextStyle) {
this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.nameTextStyle)) this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.nameTextStyle))
} }
if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisValue))
}
} }
} }
}, },

View File

@ -115,7 +115,7 @@ export default {
} }
}) })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','handleFileChange')
} }
img.src = fileResult img.src = fileResult

View File

@ -80,7 +80,7 @@ export default {
const canvasStyleData = deepCopy(this.canvasStyleData) const canvasStyleData = deepCopy(this.canvasStyleData)
canvasStyleData.panel = this.panel canvasStyleData.panel = this.panel
this.$store.commit('setCanvasStyle', canvasStyleData) this.$store.commit('setCanvasStyle', canvasStyleData)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','commitStyle')
}, },
onChangeType() { onChangeType() {
this.commitStyle() this.commitStyle()

View File

@ -44,7 +44,7 @@ export default {
const canvasStyleData = deepCopy(this.canvasStyleData) const canvasStyleData = deepCopy(this.canvasStyleData)
canvasStyleData.panel = this.panel canvasStyleData.panel = this.panel
this.$store.commit('setCanvasStyle', canvasStyleData) this.$store.commit('setCanvasStyle', canvasStyleData)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','onChangePanelStyle')
} }
} }
} }

View File

@ -189,7 +189,7 @@ export default {
}, },
subjectChange() { subjectChange() {
this.$store.commit('setCanvasStyle', JSON.parse(this.subjectItem.details)) this.$store.commit('setCanvasStyle', JSON.parse(this.subjectItem.details))
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','subjectChange')
bus.$emit('onSubjectChange') bus.$emit('onSubjectChange')
}, },
templateEdit() { templateEdit() {

View File

@ -135,7 +135,7 @@ export default {
chart.customFilter = JSON.stringify(this.chart.customFilter) chart.customFilter = JSON.stringify(this.chart.customFilter)
canvasStyleData.chart = chart canvasStyleData.chart = chart
this.$store.commit('setCanvasStyle', canvasStyleData) this.$store.commit('setCanvasStyle', canvasStyleData)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot','save')
} }
} }
} }

View File

@ -311,6 +311,7 @@ export default {
this.init(newVal.id) this.init(newVal.id)
}, },
'$store.state.styleChangeTimes'() { '$store.state.styleChangeTimes'() {
// console.log('styleChangeTimes' + this.$store.state.styleChangeTimes)
if (this.$store.state.styleChangeTimes > 0) { if (this.$store.state.styleChangeTimes > 0) {
this.destroyTimeMachine() this.destroyTimeMachine()
this.recordStyleChange(this.$store.state.styleChangeTimes) this.recordStyleChange(this.$store.state.styleChangeTimes)
@ -383,7 +384,7 @@ export default {
// this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData))) // this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
const panelStyle = JSON.parse(response.data.panelStyle) const panelStyle = JSON.parse(response.data.panelStyle)
this.$store.commit('setCanvasStyle', panelStyle) this.$store.commit('setCanvasStyle', panelStyle)
this.$store.commit('recordSnapshot')// this.$store.commit('recordSnapshot', 'init')//
// //
getPanelAllLinkageInfo(panelId).then(rsp => { getPanelAllLinkageInfo(panelId).then(rsp => {
this.$store.commit('setNowPanelTrackInfo', rsp.data) this.$store.commit('setNowPanelTrackInfo', rsp.data)
@ -493,7 +494,7 @@ export default {
component.style.left = this.getPositionX(e.layerX) component.style.left = this.getPositionX(e.layerX)
component.id = newComponentId component.id = newComponentId
this.$store.commit('addComponent', { component }) this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'handleDrop')
this.clearCurrentInfo() this.clearCurrentInfo()
// // // //
@ -545,7 +546,7 @@ export default {
// this.$store.commit('addComponent', { component }) // this.$store.commit('addComponent', { component })
this.$store.commit('setComponentWithId', component) this.$store.commit('setComponentWithId', component)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'sureFilter')
this.cancelFilter() this.cancelFilter()
}, },
reFreshComponent(component) { reFreshComponent(component) {
@ -625,7 +626,7 @@ export default {
} }
}) })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'handleFileChange')
} }
img.src = fileResult img.src = fileResult
@ -677,7 +678,7 @@ export default {
component.style.left = 600 component.style.left = 600
component.id = newComponentId component.id = newComponentId
this.$store.commit('addComponent', { component }) this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'newViewInfo')
this.clearCurrentInfo() this.clearCurrentInfo()
this.$store.commit('setCurComponent', { component: component, index: this.componentData.length - 1 }) this.$store.commit('setCurComponent', { component: component, index: this.componentData.length - 1 })
@ -703,7 +704,7 @@ export default {
recordStyleChange(index) { recordStyleChange(index) {
this.timeMachine = setTimeout(() => { this.timeMachine = setTimeout(() => {
if (index === this.$store.state.styleChangeTimes) { if (index === this.$store.state.styleChangeTimes) {
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot', 'recordStyleChange')
this.$store.state.styleChangeTimes = 0 this.$store.state.styleChangeTimes = 0
} }
this.destroyTimeMachine() this.destroyTimeMachine()

View File

@ -0,0 +1,32 @@
<template>
<div style="margin-top: 5px">
<div> 导出时间$TIME$</div>
<div contenteditable="true"> 可以输入内容</div>
<div>
<img width="100%" src="$snapshot$">
</div>
</div>
</template>
<script>
export default {
data() {
return {
}
},
computed: {
},
watch: {
},
mounted() {
},
methods: {
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,113 @@
<template>
<el-row>
<el-row class="export_body_class">
<div id="exportPdf" ref="exportPdf">
<div class="export_body_inner_class" v-html="templateContentChange" />
</div>
</el-row>
<el-row class="root_class">
<el-button size="mini" @click="cancel()">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="save()">导出PDF</el-button>
</el-row>
</el-row>
</template>
<script>
import JsPDF from 'jspdf'
import html2canvas from 'html2canvasde'
import { formatTimeToStr } from './date.js'
import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
export default {
name: 'PDFPreExport',
props: {
panelName: {
type: String,
required: false
},
snapshot: {
type: String,
required: true
},
templateContent: {
type: String,
required: true
}
},
data() {
return {
activeName: '',
templateContentChange: '',
time: '',
varsInfo: {
panelName: this.panelName,
snapshot: this.snapshot,
userName: this.$store.state.user.user.name
},
timeInfo: [
'yyyy-MM-dd',
'yyyy-MM-dd hh:mm:ss'
]
}
},
computed: {
},
watch: {
templateContent(newVal, oldVla) {
this.initContent()
}
},
mounted() {
var date = new Date()
var _this = this
_this.timeInfo.forEach(timeFormat => {
_this.varsInfo[timeFormat] = formatTimeToStr(date, timeFormat)
})
this.initContent()
},
methods: {
initContent() {
this.templateContentChange = this.templateContent
for (const [key, value] of Object.entries(this.varsInfo)) {
this.templateContentChange = pdfTemplateReplaceAll(this.templateContentChange, key, value)
}
},
cancel() {
this.$emit('closePreExport')
},
save() {
const _this = this
html2canvas(document.getElementById('exportPdf')).then(function(canvas) {
const contentWidth = canvas.width
const contentHeight = canvas.height
const pageData = canvas.toDataURL('image/jpeg', 1.0)
const PDF = new JsPDF('p', 'pt', [contentWidth, contentHeight])
PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
PDF.save(_this.panelName + '.pdf')
}
)
}
}
}
</script>
<style scoped>
.root_class {
margin: 15px 0px 5px;
text-align: center;
}
.export_body_class{
border: 1px solid #dcdfe6 ;
height: 500px;
overflow-y: auto;
}
.export_body_inner_class{
margin: 10px;
}
</style>

View File

@ -0,0 +1,30 @@
// 对Date的扩展将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
Date.prototype.Format = function(fmt) {
var o = {
'M+': this.getMonth() + 1, // 月份
'd+': this.getDate(), // 日
'h+': this.getHours(), // 小时
'm+': this.getMinutes(), // 分
's+': this.getSeconds(), // 秒
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
'S': this.getMilliseconds() // 毫秒
}
if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) }
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) }
}
return fmt
}
export function formatTimeToStr(times, pattern) {
var d = new Date(times).Format('yyyy-MM-dd hh:mm:ss')
if (pattern) {
d = new Date(times).Format(pattern)
}
return d.toLocaleString()
}

View File

@ -109,6 +109,9 @@
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-share" :command="beforeClickMore('share',data,node)"> <el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-share" :command="beforeClickMore('share',data,node)">
{{ $t('panel.share') }} {{ $t('panel.share') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-document-copy" :command="beforeClickMore('copy',data,node)">
{{ $t('panel.copy') }}
</el-dropdown-item>
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-paperclip" :command="beforeClickMore('link',data,node)"> <el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-paperclip" :command="beforeClickMore('link',data,node)">
{{ $t('panel.create_public_links') }} {{ $t('panel.create_public_links') }}
</el-dropdown-item> </el-dropdown-item>
@ -306,11 +309,16 @@ export default {
this.lastActiveNodeData.name = panelInfo.name this.lastActiveNodeData.name = panelInfo.name
return return
} }
if (!this.lastActiveNodeData.children) { //
this.$set(this.lastActiveNodeData, 'children', []) if (this.editPanel.optType === 'copy') {
this.lastActiveNode.parent.data.children.push(panelInfo)
} else {
if (!this.lastActiveNodeData.children) {
this.$set(this.lastActiveNodeData, 'children', [])
}
this.lastActiveNodeData.children.push(panelInfo)
this.lastActiveNode.expanded = true
} }
this.lastActiveNodeData.children.push(panelInfo)
this.lastActiveNode.expanded = true
this.activeNodeAndClick(panelInfo) this.activeNodeAndClick(panelInfo)
} else { } else {
this.tree(this.groupForm) this.tree(this.groupForm)
@ -367,6 +375,18 @@ export default {
} }
} }
break break
case 'copy':
this.editPanel = {
visible: true,
titlePre: this.$t('panel.copy'),
optType: 'copy',
panelInfo: {
id: param.data.id,
name: param.data.name,
optType: 'copy'
}
}
break
} }
switch (param.type) { switch (param.type) {
case 'folder': case 'folder':
@ -388,6 +408,7 @@ export default {
clickMore(param) { clickMore(param) {
switch (param.optType) { switch (param.optType) {
case 'copy':
case 'toDefaultPanel': case 'toDefaultPanel':
case 'rename': case 'rename':
this.showEditPanel(param) this.showEditPanel(param)

View File

@ -54,7 +54,7 @@
</el-row> </el-row>
<!-- 仪表板预览区域--> <!-- 仪表板预览区域-->
<el-row class="panel-design-preview"> <el-row class="panel-design-preview">
<div ref="imageWrapper" style="width: 100%;height: 100%"> <div id="imageWrapper" ref="imageWrapper" style="width: 100%;height: 100%">
<fullscreen style="height: 100%;background: #f7f8fa;overflow-y: auto" :fullscreen.sync="fullscreen"> <fullscreen style="height: 100%;background: #f7f8fa;overflow-y: auto" :fullscreen.sync="fullscreen">
<Preview v-if="showMain" :in-screen="!fullscreen" :show-type="canvasStyleData.selfAdaption?'full':'width'" /> <Preview v-if="showMain" :in-screen="!fullscreen" :show-type="canvasStyleData.selfAdaption?'full':'width'" />
</fullscreen> </fullscreen>
@ -75,9 +75,31 @@
> >
<save-to-template :template-info="templateInfo" @closeSaveDialog="closeSaveDialog" /> <save-to-template :template-info="templateInfo" @closeSaveDialog="closeSaveDialog" />
</el-dialog> </el-dialog>
<el-dialog
v-if="pdfExportShow"
:title="'['+panelInfo.name+']'+'PDF导出'"
:visible.sync="pdfExportShow"
width="70%"
:destroy-on-close="true"
class="dialog-css2"
>
<span style="position: absolute;right: 70px;top:15px">
<svg-icon icon-class="PDF" class="ds-icon-pdf" />
<el-select v-model="pdfTemplateSelectedIndex" :placeholder="'切换PDF模板'" @change="changePdfTemplate()">
<el-option
v-for="(item, index) in pdfTemplateAll"
:key="index"
:label="item.name"
:value="index"
/>
</el-select>
</span>
<PDFPreExport :snapshot="snapshotInfo" :panel-name="panelInfo.name" :template-content="pdfTemplateContent" @closePreExport="closePreExport" />
</el-dialog>
</el-row> </el-row>
</template> </template>
<script> <script>
import PDFPreExport from '@/views/panel/export/PDFPreExport'
import Preview from '@/components/canvas/components/Editor/Preview' import Preview from '@/components/canvas/components/Editor/Preview'
import SaveToTemplate from '@/views/panel/list/SaveToTemplate' import SaveToTemplate from '@/views/panel/list/SaveToTemplate'
import { mapState } from 'vuex' import { mapState } from 'vuex'
@ -85,10 +107,11 @@ import html2canvas from 'html2canvasde'
import FileSaver from 'file-saver' import FileSaver from 'file-saver'
import { enshrineList, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine' import { enshrineList, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
import bus from '@/utils/bus' import bus from '@/utils/bus'
import JsPDF from 'jspdf' import { queryAll } from '@/api/panel/pdfTemplate'
export default { export default {
name: 'PanelViewShow', name: 'PanelViewShow',
components: { Preview, SaveToTemplate }, components: { Preview, SaveToTemplate, PDFPreExport },
props: { props: {
activeTab: { activeTab: {
type: String, type: String,
@ -98,11 +121,16 @@ export default {
data() { data() {
return { return {
showMain: true, showMain: true,
pdfTemplateSelectedIndex: 0,
pdfTemplateContent: '',
templateInfo: {}, templateInfo: {},
pdfTemplateAll: [],
templateSaveTitle: '保存为模板', templateSaveTitle: '保存为模板',
templateSaveShow: false, templateSaveShow: false,
hasStar: false, hasStar: false,
fullscreen: false fullscreen: false,
pdfExportShow: false,
snapshotInfo: ''
} }
}, },
computed: { computed: {
@ -133,8 +161,15 @@ export default {
} }
}, },
mounted() { mounted() {
this.initPdfTemplate()
}, },
methods: { methods: {
initPdfTemplate() {
queryAll().then(res => {
this.pdfTemplateAll = res.data
this.changePdfTemplate()
})
},
clickFullscreen() { clickFullscreen() {
this.fullscreen = true this.fullscreen = true
}, },
@ -144,7 +179,7 @@ export default {
}, },
saveToTemplate() { saveToTemplate() {
this.templateSaveShow = true this.templateSaveShow = true
html2canvas(this.$refs.imageWrapper).then(canvas => { html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2 const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2
if (snapshot !== '') { if (snapshot !== '') {
this.templateInfo = { this.templateInfo = {
@ -162,7 +197,7 @@ export default {
}) })
}, },
downloadToTemplate() { downloadToTemplate() {
html2canvas(this.$refs.imageWrapper).then(canvas => { html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2 const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2
if (snapshot !== '') { if (snapshot !== '') {
this.templateInfo = { this.templateInfo = {
@ -180,34 +215,17 @@ export default {
}, },
downloadAsPDF() { downloadAsPDF() {
html2canvas(this.$refs.imageWrapper).then(canvas => { html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
const contentWidth = canvas.width const snapshot = canvas.toDataURL('image/jpeg', 1) // 0.2
const contentHeight = canvas.height if (snapshot !== '') {
const pageHeight = contentWidth / 592.28 * 841.89 this.snapshotInfo = snapshot
let leftHeight = contentHeight this.pdfExportShow = true
let position = 0
const imgWidth = 595.28
const imgHeight = 592.28 / contentWidth * contentHeight
const pageData = canvas.toDataURL('image/jpeg', 1.0)
const PDF = new JsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight)
} else {
while (leftHeight > 0) {
PDF.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
if (leftHeight > 0) {
PDF.addPage()
}
}
} }
PDF.save('PDF-test' + '.pdf')
}) })
}, },
refreshTemplateInfo() { refreshTemplateInfo() {
this.templateInfo = {} this.templateInfo = {}
html2canvas(this.$refs.imageWrapper).then(canvas => { html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2 const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.2
if (snapshot !== '') { if (snapshot !== '') {
this.templateInfo = { this.templateInfo = {
@ -244,6 +262,12 @@ export default {
if (this.activeTab !== 'PanelList') { if (this.activeTab !== 'PanelList') {
bus.$emit('panle_start_list_refresh', isStar) bus.$emit('panle_start_list_refresh', isStar)
} }
},
changePdfTemplate() {
this.pdfTemplateContent = this.pdfTemplateAll[this.pdfTemplateSelectedIndex].templateContent
},
closePreExport() {
this.pdfExportShow = false
} }
} }
@ -303,4 +327,14 @@ export default {
flex-flow: row nowrap; flex-flow: row nowrap;
color: #9ea6b2; color: #9ea6b2;
} }
.dialog-css2 ::v-deep .el-dialog__title {
font-size: 14px!important;
}
.dialog-css2 ::v-deep .el-dialog__header {
padding: 20px 20px 0!important;
}
.dialog-css2 ::v-deep .el-dialog__body {
padding: 0px 20px!important;
}
</style> </style>