forked from github/dataease
Merge pull request #12658 from dataease/pr@dev-v2@feat_inject-view
feat(数据大屏、仪表板): 嵌入式单图表渲染优化,支持增加图表id后缀等操作
This commit is contained in:
commit
44ea5aa8dd
@ -100,10 +100,25 @@ const props = defineProps({
|
|||||||
isSelector: {
|
isSelector: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
//图表渲染id后缀
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const { config, showPosition, index, canvasStyleData, canvasViewInfo, dvInfo, searchCount, scale } =
|
const {
|
||||||
toRefs(props)
|
config,
|
||||||
|
showPosition,
|
||||||
|
index,
|
||||||
|
canvasStyleData,
|
||||||
|
canvasViewInfo,
|
||||||
|
dvInfo,
|
||||||
|
searchCount,
|
||||||
|
scale,
|
||||||
|
suffixId
|
||||||
|
} = toRefs(props)
|
||||||
let currentInstance
|
let currentInstance
|
||||||
const component = ref(null)
|
const component = ref(null)
|
||||||
const emits = defineEmits(['userViewEnlargeOpen', 'datasetParamsInit', 'onPointClick'])
|
const emits = defineEmits(['userViewEnlargeOpen', 'datasetParamsInit', 'onPointClick'])
|
||||||
@ -385,6 +400,7 @@ const deepScale = computed(() => scale.value / 100)
|
|||||||
:scale="deepScale"
|
:scale="deepScale"
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
:is-edit="false"
|
:is-edit="false"
|
||||||
|
:suffix-id="suffixId"
|
||||||
@onPointClick="onPointClick"
|
@onPointClick="onPointClick"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,6 +37,12 @@ const props = defineProps({
|
|||||||
terminal: {
|
terminal: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'pc'
|
default: 'pc'
|
||||||
|
},
|
||||||
|
//图表渲染id后缀
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -103,10 +103,16 @@ const props = defineProps({
|
|||||||
themes: {
|
themes: {
|
||||||
type: String as PropType<EditorTheme>,
|
type: String as PropType<EditorTheme>,
|
||||||
default: 'dark'
|
default: 'dark'
|
||||||
|
},
|
||||||
|
//图表渲染id后缀
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { element, editMode, active, disabled, showPosition } = toRefs(props)
|
const { element, editMode, active, disabled, showPosition, suffixId } = toRefs(props)
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
emptyValue: '-',
|
emptyValue: '-',
|
||||||
@ -124,7 +130,7 @@ const initReady = ref(false)
|
|||||||
const editShow = ref(true)
|
const editShow = ref(true)
|
||||||
const canEdit = ref(false)
|
const canEdit = ref(false)
|
||||||
// 初始化配置
|
// 初始化配置
|
||||||
const tinymceId = 'tinymce-view-' + element.value.id
|
const tinymceId = 'tinymce-view-' + element.value.id + '-' + suffixId.value
|
||||||
const myValue = ref('')
|
const myValue = ref('')
|
||||||
|
|
||||||
const systemFontFamily = appearanceStore.fontList.map(item => item.name)
|
const systemFontFamily = appearanceStore.fontList.map(item => item.name)
|
||||||
|
@ -53,6 +53,11 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -89,6 +94,7 @@ const onPointClick = param => {
|
|||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
:search-count="searchCount"
|
:search-count="searchCount"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
|
:suffixId="suffixId"
|
||||||
@onPointClick="onPointClick"
|
@onPointClick="onPointClick"
|
||||||
></chart>
|
></chart>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,8 @@ const state = reactive({
|
|||||||
canvasStylePreview: null,
|
canvasStylePreview: null,
|
||||||
canvasViewInfoPreview: null,
|
canvasViewInfoPreview: null,
|
||||||
dvInfo: null,
|
dvInfo: null,
|
||||||
chartId: null
|
chartId: null,
|
||||||
|
suffixId: 'common'
|
||||||
})
|
})
|
||||||
|
|
||||||
const embeddedParams = embeddedParamsDiv?.chartId ? embeddedParamsDiv : embeddedStore
|
const embeddedParams = embeddedParamsDiv?.chartId ? embeddedParamsDiv : embeddedStore
|
||||||
@ -57,6 +58,7 @@ onBeforeMount(async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
state.chartId = embeddedParams.dvId
|
state.chartId = embeddedParams.dvId
|
||||||
|
state.suffixId = embeddedParams.suffixId || 'common'
|
||||||
window.addEventListener('message', winMsgHandle)
|
window.addEventListener('message', winMsgHandle)
|
||||||
|
|
||||||
// 添加外部参数
|
// 添加外部参数
|
||||||
@ -159,6 +161,7 @@ const onPointClick = param => {
|
|||||||
:canvas-view-info="state.canvasViewInfoPreview"
|
:canvas-view-info="state.canvasViewInfoPreview"
|
||||||
@userViewEnlargeOpen="userViewEnlargeOpen"
|
@userViewEnlargeOpen="userViewEnlargeOpen"
|
||||||
@onPointClick="onPointClick"
|
@onPointClick="onPointClick"
|
||||||
|
:suffix-id="state.suffixId"
|
||||||
/>
|
/>
|
||||||
<user-view-enlarge ref="userViewEnlargeRef"></user-view-enlarge>
|
<user-view-enlarge ref="userViewEnlargeRef"></user-view-enlarge>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,6 +62,12 @@ const props = defineProps({
|
|||||||
terminal: {
|
terminal: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'pc'
|
default: 'pc'
|
||||||
|
},
|
||||||
|
//图表渲染id后缀
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -76,7 +82,7 @@ const emit = defineEmits([
|
|||||||
const g2TypeSeries1 = ['bidirectional-bar']
|
const g2TypeSeries1 = ['bidirectional-bar']
|
||||||
const g2TypeSeries0 = ['bar-range']
|
const g2TypeSeries0 = ['bar-range']
|
||||||
|
|
||||||
const { view, showPosition, scale, terminal } = toRefs(props)
|
const { view, showPosition, scale, terminal, suffixId } = toRefs(props)
|
||||||
|
|
||||||
const isError = ref(false)
|
const isError = ref(false)
|
||||||
const errMsg = ref('')
|
const errMsg = ref('')
|
||||||
@ -97,7 +103,7 @@ let chartData = shallowRef<Partial<Chart['data']>>({
|
|||||||
fields: []
|
fields: []
|
||||||
})
|
})
|
||||||
|
|
||||||
const containerId = 'container-' + showPosition.value + '-' + view.value.id
|
const containerId = 'container-' + showPosition.value + '-' + view.value.id + '-' + suffixId.value
|
||||||
const viewTrack = ref(null)
|
const viewTrack = ref(null)
|
||||||
|
|
||||||
const clearLinkage = () => {
|
const clearLinkage = () => {
|
||||||
|
@ -76,12 +76,18 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
required: false,
|
required: false,
|
||||||
default: 0
|
default: 0
|
||||||
|
},
|
||||||
|
//图表渲染id后缀
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['onPointClick', 'onChartClick', 'onDrillFilters', 'onJumpClick'])
|
const emit = defineEmits(['onPointClick', 'onChartClick', 'onDrillFilters', 'onJumpClick'])
|
||||||
|
|
||||||
const { view, showPosition, scale, terminal, drillLength } = toRefs(props)
|
const { view, showPosition, scale, terminal, drillLength, suffixId } = toRefs(props)
|
||||||
|
|
||||||
const isError = ref(false)
|
const isError = ref(false)
|
||||||
const errMsg = ref('')
|
const errMsg = ref('')
|
||||||
@ -116,7 +122,7 @@ let chartData = shallowRef<Partial<Chart['data']>>({
|
|||||||
fields: []
|
fields: []
|
||||||
})
|
})
|
||||||
|
|
||||||
const containerId = 'container-' + showPosition.value + '-' + view.value.id
|
const containerId = 'container-' + showPosition.value + '-' + view.value.id + '-' + suffixId.value
|
||||||
const viewTrack = ref(null)
|
const viewTrack = ref(null)
|
||||||
|
|
||||||
const calcData = (view: Chart, callback, resetPageInfo = true) => {
|
const calcData = (view: Chart, callback, resetPageInfo = true) => {
|
||||||
|
@ -125,6 +125,11 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
required: false,
|
required: false,
|
||||||
default: 1
|
default: 1
|
||||||
|
},
|
||||||
|
suffixId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'common'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const dynamicAreaId = ref('')
|
const dynamicAreaId = ref('')
|
||||||
@ -987,6 +992,7 @@ const allEmptyCheck = computed(() => {
|
|||||||
:request="request"
|
:request="request"
|
||||||
:emitter="emitter"
|
:emitter="emitter"
|
||||||
:store="store"
|
:store="store"
|
||||||
|
:suffixId="suffixId"
|
||||||
ref="chartComponent"
|
ref="chartComponent"
|
||||||
@onChartClick="chartClick"
|
@onChartClick="chartClick"
|
||||||
@onPointClick="onPointClick"
|
@onPointClick="onPointClick"
|
||||||
@ -1002,6 +1008,7 @@ const allEmptyCheck = computed(() => {
|
|||||||
:active="active"
|
:active="active"
|
||||||
:view="view"
|
:view="view"
|
||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
|
:suffixId="suffixId"
|
||||||
>
|
>
|
||||||
</de-picture-group>
|
</de-picture-group>
|
||||||
<de-rich-text-view
|
<de-rich-text-view
|
||||||
@ -1013,6 +1020,7 @@ const allEmptyCheck = computed(() => {
|
|||||||
:disabled="!['canvas', 'canvasDataV'].includes(showPosition) || disabled"
|
:disabled="!['canvas', 'canvasDataV'].includes(showPosition) || disabled"
|
||||||
:active="active"
|
:active="active"
|
||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
|
:suffixId="suffixId"
|
||||||
/>
|
/>
|
||||||
<de-indicator
|
<de-indicator
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
@ -1021,6 +1029,7 @@ const allEmptyCheck = computed(() => {
|
|||||||
ref="chartComponent"
|
ref="chartComponent"
|
||||||
:view="view"
|
:view="view"
|
||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
|
:suffixId="suffixId"
|
||||||
/>
|
/>
|
||||||
<chart-component-g2-plot
|
<chart-component-g2-plot
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
@ -1028,6 +1037,7 @@ const allEmptyCheck = computed(() => {
|
|||||||
:view="view"
|
:view="view"
|
||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
:element="element"
|
:element="element"
|
||||||
|
:suffixId="suffixId"
|
||||||
v-else-if="
|
v-else-if="
|
||||||
showChartView(ChartLibraryType.G2_PLOT, ChartLibraryType.L7_PLOT, ChartLibraryType.L7)
|
showChartView(ChartLibraryType.G2_PLOT, ChartLibraryType.L7_PLOT, ChartLibraryType.L7)
|
||||||
"
|
"
|
||||||
@ -1050,6 +1060,7 @@ const allEmptyCheck = computed(() => {
|
|||||||
@onChartClick="chartClick"
|
@onChartClick="chartClick"
|
||||||
@onDrillFilters="onDrillFilters"
|
@onDrillFilters="onDrillFilters"
|
||||||
@onJumpClick="jumpClick"
|
@onJumpClick="jumpClick"
|
||||||
|
:suffixId="suffixId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<chart-empty-info
|
<chart-empty-info
|
||||||
|
Loading…
Reference in New Issue
Block a user