feat: 完善数据源基本功能

This commit is contained in:
fit2cloud-chenyw 2021-06-17 19:34:46 +08:00
parent fb0d195aa3
commit 54057d5dab
3 changed files with 25 additions and 15 deletions

View File

@ -1,10 +1,10 @@
<template>
<de-container>
<de-aside-container style="padding: 0 10px;">
<ds-tree @switch-main="switchMain" />
<de-aside-container style="padding: 20px 10px 0;">
<ds-tree ref="dsTree" @switch-main="switchMain" />
</de-aside-container>
<de-main-container>
<component :is="component" v-if="!!component" :params="param" @switch-component="switchMain" />
<component :is="component" v-if="!!component" :params="param" @refresh-left-tree="refreshTree" @switch-component="switchMain" />
</de-main-container>
</de-container>
</template>
@ -38,17 +38,23 @@ export default {
// main
switchMain(param) {
const { component, componentParam } = param
switch (component) {
case 'DsForm':
this.component = DsForm
this.param = componentParam
break
default:
this.component = DataHome
this.param = null
break
}
this.component = DataHome
this.param = null
this.$nextTick(() => {
switch (component) {
case 'DsForm':
this.component = DsForm
this.param = componentParam
break
default:
this.component = DataHome
this.param = null
break
}
})
},
refreshTree() {
this.$refs.dsTree && this.$refs.dsTree.queryTreeDatas()
}
}
}

View File

@ -144,7 +144,7 @@ export default {
}).then(() => {
delDs(datasource.id).then(res => {
this.$success(this.$t('commons.delete_success'))
this.search()
this.queryTreeDatas()
})
}).catch(() => {
this.$message({

View File

@ -124,6 +124,7 @@ export default {
form.configuration = JSON.stringify(form.configuration)
method(form).then(res => {
this.$success(this.$t('commons.save_success'))
this.refreshTree()
this.backToList()
})
} else {
@ -155,6 +156,9 @@ export default {
backToList() {
this.$emit('switch-component', { })
// this.$router.push({ name: 'datasource' })
},
refreshTree() {
this.$emit('refresh-left-tree')
}
}
}