Merge branch 'dev' into pr@dev_eslint_auto_fix

This commit is contained in:
dataeaseShu 2022-10-31 15:19:00 +08:00
commit c839f16d79
22 changed files with 659 additions and 108 deletions

View File

@ -1,7 +1,9 @@
package io.dataease.commons.utils;
import java.io.BufferedOutputStream;
import java.io.File;
import cn.hutool.core.io.FileUtil;
import io.dataease.commons.model.excel.ExcelSheetModel;
import java.util.List;
@ -9,29 +11,25 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ExcelUtils {
private static final String suffix = ".xls";
private static final String suffix = ".xlsx";
private static final String BASE_ROOT = "/opt/dataease/data/";
public static File exportExcel(List<ExcelSheetModel> sheets, String fileName) throws Exception {
public static File exportExcel(List<ExcelSheetModel> sheets, String fileName, String folderId) throws Exception {
AtomicReference<String> realFileName = new AtomicReference<>(fileName);
HSSFWorkbook wb = new HSSFWorkbook();
Workbook wb = new XSSFWorkbook();
sheets.forEach(sheet -> {
List<List<String>> details = sheet.getData();
details.add(0, sheet.getHeads());
String sheetName = sheet.getSheetName();
HSSFSheet curSheet = wb.createSheet(sheetName);
Sheet curSheet = wb.createSheet(sheetName);
if (StringUtils.isBlank(fileName)) {
String cName = sheetName + suffix;
realFileName.set(cName);
@ -47,11 +45,11 @@ public class ExcelUtils {
if (CollectionUtils.isNotEmpty(details)) {
for (int i = 0; i < details.size(); i++) {
HSSFRow row = curSheet.createRow(i);
Row row = curSheet.createRow(i);
List<String> rowData = details.get(i);
if (rowData != null) {
for (int j = 0; j < rowData.size(); j++) {
HSSFCell cell = row.createCell(j);
Cell cell = row.createCell(j);
cell.setCellValue(rowData.get(j));
if (i == 0) {// 头部
cell.setCellStyle(cellStyle);
@ -66,8 +64,25 @@ public class ExcelUtils {
if (!StringUtils.endsWith(fileName, suffix)) {
realFileName.set(realFileName.get() + suffix);
}
File result = new File("/opt/dataease/data/" + realFileName.get());
wb.write(result);
String folderPath = BASE_ROOT;
if (StringUtils.isNotBlank(folderId)) {
folderPath = BASE_ROOT + folderId + "/";
}
if (!FileUtil.exist(folderPath)) {
FileUtil.mkdir(folderPath);
}
File result = new File(folderPath + realFileName.get());
BufferedOutputStream outputStream = FileUtil.getOutputStream(result);
try {
wb.write(outputStream);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw e;
} finally {
wb.close();
outputStream.flush();
outputStream.close();
}
return result;
}

View File

@ -1,5 +1,7 @@
package io.dataease.controller.dataset;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DeLog;
import io.dataease.auth.annotation.DePermission;
@ -7,10 +9,14 @@ import io.dataease.auth.annotation.DePermissions;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.controller.ResultHolder;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.response.DataSetDetail;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.ExcelFileData;
import io.dataease.plugins.common.base.domain.DatasetSqlLog;
import io.dataease.plugins.common.base.domain.DatasetTable;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.DatasetTableIncrementalConfig;
@ -152,10 +158,21 @@ public class DataSetTableController {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_USE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASOURCE_LEVEL_USE)
}, logical = Logical.AND)
public Map<String, Object> getSQLPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
public ResultHolder getSQLPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getSQLPreview(dataSetTableRequest);
}
@ApiOperation("根据sql查询预览数据")
@PostMapping("sqlLog/{goPage}/{pageSize}")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_USE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASOURCE_LEVEL_USE)
}, logical = Logical.AND)
public Pager<List<DatasetSqlLog>> getSQLLog(@RequestBody DataSetTableRequest dataSetTableRequest, @PathVariable int goPage, @PathVariable int pageSize) throws Exception {
Page<DatasetSqlLog> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, dataSetTableService.getSQLLog(dataSetTableRequest));
}
@ApiOperation("预览自定义数据数据")
@PostMapping("customPreview")
public Map<String, Object> customPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {

View File

@ -1,5 +1,6 @@
package io.dataease.job.sechedule.strategy.impl;
import cn.hutool.core.io.FileUtil;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
@ -160,6 +161,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
AuthUserServiceImpl userService = SpringContextUtil.getBean(AuthUserServiceImpl.class);
SysUserService sysUserService = SpringContextUtil.getBean(SysUserService.class);
List<File> files = null;
try {
XpackEmailTaskRequest taskForm = emailXpackService.taskForm(taskInstance.getTaskId());
if (ObjectUtils.isEmpty(taskForm) || CronUtils.taskExpire(taskForm.getEndTime())) {
@ -199,7 +201,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
contentStr = new String(content, "UTF-8");
}
List<File> files = null;
String viewIds = emailTemplateDTO.getViewIds();
ChartViewService chartViewService = SpringContextUtil.getBean(ChartViewService.class);
List<ViewOption> viewOptions = chartViewService.viewOptions(panelId);
@ -343,6 +345,14 @@ public class EmailTaskHandler extends TaskHandler implements Job {
} catch (Exception e) {
error(taskInstance, e);
LogUtil.error(e.getMessage(), e);
} finally {
if (CollectionUtils.isNotEmpty(files)) {
files.forEach(file -> {
if (file.exists()) {
FileUtil.del(file);
}
});
}
}
}

View File

@ -233,7 +233,7 @@ public class XEmailTaskServer {
ExcelSheetModel excelSheetModel = excelSheetModel(instanceDTOS);
List<ExcelSheetModel> sheetModels = new ArrayList<>();
sheetModels.add(excelSheetModel);
File file = ExcelUtils.exportExcel(sheetModels, null);
File file = ExcelUtils.exportExcel(sheetModels, null, null);
InputStream inputStream = new FileInputStream(file);
HttpServletResponse response = ServletUtils.response();
try {

View File

@ -1312,4 +1312,8 @@ public class MysqlQueryProvider extends QueryProvider {
return sql;
}
}
public String sqlForPreview(String table, Datasource ds) {
return "SELECT * FROM " + String.format(MySQLConstants.KEYWORD_TABLE, table);
}
}

View File

@ -51,7 +51,7 @@ public class ViewExportExcel {
Map<String, ChartExtRequest> stringChartExtRequestMap = buildViewRequest(panelDto, justView);
List<File> results = new ArrayList<>();
List<ExcelSheetModel> sheets = viewIds.stream().map(viewId -> viewFiles(viewId, stringChartExtRequestMap.get(viewId))).collect(Collectors.toList());
File excelFile = ExcelUtils.exportExcel(sheets, panelDto.getName());
File excelFile = ExcelUtils.exportExcel(sheets, panelDto.getName(), panelDto.getId());
results.add(excelFile);
return results;
}
@ -62,7 +62,7 @@ public class ViewExportExcel {
List<Map<String, Object>> components = gson.fromJson(componentsJson, tokenType);
String panelStyle = panelDto.getPanelStyle();
Map map = gson.fromJson(panelStyle, Map.class);
Map panelMap = (LinkedTreeMap)map.get("panel");
Map panelMap = (LinkedTreeMap) map.get("panel");
double resultCount = Double.parseDouble(panelMap.get("resultCount").toString());
String resultMode = panelMap.get("resultMode").toString();
@ -73,7 +73,7 @@ public class ViewExportExcel {
ChartExtRequest chartExtRequest = new ChartExtRequest();
chartExtRequest.setQueryFrom("panel");
chartExtRequest.setFilter(chartExtFilterRequests);
chartExtRequest.setResultCount((int)resultCount);
chartExtRequest.setResultCount((int) resultCount);
chartExtRequest.setResultMode(resultMode);
result.put(entry.getKey(), chartExtRequest);
}

View File

@ -10,6 +10,7 @@ import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.constants.*;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.*;
import io.dataease.controller.ResultHolder;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
@ -131,6 +132,8 @@ public class DataSetTableService {
private PermissionsTreeService permissionsTreeService;
@Resource
private DatasourceService datasourceService;
@Resource
private DatasetSqlLogMapper datasetSqlLogMapper;
private static boolean isUpdatingDatasetTableStatus = false;
private static final String lastUpdateTime = "${__last_update_time__}";
@ -1175,9 +1178,22 @@ public class DataSetTableService {
return map;
}
public Map<String, Object> getSQLPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
public List<DatasetSqlLog> getSQLLog(DataSetTableRequest dataSetTableRequest) {
if (StringUtils.isEmpty(dataSetTableRequest.getId())) {
return new ArrayList<>();
}
DatasetSqlLogExample example = new DatasetSqlLogExample();
example.createCriteria().andDatasetIdEqualTo(dataSetTableRequest.getId());
example.setOrderByClause(" start_time desc ");
return datasetSqlLogMapper.selectByExample(example);
}
public ResultHolder getSQLPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
DatasetSqlLog datasetSqlLog = new DatasetSqlLog();
DataTableInfoDTO dataTableInfo = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class);
String sql = dataTableInfo.isBase64Encryption() ? new String(java.util.Base64.getDecoder().decode(dataTableInfo.getSql())) : dataTableInfo.getSql();
datasetSqlLog.setSql(sql);
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ds == null) {
throw new Exception(Translator.get("i18n_invalid_ds"));
@ -1202,7 +1218,25 @@ public class DataSetTableService {
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
String sqlAsTable = qp.createSQLPreview(sql, null);
datasourceRequest.setQuery(sqlAsTable);
Map<String, List> result = datasourceProvider.fetchResultAndField(datasourceRequest);
Map<String, List> result = new HashMap<>();
try {
datasetSqlLog.setStartTime(System.currentTimeMillis());
result = datasourceProvider.fetchResultAndField(datasourceRequest);
datasetSqlLog.setEndTime(System.currentTimeMillis());
datasetSqlLog.setSpend(datasetSqlLog.getEndTime() - datasetSqlLog.getStartTime());
datasetSqlLog.setStatus("Completed");
} catch (Exception e) {
datasetSqlLog.setStatus("Error");
return ResultHolder.error(e.getMessage(), datasetSqlLog);
} finally {
if (StringUtils.isNotEmpty(dataSetTableRequest.getId())) {
datasetSqlLog.setDatasetId(dataSetTableRequest.getId());
datasetSqlLog.setId(UUID.randomUUID().toString());
datasetSqlLogMapper.insert(datasetSqlLog);
}
}
List<String[]> data = result.get("dataList");
List<TableField> fields = result.get("fieldList");
String[] fieldArray = fields.stream().map(TableField::getFieldName).toArray(String[]::new);
@ -1223,8 +1257,9 @@ public class DataSetTableService {
Map<String, Object> map = new HashMap<>();
map.put("fields", fields);
map.put("data", jsonArray);
map.put("log", datasetSqlLog);
return map;
return ResultHolder.success(map);
}
public Map<String, Object> getUnionPreview(DataSetTableRequest dataSetTableRequest) throws Exception {

View File

@ -55,7 +55,7 @@ INSERT INTO `sys_msg_type` VALUES (2, 1, 'i18n_msg_type_panel_share', 'panel', '
INSERT INTO `sys_msg_type` VALUES (3, 1, 'i18n_msg_type_panel_share_cacnel', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (4, 0, 'i18n_msg_type_dataset_sync', 'sys-task-dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (5, 4, 'i18n_msg_type_dataset_sync_success', 'sys-task-dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (6, 4, 'i18n_msg_type_dataset_sync_faild', 'sys-task-dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (6, 4, 'i18n_msg_type_dataset_sync_failed', 'sys-task-dataset', 'to-msg-dataset');
COMMIT;
-- ----------------------------
@ -74,7 +74,7 @@ BEGIN;
INSERT INTO `sys_menu` VALUES (53, 1, 3, 1, '站内消息', 'sys-msg-web', 'msg/index', 1000, 'all-msg', 'system-msg-web', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (54, 53, 0, 1, '所有消息', 'sys-msg-web-all', 'msg/all', 1, 'web-msg', 'all', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (55, 53, 0, 1, '未读消息', 'sys-msg-web-unread', 'msg/unread', 2, 'unread-msg', 'unread', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (56, 53, 0, 1, '已读消息', 'sys-msg-web-readed', 'msg/readed', 3, 'readed-msg', 'readed', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (56, 53, 0, 1, '已读消息', 'sys-msg-web-read', 'msg/read', 3, 'read-msg', 'read', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (59, 53, 0, 1, '接收管理', 'sys-msg-setting', 'msg/setting', 4, 'msg-setting', 'setting', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
COMMIT;

View File

@ -54,6 +54,17 @@ VALUES ('Apache Kylin 数据源插件', 'default', '0', '0', 'datasource', 'Apac
INSERT INTO `sys_msg_channel` (`msg_channel_id`, `channel_name`, `service_name`) VALUES ('6', 'webmsg.channel_larksuite_msg', 'sendLarksuite');
CREATE TABLE `dataset_sql_log` (
`id` varchar(50) NOT NULL DEFAULT '' COMMENT 'ID',
`dataset_id` varchar(50) NOT NULL DEFAULT '' COMMENT '数据集ID',
`start_time` bigint(13) DEFAULT NULL COMMENT '开始时间',
`end_time` bigint(13) DEFAULT NULL COMMENT '结束时间',
`spend` bigint(13) DEFAULT NULL COMMENT '耗时(毫秒)',
`sql` longtext NOT NULL COMMENT '详细信息',
`status` varchar(45) DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (204, 203, 0, 2, '删除记录', NULL, NULL, 999, NULL, NULL, 0, 0, 0, 'appLog:del', NULL, NULL, 1614930903502, 1614930903502);
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (205, 203, 0, 2, '编辑记录', NULL, NULL, 999, NULL, NULL, 0, 0, 0, 'appLog:edit', NULL, NULL, 1614930935529, 1614930935529);

View File

@ -11,16 +11,25 @@
v-if="editFilter.includes(curComponent.type)"
icon="el-icon-edit-outline"
@click.native="edit"
>{{ $t('panel.edit') }}</el-dropdown-item>
>{{ $t('panel.edit') }}
</el-dropdown-item>
<el-dropdown-item
v-if="curComponent.type != 'custom-button'"
icon="el-icon-document-copy"
@click.native="copy"
>{{ $t('panel.copy') }}</el-dropdown-item>
>{{ $t('panel.copy') }}
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-delete"
@click.native="deleteComponent"
>{{ $t('panel.delete') }}</el-dropdown-item>
>{{ $t('panel.delete') }}
</el-dropdown-item>
<el-dropdown-item
v-if="curComponent.type ==='de-tabs'"
icon="el-icon-sort"
@click.native="openCustomSort"
>{{ $t('chart.sort') }}
</el-dropdown-item>
<el-dropdown-item v-if="!curComponent.auxiliaryMatrix">
<el-dropdown placement="right-start">
<span class="el-icon-copy-document">
@ -30,19 +39,23 @@
<el-dropdown-item
icon="el-icon-upload2"
@click.native="topComponent"
>{{ $t('panel.topComponent') }}</el-dropdown-item>
>{{ $t('panel.topComponent') }}
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-download"
@click.native="bottomComponent"
>{{ $t('panel.bottomComponent') }}</el-dropdown-item>
>{{ $t('panel.bottomComponent') }}
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-arrow-up"
@click.native="upComponent"
>{{ $t('panel.upComponent') }}</el-dropdown-item>
>{{ $t('panel.upComponent') }}
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-arrow-down"
@click.native="downComponent"
>{{ $t('panel.downComponent') }}</el-dropdown-item>
>{{ $t('panel.downComponent') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
@ -50,22 +63,26 @@
v-if="linkageSettingShow"
icon="el-icon-link"
@click.native="linkageSetting"
>{{ $t('panel.linkage_setting') }}</el-dropdown-item>
>{{ $t('panel.linkage_setting') }}
</el-dropdown-item>
<el-dropdown-item
v-if="'de-tabs'===curComponent.type"
icon="el-icon-plus"
@click.native="addTab"
>{{ $t('panel.add_tab') }}</el-dropdown-item>
>{{ $t('panel.add_tab') }}
</el-dropdown-item>
<el-dropdown-item
v-if="linkJumpSetShow"
icon="el-icon-connection"
@click.native="linkJumpSet"
>{{ $t('panel.setting_jump') }}</el-dropdown-item>
>{{ $t('panel.setting_jump') }}
</el-dropdown-item>
<el-dropdown-item
v-if="curComponent.type != 'custom-button'"
icon="el-icon-magic-stick"
@click.native="boardSet"
>{{ $t('panel.component_style') }}</el-dropdown-item>
>{{ $t('panel.component_style') }}
</el-dropdown-item>
<el-dropdown-item
v-if="curComponent.type != 'custom-button'"
@click.native="hyperlinksSet"
@ -91,6 +108,38 @@
@onClose="hyperlinksSetVisible = false"
/>
</el-dialog>
<el-dialog
v-if="showCustomSort"
v-dialogDrag
:title="$t('chart.custom_sort')"
:visible="showCustomSort"
:show-close="false"
width="500px"
:append-to-body="true"
class="dialog-css"
>
<custom-tabs-sort
ref="customTabsSort"
:element="curComponent"
/>
<div
slot="footer"
class="dialog-footer"
>
<el-button
size="mini"
@click="closeCustomSort"
>{{ $t('chart.cancel') }}
</el-button>
<el-button
type="primary"
size="mini"
@click="saveCustomSort"
>{{ $t('chart.confirm') }}
</el-button>
</div>
</el-dialog>
</div>
</template>
@ -100,11 +149,13 @@ import { mapState } from 'vuex'
import bus from '@/utils/bus'
import { getViewLinkageGather } from '@/api/panel/linkage'
import HyperlinksDialog from '@/components/canvas/components/Editor/HyperlinksDialog'
import CustomTabsSort from '@/components/widget/DeWidget/CustomTabsSort'
export default {
components: { HyperlinksDialog },
components: { CustomTabsSort, HyperlinksDialog },
data() {
return {
showCustomSort: false,
jumpExcludeViewType: [
'richTextView',
'liquid',
@ -150,6 +201,18 @@ export default {
])
},
methods: {
openCustomSort() {
this.showCustomSort = true
},
closeCustomSort() {
this.showCustomSort = false
},
saveCustomSort() {
this.$refs.customTabsSort.save()
this.$nextTick(() => {
this.showCustomSort = false
})
},
edit() {
if (this.curComponent.type === 'custom') {
bus.$emit('component-dialog-edit', 'update')
@ -157,7 +220,9 @@ export default {
bus.$emit('button-dialog-edit')
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
bus.$emit('component-dialog-style')
} else { bus.$emit('change_panel_right_draw', true) }
} else {
bus.$emit('change_panel_right_draw', true)
}
},
lock() {
this.$store.commit('lock')
@ -266,36 +331,36 @@ export default {
</script>
<style lang="scss" scoped>
.contextmenu {
position: absolute;
z-index: 1000;
.contextmenu {
position: absolute;
z-index: 1000;
ul {
border: 1px solid #e4e7ed;
border-radius: 4px;
background-color: #fff;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
ul {
border: 1px solid #e4e7ed;
border-radius: 4px;
background-color: #fff;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
box-sizing: border-box;
margin: 5px 0;
padding: 6px 0;
li {
font-size: 14px;
padding: 0 20px;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #606266;
height: 34px;
line-height: 34px;
box-sizing: border-box;
margin: 5px 0;
padding: 6px 0;
cursor: pointer;
li {
font-size: 14px;
padding: 0 20px;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #606266;
height: 34px;
line-height: 34px;
box-sizing: border-box;
cursor: pointer;
&:hover {
background-color: var(--background-color-base, #f5f7fa);
}
&:hover {
background-color: var(--background-color-base, #f5f7fa);
}
}
}
}
</style>

View File

@ -414,9 +414,10 @@ import StreamMediaLinks from '@/components/canvas/components/Editor/StreamMediaL
import DateFormat from '@/components/canvas/components/Editor/DateFormat'
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import FrameLinks from '@/components/canvas/components/Editor/FrameLinks'
import TitlePosition from '@/components/widget/DeWidget/TitlePosition'
export default {
components: { FrameLinks, DateFormat, VideoLinks, StreamMediaLinks },
components: { TitlePosition, FrameLinks, DateFormat, VideoLinks, StreamMediaLinks },
props: {
canvasId: {
type: String,

View File

@ -0,0 +1,121 @@
<template>
<div>
<draggable
v-model="sortList"
group="drag"
animation="300"
class="drag-list"
>
<transition-group class="draggable-group">
<span
v-for="(item) in sortList"
:key="item.name"
class="item-dimension"
:title="item.title"
>
<svg-icon
icon-class="drag"
class="item-icon"
/>
<span class="item-span">
{{ item.title }}
</span>
</span>
</transition-group>
</draggable>
</div>
</template>
<script>
import { deepCopy } from '@/components/canvas/utils/utils'
export default {
name: 'CustomTabsSort',
props: {
element: {
type: Object,
required: true
}
},
data() {
return {
sortList: []
}
},
computed: {
},
watch: {
chart() {
this.init()
}
},
mounted() {
this.init()
},
methods: {
init() {
this.sortList = deepCopy(this.element.options.tabList)
},
save() {
this.element.options.tabList = this.sortList
}
}
}
</script>
<style scoped>
.drag-list {
overflow: auto;
height: 50vh;
}
.item-dimension {
padding: 2px;
margin: 2px;
border: solid 1px #eee;
text-align: left;
color: #606266;
/*background-color: rgba(35,46,64,.05);*/
background-color: white;
display: flex;
align-items: center;
}
.item-icon{
cursor: move;
margin: 0 2px;
}
.item-span{
display: inline-block;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.blackTheme .item-dimension {
border: solid 1px;
border-color: var(--TableBorderColor);
color: var(--TextPrimary);
background-color: var(--MainBG);
}
.item-dimension + .item-dimension {
margin-top: 6px;
}
.item-dimension:hover {
color: #1890ff;
background: #e8f4ff;
border-color: #a3d3ff;
cursor: pointer;
}
.blackTheme .item-dimension:hover {
color: var(--Main);
background: var(--ContentBG);
cursor: pointer;
}
</style>

View File

@ -1,6 +1,8 @@
<template>
<div class="de-tabs-div">
<div
class="de-tabs-div"
:class="headClass"
>
<dataease-tabs
v-model="activeTabName"
type="card"
@ -293,6 +295,9 @@ export default {
}
},
computed: {
headClass() {
return 'tab-head-' + this.element.style.headPosition
},
curCanvasScaleSelf() {
return this.curCanvasScaleMap[this.canvasId]
},
@ -634,5 +639,20 @@ export default {
.canvas_move_in {
border-color: blueviolet;
}
::v-deep .el-tabs__nav{
width: 100%;
}
.tab-head-left ::v-deep .el-tabs__nav{
width: 100%;
text-align: left;
}
.tab-head-right ::v-deep .el-tabs__nav{
width: 100%;
text-align: right;
}
.tab-head-center ::v-deep .el-tabs__nav{
width: 100%;
text-align: center;
}
</style>

View File

@ -8,7 +8,7 @@
ref="tabsStyleForm"
:model="styleInfo"
size="small"
class="demo-form-inline"
class="de-form-item"
>
<el-form-item
label="头部字体颜色"
@ -102,8 +102,17 @@
</el-input>
</div>
</el-form-item>
<el-form-item :label="$t('detabs.head_position')">
<el-radio-group
v-model="styleInfo.headPosition"
size="mini"
>
<el-radio-button label="left">{{ $t('chart.text_pos_left') }}</el-radio-button>
<el-radio-button label="center">{{ $t('chart.text_pos_center') }}</el-radio-button>
<el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<i
slot="reference"
class="iconfont icon-tabs"
@ -114,6 +123,7 @@
<script>
import { mapState } from 'vuex'
export default {
name: 'TabStyle',
props: {
@ -123,9 +133,7 @@ export default {
}
},
data() {
return {
}
return {}
},
computed: {

View File

@ -534,7 +534,8 @@ export default {
selectview: 'Select View',
selectOthers: 'Select Others',
availableComponents: 'Available Components',
please: 'Please'
please: 'Please',
head_position: 'Head Position'
},
example: {
warning: 'Creating and editing pages cannot be cached by keep-alive because keep-alive include does not currently support caching based on routes, so it is currently cached based on component name. If you want to achieve a similar caching effect, you can use a browser caching scheme such as localStorage. Or do not use keep-alive include to cache all pages directly. See details'
@ -1437,6 +1438,9 @@ export default {
percent: 'Percent'
},
dataset: {
spend_time: 'Spend',
sql: 'SQL',
sql_result: 'Result',
parse_filed: 'Parse Field',
field_rename: 'Rename Field',
params_work: 'Effective only when editing SQL',

View File

@ -534,7 +534,8 @@ export default {
selectview: '選擇視圖',
selectOthers: '選擇組件',
availableComponents: '可選組件',
please: '未'
please: '未',
head_position: '頭部位置'
},
example: {
warning: '創建和編輯頁面是不能被 keep-alive 緩存的因爲keep-alive 的 include 目前不支持根據路由來緩存,所以目前都是基於 component name 來進行緩存的。如果妳想類似的實現緩存效果,可以使用 localStorage 等瀏覽器緩存方案。或者不要使用 keep-alive 的 include直接緩存所有頁面。詳情見'
@ -1437,6 +1438,9 @@ export default {
percent: '占比'
},
dataset: {
spend_time: '耗時',
sql: 'SQL 語句',
sql_result: '運行結果',
parse_filed: '解析字段',
field_rename: '字段重命名',
params_work: '僅在編輯 sql 時生效',

View File

@ -533,7 +533,8 @@ export default {
selectview: '选择视图',
selectOthers: '选择组件',
availableComponents: '可选组件',
please: '未'
please: '未',
head_position: '头部位置'
},
example: {
warning: '创建和编辑页面是不能被 keep-alive 缓存的因为keep-alive 的 include 目前不支持根据路由来缓存,所以目前都是基于 component name 来进行缓存的。如果你想类似的实现缓存效果,可以使用 localStorage 等浏览器缓存方案。或者不要使用 keep-alive 的 include直接缓存所有页面。详情见'
@ -1436,6 +1437,9 @@ export default {
percent: '占比'
},
dataset: {
spend_time: '耗时',
sql: 'SQL 语句',
sql_result: '运行结果',
parse_filed: '解析字段',
field_rename: '字段重命名',
params_work: '仅在编辑sql时生效',

View File

@ -1,15 +1,17 @@
export const DEFAULT_TAB_COLOR_CASE_DARK = {
headFontColor: '#FFFFFF',
headFontActiveColor: '#FFFFFF',
headBorderColor: '',
headBorderActiveColor: ''
headBorderColor: '#FFFFFF',
headBorderActiveColor: '#FFFFFF',
headPosition: 'left'
}
export const DEFAULT_TAB_COLOR_CASE_LIGHT = {
headFontColor: '#OOOOOO',
headFontActiveColor: '#OOOOOO',
headBorderColor: '',
headBorderActiveColor: ''
headBorderColor: '#OOOOOO',
headBorderActiveColor: '#OOOOOO',
headPosition: 'left'
}
export const DEFAULT_COLOR_CASE = {

View File

@ -154,7 +154,7 @@ export function componentStyle(chart_option, chart) {
chart_option.yAxis[0].axisLabel = customStyle.yAxis.axisLabel
chart_option.yAxis[0].splitLine = customStyle.yAxis.splitLine
chart_option.yAxis[0].nameTextStyle = customStyle.yAxis.nameTextStyle
const axisLine0 = customStyle.yAxis[0].axisLine ? customStyle.yAxis[0].axisLine : DEFAULT_YAXIS_STYLE.axisLine
const axisLine0 = customStyle.yAxis.axisLine ? customStyle.yAxis.axisLine : DEFAULT_YAXIS_STYLE.axisLine
chart_option.yAxis[0].axisLine = axisLine0
chart_option.yAxis[0].axisTick = axisLine0
@ -187,7 +187,7 @@ export function componentStyle(chart_option, chart) {
chart_option.yAxis[1].axisLabel = customStyle.yAxisExt.axisLabel
chart_option.yAxis[1].splitLine = customStyle.yAxisExt.splitLine
chart_option.yAxis[1].nameTextStyle = customStyle.yAxisExt.nameTextStyle
const axisLine1 = customStyle.yAxis[1].axisLine ? customStyle.yAxis[1].axisLine : DEFAULT_YAXIS_EXT_STYLE.axisLine
const axisLine1 = customStyle.yAxisExt.axisLine ? customStyle.yAxisExt.axisLine : DEFAULT_YAXIS_EXT_STYLE.axisLine
chart_option.yAxis[1].axisLine = axisLine1
chart_option.yAxis[1].axisTick = axisLine1

View File

@ -21,7 +21,7 @@ export function getCustomTheme(chart) {
backgroundColor: headerColor,
horizontalBorderColor: borderColor,
verticalBorderColor: borderColor,
verticalBorderWidth: 0
verticalBorderWidth: chart.type === 'table-pivot' ? 1 : 0
},
text: {
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
@ -49,7 +49,7 @@ export function getCustomTheme(chart) {
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign,
textBaseline: 'middle' // 行头字体绘制基线设置为中心,不然序号列的内容会靠上
textBaseline: chart.type === 'table-pivot' ? 'top' : 'middle' // 行头字体绘制基线设置为中心,不然序号列的内容会靠上
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
@ -127,12 +127,21 @@ export function getCustomTheme(chart) {
theme.cornerCell.text.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.cornerCell.measureText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.cell.backgroundColor = i_c // 这个参数其实只对开启序号列的行头生效
theme.rowCell.cell.horizontalBorderColor = i_c
theme.rowCell.cell.verticalBorderColor = i_c
theme.rowCell.bolderText.fill = c.tableFontColor
theme.rowCell.text.fill = c.tableFontColor
theme.rowCell.measureText.fill = c.tableFontColor
if (chart.type === 'table-pivot') {
theme.rowCell.cell.backgroundColor = h_c
theme.rowCell.cell.horizontalBorderColor = b_c
theme.rowCell.cell.verticalBorderColor = b_c
theme.rowCell.bolderText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.text.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.measureText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
} else {
theme.rowCell.cell.backgroundColor = i_c // 这个参数其实只对开启序号列的行头生效
theme.rowCell.cell.horizontalBorderColor = i_c
theme.rowCell.cell.verticalBorderColor = i_c
theme.rowCell.bolderText.fill = c.tableFontColor
theme.rowCell.text.fill = c.tableFontColor
theme.rowCell.measureText.fill = c.tableFontColor
}
theme.colCell.cell.backgroundColor = h_c
theme.colCell.cell.horizontalBorderColor = b_c
@ -161,13 +170,22 @@ export function getCustomTheme(chart) {
theme.cornerCell.measureText.fontSize = parseInt(s.tableTitleFontSize)
theme.cornerCell.measureText.textAlign = h_a
// 序号列的数字单元格内容样式使用指标的内容样式而不是表头的内容样式
theme.rowCell.bolderText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.bolderText.textAlign = i_a
theme.rowCell.text.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.text.textAlign = i_a
theme.rowCell.measureText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.measureText.textAlign = i_a
if (chart.type === 'table-pivot') {
theme.rowCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.bolderText.textAlign = h_a
theme.rowCell.text.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.text.textAlign = h_a
theme.rowCell.measureText.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.measureText.textAlign = h_a
} else {
// 序号列的数字单元格内容样式使用指标的内容样式而不是表头的内容样式
theme.rowCell.bolderText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.bolderText.textAlign = i_a
theme.rowCell.text.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.text.textAlign = i_a
theme.rowCell.measureText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.measureText.textAlign = i_a
}
theme.colCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.colCell.bolderText.textAlign = h_a

View File

@ -208,8 +208,149 @@
@input="onCmCodeChange"
/>
</div>
<el-tabs
v-model="tabActive"
@tab-click="changeTab"
>
<el-tab-pane
:label="$t('dataset.task.list')"
name="result"
/>
<el-tab-pane
:label="$t('dataset.task.record')"
name="execLog"
/>
</el-tabs>
<div class="sql-result">
<div
v-show="tabActive === 'execLog'"
class="table-container"
>
<grid-table
v-if="param.tableId"
v-loading="loading"
:table-data="data"
:columns="[]"
:pagination="paginationConfig"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<el-table-column
key="startTime"
min-width="200px"
prop="startTime"
:label="$t('dataset.start_time')"
>
<template slot-scope="scope">
<span>{{ scope.row.startTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
key="startTime"
min-width="200px"
prop="sql"
:label="$t('dataset.sql')"
/>
<el-table-column
key="startTime"
min-width="200px"
prop="spend"
:label="$t('dataset.spend_time')"
/>
<el-table-column
key="startTime"
min-width="200px"
prop="status"
:label="$t('dataset.sql_result')"
>
<template slot-scope="scope">
<span
v-if="scope.row.status"
:class="[`de-${scope.row.status}-pre`, 'de-status']"
>{{ $t(`dataset.${scope.row.status.toLocaleLowerCase()}`) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
slot="__operation"
key="__operation"
:label="$t('commons.operating')"
fixed="right"
width="100"
>
<template slot-scope="scope">
<el-button
class="de-text-btn mar3 mar6"
type="text"
@click="copy(scope.row.sql)"
>
{{ $t("commons.copy") }}
</el-button>
</template>
</el-table-column>
</grid-table>
<ux-grid
v-else
ref="tableLog"
size="mini"
style="width: 100%"
:height="height"
:checkbox-config="{ highlight: true }"
:width-resize="true"
>
<ux-table-column
key="startTime"
min-width="200px"
field="startTime"
:title="$t('dataset.start_time')"
:resizable="true"
>
<template slot-scope="scope">
<span>{{ scope.row.startTime | timestampFormatDate }}</span>
</template>
</ux-table-column>
<ux-table-column
key="startTime"
min-width="200px"
field="sql"
:title="$t('dataset.sql')"
:resizable="true"
/>
<ux-table-column
key="startTime"
min-width="200px"
field="spend"
:title="$t('dataset.spend_time')"
:resizable="true"
/>
<ux-table-column
key="startTime"
min-width="200px"
field="status"
:title="$t('dataset.sql_result')"
:resizable="true"
>
<template slot-scope="scope">
<span
v-if="scope.row.status"
:class="[`de-${scope.row.status}-pre`, 'de-status']"
>{{ $t(`dataset.${scope.row.status.toLocaleLowerCase()}`) }}
</span>
<span v-else>-</span>
</template>
</ux-table-column>
</ux-grid>
</div>
<div
v-show="tabActive === 'result'"
class="sql-result"
>
<div class="sql-title">
{{ $t('deDataset.running_results') }}
<span class="result-num">{{
@ -456,9 +597,10 @@ import { engineMode } from '@/api/system/engine'
import msgCfm from '@/components/msgCfm/index'
import cancelMix from './cancelMix'
import _ from 'lodash'
import GridTable from '@/components/gridTable/index.vue'
export default {
name: 'AddSQL',
components: { codemirror },
components: { codemirror, GridTable },
mixins: [msgCfm, cancelMix],
props: {
param: {
@ -468,6 +610,13 @@ export default {
},
data() {
return {
tabActive: 'result',
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0
},
data: [],
dataSource: '',
loading: false,
dataTable: '',
@ -592,6 +741,24 @@ export default {
})
},
methods: {
copy(text) {
this.$copyText(text).then((e) => {
this.openMessageSuccess('commons.copy_success')
}, (e) => {
this.openMessageSuccess('commons.copy_success')
})
},
changeTab() {
},
handleSizeChange(pageSize) {
this.paginationConfig.currentPage = 1
this.paginationConfig.pageSize = pageSize
this.listSqlLog()
},
handleCurrentChange(currentPage) {
this.paginationConfig.currentPage = currentPage
this.listSqlLog()
},
getField(name) {
post('/dataset/table/getFields', {
dataSourceId: this.dataSource,
@ -687,7 +854,6 @@ export default {
})
}
},
getSQLPreview() {
this.errMsg = false
this.errMsgCont = ''
@ -700,6 +866,7 @@ export default {
this.fields = []
this.$refs.plxTable?.reloadData([])
post('/dataset/table/sqlPreview', {
id: this.param.tableId,
dataSourceId: this.dataSource,
type: 'sql',
mode: parseInt(this.mode),
@ -710,17 +877,49 @@ export default {
})
}, true, 60000, true)
.then((response) => {
this.fields = response.data.fields
this.$nextTick(() => {
this.$refs.plxTable?.reloadData(response.data.data)
})
if (response.success) {
this.fields = response.data.fields
this.$nextTick(() => {
this.$refs.plxTable?.reloadData(response.data.data)
})
if (!this.param.tableId) {
this.data.unshift(response.data.log)
this.$refs.tableLog?.reloadData(this.data)
} else {
this.listSqlLog()
}
} else {
this.errMsgCont = response.message
this.errMsg = true
if (!this.param.tableId) {
this.data.unshift(response.data)
this.$refs.tableLog?.reloadData(this.data)
} else {
this.listSqlLog()
}
}
})
.catch((err, msg) => {
.catch((err, msg, response) => {
this.errMsgCont = err
this.errMsg = true
if (!this.param.tableId) {
this.data.unshift(response.data)
this.$refs.tableLog?.reloadData(this.data)
} else {
this.listSqlLog()
}
})
},
listSqlLog() {
post('/dataset/table/sqlLog/' + this.paginationConfig.currentPage + '/' + this.paginationConfig.pageSize, { id: this.param.tableId, dataSourceId: this.dataSource })
.then((response) => {
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
})
.catch(() => {
})
},
save() {
if (!this.dataSource || this.datasource === '') {
this.openMessageSuccess('dataset.pls_slc_data_source', 'error')
@ -1062,5 +1261,17 @@ export default {
}
}
}
.table-container {
height: calc(100% - 50px);
.mar6 {
margin-right: 6px;
}
.mar3 {
margin-left: -3px;
}
}
.table-container-filter {
height: calc(100% - 110px);
}
}
</style>

View File

@ -5,8 +5,9 @@ import { COMMON_BACKGROUND_BASE } from '@/components/canvas/custom-component/com
export const TAB_COMMON_STYLE = {
headFontColor: '#000000',
headFontActiveColor: '#000000',
headBorderColor: null,
headBorderActiveColor: null
headBorderColor: '#ffffff',
headBorderActiveColor: '#ffffff',
headPosition: 'left'
}
export const FILTER_COMMON_STYLE = {