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

feat(数据集): 数据集fix

上级 57c55515
......@@ -81,7 +81,15 @@ public class DataSetTableService {
saveTableField(datasetTable);
}
} 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;
}
......@@ -262,7 +270,7 @@ public class DataSetTableService {
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
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);
List<String[]> data = result.get("dataList");
List<TableFiled> fields = result.get("fieldList");
......
......@@ -88,9 +88,9 @@ export const BASE_BAR = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -117,9 +117,9 @@ export const HORIZONTAL_BAR = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -147,9 +147,9 @@ export const BASE_LINE = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -178,9 +178,9 @@ export const BASE_PIE = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -211,9 +211,9 @@ export const BASE_FUNNEL = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {
trigger: 'item'
},
......@@ -267,9 +267,9 @@ export const BASE_RADAR = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......
......@@ -19,10 +19,10 @@
<el-row>
<el-col style="width: 500px;">
<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-form-item>
<el-form-item>
<el-form-item class="form-item">
<el-upload
:action="baseUrl+'dataset/table/excel/upload'"
:multiple="false"
......@@ -41,7 +41,7 @@
</el-row>
</el-row>
<el-row>
<el-row style="margin-top: 10px;">
<el-card class="box-card dataPreview" shadow="never">
<div slot="header" class="clearfix">
<span>{{ $t('dataset.data_preview') }}</span>
......@@ -100,27 +100,13 @@ export default {
}
},
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() {
// this.initDataSource()
},
activated() {
// this.initDataSource()
window.onresize = () => {
this.calHeight()
}
this.calHeight()
},
methods: {
// initDataSource() {
......@@ -128,6 +114,13 @@ export default {
// 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) {
// console.log(response)
// console.log(file)
......
......@@ -76,6 +76,11 @@
/>
</ux-grid>
</div>
<span class="table-count">
{{ $t('dataset.preview_show') }}
<span class="span-number">1000</span>
{{ $t('dataset.preview_item') }}
</span>
</el-card>
</el-row>
</el-row>
......@@ -155,11 +160,9 @@ export default {
},
mounted() {
window.onresize = () => {
return (() => {
this.height = window.innerHeight / 2
})()
this.calHeight()
}
this.height = window.innerHeight / 2
this.calHeight()
this.initDataSource()
this.$refs.myCm.codemirror.on('keypress', () => {
this.$refs.myCm.codemirror.showHint()
......@@ -168,6 +171,13 @@ export default {
this.initTableInfo()
},
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() {
listDatasource().then(response => {
this.options = response.data
......@@ -303,4 +313,10 @@ export default {
span{
font-size: 14px;
}
.span-number{
color: #f18126;
}
.table-count{
color: #606266;
}
</style>
......@@ -160,7 +160,7 @@ export default {
float: right;
}
span{
font-size: 14px;
font-size: 12px;
}
.span-number{
color: #f18126;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论