提交 8c50976d authored 作者: junjie's avatar junjie

feat(视图): 视图编辑保存,横纵维度指标,EChart展示

上级 b6117d65
package io.dataease.controller.chart; package io.dataease.controller.chart;
import io.dataease.base.domain.ChartGroup; import io.dataease.base.domain.ChartGroup;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.controller.request.chart.ChartGroupRequest; import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.dto.chart.ChartGroupDTO; import io.dataease.dto.chart.ChartGroupDTO;
import io.dataease.service.chart.ChartGroupService; import io.dataease.service.chart.ChartGroupService;
...@@ -29,4 +30,9 @@ public class ChartGroupController { ...@@ -29,4 +30,9 @@ public class ChartGroupController {
public void tree(@PathVariable String id) { public void tree(@PathVariable String id) {
chartGroupService.delete(id); chartGroupService.delete(id);
} }
@PostMapping("/getScene/{id}")
public ChartGroup getScene(@PathVariable String id) {
return chartGroupService.getScene(id);
}
} }
...@@ -33,4 +33,9 @@ public class DataSetGroupController { ...@@ -33,4 +33,9 @@ public class DataSetGroupController {
public void tree(@PathVariable String id) { public void tree(@PathVariable String id) {
dataSetGroupService.delete(id); dataSetGroupService.delete(id);
} }
@PostMapping("/getScene/{id}")
public DatasetGroup getScene(@PathVariable String id) {
return dataSetGroupService.getScene(id);
}
} }
...@@ -47,6 +47,10 @@ public class ChartGroupService { ...@@ -47,6 +47,10 @@ public class ChartGroupService {
chartGroupMapper.deleteByExample(ChartGroupExample); chartGroupMapper.deleteByExample(ChartGroupExample);
} }
public ChartGroup getScene(String id) {
return chartGroupMapper.selectByPrimaryKey(id);
}
public List<ChartGroupDTO> tree(ChartGroupRequest ChartGroup) { public List<ChartGroupDTO> tree(ChartGroupRequest ChartGroup) {
ChartGroupExample ChartGroupExample = new ChartGroupExample(); ChartGroupExample ChartGroupExample = new ChartGroupExample();
ChartGroupExample.Criteria criteria = ChartGroupExample.createCriteria(); ChartGroupExample.Criteria criteria = ChartGroupExample.createCriteria();
......
...@@ -58,6 +58,10 @@ public class DataSetGroupService { ...@@ -58,6 +58,10 @@ public class DataSetGroupService {
}).map(DatasetGroup::getId).collect(Collectors.toList())); }).map(DatasetGroup::getId).collect(Collectors.toList()));
} }
public DatasetGroup getScene(String id) {
return datasetGroupMapper.selectByPrimaryKey(id);
}
public void deleteTableAndField(List<String> sceneIds) { public void deleteTableAndField(List<String> sceneIds) {
for (String sceneId : sceneIds) { for (String sceneId : sceneIds) {
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest(); DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
......
...@@ -216,7 +216,7 @@ export default { ...@@ -216,7 +216,7 @@ export default {
editTable: false, editTable: false,
data: [], data: [],
chartData: [], chartData: [],
currGroup: null, currGroup: {},
expandedArray: [], expandedArray: [],
groupForm: { groupForm: {
name: '', name: '',
...@@ -252,10 +252,7 @@ export default { ...@@ -252,10 +252,7 @@ export default {
}, },
mounted() { mounted() {
this.groupTree(this.groupForm); this.groupTree(this.groupForm);
this.chartTree(); this.refresh();
},
activated() {
this.groupTree(this.groupForm);
this.chartTree(); this.chartTree();
}, },
watch: {}, watch: {},
...@@ -430,7 +427,7 @@ export default { ...@@ -430,7 +427,7 @@ export default {
chartTree() { chartTree() {
this.chartData = []; this.chartData = [];
if (this.currGroup) { if (this.currGroup.id) {
this.$post('/chart/view/list', { this.$post('/chart/view/list', {
sort: 'create_time desc,name asc', sort: 'create_time desc,name asc',
sceneId: this.currGroup.id sceneId: this.currGroup.id
...@@ -505,6 +502,17 @@ export default { ...@@ -505,6 +502,17 @@ export default {
getTable(table) { getTable(table) {
this.table = table; this.table = table;
},
refresh() {
let path = this.$route.path;
if (path === '/chart/chart-edit') {
this.sceneMode = true;
let sceneId = this.$store.state.chart.sceneId;
this.$post('/chart/group/getScene/' + sceneId, null, response => {
this.currGroup = response.data;
})
}
} }
}, },
} }
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<div style="border-bottom: 1px solid #E6E6E6;overflow-y:hidden;" class="padding-lr"> <div style="border-bottom: 1px solid #E6E6E6;overflow-y:hidden;" class="padding-lr">
<el-row> <el-row>
<span>{{$t('chart.title')}}</span> <span>{{$t('chart.title')}}</span>
<el-checkbox v-model="view.show" style="float: right;">{{$t('chart.show')}}</el-checkbox> <!-- <el-checkbox v-model="view.show" style="float: right;">{{$t('chart.show')}}</el-checkbox>-->
</el-row> </el-row>
<el-form> <el-form>
<el-form-item class="form-item"> <el-form-item class="form-item">
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
<draggable v-model="view.xaxis" @end="end3" group="itxst" <draggable v-model="view.xaxis" @end="end3" group="itxst"
animation="300" animation="300"
:move="onMove" :move="onMove"
style="width:100%;margin:0 10px;border-radius: 4px;border: 1px solid #DCDFE6;"> style="width:100%;height: 100%;margin:0 10px;border-radius: 4px;border: 1px solid #DCDFE6;">
<transition-group> <transition-group style="width: 100%;height: 100%;">
<el-tag size="mini" class="item" v-for="(item,index) in view.xaxis" :key="index" closable <el-tag size="small" class="item" v-for="(item,index) in view.xaxis" :key="index" closable
@close="clear1(index)"> @close="clear1(index)">
{{item.name}} {{item.name}}
</el-tag> </el-tag>
...@@ -105,9 +105,9 @@ ...@@ -105,9 +105,9 @@
<draggable v-model="view.yaxis" @end="end4" group="itxst" <draggable v-model="view.yaxis" @end="end4" group="itxst"
animation="300" animation="300"
:move="onMove" :move="onMove"
style="width:100%;margin:0 10px;border-radius: 4px;border: 1px solid #DCDFE6;"> style="width:100%;height: 100%;margin:0 10px;border-radius: 4px;border: 1px solid #DCDFE6;">
<transition-group> <transition-group style="width:100%;height: 100%;">
<el-tag size="mini" class="item" v-for="(item,index) in view.yaxis" :key="index" closable <el-tag size="small" class="item" v-for="(item,index) in view.yaxis" :key="index" closable
@close="clear2(index)"> @close="clear2(index)">
{{item.name}} {{item.name}}
</el-tag> </el-tag>
...@@ -172,16 +172,16 @@ export default { ...@@ -172,16 +172,16 @@ export default {
}, },
computed: { computed: {
tableId() { tableId() {
console.log(this.$store.state.chart.tableId); // console.log(this.$store.state.chart.tableId);
this.initTableData(this.$store.state.chart.tableId); this.initTableData(this.$store.state.chart.tableId);
return this.$store.state.chart.tableId; return this.$store.state.chart.tableId;
}, },
sceneId() { sceneId() {
console.log(this.$store.state.chart.sceneId); // console.log(this.$store.state.chart.sceneId);
return this.$store.state.chart.sceneId; return this.$store.state.chart.sceneId;
}, },
vId() { vId() {
console.log(this.$store.state.chart.viewId); // console.log(this.$store.state.chart.viewId);
this.getData(this.$store.state.chart.viewId); this.getData(this.$store.state.chart.viewId);
return this.$store.state.chart.viewId; return this.$store.state.chart.viewId;
}, },
......
...@@ -231,7 +231,7 @@ export default { ...@@ -231,7 +231,7 @@ export default {
editTable: false, editTable: false,
data: [], data: [],
tableData: [], tableData: [],
currGroup: null, currGroup: {},
expandedArray: [], expandedArray: [],
groupForm: { groupForm: {
name: '', name: '',
...@@ -266,15 +266,9 @@ export default { ...@@ -266,15 +266,9 @@ export default {
}, },
mounted() { mounted() {
this.tree(this.groupForm); this.tree(this.groupForm);
this.refresh();
this.tableTree(); this.tableTree();
this.$router.push('/dataset'); // this.$router.push('/dataset');
this.$store.commit('setTable', null);
},
activated() {
this.tree(this.groupForm);
this.tableTree();
this.$router.push('/dataset');
this.$store.commit('setTable', null);
}, },
watch: { watch: {
// search(val){ // search(val){
...@@ -457,7 +451,7 @@ export default { ...@@ -457,7 +451,7 @@ export default {
tableTree() { tableTree() {
this.tableData = []; this.tableData = [];
if (this.currGroup) { if (this.currGroup.id) {
this.$post('/dataset/table/list', { this.$post('/dataset/table/list', {
sort: 'type asc,create_time desc,name asc', sort: 'type asc,create_time desc,name asc',
sceneId: this.currGroup.id sceneId: this.currGroup.id
...@@ -473,6 +467,7 @@ export default { ...@@ -473,6 +467,7 @@ export default {
if (data.type === 'scene') { if (data.type === 'scene') {
this.sceneMode = true; this.sceneMode = true;
this.currGroup = data; this.currGroup = data;
this.$store.commit("setSceneData", this.currGroup.id);
} }
if (node.expanded) { if (node.expanded) {
this.expandedArray.push(data.id); this.expandedArray.push(data.id);
...@@ -535,6 +530,16 @@ export default { ...@@ -535,6 +530,16 @@ export default {
}); });
}, },
refresh() {
let path = this.$route.path;
if (path === '/dataset/table') {
this.sceneMode = true;
let sceneId = this.$store.state.dataset.sceneData;
this.$post('/dataset/group/getScene/' + sceneId, null, response => {
this.currGroup = response.data;
})
}
}
}, },
} }
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论