forked from github/dataease
feat(视图):视图保留实时计算与渲染功能,但不实时保存,提供保存与重置按钮
This commit is contained in:
parent
ca2fe2bf02
commit
fb533cde83
@ -105,6 +105,6 @@ public class ChartViewController {
|
||||
@ApiOperation("计算结果")
|
||||
@PostMapping("/calcData")
|
||||
public ChartViewDTO calcData(@RequestBody ChartCalRequest request) throws Exception {
|
||||
return chartViewService.calcData(request.getView(), request.getRequestList(), true);
|
||||
return chartViewService.calcData(request.getView(), request.getRequestList(), false);
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +75,14 @@ public class ChartViewService {
|
||||
chartView.setUpdateTime(timestamp);
|
||||
chartViewMapper.insertSelective(chartView);
|
||||
}
|
||||
// Optional.ofNullable(chartView.getId()).ifPresent(id -> {
|
||||
// CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
|
||||
// });
|
||||
Optional.ofNullable(chartView.getId()).ifPresent(id -> {
|
||||
CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
|
||||
});
|
||||
try {
|
||||
calcData(chartView, new ChartExtRequest(), true);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return getOneWithPermission(chartView.getId());
|
||||
}
|
||||
|
||||
@ -179,15 +184,10 @@ public class ChartViewService {
|
||||
|
||||
public ChartViewDTO getData(String id, ChartExtRequest requestList) throws Exception {
|
||||
ChartViewWithBLOBs view = chartViewMapper.selectByPrimaryKey(id);
|
||||
return calcData(view, requestList, false);
|
||||
return calcData(view, requestList, true);
|
||||
}
|
||||
|
||||
public ChartViewDTO calcData(ChartViewWithBLOBs view, ChartExtRequest requestList, boolean clearCache) throws Exception {
|
||||
if (clearCache) {
|
||||
Optional.ofNullable(view.getId()).ifPresent(id -> {
|
||||
CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
|
||||
});
|
||||
}
|
||||
public ChartViewDTO calcData(ChartViewWithBLOBs view, ChartExtRequest requestList, boolean cache) throws Exception {
|
||||
if (ObjectUtils.isEmpty(view)) {
|
||||
throw new RuntimeException(Translator.get("i18n_chart_delete"));
|
||||
}
|
||||
@ -427,7 +427,7 @@ public class ChartViewService {
|
||||
data = (List<String[]>) cache;
|
||||
}*/
|
||||
// 仪表板有参数不实用缓存
|
||||
if (CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
if (!cache || CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getLinkageFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getDrill())) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
|
@ -1094,8 +1094,15 @@ export default {
|
||||
this.hasEdit = true
|
||||
// 将视图传入echart...组件
|
||||
const view = JSON.parse(JSON.stringify(this.view))
|
||||
view.xaxis = JSON.stringify(this.view.xaxis)
|
||||
view.yaxis = JSON.stringify(this.view.yaxis)
|
||||
view.yaxisExt = JSON.stringify(this.view.yaxisExt)
|
||||
view.extStack = JSON.stringify(this.view.extStack)
|
||||
view.drillFields = JSON.stringify(this.view.drillFields)
|
||||
view.extBubble = JSON.stringify(this.view.extBubble)
|
||||
view.customAttr = JSON.stringify(this.view.customAttr)
|
||||
view.customStyle = JSON.stringify(this.view.customStyle)
|
||||
view.customFilter = JSON.stringify(this.view.customFilter)
|
||||
view.data = JSON.parse(JSON.stringify(this.data))
|
||||
this.chart = view
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user