commit
a8b382b452
@ -37,6 +37,12 @@
|
||||
<if test="createTime != null">
|
||||
and chart_group.create_time = #{createTime,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
and id in
|
||||
<foreach collection="ids" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
|
||||
@ -39,6 +39,9 @@
|
||||
<if test="sceneId != null">
|
||||
and scene_id = #{sceneId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
and name like CONCAT('%', #{name},'%')
|
||||
</if>
|
||||
</where>
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
|
||||
@ -37,6 +37,12 @@
|
||||
<if test="createTime != null">
|
||||
and dataset_group.create_time = #{createTime,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
and id in
|
||||
<foreach collection="ids" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
|
||||
@ -45,6 +45,9 @@
|
||||
<if test="sceneId != null">
|
||||
and scene_id = #{sceneId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
and name like CONCAT('%', #{name},'%')
|
||||
</if>
|
||||
<if test="mode != null">
|
||||
and mode = #{mode,jdbcType=INTEGER}
|
||||
</if>
|
||||
|
||||
@ -4,7 +4,9 @@ import io.dataease.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.chart.ChartViewRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.dto.chart.ChartViewDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.service.chart.ChartViewService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -63,7 +65,7 @@ public class ChartViewController {
|
||||
}
|
||||
|
||||
@GetMapping("searchAdviceSceneId/{panelId}")
|
||||
public String searchAdviceSceneId(@PathVariable String panelId){
|
||||
public String searchAdviceSceneId(@PathVariable String panelId) {
|
||||
return chartViewService.searchAdviceSceneId(panelId);
|
||||
}
|
||||
|
||||
@ -71,10 +73,16 @@ public class ChartViewController {
|
||||
public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception {
|
||||
//如果能获取用户 则添加对应的权限
|
||||
ChartViewDTO dto = chartViewService.getData(id, requestList);
|
||||
if(dto!=null && AuthUtils.getUser()!=null){
|
||||
ChartViewDTO permissionDto = chartViewService.getOneWithPermission(dto.getId());
|
||||
if (dto != null && AuthUtils.getUser() != null) {
|
||||
ChartViewDTO permissionDto = chartViewService.getOneWithPermission(dto.getId());
|
||||
dto.setPrivileges(permissionDto.getPrivileges());
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("search")
|
||||
public List<ChartViewDTO> search(@RequestBody ChartViewRequest chartViewRequest) {
|
||||
return chartViewService.search(chartViewRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,4 +108,9 @@ public class DataSetTableController {
|
||||
public Boolean checkDorisTableIsExists(@PathVariable String id) throws Exception {
|
||||
return dataSetTableService.checkDorisTableIsExists(id);
|
||||
}
|
||||
|
||||
@PostMapping("search")
|
||||
public List<DataSetTableDTO> search(@RequestBody DataSetTableRequest dataSetTableRequest) {
|
||||
return dataSetTableService.search(dataSetTableRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,9 +3,12 @@ package io.dataease.controller.request.chart;
|
||||
import io.dataease.base.domain.ChartGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@Data
|
||||
public class ChartGroupRequest extends ChartGroup {
|
||||
private String sort;
|
||||
private String userId;
|
||||
private Set<String> ids;
|
||||
}
|
||||
|
||||
@ -3,6 +3,9 @@ package io.dataease.controller.request.dataset;
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/22 1:30 下午
|
||||
@ -12,4 +15,6 @@ public class DataSetGroupRequest extends DatasetGroup {
|
||||
private String sort;
|
||||
|
||||
private String userId;
|
||||
|
||||
private Set<String> ids;
|
||||
}
|
||||
|
||||
@ -15,11 +15,15 @@ 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.controller.request.dataset.DataSetTableRequest;
|
||||
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.*;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.i18n.Translator;
|
||||
@ -110,6 +114,53 @@ public class ChartViewService {
|
||||
return group;
|
||||
}
|
||||
|
||||
public List<ChartViewDTO> search(ChartViewRequest chartViewRequest) {
|
||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||
chartViewRequest.setUserId(userId);
|
||||
chartViewRequest.setSort("name asc");
|
||||
List<ChartViewDTO> ds = extChartViewMapper.search(chartViewRequest);
|
||||
if (CollectionUtils.isEmpty(ds)) {
|
||||
return ds;
|
||||
}
|
||||
|
||||
TreeSet<String> ids = new TreeSet<>();
|
||||
ds.forEach(ele -> {
|
||||
ele.setIsLeaf(true);
|
||||
ele.setPid(ele.getSceneId());
|
||||
ids.add(ele.getPid());
|
||||
});
|
||||
|
||||
List<ChartViewDTO> group = new ArrayList<>();
|
||||
ChartGroupRequest chartGroupRequest = new ChartGroupRequest();
|
||||
chartGroupRequest.setUserId(userId);
|
||||
chartGroupRequest.setIds(ids);
|
||||
List<ChartGroupDTO> search = extChartGroupMapper.search(chartGroupRequest);
|
||||
while (CollectionUtils.isNotEmpty(search)) {
|
||||
ids.clear();
|
||||
search.forEach(ele -> {
|
||||
ChartViewDTO dto = new ChartViewDTO();
|
||||
BeanUtils.copyBean(dto, ele);
|
||||
dto.setIsLeaf(false);
|
||||
dto.setType("group");
|
||||
group.add(dto);
|
||||
ids.add(ele.getPid());
|
||||
});
|
||||
chartGroupRequest.setIds(ids);
|
||||
search = extChartGroupMapper.search(chartGroupRequest);
|
||||
}
|
||||
|
||||
List<ChartViewDTO> res = new ArrayList<>();
|
||||
Map<String, ChartViewDTO> map = new TreeMap<>();
|
||||
group.forEach(ele -> map.put(ele.getId(), ele));
|
||||
Iterator<Map.Entry<String, ChartViewDTO>> iterator = map.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
res.add(iterator.next().getValue());
|
||||
}
|
||||
res.sort(Comparator.comparing(ChartViewDTO::getName));
|
||||
res.addAll(ds);
|
||||
return res;
|
||||
}
|
||||
|
||||
public ChartViewWithBLOBs get(String id) {
|
||||
return chartViewMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import io.dataease.commons.constants.JobStatus;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.commons.constants.TaskStatus;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.chart.ChartGroupRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTaskRequest;
|
||||
@ -232,6 +233,53 @@ public class DataSetTableService {
|
||||
return group;
|
||||
}
|
||||
|
||||
public List<DataSetTableDTO> search(DataSetTableRequest dataSetTableRequest) {
|
||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||
dataSetTableRequest.setUserId(userId);
|
||||
dataSetTableRequest.setSort("name asc");
|
||||
List<DataSetTableDTO> ds = extDataSetTableMapper.search(dataSetTableRequest);
|
||||
if (CollectionUtils.isEmpty(ds)) {
|
||||
return ds;
|
||||
}
|
||||
|
||||
TreeSet<String> ids = new TreeSet<>();
|
||||
ds.forEach(ele -> {
|
||||
ele.setIsLeaf(true);
|
||||
ele.setPid(ele.getSceneId());
|
||||
ids.add(ele.getPid());
|
||||
});
|
||||
|
||||
List<DataSetTableDTO> group = new ArrayList<>();
|
||||
DataSetGroupRequest dataSetGroupRequest = new DataSetGroupRequest();
|
||||
dataSetGroupRequest.setUserId(userId);
|
||||
dataSetGroupRequest.setIds(ids);
|
||||
List<DataSetGroupDTO> search = extDataSetGroupMapper.search(dataSetGroupRequest);
|
||||
while (CollectionUtils.isNotEmpty(search)) {
|
||||
ids.clear();
|
||||
search.forEach(ele -> {
|
||||
DataSetTableDTO dto = new DataSetTableDTO();
|
||||
BeanUtils.copyBean(dto, ele);
|
||||
dto.setIsLeaf(false);
|
||||
dto.setType("group");
|
||||
group.add(dto);
|
||||
ids.add(ele.getPid());
|
||||
});
|
||||
dataSetGroupRequest.setIds(ids);
|
||||
search = extDataSetGroupMapper.search(dataSetGroupRequest);
|
||||
}
|
||||
|
||||
List<DataSetTableDTO> res = new ArrayList<>();
|
||||
Map<String, DataSetTableDTO> map = new TreeMap<>();
|
||||
group.forEach(ele -> map.put(ele.getId(), ele));
|
||||
Iterator<Map.Entry<String, DataSetTableDTO>> iterator = map.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
res.add(iterator.next().getValue());
|
||||
}
|
||||
res.sort(Comparator.comparing(DatasetTable::getName));
|
||||
res.addAll(ds);
|
||||
return res;
|
||||
}
|
||||
|
||||
public DatasetTable get(String id) {
|
||||
return datasetTableMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@ -111,11 +111,12 @@ export function batchEdit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function post(url, data, showLoading = true) {
|
||||
export function post(url, data, showLoading = true, timeout = 10000) {
|
||||
return request({
|
||||
url: url,
|
||||
method: 'post',
|
||||
loading: showLoading,
|
||||
timeout: timeout,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@ -26,19 +26,19 @@
|
||||
<span>{{ $t('chart.content_formatter') }}</span>
|
||||
<el-tooltip class="item" effect="dark" placement="bottom">
|
||||
<div slot="content">
|
||||
模板变量有 {a}, {b},{c},{d},{e},分别表示系列名,数据名,数据值等。
|
||||
模板变量有 {a}, {b},{c},{d},分别表示系列名,数据名,数据值等。
|
||||
<br>
|
||||
在 trigger 为 'axis' 的时候,会有多个系列的数据,此时可以通过 {a0}, {a1}, {a2} 这种后面加索引的方式表示系列的索引。
|
||||
在 触发位置 为 '坐标轴' 的时候,会有多个系列的数据,此时可以通过 {a0}, {a1}, {a2} 这种后面加索引的方式表示系列的索引。
|
||||
<br>
|
||||
不同图表类型下的 {a},{b},{c},{d} 含义不一样。 其中变量{a}, {b}, {c}, {d}在不同图表类型下代表数据含义为:
|
||||
<br><br>
|
||||
折线(区域)图、柱状(条形)图、K线图 : {a}(系列名称),{b}(类目值),{c}(数值), {d}(无)
|
||||
折线(区域)图、柱状(条形)图、仪表盘 : {a}(系列名称),{b}(类目值),{c}(数值)
|
||||
<br>
|
||||
散点图(气泡)图 : {a}(系列名称),{b}(数据名称),{c}(数值数组), {d}(无)
|
||||
<br>
|
||||
地图 : {a}(系列名称),{b}(区域名称),{c}(合并数值), {d}(无)
|
||||
<br>
|
||||
饼图、仪表板、漏斗图: {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
|
||||
<!-- 散点图(气泡)图 : {a}(系列名称),{b}(数据名称),{c}(数值数组), {d}(无)-->
|
||||
<!-- <br>-->
|
||||
<!-- 地图 : {a}(系列名称),{b}(区域名称),{c}(合并数值), {d}(无)-->
|
||||
<!-- <br>-->
|
||||
饼图、漏斗图: {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
|
||||
</div>
|
||||
<i class="el-icon-info" style="cursor: pointer;" />
|
||||
</el-tooltip>
|
||||
|
||||
@ -535,7 +535,8 @@ export default {
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.treeNode(this.groupForm)
|
||||
// this.treeNode(this.groupForm)
|
||||
this.refreshNodeBy(group.pid)
|
||||
})
|
||||
} else {
|
||||
// this.$message({
|
||||
@ -588,7 +589,8 @@ export default {
|
||||
message: this.$t('chart.delete_success'),
|
||||
showClose: true
|
||||
})
|
||||
this.treeNode(this.groupForm)
|
||||
// this.treeNode(this.groupForm)
|
||||
this.refreshNodeBy(data.pid)
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
@ -889,14 +891,18 @@ export default {
|
||||
|
||||
searchTree(val) {
|
||||
const queryCondition = {
|
||||
withExtend: 'parent',
|
||||
modelType: 'chart',
|
||||
// withExtend: 'parent',
|
||||
// modelType: 'chart',
|
||||
name: val
|
||||
}
|
||||
authModel(queryCondition).then(res => {
|
||||
// this.highlights(res.data)
|
||||
// authModel(queryCondition).then(res => {
|
||||
// // this.highlights(res.data)
|
||||
// this.tData = this.buildTree(res.data)
|
||||
// // console.log(this.tData)
|
||||
// })
|
||||
|
||||
post('/chart/view/search', queryCondition).then(res => {
|
||||
this.tData = this.buildTree(res.data)
|
||||
// console.log(this.tData)
|
||||
})
|
||||
},
|
||||
|
||||
@ -908,8 +914,8 @@ export default {
|
||||
const roots = []
|
||||
arrs.forEach(el => {
|
||||
// 判断根节点 ###
|
||||
el.type = el.modelInnerType
|
||||
el.isLeaf = el.leaf
|
||||
// el.type = el.modelInnerType
|
||||
// el.isLeaf = el.leaf
|
||||
if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') {
|
||||
roots.push(el)
|
||||
return
|
||||
|
||||
@ -72,7 +72,7 @@ export default {
|
||||
if (this.table.id) {
|
||||
this.dataLoading = true
|
||||
this.table.row = 100
|
||||
post('/dataset/table/getPreviewData/1/100', this.table, false).then(response => {
|
||||
post('/dataset/table/getPreviewData/1/100', this.table, false,30000).then(response => {
|
||||
this.fields = response.data.fields
|
||||
this.data = response.data.data
|
||||
const datas = this.data
|
||||
|
||||
@ -134,7 +134,7 @@ export default {
|
||||
initPreviewData(page) {
|
||||
if (this.table.id) {
|
||||
this.table.row = this.tableViewRowForm.row
|
||||
post('/dataset/table/getPreviewData/' + page.page + '/' + page.pageSize, this.table).then(response => {
|
||||
post('/dataset/table/getPreviewData/' + page.page + '/' + page.pageSize, this.table, true, 30000).then(response => {
|
||||
this.fields = response.data.fields
|
||||
this.data = response.data.data
|
||||
this.page = response.data.page
|
||||
|
||||
@ -856,14 +856,18 @@ export default {
|
||||
|
||||
searchTree(val) {
|
||||
const queryCondition = {
|
||||
withExtend: 'parent',
|
||||
modelType: 'dataset',
|
||||
// withExtend: 'parent',
|
||||
// modelType: 'dataset',
|
||||
name: val
|
||||
}
|
||||
authModel(queryCondition).then(res => {
|
||||
// this.highlights(res.data)
|
||||
// authModel(queryCondition).then(res => {
|
||||
// // this.highlights(res.data)
|
||||
// this.tData = this.buildTree(res.data)
|
||||
// // console.log(this.tData)
|
||||
// })
|
||||
|
||||
post('/dataset/table/search', queryCondition).then(res => {
|
||||
this.tData = this.buildTree(res.data)
|
||||
// console.log(this.tData)
|
||||
})
|
||||
},
|
||||
|
||||
@ -875,8 +879,8 @@ export default {
|
||||
const roots = []
|
||||
arrs.forEach(el => {
|
||||
// 判断根节点 ###
|
||||
el.type = el.modelInnerType
|
||||
el.isLeaf = el.leaf
|
||||
// el.type = el.modelInnerType
|
||||
// el.isLeaf = el.leaf
|
||||
if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') {
|
||||
roots.push(el)
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user