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

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

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