mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
refactor: resource delete
This commit is contained in:
@@ -158,7 +158,7 @@ const afterTreeInit = () => {
|
||||
}
|
||||
|
||||
const copyLoading = ref(false)
|
||||
const emit = defineEmits(['nodeClick'])
|
||||
const emit = defineEmits(['nodeClick', 'deleteCurResource'])
|
||||
|
||||
function createNewObject() {
|
||||
addOperation({ opt: 'newLeaf' })
|
||||
@@ -230,7 +230,8 @@ const operation = (opt: string, data: SQTreeNode) => {
|
||||
dashboardApi.delete_resource({ id: data.id }).then(() => {
|
||||
ElMessage.success(t('dashboard.delete_success'))
|
||||
getTree()
|
||||
dashboardStore.setCurComponent(null)
|
||||
dashboardStore.canvasDataInit()
|
||||
emit('deleteCurResource')
|
||||
})
|
||||
})
|
||||
} else if (opt === 'rename') {
|
||||
|
||||
@@ -48,6 +48,13 @@ const mounted = computed(() => {
|
||||
function createNew() {
|
||||
resourceTreeRef.value?.createNewObject()
|
||||
}
|
||||
|
||||
const stateInit = () => {
|
||||
state.canvasDataPreview = []
|
||||
state.canvasStylePreview = {}
|
||||
state.canvasViewInfoPreview = {}
|
||||
state.dashboardInfo = {}
|
||||
}
|
||||
const loadCanvasData = (params: any) => {
|
||||
dataInitState.value = false
|
||||
load_resource_prepare(
|
||||
@@ -100,6 +107,7 @@ defineExpose({
|
||||
:cur-canvas-type="'dashboard'"
|
||||
:show-position="showPosition"
|
||||
@node-click="resourceNodeClick"
|
||||
@delete-cur-resource="stateInit"
|
||||
/>
|
||||
</el-aside>
|
||||
<el-container
|
||||
|
||||
Reference in New Issue
Block a user