提交 b8d07ce0 authored 作者: wangjiahao's avatar wangjiahao

Merge remote-tracking branch 'origin/main' into main

[submodule "dataease-plugins"]
path = dataease-plugins
url = git@github.com:dataease/dataease-plugins.git
[submodule "dataease-plugin-xpack"]
path = dataease-plugin-xpack
url = git@github.com:dataease/dataease-plugin-xpack.git
......@@ -155,7 +155,7 @@ curl -sSL https://github.com/dataease/dataease/releases/latest/download/quick_st
<tr height="18" style='height:18.00pt;'>
<td class="xl67" height="36" rowspan="2" style='height:36.00pt;border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;' x:str>数据源</td>
<td class="xl68" rowspan="2" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;' x:str>数据源管理</td>
<td class="xl70" x:str>支持 MySQL 和 SQL Server 类型的数据源</td>
<td class="xl70" x:str>支持 MySQL 数据源</td>
</tr>
<tr height="18" style='height:18.00pt;'>
<td class="xl70" x:str>支持对数据源有效性校验</td>
......@@ -184,15 +184,15 @@ curl -sSL https://github.com/dataease/dataease/releases/latest/download/quick_st
## 技术栈
- 后端: [Spring Boot](https://www.tutorialspoint.com/spring_boot/spring_boot_introduction.htm)
- 后端: [Spring Boot](https://spring.io/projects/spring-boot)
- 前端: [Vue.js](https://vuejs.org/)
- 中间件: [MySQL](https://www.mysql.com/)
- 数据处理: [Kettle](https://community.hitachivantara.com/s/article/data-integration-kettle/)[Apache Doris](https://doris.apache.org/)
- 数据处理: [Kettle](https://github.com/pentaho/pentaho-kettle)[Apache Doris](https://github.com/apache/incubator-doris/)
- 基础设施: [Docker](https://www.docker.com/)
## 致谢
- [Kettle](https://community.hitachivantara.com/s/article/data-integration-kettle/):DataEase 使用了 Kettle 进行数据处理工作;
- [Kettle](https://github.com/pentaho/pentaho-kettle/):DataEase 使用了 Kettle 进行数据处理工作;
- [Apache Doris](https://doris.apache.org/):DataEase 使用了 Apache Doris 进行快速的数据分析;
- [Element](https://element.eleme.cn/):感谢 Element 提供的优秀组件库。
......
package io.dataease.base.mapper.ext;
import io.dataease.controller.request.BaseTreeRequest;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.dto.chart.ChartGroupDTO;
......
......@@ -26,6 +26,11 @@ public class ChartGroupController {
return chartGroupService.tree(ChartGroup);
}
@PostMapping("/treeNode")
public List<ChartGroupDTO> treeNode(@RequestBody ChartGroupRequest ChartGroup) {
return chartGroupService.tree(ChartGroup);
}
@PostMapping("/delete/{id}")
public void tree(@PathVariable String id) {
chartGroupService.delete(id);
......
......@@ -32,6 +32,11 @@ public class ChartViewController {
return chartViewService.list(chartViewRequest);
}
@PostMapping("/listAndGroup")
public List<ChartViewDTO> listAndGroup(@RequestBody ChartViewRequest chartViewRequest) {
return chartViewService.listAndGroup(chartViewRequest);
}
@PostMapping("/get/{id}")
public ChartViewWithBLOBs get(@PathVariable String id) {
return chartViewService.get(id);
......
......@@ -21,6 +21,7 @@ public class DataSetGroupController {
private DataSetGroupService dataSetGroupService;
@Resource
private ExtractDataService extractDataService;
@PostMapping("/save")
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
return dataSetGroupService.save(datasetGroup);
......@@ -31,8 +32,13 @@ public class DataSetGroupController {
return dataSetGroupService.tree(datasetGroup);
}
@PostMapping("/treeNode")
public List<DataSetGroupDTO> treeNode(@RequestBody DataSetGroupRequest datasetGroup) {
return dataSetGroupService.treeNode(datasetGroup);
}
@PostMapping("/delete/{id}")
public void tree(@PathVariable String id) throws Exception{
public void tree(@PathVariable String id) throws Exception {
dataSetGroupService.delete(id);
}
......@@ -42,7 +48,7 @@ public class DataSetGroupController {
}
@PostMapping("/isKettleRunning")
public boolean isKettleRunning(){
public boolean isKettleRunning() {
return extractDataService.isKettleRunning();
}
}
......@@ -44,6 +44,11 @@ public class DataSetTableController {
return dataSetTableService.list(dataSetTableRequest);
}
@PostMapping("listAndGroup")
public List<DataSetTableDTO> listAndGroup(@RequestBody DataSetTableRequest dataSetTableRequest) {
return dataSetTableService.listAndGroup(dataSetTableRequest);
}
@PostMapping("get/{id}")
public DatasetTable get(@PathVariable String id) {
return dataSetTableService.get(id);
......
......@@ -16,4 +16,7 @@ public class ChartViewDTO extends ChartViewWithBLOBs {
private Map<String, Object> data;
private String privileges;
private Boolean isLeaf;
private String pid;
}
......@@ -15,4 +15,7 @@ import java.util.List;
public class DataSetTableDTO extends DatasetTable {
private List<DataSetTableDTO> children;
private String privileges;
private Boolean isLeaf;
private String pid;
}
......@@ -30,17 +30,21 @@ public class ScheduleService {
scheduleManager.getDefaultJobDataMap(datasetTableTask.getTableId(), datasetTableTask.getCron(), datasetTableTask.getId(), datasetTableTask.getType()));
} else if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), ScheduleType.CRON.toString())) {
Date endTime;
if (datasetTableTask.getEndTime() == null || datasetTableTask.getEndTime() == 0) {
endTime = null;
} else {
endTime = new Date(datasetTableTask.getEndTime());
if (StringUtils.equalsIgnoreCase(datasetTableTask.getEnd(), "1")) {
if (datasetTableTask.getEndTime() == null || datasetTableTask.getEndTime() == 0) {
endTime = null;
} else {
endTime = new Date(datasetTableTask.getEndTime());
// if (endTime.before(new Date())) {
// return;
// }
if (endTime.before(new Date())) {
deleteSchedule(datasetTableTask);
return;
if (endTime.before(new Date())) {
deleteSchedule(datasetTableTask);
return;
}
}
} else {
endTime = null;
}
scheduleManager.addOrUpdateCronJob(new JobKey(datasetTableTask.getId(), datasetTableTask.getTableId()),
......
......@@ -89,6 +89,16 @@ public class ChartGroupService {
return result;
}
public List<ChartGroupDTO> treeNode(ChartGroupRequest chartGroup) {
chartGroup.setLevel(null);
chartGroup.setPid("0");
chartGroup.setType("group");
chartGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<ChartGroupDTO> treeInfo = extChartGroupMapper.search(chartGroup);
List<ChartGroupDTO> result = TreeUtils.mergeTree(treeInfo);
return result;
}
public List<String> getAllId(List<ChartGroupDTO> list, List<String> ids) {
for (ChartGroupDTO dto : list) {
ids.add(dto.getId());
......
......@@ -4,21 +4,23 @@ import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.ChartViewMapper;
import io.dataease.base.mapper.ext.ExtChartGroupMapper;
import io.dataease.base.mapper.ext.ExtChartViewMapper;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.datasource.provider.DatasourceProvider;
import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.datasource.service.DatasourceService;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.chart.Series;
import io.dataease.dto.chart.*;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.i18n.Translator;
import io.dataease.provider.QueryProvider;
......@@ -51,6 +53,8 @@ public class ChartViewService {
private DatasourceService datasourceService;
@Resource
private DataSetTableFieldsService dataSetTableFieldsService;
@Resource
private ExtChartGroupMapper extChartGroupMapper;
public ChartViewWithBLOBs save(ChartViewWithBLOBs chartView) {
checkName(chartView);
......@@ -72,6 +76,31 @@ public class ChartViewService {
return extChartViewMapper.search(chartViewRequest);
}
public List<ChartViewDTO> listAndGroup(ChartViewRequest chartViewRequest) {
chartViewRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<ChartViewDTO> charts = extChartViewMapper.search(chartViewRequest);
charts.forEach(ele -> ele.setIsLeaf(true));
// 获取group下的子group
ChartGroupRequest chartGroupRequest = new ChartGroupRequest();
chartGroupRequest.setLevel(null);
chartGroupRequest.setType("group");
chartGroupRequest.setPid(chartViewRequest.getSceneId());
chartGroupRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
chartGroupRequest.setSort("name asc,create_time desc");
List<ChartGroupDTO> groups = extChartGroupMapper.search(chartGroupRequest);
List<ChartViewDTO> group = groups.stream().map(ele -> {
ChartViewDTO dto = new ChartViewDTO();
dto.setId(ele.getId());
dto.setName(ele.getName());
dto.setIsLeaf(false);
dto.setType("group");
dto.setPid(ele.getPid());
return dto;
}).collect(Collectors.toList());
group.addAll(charts);
return group;
}
public ChartViewWithBLOBs get(String id) {
return chartViewMapper.selectByPrimaryKey(id);
}
......
......@@ -87,6 +87,16 @@ public class DataSetGroupService {
}
}
public List<DataSetGroupDTO> treeNode(DataSetGroupRequest datasetGroup) {
datasetGroup.setLevel(null);
datasetGroup.setPid("0");
datasetGroup.setType("group");
datasetGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<DataSetGroupDTO> treeInfo = extDataSetGroupMapper.search(datasetGroup);
List<DataSetGroupDTO> result = TreeUtils.mergeTree(treeInfo);
return result;
}
public List<DataSetGroupDTO> tree(DataSetGroupRequest datasetGroup) {
datasetGroup.setLevel(null);
datasetGroup.setPid(null);
......
......@@ -5,21 +5,19 @@ import com.fit2cloud.quartz.anno.QuartzScheduled;
import com.google.gson.Gson;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.base.mapper.ext.ExtDataSetTableMapper;
import io.dataease.base.mapper.ext.UtilMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.utils.*;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.datasource.dto.TableFiled;
import io.dataease.datasource.provider.DatasourceProvider;
import io.dataease.datasource.provider.JdbcProvider;
import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.dataset.DataSetPreviewPage;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.dto.dataset.DataTableInfoCustomUnion;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.dto.dataset.*;
import io.dataease.i18n.Translator;
import io.dataease.provider.DDLProvider;
import io.dataease.provider.QueryProvider;
......@@ -81,6 +79,8 @@ public class DataSetTableService {
private QrtzSchedulerStateMapper qrtzSchedulerStateMapper;
@Resource
private DatasetTableTaskLogMapper datasetTableTaskLogMapper;
@Resource
private ExtDataSetGroupMapper extDataSetGroupMapper;
private static String lastUpdateTime = "${__last_update_time__}";
private static String currentUpdateTime = "${__current_update_time__}";
......@@ -186,6 +186,32 @@ public class DataSetTableService {
return extDataSetTableMapper.search(dataSetTableRequest);
}
public List<DataSetTableDTO> listAndGroup(DataSetTableRequest dataSetTableRequest) {
dataSetTableRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
dataSetTableRequest.setTypeFilter(dataSetTableRequest.getTypeFilter());
List<DataSetTableDTO> ds = extDataSetTableMapper.search(dataSetTableRequest);
ds.forEach(ele -> ele.setIsLeaf(true));
// 获取group下的子group
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();
datasetGroup.setLevel(null);
datasetGroup.setType("group");
datasetGroup.setPid(dataSetTableRequest.getSceneId());
datasetGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
datasetGroup.setSort("name asc,create_time desc");
List<DataSetGroupDTO> groups = extDataSetGroupMapper.search(datasetGroup);
List<DataSetTableDTO> group = groups.stream().map(ele -> {
DataSetTableDTO dto = new DataSetTableDTO();
dto.setId(ele.getId());
dto.setName(ele.getName());
dto.setIsLeaf(false);
dto.setType("group");
dto.setPid(ele.getPid());
return dto;
}).collect(Collectors.toList());
group.addAll(ds);
return group;
}
public DatasetTable get(String id) {
return datasetTableMapper.selectByPrimaryKey(id);
}
......
......@@ -763,12 +763,11 @@ public class ExtractDataService {
userDefinedJavaClassMeta.setFieldInfo(fields);
List<UserDefinedJavaClassDef> definitions = new ArrayList<UserDefinedJavaClassDef>();
String tmp_code = code.replace("alterColumnTypeCode", needToChangeColumnType).replace("Column_Fields", String.join(",", datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList())));
tmp_code = tmp_code.replace("handleWraps", handleWraps);
if(isExcel){
tmp_code = tmp_code.replace("handleExcelIntColumn", handleExcelIntColumn);
tmp_code = tmp_code.replace("handleExcelWraps", handleExcelWraps);
}else {
tmp_code = tmp_code.replace("handleExcelIntColumn", "");
tmp_code = tmp_code.replace("handleExcelWraps", "");
}
UserDefinedJavaClassDef userDefinedJavaClassDef = new UserDefinedJavaClassDef(UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "Processor", tmp_code);
......@@ -861,13 +860,12 @@ public class ExtractDataService {
" }catch (Exception e){}\n" +
" }";
private static String handleExcelWraps = " \n" +
" if(tmp != null ){\n" +
" tmp = tmp.trim();\n" +
" tmp = tmp.replaceAll(\"\\r\",\" \");\n" +
" tmp = tmp.replaceAll(\"\\n\",\" \");\n" +
" get(Fields.Out, filed).setValue(r, tmp);\n" +
" }";
private static String handleWraps = " if(tmp != null && ( tmp.contains(\"\\r\") || tmp.contains(\"\\n\"))){\n" +
"\t\t\ttmp = tmp.trim();\n" +
" tmp = tmp.replaceAll(\"\\r\",\" \");\n" +
" tmp = tmp.replaceAll(\"\\n\",\" \");\n" +
" get(Fields.Out, filed).setValue(r, tmp);\n" +
" } ";
private static String code = "import org.pentaho.di.core.row.ValueMetaInterface;\n" +
"import java.util.List;\n" +
......@@ -898,7 +896,7 @@ public class ExtractDataService {
" List<String> fileds = Arrays.asList(\"Column_Fields\".split(\",\"));\n" +
" for (String filed : fileds) {\n" +
" String tmp = get(Fields.In, filed).getString(r);\n" +
"handleExcelWraps \n" +
"handleWraps \n" +
"alterColumnTypeCode \n" +
"handleExcelIntColumn \n" +
" str = str + tmp;\n" +
......
Subproject commit 9879b705aa4a5105056109ecf5b9da70b783969d
Subproject commit 2541de3d2c82f37dcf9916fda70ada0ca3fc6132
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1624249976156" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2309" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M279.04 483.584l193.706667 114.218667v227.242666L279.04 938.666667 85.333333 825.045333v-227.242666l193.706667-114.218667z m465.92 0L938.666667 597.802667v227.242666L744.96 938.666667l-193.706667-113.621334v-227.242666l193.706667-114.218667zM279.04 567.381333L156.586667 639.573333v143.573334l122.453333 71.765333 122.453333-71.765333V639.573333l-122.453333-72.192z m465.92 0l-122.453333 72.192v143.573334l122.453333 71.765333 122.368-71.765333V639.573333l-122.410667-72.149333zM512 85.333333l193.706667 113.621334v227.242666L512 540.416 318.293333 426.197333V198.954667L512 85.333333z m0 83.669334L389.546667 240.853333v143.530667L512 456.533333l122.410667-72.192V240.853333l-122.453334-71.850666z" p-id="2310" fill="#707070"></path></svg>
\ No newline at end of file
......@@ -38,7 +38,7 @@
<lang-select class="right-menu-item hover-effect" />
<div style="height: 100%;padding: 0 8px;" class="right-menu-item hover-effect">
<a href="https://de-docs.fit2cloud.com/" target="_blank" style="display: flex;height: 100%;width: 100%;justify-content: center;align-items: center;">
<a href="https://docs.dataease.io/" target="_blank" style="display: flex;height: 100%;width: 100%;justify-content: center;align-items: center;">
<svg-icon icon-class="docs" />
</a>
</div>
......
<template>
<el-col style="height: 400px;overflow-y: auto;margin-bottom: 10px;">
<el-tree
:data="tData"
node-key="id"
:expand-on-click-node="false"
highlight-current
@node-click="nodeClick"
>
<span slot-scope="{ node, data }" :class="treeClass(data,node)">
<span style="display: flex;flex: 1;width: 0;">
<span v-if="data.type === 'scene'">
<svg-icon icon-class="scene" class="ds-icon-scene" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
</span>
</span>
</el-tree>
</el-col>
</template>
<script>
import { post } from '@/api/chart/chart'
export default {
name: 'ChartMoveSelector',
props: {
item: {
type: Object,
required: true
}
},
data() {
return {
tData: [],
currGroup: '',
groupForm: {
name: '',
pid: '0',
level: 0,
type: 'group',
children: [],
sort: 'type desc,name asc'
},
targetGroup: {}
}
},
watch: {
'item': function() {
this.tree(this.groupForm)
}
},
mounted() {
this.tree(this.groupForm)
},
methods: {
tree(group) {
post('/chart/group/tree', group).then(res => {
this.tData = res.data
})
},
nodeClick(data, node) {
this.targetGroup = data
this.$emit('targetDs', data)
},
treeClass(data, node) {
if (data.id === this.item.id) {
node.visible = false
}
return 'custom-tree-node'
}
}
}
</script>
<style scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right:8px;
}
</style>
<template>
<el-col style="height: 400px;overflow-y: auto;margin-bottom: 10px;">
<el-tree
:data="tData"
node-key="id"
:expand-on-click-node="false"
highlight-current
@node-click="nodeClick"
>
<span slot-scope="{ node, data }" :class="treeClass(data,node)">
<span style="display: flex;flex: 1;width: 0;">
<span v-if="data.type === 'scene'">
<svg-icon icon-class="scene" class="ds-icon-scene" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
</span>
</span>
</el-tree>
</el-col>
</template>
<script>
import { post } from '@/api/chart/chart'
export default {
name: 'GroupMoveSelector',
props: {
item: {
type: Object,
required: true
}
},
data() {
return {
tData: [],
currGroup: '',
groupForm: {
name: '',
pid: '0',
level: 0,
type: 'group',
children: [],
sort: 'type desc,name asc'
},
targetGroup: {}
}
},
watch: {
'item': function() {
this.tree(this.groupForm)
}
},
mounted() {
this.tree(this.groupForm)
},
methods: {
tree(group) {
post('/chart/group/tree', group).then(res => {
this.tData = [{
id: '0',
name: this.$t('dataset.dataset_group'),
pid: '0',
privileges: 'grant,manage,use',
type: 'group',
children: res.data
}]
})
},
nodeClick(data, node) {
this.targetGroup = data
this.$emit('targetGroup', data)
},
treeClass(data, node) {
if (data.id === this.item.id) {
node.visible = false
}
return 'custom-tree-node'
}
}
}
</script>
<style scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right:8px;
}
</style>
......@@ -37,9 +37,10 @@
<el-form-item v-show="(chart.type && chart.type.includes('table')) || sourceType==='panelTable'" :label="$t('chart.table_item_font_color')" class="form-item">
<colorPicker v-model="colorForm.tableFontColor" style="margin-top: 6px;cursor: pointer;z-index: 1002;border: solid 1px black" @change="changeColorCase" />
</el-form-item>
<el-form-item v-show="(chart.type && chart.type.includes('table')) || sourceType==='panelTable'" :label="$t('chart.stripe')" class="form-item">
<el-checkbox v-model="colorForm.tableStripe" @change="changeColorCase">{{ $t('chart.stripe') }}</el-checkbox>
</el-form-item>
<!-- 暂时不支持该功能-->
<!-- <el-form-item v-show="(chart.type && chart.type.includes('table')) || sourceType==='panelTable'" :label="$t('chart.stripe')" class="form-item">-->
<!-- <el-checkbox v-model="colorForm.tableStripe" @change="changeColorCase">{{ $t('chart.stripe') }}</el-checkbox>-->
<!-- </el-form-item>-->
</div>
<el-form-item v-show="chart.type && !chart.type.includes('text')" :label="$t('chart.not_alpha')" class="form-item form-item-slider">
......
......@@ -117,23 +117,24 @@ export default {
}
},
calcHeight() {
const that = this
this.$nextTick(function() {
if (that.$refs.tableContainer) {
const currentHeight = that.$refs.tableContainer.offsetHeight
const tableMaxHeight = currentHeight - that.$refs.title.offsetHeight
let tableHeight
if (that.chart.data) {
tableHeight = (that.chart.data.tableRow.length + 2) * 36
} else {
tableHeight = 0
}
if (tableHeight > tableMaxHeight) {
that.height = tableMaxHeight + 'px'
} else {
that.height = 'auto'
this.$nextTick(() => {
setTimeout(() => {
if (this.$refs.tableContainer) {
const currentHeight = this.$refs.tableContainer.offsetHeight
const tableMaxHeight = currentHeight - this.$refs.title.offsetHeight
let tableHeight
if (this.chart.data) {
tableHeight = (this.chart.data.tableRow.length + 2) * 36
} else {
tableHeight = 0
}
if (tableHeight > tableMaxHeight) {
this.height = tableMaxHeight + 'px'
} else {
this.height = 'auto'
}
}
}
}, 100)
})
},
initStyle() {
......@@ -150,15 +151,16 @@ export default {
this.table_item_class.fontSize = customAttr.size.tableItemFontSize + 'px'
}
this.table_item_class_stripe = JSON.parse(JSON.stringify(this.table_item_class))
if (customAttr.color.tableStripe) {
// this.table_item_class_stripe.background = hexColorToRGBA(customAttr.color.tableItemBgColor, customAttr.color.alpha - 40)
if (this.chart.customStyle) {
const customStyle = JSON.parse(this.chart.customStyle)
if (customStyle.background) {
this.table_item_class_stripe.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)
}
}
}
// 暂不支持斑马纹
// if (customAttr.color.tableStripe) {
// // this.table_item_class_stripe.background = hexColorToRGBA(customAttr.color.tableItemBgColor, customAttr.color.alpha - 40)
// if (this.chart.customStyle) {
// const customStyle = JSON.parse(this.chart.customStyle)
// if (customStyle.background) {
// this.table_item_class_stripe.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)
// }
// }
// }
}
if (this.chart.customStyle) {
const customStyle = JSON.parse(this.chart.customStyle)
......
......@@ -2,12 +2,12 @@
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa">
<de-aside-container>
<group @switchComponent="switchComponent" />
<group :save-status="saveStatus" @switchComponent="switchComponent" />
</de-aside-container>
<de-main-container>
<!-- <router-view />-->
<component :is="component" :param="param" @switchComponent="switchComponent" />
<component :is="component" :param="param" @switchComponent="switchComponent" @saveSuccess="saveSuccess" />
</de-main-container>
</de-container>
</template>
......@@ -28,7 +28,8 @@ export default {
data() {
return {
component: ChartHome,
param: {}
param: {},
saveStatus: null
}
},
mounted() {
......@@ -45,6 +46,9 @@ export default {
this.component = ChartHome
break
}
},
saveSuccess(val) {
this.saveStatus = val
}
}
}
......
......@@ -98,7 +98,7 @@
<el-radio-group
v-model="view.type"
style="width: 100%"
@change="save(true,'chart')"
@change="save(true,'chart',true)"
>
<div style="width: 100%;display: flex;display: -webkit-flex;justify-content: space-between;flex-direction: row;flex-wrap: wrap;">
<el-radio value="table-normal" label="table-normal">
......@@ -471,17 +471,19 @@ export default {
}
},
initTableField(id) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
this.dimension = response.data.dimension
this.quota = response.data.quota
}).catch(err => {
this.resetView()
this.httpRequest.status = err.response.data.success
this.httpRequest.msg = err.response.data.message
return true
})
if (this.table) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
this.dimension = response.data.dimension
this.quota = response.data.quota
}).catch(err => {
this.resetView()
this.httpRequest.status = err.response.data.success
this.httpRequest.msg = err.response.data.message
return true
})
}
},
save(getData, trigger) {
save(getData, trigger, needRefreshGroup = false) {
const view = JSON.parse(JSON.stringify(this.view))
view.id = this.view.id
view.sceneId = this.view.sceneId
......@@ -549,8 +551,11 @@ export default {
this.getChart(response.data.id)
}
this.$store.dispatch('chart/setChartSceneData', null)
this.$store.dispatch('chart/setChartSceneData', response.data)
// this.$store.dispatch('chart/setChartSceneData', null)
// this.$store.dispatch('chart/setChartSceneData', response.data)
if (needRefreshGroup) {
this.refreshGroup(view)
}
})
},
......@@ -797,7 +802,7 @@ export default {
onTextChange(val) {
this.view.customStyle.text = val
this.view.title = val.title
this.save()
this.save(false, '', true)
},
onLegendChange(val) {
......@@ -921,6 +926,10 @@ export default {
yAxis: [],
type: ''
}
},
refreshGroup(view) {
this.$emit('saveSuccess', view)
}
}
}
......
<template>
<de-container>
<de-aside-container>
<dataset-group-selector @getTable="getTable" />
<dataset-group-selector-tree @getTable="getTable" />
</de-aside-container>
<de-main-container>
......@@ -15,14 +15,15 @@ import DeMainContainer from '@/components/dataease/DeMainContainer'
import DeContainer from '@/components/dataease/DeContainer'
import DeAsideContainer from '@/components/dataease/DeAsideContainer'
import DatasetGroupSelector from '../../dataset/common/DatasetGroupSelector'
// import DatasetGroupSelector from '../../dataset/common/DatasetGroupSelector'
import DatasetGroupSelectorTree from '../../dataset/common/DatasetGroupSelectorTree'
import DatasetTableData from '../../dataset/common/DatasetTableData'
export default {
name: 'TableSelector',
components: {
DatasetTableData,
DeMainContainer, DeContainer, DeAsideContainer, DatasetGroupSelector
DeMainContainer, DeContainer, DeAsideContainer, DatasetGroupSelectorTree
},
data() {
return {
......
......@@ -208,7 +208,8 @@ export default {
info: '{"list":' + JSON.stringify(this.checkedList) + '}'
}
post('/dataset/table/update', table).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
this.$emit('saveSuccess', table)
this.cancel()
})
},
......
......@@ -141,7 +141,8 @@ export default {
})
})
post('/dataset/table/batchAdd', tables).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
this.$emit('saveSuccess', tables[0])
this.cancel()
})
},
......
......@@ -202,7 +202,8 @@ export default {
}
}
post('/dataset/table/update', table).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
this.$emit('saveSuccess', table)
this.cancel()
})
},
......
......@@ -265,7 +265,8 @@ export default {
info: JSON.stringify({ sql: this.sql })
}
post('/dataset/table/update', table).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
this.$emit('saveSuccess', table)
this.cancel()
})
},
......
......@@ -29,8 +29,10 @@
:default-expanded-keys="expandedArray"
:data="data"
node-key="id"
:expand-on-click-node="true"
:expand-on-click-node="false"
@node-click="nodeClick"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
>
<span slot-scope="{ node, data }" class="custom-tree-node">
<span style="display: flex;flex: 1;width: 0;">
......@@ -234,7 +236,7 @@ export default {
if (this.currGroup) {
this.dsLoading = true
post('/dataset/table/list', {
sort: 'type asc,create_time desc,name asc',
sort: 'type asc,name asc,create_time desc',
sceneId: this.currGroup.id,
mode: this.mode < 0 ? null : this.mode,
typeFilter: this.customType ? this.customType : null
......@@ -258,19 +260,19 @@ export default {
},
nodeClick(data, node) {
if (data.type === 'scene') {
this.sceneMode = true
this.currGroup = data
this.tableTree()
}
if (node.expanded) {
this.expandedArray.push(data.id)
} else {
const index = this.expandedArray.indexOf(data.id)
if (index > -1) {
this.expandedArray.splice(index, 1)
}
}
// if (data.type === 'scene') {
this.sceneMode = true
this.currGroup = data
this.tableTree()
// }
// if (node.expanded) {
// this.expandedArray.push(data.id)
// } else {
// const index = this.expandedArray.indexOf(data.id)
// if (index > -1) {
// this.expandedArray.splice(index, 1)
// }
// }
// console.log(this.expandedArray);
},
......@@ -339,6 +341,17 @@ export default {
div1.style.setProperty('cursor', 'not-allowed')
div2.style.setProperty('pointer-events', 'none')
})
},
nodeExpand(data) {
if (data.id) {
this.expandedArray.push(data.id)
}
},
nodeCollapse(data) {
if (data.id) {
this.expandedArray.splice(this.expandedArray.indexOf(data.id), 1)
}
}
}
}
......
......@@ -57,9 +57,9 @@
<svg-icon v-if="scope.row.deExtractType === 1" icon-class="field_time" class="field-icon-time" />
<span class="field-class">{{ $t('dataset.time') }}</span>
</span>
<span v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3">
<svg-icon v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3" icon-class="field_value" class="field-icon-value" />
<span v-if="scope.row.deExtractType === 2" class="field-class">{{ $t('dataset.value') }}</span>
<span v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3 || scope.row.deExtractType === 4">
<svg-icon v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3 || scope.row.deExtractType === 4" icon-class="field_value" class="field-icon-value" />
<span v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 4" class="field-class">{{ $t('dataset.value') }}</span>
<span v-if="scope.row.deExtractType === 3" class="field-class">{{ $t('dataset.value') + '(' + $t('dataset.float') + ')' }}</span>
</span>
</span>
......
......@@ -38,7 +38,7 @@ export default {
name: '',
pid: '0',
level: 0,
type: '',
type: 'group',
children: [],
sort: 'type desc,name asc'
},
......
......@@ -2,12 +2,12 @@
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<de-aside-container>
<group @switchComponent="switchComponent" />
<group :save-status="saveStatus" @switchComponent="switchComponent" />
</de-aside-container>
<de-main-container>
<!--<router-view/>-->
<component :is="component" :param="param" @switchComponent="switchComponent" />
<component :is="component" :param="param" @switchComponent="switchComponent" @saveSuccess="saveSuccess" />
</de-main-container>
</de-container>
</template>
......@@ -33,7 +33,8 @@ export default {
data() {
return {
component: DataHome,
param: {}
param: {},
saveStatus: null
}
},
mounted() {
......@@ -65,6 +66,10 @@ export default {
this.component = DataHome
break
}
},
saveSuccess(val) {
this.saveStatus = val
}
}
}
......
......@@ -32,7 +32,7 @@
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
<span style="display: flex; flex: 1 1 0%; width: 0px;">
<span v-if="data.type !== 'folder'">
<svg-icon icon-class="panel" class="ds-icon-scene" />
<svg-icon icon-class="datasource" class="ds-icon-scene" />
</span>
<span v-if="data.type === 'folder'">
<i class="el-icon-folder" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论