提交 3526d39e authored 作者: junjie's avatar junjie

feat(数据集): 数据集fix

上级 57c55515
...@@ -81,7 +81,15 @@ public class DataSetTableService { ...@@ -81,7 +81,15 @@ public class DataSetTableService {
saveTableField(datasetTable); saveTableField(datasetTable);
} }
} else { } else {
datasetTableMapper.updateByPrimaryKeySelective(datasetTable); int update = datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
// sql 更新
if (update == 1) {
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
// 删除所有字段,重新抽象
dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
saveTableField(datasetTable);
}
}
} }
return datasetTable; return datasetTable;
} }
...@@ -262,7 +270,7 @@ public class DataSetTableService { ...@@ -262,7 +270,7 @@ public class DataSetTableService {
DatasourceRequest datasourceRequest = new DatasourceRequest(); DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds); datasourceRequest.setDatasource(ds);
String sql = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class).getSql(); String sql = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class).getSql();
datasourceRequest.setQuery(sql); datasourceRequest.setQuery("SELECT * FROM (" + sql + ") AS tmp LIMIT 0,1000");
Map<String, List> result = datasourceProvider.fetchResultAndField(datasourceRequest); Map<String, List> result = datasourceProvider.fetchResultAndField(datasourceRequest);
List<String[]> data = result.get("dataList"); List<String[]> data = result.get("dataList");
List<TableFiled> fields = result.get("fieldList"); List<TableFiled> fields = result.get("fieldList");
......
...@@ -88,9 +88,9 @@ export const BASE_BAR = { ...@@ -88,9 +88,9 @@ export const BASE_BAR = {
title: { title: {
text: '' text: ''
}, },
grid: { // grid: {
containLabel: true // containLabel: true
}, // },
tooltip: {}, tooltip: {},
legend: { legend: {
show: true, show: true,
...@@ -117,9 +117,9 @@ export const HORIZONTAL_BAR = { ...@@ -117,9 +117,9 @@ export const HORIZONTAL_BAR = {
title: { title: {
text: '' text: ''
}, },
grid: { // grid: {
containLabel: true // containLabel: true
}, // },
tooltip: {}, tooltip: {},
legend: { legend: {
show: true, show: true,
...@@ -147,9 +147,9 @@ export const BASE_LINE = { ...@@ -147,9 +147,9 @@ export const BASE_LINE = {
title: { title: {
text: '' text: ''
}, },
grid: { // grid: {
containLabel: true // containLabel: true
}, // },
tooltip: {}, tooltip: {},
legend: { legend: {
show: true, show: true,
...@@ -178,9 +178,9 @@ export const BASE_PIE = { ...@@ -178,9 +178,9 @@ export const BASE_PIE = {
title: { title: {
text: '' text: ''
}, },
grid: { // grid: {
containLabel: true // containLabel: true
}, // },
tooltip: {}, tooltip: {},
legend: { legend: {
show: true, show: true,
...@@ -211,9 +211,9 @@ export const BASE_FUNNEL = { ...@@ -211,9 +211,9 @@ export const BASE_FUNNEL = {
title: { title: {
text: '' text: ''
}, },
grid: { // grid: {
containLabel: true // containLabel: true
}, // },
tooltip: { tooltip: {
trigger: 'item' trigger: 'item'
}, },
...@@ -267,9 +267,9 @@ export const BASE_RADAR = { ...@@ -267,9 +267,9 @@ export const BASE_RADAR = {
title: { title: {
text: '' text: ''
}, },
grid: { // grid: {
containLabel: true // containLabel: true
}, // },
tooltip: {}, tooltip: {},
legend: { legend: {
show: true, show: true,
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
<el-row> <el-row>
<el-col style="width: 500px;"> <el-col style="width: 500px;">
<el-form :inline="true" size="mini" class="row-style"> <el-form :inline="true" size="mini" class="row-style">
<el-form-item> <el-form-item class="form-item">
<el-input v-model="name" :placeholder="$t('commons.name')" /> <el-input v-model="name" :placeholder="$t('commons.name')" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item class="form-item">
<el-upload <el-upload
:action="baseUrl+'dataset/table/excel/upload'" :action="baseUrl+'dataset/table/excel/upload'"
:multiple="false" :multiple="false"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</el-row> </el-row>
</el-row> </el-row>
<el-row> <el-row style="margin-top: 10px;">
<el-card class="box-card dataPreview" shadow="never"> <el-card class="box-card dataPreview" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ $t('dataset.data_preview') }}</span> <span>{{ $t('dataset.data_preview') }}</span>
...@@ -100,27 +100,13 @@ export default { ...@@ -100,27 +100,13 @@ export default {
} }
}, },
watch: { watch: {
// dataSource(val) {
// if (val) {
// post('/datasource/getTables', { id: val }).then(response => {
// this.tables = response.data
// this.tableData = JSON.parse(JSON.stringify(this.tables))
// })
// }
// },
// searchTable(val) {
// if (val && val !== '') {
// this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.includes(val) })))
// } else {
// this.tableData = JSON.parse(JSON.stringify(this.tables))
// }
// }
}, },
mounted() { mounted() {
// this.initDataSource() // this.initDataSource()
}, window.onresize = () => {
activated() { this.calHeight()
// this.initDataSource() }
this.calHeight()
}, },
methods: { methods: {
// initDataSource() { // initDataSource() {
...@@ -128,6 +114,13 @@ export default { ...@@ -128,6 +114,13 @@ export default {
// this.options = response.data // this.options = response.data
// }) // })
// }, // },
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10
}, 10)
},
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
// console.log(response) // console.log(response)
// console.log(file) // console.log(file)
......
...@@ -76,6 +76,11 @@ ...@@ -76,6 +76,11 @@
/> />
</ux-grid> </ux-grid>
</div> </div>
<span class="table-count">
{{ $t('dataset.preview_show') }}
<span class="span-number">1000</span>
{{ $t('dataset.preview_item') }}
</span>
</el-card> </el-card>
</el-row> </el-row>
</el-row> </el-row>
...@@ -155,11 +160,9 @@ export default { ...@@ -155,11 +160,9 @@ export default {
}, },
mounted() { mounted() {
window.onresize = () => { window.onresize = () => {
return (() => { this.calHeight()
this.height = window.innerHeight / 2
})()
} }
this.height = window.innerHeight / 2 this.calHeight()
this.initDataSource() this.initDataSource()
this.$refs.myCm.codemirror.on('keypress', () => { this.$refs.myCm.codemirror.on('keypress', () => {
this.$refs.myCm.codemirror.showHint() this.$refs.myCm.codemirror.showHint()
...@@ -168,6 +171,13 @@ export default { ...@@ -168,6 +171,13 @@ export default {
this.initTableInfo() this.initTableInfo()
}, },
methods: { methods: {
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 43 - 160 - 10 - 37 - 20 - 10 - 16
}, 10)
},
initDataSource() { initDataSource() {
listDatasource().then(response => { listDatasource().then(response => {
this.options = response.data this.options = response.data
...@@ -303,4 +313,10 @@ export default { ...@@ -303,4 +313,10 @@ export default {
span{ span{
font-size: 14px; font-size: 14px;
} }
.span-number{
color: #f18126;
}
.table-count{
color: #606266;
}
</style> </style>
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
float: right; float: right;
} }
span{ span{
font-size: 14px; font-size: 12px;
} }
.span-number{ .span-number{
color: #f18126; color: #f18126;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论