fix: 替换excel后,切换tab 刷新字段

This commit is contained in:
taojinlong 2022-04-03 19:34:48 +08:00
parent 6ca6e25a3e
commit ff436ddb88
2 changed files with 69 additions and 41 deletions

View File

@ -284,8 +284,8 @@ public class JdbcProvider extends DatasourceProvider {
String f = metaData.getColumnName(j + 1); String f = metaData.getColumnName(j + 1);
String l = StringUtils.isNotEmpty(metaData.getColumnLabel(j + 1)) ? metaData.getColumnLabel(j + 1) : f; String l = StringUtils.isNotEmpty(metaData.getColumnLabel(j + 1)) ? metaData.getColumnLabel(j + 1) : f;
String t = metaData.getColumnTypeName(j + 1); String t = metaData.getColumnTypeName(j + 1);
if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.hive.name()) && l.contains("\\.")) { if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.hive.name()) && l.contains(".")) {
l = l.split("\\.")[1]; l = l.split(".")[1];
} }
TableField field = new TableField(); TableField field = new TableField();
field.setFieldName(l); field.setFieldName(l);

View File

@ -13,10 +13,12 @@
> >
<dataset-chart-detail type="dataset" :data="table" :tab-status="tabStatus"/> <dataset-chart-detail type="dataset" :data="table" :tab-status="tabStatus"/>
<!-- <svg-icon slot="reference" class="title-text" icon-class="more_v" style="cursor: pointer;" />--> <!-- <svg-icon slot="reference" class="title-text" icon-class="more_v" style="cursor: pointer;" />-->
<i slot="reference" class="el-icon-warning icon-class" style="margin-left: 4px;cursor: pointer;font-size: 14px;" /> <i slot="reference" class="el-icon-warning icon-class"
style="margin-left: 4px;cursor: pointer;font-size: 14px;"/>
</el-popover> </el-popover>
<el-row v-if="hasDataPermission('manage',param.privileges)" style="float: right"> <el-row v-if="hasDataPermission('manage',param.privileges)" style="float: right">
<el-dropdown v-if="table.type ==='excel'" style="margin-right: 10px;" size="small" trigger="click" @command="clickEditExcel"> <el-dropdown v-if="table.type ==='excel'" style="margin-right: 10px;" size="small" trigger="click"
@command="clickEditExcel">
<el-button size="mini"> <el-button size="mini">
{{ $t('dataset.edit_excel') }} {{ $t('dataset.edit_excel') }}
</el-button> </el-button>
@ -44,22 +46,31 @@
<el-tabs v-model="tabActive" @tab-click="tabClick"> <el-tabs v-model="tabActive" @tab-click="tabClick">
<el-tab-pane :label="$t('dataset.data_preview')" name="dataPreview"> <el-tab-pane :label="$t('dataset.data_preview')" name="dataPreview">
<tab-data-preview :param="param" :table="table" :fields="fields" :data="data" :page="page" :form="tableViewRowForm" @reSearch="reSearch" /> <tab-data-preview :param="param" :table="table" :fields="fields" :data="data" :page="page"
:form="tableViewRowForm" @reSearch="reSearch"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('dataset.field_manage')" name="fieldEdit"> <el-tab-pane :label="$t('dataset.field_manage')" :lazy="true" name="fieldEdit">
<field-edit :param="param" :table="table" /> <field-edit v-if="tabActive === 'fieldEdit'" :param="param" :table="table"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="!hideCustomDs && table.type !== 'union' && table.type !== 'custom' && !(table.type === 'sql' && table.mode === 0)" :label="$t('dataset.join_view')" name="joinView"> <el-tab-pane
v-if="!hideCustomDs && table.type !== 'union' && table.type !== 'custom' && !(table.type === 'sql' && table.mode === 0)"
:label="$t('dataset.join_view')" name="joinView">
<union-view :param="param" :table="table"/> <union-view :param="param" :table="table"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="table.mode === 1 && (table.type === 'excel' || table.type === 'db' || table.type === 'sql' || table.type === 'api')" :label="$t('dataset.update_info')" name="updateInfo"> <el-tab-pane
v-if="table.mode === 1 && (table.type === 'excel' || table.type === 'db' || table.type === 'sql' || table.type === 'api')"
:label="$t('dataset.update_info')" name="updateInfo">
<update-info v-if="tabActive=='updateInfo'" :param="param" :table="table"/> <update-info v-if="tabActive=='updateInfo'" :param="param" :table="table"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="isPluginLoaded && hasDataPermission('manage',param.privileges)" :lazy="true" :label="$t('dataset.row_permissions')" name="rowPermissions"> <el-tab-pane v-if="isPluginLoaded && hasDataPermission('manage',param.privileges)" :lazy="true"
<plugin-com v-if="isPluginLoaded && tabActive=='rowPermissions'" ref="RowPermissions" component-name="RowPermissions" :obj="table" /> :label="$t('dataset.row_permissions')" name="rowPermissions">
<plugin-com v-if="isPluginLoaded && tabActive=='rowPermissions'" ref="RowPermissions"
component-name="RowPermissions" :obj="table"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="isPluginLoaded && hasDataPermission('manage',param.privileges)" :lazy="true" :label="$t('dataset.column_permissions')" name="columnPermissions"> <el-tab-pane v-if="isPluginLoaded && hasDataPermission('manage',param.privileges)" :lazy="true"
<plugin-com v-if="isPluginLoaded && tabActive=='columnPermissions'" ref="ColumnPermissions" component-name="ColumnPermissions" :obj="table" /> :label="$t('dataset.column_permissions')" name="columnPermissions">
<plugin-com v-if="isPluginLoaded && tabActive=='columnPermissions'" ref="ColumnPermissions"
component-name="ColumnPermissions" :obj="table"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-row> </el-row>
@ -172,13 +183,22 @@ export default {
}, },
editSql() { editSql() {
this.$emit('switchComponent', { name: 'AddSQL', param: { id: this.table.sceneId, tableId: this.table.id, table: this.table }}) this.$emit('switchComponent', {
name: 'AddSQL',
param: {id: this.table.sceneId, tableId: this.table.id, table: this.table}
})
}, },
editCustom() { editCustom() {
this.$emit('switchComponent', { name: 'AddCustom', param: { id: this.table.sceneId, tableId: this.table.id, table: this.table }}) this.$emit('switchComponent', {
name: 'AddCustom',
param: {id: this.table.sceneId, tableId: this.table.id, table: this.table}
})
}, },
editUnion() { editUnion() {
this.$emit('switchComponent', { name: 'AddUnion', param: { id: this.table.sceneId, tableId: this.table.id, table: this.table }}) this.$emit('switchComponent', {
name: 'AddUnion',
param: {id: this.table.sceneId, tableId: this.table.id, table: this.table}
})
}, },
reSearch(val) { reSearch(val) {
@ -197,10 +217,16 @@ export default {
// console.log(param); // console.log(param);
switch (param.type) { switch (param.type) {
case '0': case '0':
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 0, table: this.table }}) this.$emit('switchComponent', {
name: 'AddExcel',
param: {id: this.table.sceneId, tableId: this.table.id, editType: 0, table: this.table}
})
break break
case '1': case '1':
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 1, table: this.table }}) this.$emit('switchComponent', {
name: 'AddExcel',
param: {id: this.table.sceneId, tableId: this.table.id, editType: 1, table: this.table}
})
break break
} }
}, },
@ -240,9 +266,11 @@ export default {
.form-item { .form-item {
margin-bottom: 6px; margin-bottom: 6px;
} }
.icon-class { .icon-class {
color: #6c6c6c; color: #6c6c6c;
} }
.blackTheme .icon-class { .blackTheme .icon-class {
color: #cccccc; color: #cccccc;
} }