forked from github/dataease
feat(仪表板): 复制仪表板和数据大屏操作时需要增加 loading 提示 #12289
This commit is contained in:
parent
e07a22c417
commit
b9b510e73a
@ -260,6 +260,8 @@ const afterTreeInit = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const copyLoading = ref(false)
|
||||||
|
|
||||||
const emit = defineEmits(['nodeClick'])
|
const emit = defineEmits(['nodeClick'])
|
||||||
|
|
||||||
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
||||||
@ -291,29 +293,36 @@ const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
|||||||
id: data.id,
|
id: data.id,
|
||||||
pid: targetPid || '0'
|
pid: targetPid || '0'
|
||||||
}
|
}
|
||||||
copyResource(params).then(data => {
|
|
||||||
const baseUrl =
|
copyLoading.value = true
|
||||||
curCanvasType.value === 'dataV'
|
|
||||||
? `#/dvCanvas?opt=copy&pid=${params.pid}&dvId=${data.data}`
|
copyResource(params)
|
||||||
: `#/dashboard?opt=copy&pid=${params.pid}&resourceId=${data.data}`
|
.then(data => {
|
||||||
if (isEmbedded.value) {
|
const baseUrl =
|
||||||
embeddedStore.clearState()
|
curCanvasType.value === 'dataV'
|
||||||
embeddedStore.setPid(params.pid as string)
|
? `#/dvCanvas?opt=copy&pid=${params.pid}&dvId=${data.data}`
|
||||||
embeddedStore.setOpt('copy')
|
: `#/dashboard?opt=copy&pid=${params.pid}&resourceId=${data.data}`
|
||||||
if (curCanvasType.value === 'dataV') {
|
if (isEmbedded.value) {
|
||||||
embeddedStore.setDvId(data.data)
|
embeddedStore.clearState()
|
||||||
} else {
|
embeddedStore.setPid(params.pid as string)
|
||||||
embeddedStore.setResourceId(data.data)
|
embeddedStore.setOpt('copy')
|
||||||
|
if (curCanvasType.value === 'dataV') {
|
||||||
|
embeddedStore.setDvId(data.data)
|
||||||
|
} else {
|
||||||
|
embeddedStore.setResourceId(data.data)
|
||||||
|
}
|
||||||
|
useEmitt().emitter.emit(
|
||||||
|
'changeCurrentComponent',
|
||||||
|
curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'DashboardEditor'
|
||||||
|
)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
useEmitt().emitter.emit(
|
const newWindow = window.open(baseUrl, '_blank')
|
||||||
'changeCurrentComponent',
|
initOpenHandler(newWindow)
|
||||||
curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'DashboardEditor'
|
})
|
||||||
)
|
.finally(() => {
|
||||||
return
|
copyLoading.value = false
|
||||||
}
|
})
|
||||||
const newWindow = window.open(baseUrl, '_blank')
|
|
||||||
initOpenHandler(newWindow)
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
resourceGroupOpt.value.optInit(nodeType, data, cmd, ['copy'].includes(cmd))
|
resourceGroupOpt.value.optInit(nodeType, data, cmd, ['copy'].includes(cmd))
|
||||||
}
|
}
|
||||||
@ -593,7 +602,7 @@ defineExpose({
|
|||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar class="custom-tree">
|
<el-scrollbar class="custom-tree" v-loading="copyLoading">
|
||||||
<el-tree
|
<el-tree
|
||||||
menu
|
menu
|
||||||
ref="resourceListTree"
|
ref="resourceListTree"
|
||||||
|
Loading…
Reference in New Issue
Block a user