feat(数据集): 数据集fix

This commit is contained in:
junjie 2021-04-29 12:12:12 +08:00
parent 57c5551549
commit 3526d39e01
5 changed files with 63 additions and 46 deletions

View File

@ -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");

View File

@ -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,

View File

@ -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)

View 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>

View File

@ -160,7 +160,7 @@ export default {
float: right;
}
span{
font-size: 14px;
font-size: 12px;
}
.span-number{
color: #f18126;