Merge branch 'dev' into v1.17

This commit is contained in:
taojinlong 2022-11-30 00:05:48 +08:00
commit b98dea0642
57 changed files with 583 additions and 184 deletions

13
.github/workflows/typos_check.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Typos Check
on: [push, pull_request]
jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Check spelling
uses: crate-ci/typos@master

12
.typos.toml Normal file
View File

@ -0,0 +1,12 @@
[default.extend-words]
Rela = "Rela"
eles = "eles"
delink = "delink"
testng = "testng"
ba = "ba"
referer = "referer"
keynode = "keynode"
[files]
extend-exclude = ["public/", "amap-wx/", "m-icon/", "uni-card/", "uni-col/", "uni-link/", "uni-list/", "uni-list-item/", "uni-row/", "migration/", "mapFiles/"]

View File

@ -0,0 +1,26 @@
package io.dataease.commons.utils;
import io.dataease.dto.dataset.union.UnionDTO;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/11/28
* Description:
*/
public class DatasetUtils {
public static void getUnionTable(List<String> tableIdList, List<UnionDTO> childrenDs) {
if (CollectionUtils.isNotEmpty(childrenDs)) {
for (UnionDTO unionDTO : childrenDs) {
String tableId = unionDTO.getCurrentDs().getId();
tableIdList.add(tableId);
if (CollectionUtils.isNotEmpty(unionDTO.getChildrenDs())) {
getUnionTable(tableIdList, unionDTO.getChildrenDs());
}
}
}
}
}

View File

@ -8,4 +8,6 @@ import java.util.List;
public interface ExtDataSetTableFieldMapper {
List<DatasetTableField> findByPanelId(@Param("panelId") String panelId);
List<DatasetTableField> findByTableIds(@Param("tableIds") List<String> tableIds);
}

View File

@ -7,23 +7,22 @@
</resultMap>
<select id="findByPanelId" resultMap="BaseResultMapDTO">
select
dataset_table_field.*
select dataset_table_field.*
from dataset_table_field
where table_id in (
SELECT
table_id
FROM
chart_view
WHERE
id IN (
SELECT
chart_view_id
FROM
panel_view
WHERE
panel_id = #{panelId}
)
)
where table_id in (SELECT table_id
FROM chart_view
WHERE id IN (SELECT chart_view_id
FROM panel_view
WHERE panel_id = #{panelId}))
</select>
<select id="findByTableIds" resultMap="BaseResultMapDTO">
select
dataset_table_field.*
from dataset_table_field
where dataset_table_field.table_id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -11,8 +11,13 @@ public interface ExtDataSetTableMapper {
List<DataSetTableDTO> search(DataSetTableRequest request);
DataSetTableDTO searchOne(DataSetTableRequest request);
DataSetTableDTO findOneDetails(@Param("datasetTableId") String datasetTableId);
List<DataSetTableDTO> searchDataSetTableWithPanelId(@Param("panelId") String panelId, @Param("userId") String userId);
List<DatasetTable> findByPanelId(@Param("panelId") String panelId);
List<DatasetTable> findByTableIds(@Param("tableIds") List<String> tableIds);
}

View File

@ -25,7 +25,7 @@
`info`,
create_by,
create_time,
( SELECT nick_name FROM sys_user WHERE sys_user.username = dataset_table.create_by ) AS creator_name
(SELECT nick_name FROM sys_user WHERE sys_user.username = dataset_table.create_by) AS creator_name
from dataset_table
where id = #{datasetTableId}
</select>
@ -147,4 +147,13 @@
FROM panel_view
WHERE panel_id = #{panelId}))
</select>
<select id="findByTableIds" resultMap="BaseResultMapDTO">
select dataset_table.*
from dataset_table
where dataset_table.id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -1,8 +1,8 @@
package io.dataease.ext;
import io.dataease.ext.query.GridExample;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.dto.dataset.DataSetTaskLogDTO;
import io.dataease.ext.query.GridExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -25,4 +25,6 @@ public interface ExtDataSetTaskMapper {
List<DataSetTaskDTO> taskWithTriggers(GridExample example);
List<DataSetTaskDTO> findByPanelId(@Param("panelId") String panelId);
List<DataSetTaskDTO> findByTableIds(@Param("tableIds") List tableIds);
}

View File

@ -8,19 +8,21 @@
<result column="dataset_name" jdbcType="VARCHAR" property="datasetName"/>
</resultMap>
<resultMap id="TaskResult" type="io.dataease.dto.dataset.DataSetTaskDTO" extends="io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper.BaseResultMap">
<resultMap id="TaskResult" type="io.dataease.dto.dataset.DataSetTaskDTO"
extends="io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper.BaseResultMap">
<result column="table_name" jdbcType="VARCHAR" property="datasetName"/>
<result column="privileges" jdbcType="VARCHAR" property="privileges"/>
<result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextExecTime"/>
</resultMap>
<select id="listTaskLog" resultMap="BaseResult" parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
<select id="listTaskLog" resultMap="BaseResult"
parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
SELECT dataset_table_task_log.*, dataset_table_task.name, dataset_table.name as dataset_name
FROM dataset_table_task_log
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
LEFT JOIN dataset_table ON dataset_table_task_log.table_id = dataset_table.id
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition" />
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -30,13 +32,14 @@
</if>
</select>
<select id="listUserTaskLog" resultMap="BaseResult" parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
<select id="listUserTaskLog" resultMap="BaseResult"
parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
SELECT dataset_table_task_log.*, dataset_table_task.name, dataset_table.name as dataset_name
FROM dataset_table_task_log
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
LEFT JOIN dataset_table ON dataset_table_task_log.table_id = dataset_table.id
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition" />
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -47,12 +50,13 @@
</select>
<select id="taskList" resultMap="TaskResult" parameterType="io.dataease.ext.query.GridExample">
SELECT dataset_table.name as table_name, 'grant,manage,use' as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
SELECT dataset_table.name as table_name, 'grant,manage,use' as `privileges`,dataset_table_task.* ,
qrtz_triggers.NEXT_FIRE_TIME
FROM dataset_table_task
left join dataset_table on dataset_table.id=dataset_table_task.table_id
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition" />
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -63,12 +67,13 @@
</select>
<select id="userTaskList" resultMap="TaskResult" parameterType="io.dataease.ext.query.GridExample">
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as
`privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
FROM dataset_table_task
left join dataset_table on dataset_table.id=dataset_table_task.table_id
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition" />
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -79,12 +84,13 @@
</select>
<select id="taskWithTriggers" resultMap="TaskResult" parameterType="io.dataease.ext.query.GridExample">
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as
`privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
FROM dataset_table_task
left join dataset_table on dataset_table.id=dataset_table_task.table_id
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition" />
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -95,26 +101,23 @@
</select>
<select id="findByPanelId" resultMap="TaskResult">
select
dataset_table_task.*
select dataset_table_task.*
from dataset_table_task
where id in (
SELECT
table_id
FROM
chart_view
WHERE
id IN (
SELECT
chart_view_id
FROM
panel_view
WHERE
panel_id = #{panelId}
)
)
where id in (SELECT table_id
FROM chart_view
WHERE id IN (SELECT chart_view_id
FROM panel_view
WHERE panel_id = #{panelId}))
</select>
<select id="findByTableIds" resultMap="TaskResult">
select dataset_table_task.*
from dataset_table_task
where dataset_table_task.table_id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -1,8 +1,8 @@
package io.dataease.ext;
import io.dataease.ext.query.GridExample;
import io.dataease.controller.request.DatasourceUnionRequest;
import io.dataease.dto.DatasourceDTO;
import io.dataease.ext.query.GridExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -15,7 +15,9 @@ public interface ExtDataSourceMapper {
List<DatasourceDTO> findByPanelId(@Param("panelId") String panelId);
DatasourceDTO queryDetails(@Param("datasourceId") String datasourceId,@Param("userId") String userId);
List<DatasourceDTO> findByTableIds(@Param("tableIds") List<String> tableIds);
DatasourceDTO queryDetails(@Param("datasourceId") String datasourceId, @Param("userId") String userId);
}

View File

@ -130,6 +130,19 @@
WHERE panel_view.panel_id = #{panelId}
</select>
<select id="findByTableIds" resultMap="BaseResultMapDTO">
SELECT DISTINCT datasource.id,
datasource.`name`,
datasource.DESC,
datasource.type
FROM dataset_table
INNER JOIN datasource ON dataset_table.data_source_id = datasource.id
WHERE dataset_table.id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryDetails" resultMap="BaseResultMapDTO">
select datasource.*,
get_auths(id, 'link', #{userId}) as `privileges`

View File

@ -2,6 +2,7 @@ package io.dataease.provider;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.Datasource;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
@ -41,11 +42,15 @@ public class DDLProviderImpl extends DDLProvider {
Integer realSize = page * pageNumber < dataList.size() ? page * pageNumber : dataList.size();
for (String[] strings : dataList.subList((page - 1) * pageNumber, realSize)) {
String[] strings1 = new String[strings.length];
for(int i=0; i< strings.length;i++){
strings1[i] = strings[i].replace("'","\\'");
for (int i = 0; i < strings.length; i++) {
if (StringUtils.isEmpty(strings[i])) {
strings1[i] = "";
} else {
strings1[i] = strings[i].replace("'", "\\'");
}
}
values.append("('").append(UUID.randomUUID())
.append("','" ).append(String.join("','", Arrays.asList(strings1)))
.append("','").append(String.join("','", Arrays.asList(strings1)))
.append("'),");
}
return insertSql + values.substring(0, values.length() - 1);

View File

@ -1324,4 +1324,8 @@ public class EsQueryProvider extends QueryProvider {
"{\"dateformat\": \"yyyy-MM-dd HH:mm:ss\"}\n" +
"]", Dateformat.class);
}
public String getResultCount(boolean isTable, String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return null;
}
}

View File

@ -1144,7 +1144,7 @@ public class HiveQueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
fieldName = String.format(HiveConstants.DATE_FORMAT, originField, format);
fieldName = String.format(HiveConstants.DATE_FORMAT, String.format(HiveConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT), format);
} else {
String cast = String.format(HiveConstants.CAST, originField, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";
String from_unixtime = String.format(HiveConstants.FROM_UNIXTIME, cast, HiveConstants.DEFAULT_DATE_FORMAT);

View File

@ -1174,7 +1174,7 @@ public class MysqlQueryProvider extends QueryProvider {
if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == 0) {
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);
fieldName = String.format(MySQLConstants.DATE_FORMAT, String.format(MySQLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT), format);
} else {
String cast = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
String from_unixtime = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);

View File

@ -457,7 +457,7 @@ public class PgQueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
@ -964,7 +964,7 @@ public class PgQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.CAST, originName, "timestamp");
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
@ -1063,7 +1063,7 @@ public class PgQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.CAST, originName, "timestamp");
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
@ -1177,7 +1177,9 @@ public class PgQueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
fieldName = String.format(PgConstants.DATE_FORMAT, String.format(PgConstants.CAST, originField, "timestamp"), format);
fieldName = String.format(PgConstants.DATE_FORMAT,
String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT),
format);
} else {
String cast = String.format(PgConstants.CAST, originField, "bigint");
String from_unixtime = String.format(PgConstants.FROM_UNIXTIME, cast);

View File

@ -963,7 +963,7 @@ public class RedshiftQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.CAST, originName, "timestamp");
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
@ -1058,7 +1058,7 @@ public class RedshiftQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.CAST, originName, "timestamp");
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
@ -1166,7 +1166,7 @@ public class RedshiftQueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
fieldName = String.format(PgConstants.DATE_FORMAT, originField, format);
fieldName = String.format(PgConstants.DATE_FORMAT, String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT), format);
} else {
String cast = String.format(PgConstants.CAST, originField, "bigint");
String from_unixtime = String.format(PgConstants.FROM_UNIXTIME, cast);

View File

@ -1343,4 +1343,8 @@ public class SqlserverQueryProvider extends QueryProvider {
"{\"dateformat\": \"120\", \"desc\": \"yyyy-mm-dd hh:mi:ss\"}\n" +
"]", Dateformat.class);
}
public String getResultCount(boolean isTable, String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return null;
}
}

View File

@ -116,4 +116,8 @@ public class DataSetTableFieldsService {
public void delete(String id) {
datasetTableFieldMapper.deleteByPrimaryKey(id);
}
public void updateByPrimaryKeySelective(DatasetTableField request) {
datasetTableFieldMapper.updateByPrimaryKeySelective(request);
}
}

View File

@ -5,6 +5,7 @@ import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TableUtils;
import io.dataease.controller.datasource.request.UpdataDsRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest;
@ -197,28 +198,43 @@ public class PanelAppTemplateService {
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo, Map<String, String> datasetsRealMap) {
public Map<String, String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo, Map<String, String> datasetsRealMap, Map<String, String> datasetTypeRealMap, Map<String, String> datasetFieldsMd5FormatRealMap) {
Map<String, String> datasetFieldsRealMap = new HashMap<>();
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
if (datasetTableField.getExtField() != 2) {
String oldId = datasetTableField.getId();
datasetTableField.setTableId(datasetsRealMap.get(datasetTableField.getTableId()));
String oldTableId = datasetTableField.getTableId();
datasetTableField.setTableId(datasetsRealMap.get(oldTableId));
datasetTableField.setId(null);
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
datasetFieldsRealMap.put(oldId, newTableField.getId());
datasetFieldsMd5FormatRealMap.put(TableUtils.fieldNameShort(oldTableId + "_" + datasetTableField.getOriginName()), TableUtils.fieldNameShort(newTableField.getTableId() + "_" + datasetTableField.getOriginName()));
}
}
//数据集计算字段替换
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
if (datasetTableField.getExtField() == 2) {
String oldId = datasetTableField.getId();
datasetTableField.setTableId(datasetsRealMap.get(datasetTableField.getTableId()));
String oldTableId = datasetTableField.getTableId();
String oldOriginName = datasetTableField.getOriginName();
datasetTableField.setTableId(datasetsRealMap.get(oldTableId));
datasetTableField.setId(null);
datasetFieldsRealMap.forEach((k, v) -> {
datasetTableField.setOriginName(datasetTableField.getOriginName().replaceAll(k, v));
});
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
datasetFieldsRealMap.put(oldId, newTableField.getId());
datasetFieldsMd5FormatRealMap.put(TableUtils.fieldNameShort(oldTableId + "_" + oldOriginName), TableUtils.fieldNameShort(newTableField.getTableId() + "_" + datasetTableField.getOriginName()));
}
}
//custom union originName替换
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
if (DatasetType.UNION.name().equalsIgnoreCase(datasetTypeRealMap.get(datasetTableField.getTableId())) || DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTypeRealMap.get(datasetTableField.getTableId()))) {
DatasetTableField updateField = new DatasetTableField();
updateField.setId(datasetTableField.getId());
updateField.setOriginName(datasetFieldsMd5FormatRealMap.get(datasetTableField.getOriginName()));
dataSetTableFieldsService.updateByPrimaryKeySelective(updateField);
}
}
return datasetFieldsRealMap;
@ -248,7 +264,7 @@ public class PanelAppTemplateService {
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo, Map<String, String> datasetsRealMap, Map<String, String> datasetFieldsRealMap, String sceneId) throws Exception {
public Map<String, String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo, Map<String, String> datasetsRealMap, Map<String, String> datasetFieldsRealMap, Map<String, String> datasetFieldsMd5FormatRealMap, String sceneId) throws Exception {
Map<String, String> chartViewsRealMap = new HashMap<>();
for (ChartViewWithBLOBs chartView : chartViewsInfo) {
String oldViewId = chartView.getId();
@ -279,6 +295,19 @@ public class PanelAppTemplateService {
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
});
//替换originName
datasetFieldsMd5FormatRealMap.forEach((k, v) -> {
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));
chartView.setYAxis(chartView.getYAxis().replaceAll(k, v));
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k, v));
chartView.setExtStack(chartView.getExtStack().replaceAll(k, v));
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k, v));
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k, v));
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k, v));
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
});
chartView.setId(null);
chartView.setSceneId(sceneId);
ChartViewWithBLOBs newOne = chartViewService.newOne(chartView);

View File

@ -18,6 +18,7 @@ import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.dto.panel.PanelExport2App;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.PanelTemplateFileDTO;
@ -313,7 +314,9 @@ public class PanelGroupService {
panelGroup.setPanelStyle(sourcePanel.getPanelStyle());
panelGroup.setSourcePanelName(sourcePanel.getName());
}
panelGroup.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
if (panelGroup != null) {
panelGroup.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
}
return panelGroup;
}
@ -808,12 +811,42 @@ public class PanelGroupService {
List<ChartViewField> chartViewFieldsInfo = extChartViewFieldMapper.findByPanelId(panelId);
//3.获取所有数据集信息
List<DatasetTable> datasetTablesInfo = extDataSetTableMapper.findByPanelId(panelId);
List<String> attachTableIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(datasetTablesInfo)) {
for (DatasetTable datasetTable : datasetTablesInfo) {
if ("union".equals(datasetTable.getType()) && StringUtils.isNotEmpty(datasetTable.getInfo())) {
DataTableInfoDTO dt = gson.fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
DatasetUtils.getUnionTable(attachTableIds, dt.getUnion());
} else if ("custom".equals(datasetTable.getType()) && StringUtils.isNotEmpty(datasetTable.getInfo())) {
Map result = gson.fromJson(datasetTable.getInfo(), Map.class);
List<Map> list = (List<Map>) result.get("list");
if (CollectionUtils.isNotEmpty(list)) {
for (Map details : list) {
attachTableIds.add(String.valueOf(details.get("tableId")));
}
}
}
}
if (CollectionUtils.isNotEmpty(attachTableIds)) {
List<DatasetTable> attachDatasetTables = extDataSetTableMapper.findByTableIds(attachTableIds);
if (CollectionUtils.isNotEmpty(attachDatasetTables)) {
datasetTablesInfo.addAll(attachDatasetTables);
}
}
}
// dataset check
if (CollectionUtils.isEmpty(datasetTablesInfo)) {
return new PanelExport2App(Translator.get("I18N_APP_NO_DATASET_ERROR"));
} else if (datasetTablesInfo.stream().filter(datasetTable -> datasetTable.getType().equals("excel") || datasetTable.getType().equals("api")).collect(Collectors.toList()).size() > 0) {
return new PanelExport2App(Translator.get("I18N_APP_ERROR_DATASET"));
}
List<String> allTableIds = datasetTablesInfo.stream().map(DatasetTable::getId).collect(Collectors.toList());
//4.获取所有数据集字段信息
List<DatasetTableField> datasetTableFieldsInfo = extDataSetTableFieldMapper.findByPanelId(panelId);
List<DatasetTableField> datasetTableFieldsInfo = extDataSetTableFieldMapper.findByTableIds(allTableIds);
//5.获取所有任务信息
List<DataSetTaskDTO> dataSetTasksInfo = extDataSetTaskMapper.findByPanelId(panelId);
List<DataSetTaskDTO> dataSetTasksInfo = extDataSetTaskMapper.findByTableIds(allTableIds);
//6.获取所有数据源信息
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.findByPanelId(panelId);
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.findByTableIds(allTableIds);
List<PanelView> panelViews = panelViewService.findPanelViewsByPanelId(panelId);
@ -825,13 +858,6 @@ public class PanelGroupService {
return new PanelExport2App(Translator.get("I18N_APP_TEMPLATE_VIEW_ERROR"));
}
// dataset check
if (CollectionUtils.isEmpty(datasetTablesInfo)) {
return new PanelExport2App(Translator.get("I18N_APP_NO_DATASET_ERROR"));
} else if (datasetTablesInfo.stream().filter(datasetTable -> datasetTable.getType().equals("excel") || datasetTable.getType().equals("api")).collect(Collectors.toList()).size() > 0) {
return new PanelExport2App(Translator.get("I18N_APP_ERROR_DATASET"));
}
//datasource check
if (CollectionUtils.isEmpty(datasourceDTOS)) {
return new PanelExport2App(Translator.get("I18N_APP_NO_DATASOURCE"));
@ -885,11 +911,15 @@ public class PanelGroupService {
Map<String, String> datasetsRealMap = panelAppTemplateService.applyDataset(datasetTablesInfo, datasourceRealMap, asideDatasetGroupId);
Map<String, String> datasetFieldsRealMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo, datasetsRealMap);
Map<String, String> datasetTypeRealMap = datasetTablesInfo.stream().collect(Collectors.toMap(DatasetTable::getId, DatasetTable::getType));
Map<String, String> datasetFieldsMd5FormatRealMap = new HashMap<>();
Map<String, String> datasetFieldsRealMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo, datasetsRealMap, datasetTypeRealMap, datasetFieldsMd5FormatRealMap);
panelAppTemplateService.resetCustomAndUnionDataset(datasetTablesInfo, datasetsRealMap, datasetFieldsRealMap);
Map<String, String> chartViewsRealMap = panelAppTemplateService.applyViews(chartViewsInfo, datasetsRealMap, datasetFieldsRealMap, newPanelId);
Map<String, String> chartViewsRealMap = panelAppTemplateService.applyViews(chartViewsInfo, datasetsRealMap, datasetFieldsRealMap, datasetFieldsMd5FormatRealMap, newPanelId);
panelAppTemplateService.applyViewsField(chartViewFieldsInfo, chartViewsRealMap, datasetsRealMap, datasetFieldsRealMap);

View File

@ -52,3 +52,7 @@ where id = '3986ba4c-5a8e-11ed-bc5b-cf4a43b3b40c';
update `my_plugin` set `name` = '气泡地图插件' where `plugin_id` = 2;
ALTER TABLE `dataset_table_field`
CHANGE COLUMN `origin_name` `origin_name` LONGTEXT CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin' NOT NULL ;

View File

@ -8,6 +8,15 @@ export function post(url, data, loading = false) {
data
})
}
export function tableField(id) {
return request({
url: '/dataset/table/getWithPermission/' + id,
method: 'post',
loading: true,
hideMsg: true,
timeout: 60000
})
}
export function getChartTree(data) {
return request({

View File

@ -185,7 +185,7 @@ export function multFieldValues(data) {
return request({
url: '/dataset/field/multFieldValues',
method: 'post',
loading: true,
loading: false,
data
})
}
@ -241,6 +241,7 @@ export function checkCustomDs() {
loading: true
})
}
export function exportExcel(data) {
return request({
url: '/dataset/taskLog/export',
@ -268,4 +269,5 @@ export function exportDataset(data) {
responseType: 'blob'
})
}
export default { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, checkCustomDs, exportDataset }

View File

@ -106,6 +106,7 @@ export default {
this.$router.back(-1)
},
exportPDF() {
this.$refs['widget-div'].style.display = ''
this.$emit('link-export-pdf')
},
setWidgetStatus() {

View File

@ -274,7 +274,7 @@ export default {
} else {
return {
...
getStyle(style, ['top', 'left', 'width', 'height', 'rotate']),
getStyle(style, ['top', 'left', 'width', 'height', 'rotate']),
position: 'relative'
}
}
@ -312,9 +312,14 @@ export default {
}
},
clearHandler() {
if (this.$refs.deOutWidget && this.$refs.deOutWidget.clearHandler) {
if (this.$refs.deOutWidget?.clearHandler) {
this.$refs.deOutWidget.clearHandler()
}
},
responseResetButton() {
if (this.$refs.wrapperChild?.responseResetButton) {
this.$refs.wrapperChild.responseResetButton()
}
}
}
}

View File

@ -1106,6 +1106,11 @@ export default {
},
triggerResetButton() {
this.triggerSearchButton(true)
this.$refs['wrapperChild']?.forEach(item => {
if (item?.['responseResetButton']) {
item.responseResetButton()
}
})
},
refreshButtonInfo(isClear = false) {
const result = this.buildButtonFilterMap(this.componentData, isClear)

View File

@ -137,7 +137,7 @@
:target="curComponent.hyperlinks.openMode "
:href="curComponent.hyperlinks.content "
>
<i class="icon iconfont icon-com-jump" />
<i class="icon iconfont icon-com-jump"/>
</a>
</span>
@ -243,6 +243,7 @@ export default {
},
data() {
return {
systemOS: 'Mac',
maxImageSize: 15000000,
boardSetVisible: false,
linkJumpSetVisible: false,
@ -362,6 +363,9 @@ export default {
])
},
mounted() {
if (navigator.platform.indexOf('Mac') == -1) {
this.systemOS = 'Other'
}
this.initCurFields()
if (this.element.type === 'view') {
bus.$on('initCurFields-' + this.element.id, this.initCurFields)

View File

@ -95,6 +95,49 @@
@closePreExport="closePreExport"
/>
</el-dialog>
<!--视图详情-->
<el-dialog
:visible.sync="chartDetailsVisible"
width="80%"
class="dialog-css"
:destroy-on-close="true"
:show-close="true"
:append-to-body="false"
top="5vh"
>
<span
v-if="chartDetailsVisible"
style="position: absolute;right: 70px;top:15px"
>
<el-button
v-if="showChartInfoType==='enlarge' && showChartInfo && showChartInfo.type !== 'symbol-map'"
class="el-icon-picture-outline"
size="mini"
@click="exportViewImg"
>
{{ $t('chart.export_img') }}
</el-button>
<el-button
v-if="showChartInfoType==='details'"
size="mini"
@click="exportExcel"
>
<svg-icon
icon-class="ds-excel"
class="ds-icon-excel"
/>{{ $t('chart.export') }}Excel
</el-button>
</span>
<user-view-dialog
v-if="chartDetailsVisible"
ref="userViewDialog-canvas-main"
:chart="showChartInfo"
:chart-table="showChartTableInfo"
:canvas-style-data="canvasStyleData"
:open-type="showChartInfoType"
/>
</el-dialog>
</div>
</template>
@ -117,10 +160,11 @@ import html2canvas from 'html2canvasde'
import { queryAll } from '@/api/panel/pdfTemplate'
import PDFPreExport from '@/views/panel/export/PDFPreExport'
import { listenGlobalKeyDownPreview } from '@/components/canvas/utils/shortcutKey'
import UserViewDialog from '@/components/canvas/customComponent/UserViewDialog'
const erd = elementResizeDetectorMaker()
export default {
components: { ComponentWrapper, CanvasOptBar, PDFPreExport },
components: { UserViewDialog, ComponentWrapper, CanvasOptBar, PDFPreExport },
model: {
prop: 'show',
event: 'change'
@ -189,6 +233,10 @@ export default {
},
data() {
return {
chartDetailsVisible: false,
showChartInfo: {},
showChartTableInfo: {},
showChartInfoType: 'details',
mainHeightCount: null,
userInfo: null,
previewMainDomId: 'preview-main-' + this.canvasId,
@ -381,6 +429,7 @@ export default {
if (this.terminal === 'mobile') {
this.initMobileCanvas()
}
this.canvasId === 'canvas-main' && bus.$on('pcChartDetailsDialog', this.openChartDetailsDialog)
bus.$on('trigger-search-button', this.triggerSearchButton)
bus.$on('trigger-reset-button', this.triggerResetButton)
this.initPdfTemplate()
@ -389,10 +438,19 @@ export default {
erd.uninstall(this.$refs[this.previewTempRefId])
erd.uninstall(this.$refs[this.previewRefId])
clearInterval(this.timer)
this.canvasId === 'canvas-main' && bus.$off('pcChartDetailsDialog', this.openChartDetailsDialog)
bus.$off('trigger-search-button', this.triggerSearchButton)
bus.$off('trigger-reset-button', this.triggerResetButton)
},
methods: {
openChartDetailsDialog(paramInfo) {
if (this.canvasId === 'canvas-main') {
this.showChartInfo = paramInfo.showChartInfo
this.showChartTableInfo = paramInfo.showChartTableInfo
this.showChartInfoType = paramInfo.showChartInfoType
this.chartDetailsVisible = true
}
},
initWatermark(waterDomId = 'preview-main-canvas-main') {
if (this.panelInfo.watermarkInfo && this.canvasId === 'canvas-main') {
if (this.userInfo) {
@ -410,6 +468,11 @@ export default {
},
triggerResetButton() {
this.triggerSearchButton(true)
this.$refs['viewWrapperChild']?.forEach(item => {
if (item?.responseResetButton) {
item.responseResetButton()
}
})
},
triggerSearchButton(isClear = false) {
const result = this.buildButtonFilterMap(this.componentData, isClear)
@ -585,10 +648,10 @@ export default {
}
},
exportExcel() {
this.$refs['userViewDialog'].exportExcel()
this.$refs['userViewDialog-canvas-main'].exportExcel()
},
exportViewImg() {
this.$refs['userViewDialog'].exportViewImg()
this.$refs['userViewDialog-canvas-main'].exportViewImg()
},
deselectCurComponent(e) {
if (!this.isClickComponent) {

View File

@ -17,7 +17,8 @@
v-if="curComponent.type != 'custom-button'"
icon="el-icon-document-copy"
@click.native="copy"
>{{ $t('panel.copy') }}
><span>{{ $t('panel.copy') }}(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command"
/>+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-delete"
@ -162,6 +163,7 @@ export default {
components: { CustomTabsSort, HyperlinksDialog },
data() {
return {
systemOS: 'Mac',
showCustomSort: false,
jumpExcludeViewType: [
'richTextView',
@ -207,6 +209,11 @@ export default {
'componentData'
])
},
mounted() {
if (navigator.platform.indexOf('Mac') == -1) {
this.systemOS = 'Other'
}
},
methods: {
openCustomSort() {
this.showCustomSort = true

View File

@ -18,8 +18,8 @@
<script>
import tinymce from 'tinymce/tinymce' // tinymcehidden
import Editor from '@tinymce/tinymce-vue'//
import 'tinymce/themes/silver/theme'//
import Editor from '@tinymce/tinymce-vue' //
import 'tinymce/themes/silver/theme' //
import 'tinymce/icons/default' // icon
//
import 'tinymce/plugins/advlist' //
@ -29,9 +29,9 @@ import 'tinymce/plugins/image' // 插入编辑图片
import 'tinymce/plugins/lists' //
import 'tinymce/plugins/charmap' //
import 'tinymce/plugins/media' //
import 'tinymce/plugins/wordcount'//
import 'tinymce/plugins/table'//
import 'tinymce/plugins/contextmenu'// contextmenu
import 'tinymce/plugins/wordcount' //
import 'tinymce/plugins/table' //
import 'tinymce/plugins/contextmenu' // contextmenu
import 'tinymce/plugins/directionality'
import 'tinymce/plugins/nonbreaking'
import 'tinymce/plugins/pagebreak'
@ -173,34 +173,43 @@ export default {
.rich-main-class {
width: 100%;
height: 100%;
overflow-y: auto!important;
overflow-y: auto !important;
position: relative;
}
::-webkit-scrollbar {
width: 0px!important;
height: 0px!important;
width: 0px !important;
height: 0px !important;
}
::v-deep ol {
display: block!important;
display: block !important;
list-style-type: decimal;
margin-block-start: 1em!important;
margin-block-end: 1em!important;
margin-inline-start: 0px!important;
margin-inline-end: 0px!important;
padding-inline-start: 40px!important;
margin-block-start: 1em !important;
margin-block-end: 1em !important;
margin-inline-start: 0px !important;
margin-inline-end: 0px !important;
padding-inline-start: 40px !important;
}
::v-deep ul {
display: block!important;
display: block !important;
list-style-type: disc;
margin-block-start: 1em!important;
margin-block-end: 1em!important;
margin-inline-start: 0px!important;
margin-inline-end: 0px!important;
padding-inline-start: 40px!important;
margin-block-start: 1em !important;
margin-block-end: 1em !important;
margin-inline-start: 0px !important;
margin-inline-end: 0px !important;
padding-inline-start: 40px !important;
}
::v-deep li {
display: list-item!important;
text-align: -webkit-match-parent!important;
display: list-item !important;
text-align: -webkit-match-parent !important;
}
::v-deep p {
margin: 0px;
padding: 0px;
}
</style>

View File

@ -18,8 +18,8 @@
<script>
import tinymce from 'tinymce/tinymce' // tinymcehidden
import Editor from '@tinymce/tinymce-vue'//
import 'tinymce/themes/silver/theme'//
import Editor from '@tinymce/tinymce-vue' //
import 'tinymce/themes/silver/theme' //
import 'tinymce/icons/default' // icon
//
import 'tinymce/plugins/advlist' //
@ -29,9 +29,9 @@ import 'tinymce/plugins/image' // 插入编辑图片
import 'tinymce/plugins/lists' //
import 'tinymce/plugins/charmap' //
import 'tinymce/plugins/media' //
import 'tinymce/plugins/wordcount'//
import 'tinymce/plugins/table'//
import 'tinymce/plugins/contextmenu'// contextmenu
import 'tinymce/plugins/wordcount' //
import 'tinymce/plugins/table' //
import 'tinymce/plugins/contextmenu' // contextmenu
import 'tinymce/plugins/directionality'
import 'tinymce/plugins/nonbreaking'
import 'tinymce/plugins/pagebreak'
@ -272,5 +272,10 @@ export default {
::v-deep .base-selected {
background-color: #b4d7ff
}
::v-deep p {
margin: 0px;
padding: 0px;
}
</style>

View File

@ -232,6 +232,11 @@ export default {
ChartComponentG2
},
props: {
inScreen: {
type: Boolean,
required: false,
default: true
},
canvasId: {
type: String,
required: true
@ -469,7 +474,7 @@ export default {
},
'cfilters': {
handler: function(val1, val2) {
if ((isChange(val1, val2) || isChange(val1, this.filters)) && !this.isFirstLoad) {
if (isChange(val1, val2) && !this.isFirstLoad) {
this.getData(this.element.propValue.viewId)
}
},
@ -555,6 +560,11 @@ export default {
}
},
methods: {
responseResetButton() {
if (!this.cfilters?.length) {
this.getData(this.element.propValue.viewId, false)
}
},
exportExcel() {
this.$refs['userViewDialog'].exportExcel()
},
@ -724,6 +734,7 @@ export default {
// echart
if (response.success) {
this.chart = response.data
this.view = response.data
this.$emit('fill-chart-2-parent', this.chart)
this.getDataOnly(response.data, dataBroadcast)
this.chart['position'] = this.inTab ? 'tab' : 'panel'
@ -860,6 +871,7 @@ export default {
tableChart.customStyle = JSON.parse(this.chart.customStyle)
tableChart.customAttr.color.tableHeaderBgColor = '#f8f8f9'
tableChart.customAttr.color.tableItemBgColor = '#ffffff'
tableChart.customAttr.color.tableHeaderFontColor = '#7c7e81'
tableChart.customAttr.color.tableFontColor = '#7c7e81'
tableChart.customAttr.color.tableStripe = true
tableChart.customStyle.text.show = false
@ -869,7 +881,13 @@ export default {
this.showChartInfo = this.chart
this.showChartTableInfo = tableChart
this.showChartInfoType = params.openType
if (this.terminal === 'pc') {
if (!this.inScreen) {
bus.$emit('pcChartDetailsDialog', {
showChartInfo: this.showChartInfo,
showChartTableInfo: this.showChartTableInfo,
showChartInfoType: this.showChartInfoType
})
} else if (this.terminal === 'pc') {
this.chartDetailsVisible = true
} else {
this.mobileChartDetailsVisible = true
@ -1181,6 +1199,7 @@ export default {
}
viewData(this.chart.id, this.panelInfo.id, requestInfo).then(response => {
this.componentViewsData[this.chart.id] = response.data
this.view = response.data
if (dataBroadcast) {
bus.$emit('prop-change-data')
}

View File

@ -1,9 +1,11 @@
import { toBottom, toTop, moveUp, moveDown } from '@/components/canvas/utils/utils'
import { findCurComponentIndex, moveDown, moveUp, toBottom, toTop } from '@/components/canvas/utils/utils'
import toast from '@/components/canvas/utils/toast'
export default {
mutations: {
upComponent({ componentData, curComponentIndex }) {
upComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent)
// 上移图层 index表示元素在数组中越往后
if (curComponentIndex < componentData.length - 1) {
moveUp(componentData, curComponentIndex)
@ -12,7 +14,8 @@ export default {
}
},
downComponent({ componentData, curComponentIndex }) {
downComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent)
// 下移图层 index表示元素在数组中越往前
if (curComponentIndex > 0) {
moveDown(componentData, curComponentIndex)
@ -21,14 +24,16 @@ export default {
}
},
topComponent({ componentData, curComponentIndex }) {
topComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent)
// 置顶
if (curComponentIndex < componentData.length - 1) {
toTop(componentData, curComponentIndex)
}
},
bottomComponent({ componentData, curComponentIndex }) {
bottomComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent)
// 置底
if (curComponentIndex > 0) {
toBottom(componentData, curComponentIndex)

View File

@ -15,7 +15,7 @@ const bKey = 66 // 拆分
const lKey = 76 // 锁定
const dKey = 68 // 删除
const dKey = 68 // 复制并粘贴
const deleteKey = 46 // 删除
@ -39,7 +39,7 @@ const unlockMap = {
[xKey]: cut,
[gKey]: compose,
[bKey]: decompose,
[dKey]: deleteComponent,
[dKey]: copyAndPast,
[deleteKey]: deleteComponent,
[lKey]: lock,
[sKey]: save,
@ -56,7 +56,7 @@ export function listenGlobalKeyDown() {
if (keyCode === ctrlKey || keyCode === commandKey) {
isCtrlOrCommandDown = true
} else if (isCtrlOrCommandDown) {
if (keyCode === zKey || keyCode === yKey || keyCode === cKey || keyCode === sKey || keyCode === enlargeKey) {
if (keyCode === zKey || keyCode === yKey || keyCode === dKey || keyCode === sKey || keyCode === enlargeKey) {
e.preventDefault()
unlockMap[keyCode]()
}
@ -125,6 +125,14 @@ function decompose() {
}
}
function copyAndPast() {
if (store.state.curComponent) {
store.commit('copy')
store.commit('paste', false)
store.commit('recordSnapshot', 'copyAndPast')
}
}
function deleteComponent() {
if (store.state.curComponent) {
store.commit('deleteComponent')

View File

@ -246,3 +246,15 @@ export function getNowCanvasComponentData(canvasId, showPosition) {
return store.state.componentData.filter(item => item.canvasId === canvasId)
}
}
export function findCurComponentIndex(componentData, curComponent) {
let curIndex = 0
for (let index = 0; index < componentData.length; index++) {
const element = componentData[index]
if (element.id && element.id === curComponent.id) {
curIndex = index
break
}
}
return curIndex
}

View File

@ -2,7 +2,7 @@
<div
ref="myContainer"
class="my-container"
:style="autoStyle"
:style="inScreen?autoStyle:''"
>
<div
ref="conditionMain"

View File

@ -65,7 +65,7 @@
@mousedown.stop.prevent="handleDown(handlei, $event)"
@touchstart.stop.prevent="handleTouchDown(handlei, $event)"
>
<slot :name="handlei" />
<slot :name="handlei"/>
</div>
<div
:id="componentCanvasId"
@ -78,7 +78,7 @@
class="svg-background"
:icon-class="mainSlotSvgInner"
/>
<slot />
<slot/>
</div>
</div>
</div>
@ -588,7 +588,7 @@ export default {
return 'auto'
}
}
if (this.element.auxiliaryMatrix) {
if (this.element.auxiliaryMatrix && this.curCanvasScaleSelf) {
const width = Math.round(this.width / this.curCanvasScaleSelf.matrixStyleWidth) * this.curCanvasScaleSelf.matrixStyleWidth
return (width - this.curGap * 2) + 'px'
} else {
@ -602,7 +602,7 @@ export default {
return 'auto'
}
}
if (this.element.auxiliaryMatrix) {
if (this.element.auxiliaryMatrix && this.curCanvasScaleSelf) {
const height = Math.round(this.height / this.curCanvasScaleSelf.matrixStyleHeight) * this.curCanvasScaleSelf.matrixStyleHeight
return (height - this.curGap * 2) + 'px'
} else {

View File

@ -6,7 +6,7 @@
:round="element.options.attrs.round"
:plain="element.options.attrs.plain"
:size="size"
class="de-search-button"
:class="'de-search-button' + (useDarkClass ? ' dark-reset-button' : '')"
@click="triggerReset"
>
{{ element.options.value }}
@ -15,6 +15,7 @@
<script>
import bus from '@/utils/bus'
import { mapState } from 'vuex'
export default {
props: {
@ -34,6 +35,21 @@ export default {
values: null
}
},
computed: {
useDarkClass() {
if (this.canvasStyleData.openCommonStyle && this.canvasStyleData.panel.backgroundType === 'color') {
const themeColor = this.canvasStyleData.panel.themeColor
if (themeColor !== 'light') {
return true
}
}
return false
},
...mapState([
'canvasStyleData'
])
},
created() {
},
methods: {
@ -49,4 +65,14 @@ export default {
height: 100%;
width: 100%;
}
.dark-reset-button {
color: #f2f6fc !important;
background-color: #21333b !important;
border-color: #bbbfc4 !important;
border: 1px solid;
&:hover {
background: #bec2c7 !important;
border-color: #bbbfc4 !important;
}
}
</style>

View File

@ -569,7 +569,7 @@ const data = {
// 移动端布局转换
state.componentData.forEach(item => {
item.mobileStyle = (item.mobileStyle || BASE_MOBILE_STYLE)
if (item.mobileSelected) {
if (item.mobileSelected || item.canvasId !== 'canvas-main') {
item.style.width = item.mobileStyle.style.width
item.style.height = item.mobileStyle.style.height
item.style.top = item.mobileStyle.style.top

View File

@ -54,6 +54,12 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe644;</span>
<div class="name">command</div>
<div class="code-name">&amp;#xe644;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe63d;</span>
<div class="name">font</div>
@ -804,9 +810,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1669087400468') format('woff2'),
url('iconfont.woff?t=1669087400468') format('woff'),
url('iconfont.ttf?t=1669087400468') format('truetype');
src: url('iconfont.woff2?t=1669699377636') format('woff2'),
url('iconfont.woff?t=1669699377636') format('woff'),
url('iconfont.ttf?t=1669699377636') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -832,6 +838,15 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-command"></span>
<div class="name">
command
</div>
<div class="code-name">.icon-command
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-font"></span>
<div class="name">
@ -1957,6 +1972,14 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-command"></use>
</svg>
<div class="name">command</div>
<div class="code-name">#icon-command</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-font"></use>

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2459092 */
src: url('iconfont.woff2?t=1669087400468') format('woff2'),
url('iconfont.woff?t=1669087400468') format('woff'),
url('iconfont.ttf?t=1669087400468') format('truetype');
src: url('iconfont.woff2?t=1669699377636') format('woff2'),
url('iconfont.woff?t=1669699377636') format('woff'),
url('iconfont.ttf?t=1669699377636') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-command:before {
content: "\e644";
}
.icon-font:before {
content: "\e63d";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "1567487",
"name": "command",
"font_class": "command",
"unicode": "e644",
"unicode_decimal": 58948
},
{
"icon_id": "109745",
"name": "font",

View File

@ -202,7 +202,7 @@ export default {
})
},
checkSelected(param) {
return (this.linkageActiveParam.name.indexOf(param.name) > -1) &&
return (this.linkageActiveParam.name === param.name || (this.linkageActiveParam.name === 'NO_DATA' && !param.name)) &&
(this.linkageActiveParam.category === param.category)
},
preDraw() {

View File

@ -61,7 +61,10 @@
class="table-page"
:style="autoStyle"
>
<span class="total-style">
<span
class="total-style"
:style="totalStyle"
>
{{ $t('chart.total') }}
<span>{{
chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
@ -167,6 +170,9 @@ export default {
remarkCfg: {
show: false,
content: ''
},
totalStyle: {
color: '#606266'
}
}
},
@ -426,6 +432,8 @@ export default {
this.title_class.fontFamily = customStyle.text.fontFamily ? customStyle.text.fontFamily : DEFAULT_TITLE_STYLE.fontFamily
this.title_class.letterSpacing = (customStyle.text.letterSpace ? customStyle.text.letterSpace : DEFAULT_TITLE_STYLE.letterSpace) + 'px'
this.title_class.textShadow = customStyle.text.fontShadow ? '2px 2px 4px' : 'none'
//
this.totalStyle.color = customStyle.text.color
}
if (customStyle.background) {
this.title_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)

View File

@ -49,7 +49,10 @@
class="table-page-inner"
:style="autoStyle"
>
<span class="total-style">
<span
class="total-style"
:style="totalStyle"
>
{{ $t('chart.total') }}
<span>{{
chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
@ -160,7 +163,10 @@ export default {
showIndex: false,
indexLabel: '序号',
scrollBarColor: DEFAULT_COLOR_CASE.tableScrollBarColor,
scrollBarHoverColor: DEFAULT_COLOR_CASE.tableScrollBarHoverColor
scrollBarHoverColor: DEFAULT_COLOR_CASE.tableScrollBarHoverColor,
totalStyle: {
color: '#606266'
}
}
},
computed: {
@ -365,6 +371,8 @@ export default {
this.title_class.textAlign = customStyle.text.hPosition
this.title_class.fontStyle = customStyle.text.isItalic ? 'italic' : 'normal'
this.title_class.fontWeight = customStyle.text.isBolder ? 'bold' : 'normal'
//
this.totalStyle.color = customStyle.text.color
}
if (customStyle.background) {
this.bg_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)

View File

@ -1610,7 +1610,8 @@ import {
pluginTypes,
post,
resetViewCacheCallBack,
viewEditSave
viewEditSave,
tableField
} from '@/api/chart/chart'
import DimensionItem from '../components/dragItem/DimensionItem'
import QuotaItem from '../components/dragItem/QuotaItem'
@ -2000,7 +2001,7 @@ export default {
},
initTableData(id, optType) {
if (id != null) {
post('/dataset/table/getWithPermission/' + id, null).then(response => {
tableField(id).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (this.view.tableId === id) {
this.table = response.data

View File

@ -860,7 +860,9 @@ export default {
item.dateFormat = item.dateFormatType
}
}
if(item.dateFormatType === 'custom' && !item.dateFormat){
return;
}
post('/dataset/field/save', item)
.then((response) => {
this.initField()
@ -895,7 +897,7 @@ export default {
if (val && val !== '') {
this.tableFields.dimensionListData = JSON.parse(
JSON.stringify(
this.tableFields.dimensionListData.filter((ele) => {
this.tableFields.dimensionList.filter((ele) => {
return ele.name
.toLocaleLowerCase()
.includes(val.toLocaleLowerCase())

View File

@ -861,7 +861,7 @@ export default {
},
disableExec(task) {
return (
task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges)
(task.status === 'Stopped' && task.rate !== 'SIMPLE') || task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges)
)
},
disableDelete(task) {

View File

@ -2,6 +2,7 @@
<el-row
style="text-align: left"
class="de-search-table"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
>
<el-row class="top-operate">
<el-col :span="12">
@ -35,8 +36,8 @@
icon="iconfont icon-icon-filter"
@click="filterShow"
>{{
$t('user.filter')
}}
$t('user.filter')
}}
<template v-if="filterTexts.length">
({{ cacheCondition.length }})
</template>
@ -49,7 +50,7 @@
>
<span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{ $t('user.result_one') }}</span>
<el-divider direction="vertical" />
<el-divider direction="vertical"/>
<i
v-if="showScroll"
class="el-icon-arrow-left arrow-filter"
@ -62,9 +63,9 @@
class="text"
>
{{ ele }} <i
class="el-icon-close"
@click="clearOneFilter(index)"
/>
class="el-icon-close"
@click="clearOneFilter(index)"
/>
</p>
</div>
<i
@ -87,7 +88,6 @@
>
<grid-table
:ref="'grid-table'"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:table-data="data"
:columns="[]"
:pagination="paginationConfig"
@ -101,12 +101,7 @@
:label="$t('app_template.datasource')"
>
<template #default="{ row }">
<span
v-if="row.datasourceId && hasDataPermission('use',row.datasourcePrivileges)"
class="link-span"
@click="goToDatasource(row)"
>{{ row.datasourceName }}</span>
<span v-else>{{ row.datasourceName }}</span>
<span>{{ row.datasourceName }}</span>
</template>
</el-table-column>
<el-table-column
@ -189,6 +184,7 @@
:visible.sync="deleteConfirmDialog"
:show-close="true"
width="420px"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
>
<el-row>
<el-checkbox
@ -217,10 +213,7 @@ import GridTable from '@/components/gridTable/index.vue'
import filterUser from './FilterUser'
import _ from 'lodash'
import keyEnter from '@/components/msgCfm/keyEnter.js'
import {
addOrder,
formatOrders
} from '@/utils/index'
import { addOrder, formatOrders } from '@/utils/index'
import { deleteLogAndResource, logGrid } from '@/api/appTemplateMarket/log'
import { findOneWithParent } from '@/api/panel/panel'
import AppTemplateApply from '@/views/panel/appTemplate/component/AppTemplateApply'
@ -288,9 +281,24 @@ export default {
this.deleteConfirmDialog = false
},
confirmDel() {
deleteLogAndResource(this.deleteItemInfo).then(() => {
this.closeDel()
this.search()
const _this = this
deleteLogAndResource(_this.deleteItemInfo).then(() => {
if (_this.deleteItemInfo.deleteResource) {
_this.clearLocalStorage()
}
_this.closeDel()
_this.search()
})
},
clearLocalStorage() {
const clearParams = [
'panel-main-tree',
'panel-default-tree',
'chart-tree',
'dataset-tree'
]
clearParams.forEach(item => {
localStorage.removeItem(item)
})
},
closeDraw() {

View File

@ -798,7 +798,6 @@ export default {
},
created() {
listenGlobalKeyDown()
document.addEventListener('paste', this.passFromClipboard)
},
mounted() {
this.initWatermark()
@ -815,10 +814,7 @@ export default {
this.init(this.$store.state.panel.panelInfo.id)
},
beforeDestroy() {
document.removeEventListener('paste', this.passFromClipboard)
bus.$off('component-on-drag', this.componentOnDrag)
// bus.$off('component-dialog-edit', this.editDialog)
// bus.$off('button-dialog-edit', this.editButtonDialog)
bus.$off('component-dialog-style', this.componentDialogStyle)
bus.$off('previewFullScreenClose', this.previewFullScreenClose)
bus.$off('change_panel_right_draw', this.changeRightDrawOpen)
@ -829,14 +825,6 @@ export default {
elx && elx.remove()
},
methods: {
passFromClipboard(event) {
//
const text = (event.clipboardData || window.clipboardData).getData('text')
if (text && text.includes('datease-component-')) {
event.preventDefault()
this.$store.commit('passFromClipboard', text.replace('datease-component-', ''))
}
},
initWatermark() {
if (this.panelInfo.watermarkInfo) {
userLoginInfo().then(res => {

View File

@ -634,7 +634,7 @@ export default {
)
},
disableExec(task) {
return (task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges))
return ((task.status === 'Stopped' && task.rate !== 'SIMPLE') || task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges))
},
disableDelete(task) {
return false

View File

@ -20,8 +20,8 @@ class DeWebsocket {
initialize() {
this.connection()
const _this = this
this.timer = this.isLoginStatu() && setInterval(() => {
this.isLoginStatu() || this.destroy()
this.timer = this.isLoginStatus() && setInterval(() => {
this.isLoginStatus() || this.destroy()
try {
_this.client && _this.client.send('heart detection')
} catch (error) {
@ -41,12 +41,12 @@ class DeWebsocket {
this.initialize()
}
isLoginStatu() {
isLoginStatus() {
return store.state && store.state.user && store.state.user.user && store.state.user.user.userId
}
connection() {
if (!this.isLoginStatu()) {
if (!this.isLoginStatus()) {
return
}
const socket = new SockJS(this.ws_url + '?userId=' + store.state.user.user.userId)
@ -70,6 +70,7 @@ class DeWebsocket {
}
).bind(this)
}
subscribe() {
this.channels.forEach(channel => {
this.client.subscribe('/user/' + store.state.user.user.userId + channel.topic, res => {
@ -77,6 +78,7 @@ class DeWebsocket {
})
})
}
disconnect() {
this.client && this.client.disconnect()
}