Unverified 提交 55acb8a5 authored 作者: XiaJunjie2020's avatar XiaJunjie2020 提交者: GitHub

Merge pull request #1150 from dataease/pr@dev@feat_dataset_table_field_sync

feat(数据集):数据集字段管理页面,增加同步字段功能
...@@ -1080,7 +1080,7 @@ public class DataSetTableService { ...@@ -1080,7 +1080,7 @@ public class DataSetTableService {
} }
// delete 数据库中多余的字段 // delete 数据库中多余的字段
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample(); DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
datasetTableFieldExample.createCriteria().andTableIdEqualTo(datasetTable.getId()).andOriginNameNotIn(originNameList); datasetTableFieldExample.createCriteria().andTableIdEqualTo(datasetTable.getId()).andExtFieldEqualTo(0).andOriginNameNotIn(originNameList);
datasetTableFieldMapper.deleteByExample(datasetTableFieldExample); datasetTableFieldMapper.deleteByExample(datasetTableFieldExample);
} }
} }
......
...@@ -1144,7 +1144,10 @@ export default { ...@@ -1144,7 +1144,10 @@ export default {
field_name_less_50: 'Field name can not more 50 chars.', field_name_less_50: 'Field name can not more 50 chars.',
excel_info_1: '1、Merged cells cannot exist in the file;', excel_info_1: '1、Merged cells cannot exist in the file;',
excel_info_2: '2、The first line of the file is the title line, which cannot be empty or date;', excel_info_2: '2、The first line of the file is the title line, which cannot be empty or date;',
excel_info_3: '3、The file size shall not exceed 500m。' excel_info_3: '3、The file size shall not exceed 500m。',
sync_field: 'Sync Field',
confirm_sync_field: 'Confirm Sync',
confirm_sync_field_tips: 'Sync field maybe change edit field,please confirm'
}, },
datasource: { datasource: {
datasource: 'Data Source', datasource: 'Data Source',
......
...@@ -1145,7 +1145,10 @@ export default { ...@@ -1145,7 +1145,10 @@ export default {
field_name_less_50: '字段名不能超過50個字符', field_name_less_50: '字段名不能超過50個字符',
excel_info_1: '1、文件終不能存在合併單元格;', excel_info_1: '1、文件終不能存在合併單元格;',
excel_info_2: '2、文件的第一行為標題行,不能為空,不能為日期;', excel_info_2: '2、文件的第一行為標題行,不能為空,不能為日期;',
excel_info_3: '3、文件不超過500M。' excel_info_3: '3、文件不超過500M。',
sync_field: '同步字段',
confirm_sync_field: '確認同步',
confirm_sync_field_tips: '同步字段可能會導致已編輯字段發生變更,請確認'
}, },
datasource: { datasource: {
datasource: '數據源', datasource: '數據源',
......
...@@ -1148,7 +1148,10 @@ export default { ...@@ -1148,7 +1148,10 @@ export default {
field_name_less_50: '字段名不能超过50个字符', field_name_less_50: '字段名不能超过50个字符',
excel_info_1: '1、文件中不能存在合并单元格;', excel_info_1: '1、文件中不能存在合并单元格;',
excel_info_2: '2、文件的第一行为标题行,不能为空,不能为日期型;', excel_info_2: '2、文件的第一行为标题行,不能为空,不能为日期型;',
excel_info_3: '3、Excel文件大小请确保在500M以内。' excel_info_3: '3、Excel文件大小请确保在500M以内。',
sync_field: '同步字段',
confirm_sync_field: '确认同步',
confirm_sync_field_tips: '同步字段可能会导致已编辑字段发生变更,请确认'
}, },
datasource: { datasource: {
datasource: '数据源', datasource: '数据源',
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<el-form :inline="true"> <el-form :inline="true">
<el-form-item class="form-item"> <el-form-item class="form-item">
<el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="addCalcField">{{ $t('dataset.add_calc_field') }}</el-button> <el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="addCalcField">{{ $t('dataset.add_calc_field') }}</el-button>
<el-button v-if="hasDataPermission('manage',param.privileges) && table.type !== 'excel' && table.type !== 'custom'" size="mini" :loading="isSyncField" @click="syncField">{{ $t('dataset.sync_field') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item class="form-item" style="float: right;margin-right: 0;"> <el-form-item class="form-item" style="float: right;margin-right: 0;">
<el-input <el-input
...@@ -266,6 +267,10 @@ export default { ...@@ -266,6 +267,10 @@ export default {
param: { param: {
type: Object, type: Object,
required: true required: true
},
table: {
type: Object,
required: true
} }
}, },
data() { data() {
...@@ -287,7 +292,8 @@ export default { ...@@ -287,7 +292,8 @@ export default {
fieldActiveNames: ['d', 'q'], fieldActiveNames: ['d', 'q'],
searchField: '', searchField: '',
editCalcField: false, editCalcField: false,
currEditField: {} currEditField: {},
isSyncField: false
} }
}, },
watch: { watch: {
...@@ -388,6 +394,23 @@ export default { ...@@ -388,6 +394,23 @@ export default {
}) })
}).catch(() => { }).catch(() => {
}) })
},
syncField() {
this.$confirm(this.$t('dataset.confirm_sync_field_tips'), this.$t('dataset.confirm_sync_field'), {
confirmButtonText: this.$t('chart.confirm'),
cancelButtonText: this.$t('chart.cancel'),
type: 'warning'
}).then(() => {
this.isSyncField = true
post('/dataset/table/syncField/' + this.param.id, null).then(response => {
setTimeout(() => {
this.isSyncField = false
this.initField()
}, 500)
})
}).catch(() => {
})
} }
} }
} }
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<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')" name="fieldEdit">
<field-edit :param="param" /> <field-edit :param="param" :table="table" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="table.type !== 'custom' && !(table.type === 'sql' && table.mode === 0)" :label="$t('dataset.join_view')" name="joinView"> <el-tab-pane v-if="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" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论