提交 602e3750 authored 作者: junjie's avatar junjie

feat(frontend):编辑自助数据集

上级 dae257be
......@@ -815,7 +815,9 @@ export default {
invalid_dataset: 'Kettle未运行,无效数据集',
check_all: '全选',
can_not_union_self: '被关联表不能与关联表相同',
float: '小数'
float: '小数',
edit_custom_table: '编辑自助数据集',
edit_field: '编辑字段'
},
datasource: {
datasource: '数据源',
......
......@@ -2,7 +2,7 @@
<el-col>
<el-row style="height: 26px;">
<span style="line-height: 26px;">
{{ $t('dataset.add_custom_table') }}
{{ param.tableId?$t('dataset.edit_custom_table'):$t('dataset.add_custom_table') }}
</span>
<el-row style="float: right">
<el-button size="mini" @click="cancel">
......@@ -62,7 +62,7 @@
</template>
<script>
import { post } from '@/api/dataset/dataset'
import { post, getTable } from '@/api/dataset/dataset'
import DatasetGroupSelector from '../common/DatasetGroupSelector'
import DatasetCustomField from '../common/DatasetCustomField'
......@@ -89,15 +89,7 @@ export default {
watch: {
'checkedList': function() {
// console.log(this.checkedList)
if (this.checkedList && this.checkedList.length > 0) {
// 根据第一个选择的数据集找到关联视图
post('dataset/union/listByTableId/' + this.checkedList[0].tableId, {}).then(response => {
// console.log(response)
this.unionData = response.data
})
} else {
this.unionData = []
}
this.getUnionData()
}
},
mounted() {
......@@ -105,6 +97,11 @@ export default {
this.calHeight()
}
this.calHeight()
if (this.param && this.param.id && this.param.tableId) {
this.getCustomTable()
this.getUnionData()
}
},
methods: {
calHeight() {
......@@ -144,6 +141,9 @@ export default {
}
}
// console.log(this.checkedList)
this.getData()
},
getData() {
// request to get data
if (this.checkedList.length > 0) {
const table = {
......@@ -169,6 +169,17 @@ export default {
this.$refs.plxTable.reloadData(datas)
}
},
getUnionData() {
if (this.checkedList && this.checkedList.length > 0) {
// 根据第一个选择的数据集找到关联视图
post('dataset/union/listByTableId/' + this.checkedList[0].tableId, {}).then(response => {
// console.log(response)
this.unionData = response.data
})
} else {
this.unionData = []
}
},
save() {
const table = {
id: this.param.tableId,
......@@ -185,6 +196,22 @@ export default {
})
},
getCustomTable() {
getTable(this.param.tableId).then(response => {
const table = response.data
this.name = table.name
this.checkedList = JSON.parse(table.info).list
this.getCheckTable(this.checkedList[0].tableId)
this.getData()
})
},
getCheckTable(tableId) {
getTable(tableId).then(response => {
this.table = response.data
})
},
cancel() {
this.dataReset()
this.$emit('switchComponent', { name: '' })
......
......@@ -28,7 +28,7 @@
:multiple="false"
:show-file-list="false"
:file-list="fileList"
accept=".xls,.xlsx,.csv"
accept=".xls,.xlsx,"
:before-upload="beforeUpload"
:on-success="uploadSuccess"
:on-error="uploadFail"
......
......@@ -14,11 +14,14 @@
</span>
</el-popover>
<el-row style="float: right">
<el-button v-if="table.type ==='custom'" size="mini" @click="editCustom">
{{ $t('dataset.edit_custom_table') }}
</el-button>
<el-button v-if="table.type ==='sql'" size="mini" @click="editSql">
{{ $t('dataset.edit_sql') }}
</el-button>
<el-button size="mini" @click="edit">
{{ $t('dataset.edit') }}
{{ $t('dataset.edit_field') }}
</el-button>
<!-- <el-button size="mini" type="primary" @click="createChart">-->
<!-- {{$t('dataset.create_view')}}-->
......@@ -116,6 +119,9 @@ export default {
editSql() {
this.$emit('switchComponent', { name: 'AddSQL', param: { id: this.table.sceneId, tableId: this.table.id }})
},
editCustom() {
this.$emit('switchComponent', { name: 'AddCustom', param: { id: this.table.sceneId, tableId: this.table.id }})
},
reSearch(val) {
this.tableViewRowForm = val.form
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论