mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
refactor: support sq add view to dashboard
This commit is contained in:
@@ -189,8 +189,9 @@ function showSql() {
|
||||
}
|
||||
|
||||
function addToDashboard() {
|
||||
const viewInfo = chartRef.value?.getViewInfo()
|
||||
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
addViewRef.value?.optInit()
|
||||
addViewRef.value?.optInit(viewInfo)
|
||||
}
|
||||
|
||||
function copy() {
|
||||
|
||||
@@ -54,9 +54,22 @@ function onTypeChange() {
|
||||
chartRef.value?.renderChart()
|
||||
})
|
||||
}
|
||||
|
||||
function getViewInfo() {
|
||||
return {
|
||||
chart: {
|
||||
columns: chartObject.value?.columns,
|
||||
type: props.chartType,
|
||||
xAxis: xAxis.value,
|
||||
yAxis: yAxis.value,
|
||||
series: series.value,
|
||||
title: chartObject.value.title,
|
||||
},
|
||||
data: { data: props.data },
|
||||
}
|
||||
}
|
||||
defineExpose({
|
||||
onTypeChange,
|
||||
getViewInfo,
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ const saveResourcePrepare = () => {
|
||||
component['id'] = newComponentId
|
||||
component['y'] = bottomPosition + 1
|
||||
canvasDataResult.push(component)
|
||||
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
state.viewInfo.chart['id'] = newComponentId
|
||||
canvasViewInfoPreview[newComponentId] = state.viewInfo
|
||||
const commonParams = {
|
||||
componentData: canvasDataResult,
|
||||
|
||||
Reference in New Issue
Block a user