feat(数据大屏): 数据大屏支持批量样式设置

This commit is contained in:
wangjiahao 2024-07-25 11:40:26 +08:00
parent 5eec729cc1
commit 508a578f0b
6 changed files with 89 additions and 41 deletions

View File

@ -1371,6 +1371,15 @@ const contextMenuShow = computed(() => {
const markLineShow = computed(() => isMainCanvas(canvasId.value)) const markLineShow = computed(() => isMainCanvas(canvasId.value))
//
const dataVBatchOptAdaptor = () => {
dvMainStore.setBatchOptStatus(true)
areaData.value.components.forEach(component => {
dvMainStore.addCurBatchComponent(component)
})
}
// //
const groupAreaClickChange = async () => { const groupAreaClickChange = async () => {
let groupAreaCom let groupAreaCom
@ -1378,8 +1387,12 @@ const groupAreaClickChange = async () => {
if (groupAreaHis && groupAreaHis.length > 0) { if (groupAreaHis && groupAreaHis.length > 0) {
groupAreaCom = groupAreaHis[0] groupAreaCom = groupAreaHis[0]
} }
if (areaData.value.components.length === 0) {
dvMainStore.setBatchOptStatus(false)
}
// Group // Group
if (areaData.value.components.length > 1) { if (areaData.value.components.length > 1) {
dataVBatchOptAdaptor()
// //
composeStore.calcComposeArea() composeStore.calcComposeArea()
if (groupAreaHis.length === 0) { if (groupAreaHis.length === 0) {

View File

@ -59,7 +59,7 @@
:style="getPointStyle(item)" :style="getPointStyle(item)"
@mousedown="handleMouseDownOnPoint(item, $event)" @mousedown="handleMouseDownOnPoint(item, $event)"
></div> ></div>
<div class="shape-shadow" v-show="batchOptStatus" @mousedown="batchSelected"></div> <div class="shape-shadow" v-show="batchOptFlag" @mousedown="batchSelected"></div>
<template v-if="boardMoveActive"> <template v-if="boardMoveActive">
<div <div
v-show="!element.editing" v-show="!element.editing"
@ -164,7 +164,8 @@ const shapeLock = computed(() => {
const showPosition = computed(() => { const showPosition = computed(() => {
let position let position
if (batchOptStatus.value) { //
if (batchOptFlag.value) {
position = 'batchOpt' position = 'batchOpt'
} else if (isEditMode.value) { } else if (isEditMode.value) {
position = dvInfo.value.type === 'dashboard' ? 'canvas' : 'canvasDataV' position = dvInfo.value.type === 'dashboard' ? 'canvas' : 'canvasDataV'
@ -421,7 +422,7 @@ const handleInnerMouseDownOnShape = e => {
if (!canvasActive.value) { if (!canvasActive.value) {
return return
} }
if (dvMainStore.batchOptStatus) { if (batchOptFlag.value) {
componentEditBarRef.value.batchOptCheckOut() componentEditBarRef.value.batchOptCheckOut()
e.stopPropagation() e.stopPropagation()
e.preventDefault() e.preventDefault()
@ -592,7 +593,7 @@ const selectCurComponent = e => {
} }
const batchSelected = e => { const batchSelected = e => {
if (dvMainStore.batchOptStatus) { if (batchOptFlag.value) {
componentEditBarRef.value.batchOptCheckOut() componentEditBarRef.value.batchOptCheckOut()
e.stopPropagation() e.stopPropagation()
e.preventDefault() e.preventDefault()
@ -823,7 +824,7 @@ const componentBackgroundStyle = computed(() => {
const editBarShowFlag = computed(() => { const editBarShowFlag = computed(() => {
return ( return (
((active.value || batchOptStatus.value) && ((active.value || batchOptFlag.value) &&
['canvas', 'canvasDataV', 'batchOpt'].includes(showPosition.value)) || ['canvas', 'canvasDataV', 'batchOpt'].includes(showPosition.value)) ||
linkageSettingStatus.value linkageSettingStatus.value
) )
@ -921,6 +922,10 @@ const tabMoveInCheck = async () => {
} }
} }
const batchOptFlag = computed(() => {
return batchOptStatus.value && dashboardActive.value
})
const dragCollision = computed(() => { const dragCollision = computed(() => {
return active.value && Boolean(tabCollisionActiveId.value) return active.value && Boolean(tabCollisionActiveId.value)
}) })

View File

@ -440,8 +440,10 @@ const multiplexingCheck = val => {
// -Begin // -Begin
const batchOptCheckOut = () => { const batchOptCheckOut = () => {
state.batchOptCheckModel = !state.batchOptCheckModel if (showPosition.value === 'batchOpt') {
batchOptChange(state.batchOptCheckModel) state.batchOptCheckModel = !state.batchOptCheckModel
batchOptChange(state.batchOptCheckModel)
}
} }
const batchOptChange = val => { const batchOptChange = val => {

View File

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { PropType, toRefs, nextTick, watch, ref } from 'vue' import { PropType, toRefs, nextTick, watch, ref, computed } from 'vue'
import MiscSelector from '@/views/chart/components/editor/editor-style/components/MiscSelector.vue' import MiscSelector from '@/views/chart/components/editor/editor-style/components/MiscSelector.vue'
import LabelSelector from '@/views/chart/components/editor/editor-style/components/LabelSelector.vue' import LabelSelector from '@/views/chart/components/editor/editor-style/components/LabelSelector.vue'
import TooltipSelector from '@/views/chart/components/editor/editor-style/components/TooltipSelector.vue' import TooltipSelector from '@/views/chart/components/editor/editor-style/components/TooltipSelector.vue'
@ -27,7 +27,7 @@ import FlowMapLineSelector from '@/views/chart/components/editor/editor-style/co
import FlowMapPointSelector from '@/views/chart/components/editor/editor-style/components/FlowMapPointSelector.vue' import FlowMapPointSelector from '@/views/chart/components/editor/editor-style/components/FlowMapPointSelector.vue'
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const { dvInfo } = storeToRefs(dvMainStore) const { dvInfo, batchOptStatus } = storeToRefs(dvMainStore)
const { t } = useI18n() const { t } = useI18n()
const state = { const state = {
@ -113,6 +113,10 @@ const emit = defineEmits([
const indicatorValueRef = ref() const indicatorValueRef = ref()
const indicatorNameRef = ref() const indicatorNameRef = ref()
const positionComponentShow = computed(() => {
return !batchOptStatus.value && dvInfo.value.type !== 'dashboard'
})
const showProperties = (property: EditorProperty) => properties.value?.includes(property) const showProperties = (property: EditorProperty) => properties.value?.includes(property)
const onMiscChange = (val, prop) => { const onMiscChange = (val, prop) => {
@ -220,7 +224,7 @@ watch(
:effect="themes" :effect="themes"
name="position" name="position"
:title="'位置'" :title="'位置'"
v-if="dvInfo.type !== 'dashboard'" v-if="positionComponentShow"
> >
<component-position :themes="themes" /> <component-position :themes="themes" />
</el-collapse-item> </el-collapse-item>

View File

@ -3,7 +3,7 @@
<chart-style <chart-style
v-if="mixProperties && batchOptComponentInfo && batchOptComponentType === 'UserView'" v-if="mixProperties && batchOptComponentInfo && batchOptComponentType === 'UserView'"
class="chart-style-main" class="chart-style-main"
themes="light" :themes="themes"
:param="param" :param="param"
:common-background-pop="batchOptComponentInfo.commonBackground" :common-background-pop="batchOptComponentInfo.commonBackground"
:view="batchOptComponentInfo" :view="batchOptComponentInfo"
@ -60,6 +60,15 @@ const state = reactive({
quotaData: [] quotaData: []
}) })
const props = withDefaults(
defineProps<{
themes?: EditorTheme
}>(),
{
themes: 'light'
}
)
const onMiscChange = (val, prop) => { const onMiscChange = (val, prop) => {
batchOptChange('customAttr', 'misc', val.data, prop) batchOptChange('customAttr', 'misc', val.data, prop)
} }

View File

@ -42,6 +42,7 @@ import DvPreview from '@/views/data-visualization/DvPreview.vue'
import DeRuler from '@/custom-component/common/DeRuler.vue' import DeRuler from '@/custom-component/common/DeRuler.vue'
import { useRequestStoreWithOut } from '@/store/modules/request' import { useRequestStoreWithOut } from '@/store/modules/request'
import { usePermissionStoreWithOut } from '@/store/modules/permission' import { usePermissionStoreWithOut } from '@/store/modules/permission'
import ChartStyleBatchSet from '@/views/chart/components/editor/editor-style/ChartStyleBatchSet.vue'
const interactiveStore = interactiveStoreWithOut() const interactiveStore = interactiveStoreWithOut()
const embeddedStore = useEmbedded() const embeddedStore = useEmbedded()
const { wsCache } = useCache() const { wsCache } = useCache()
@ -79,7 +80,8 @@ const {
canvasViewInfo, canvasViewInfo,
editMode, editMode,
dvInfo, dvInfo,
canvasState canvasState,
batchOptStatus
} = storeToRefs(dvMainStore) } = storeToRefs(dvMainStore)
const { editorMap } = storeToRefs(composeStore) const { editorMap } = storeToRefs(composeStore)
const canvasOut = ref(null) const canvasOut = ref(null)
@ -471,39 +473,52 @@ eventBus.on('handleNew', handleNew)
</main> </main>
<!-- 右侧侧组件列表 --> <!-- 右侧侧组件列表 -->
<div style="width: auto; height: 100%" ref="leftSidebarRef"> <div style="width: auto; height: 100%" ref="leftSidebarRef">
<template v-if="!batchOptStatus">
<dv-sidebar
v-if="commonPropertiesShow"
:title="curComponent['name']"
:width="240"
:side-name="'componentProp'"
:aside-position="'right'"
class="left-sidebar"
:class="{ 'preview-aside': editMode === 'preview' }"
>
<component :is="findComponent(curComponent['component'] + 'Attr')" />
</dv-sidebar>
<dv-sidebar
v-show="canvasPropertiesShow"
:title="'大屏配置'"
:width="240"
:side-name="'canvas'"
:aside-position="'right'"
class="left-sidebar"
:class="{ 'preview-aside': editMode === 'preview' }"
>
<canvas-attr></canvas-attr>
</dv-sidebar>
<div
v-show="viewsPropertiesShow"
style="height: 100%"
:class="{ 'preview-aside': editMode === 'preview' }"
>
<editor
:view="canvasViewInfo[curComponent ? curComponent.id : 'default']"
themes="dark"
:dataset-tree="state.datasetTree"
></editor>
</div>
</template>
<dv-sidebar <dv-sidebar
v-if="commonPropertiesShow" v-if="batchOptStatus"
:title="curComponent['name']" :theme-info="'dark'"
:width="240" title="批量设置样式"
:side-name="'componentProp'" :width="280"
:aside-position="'right'" aside-position="right"
class="left-sidebar" class="left-sidebar"
:class="{ 'preview-aside': editMode === 'preview' }" :side-name="'batchOpt'"
> >
<component :is="findComponent(curComponent['component'] + 'Attr')" /> <chart-style-batch-set themes="dark"></chart-style-batch-set>
</dv-sidebar> </dv-sidebar>
<dv-sidebar
v-show="canvasPropertiesShow"
:title="'大屏配置'"
:width="240"
:side-name="'canvas'"
:aside-position="'right'"
class="left-sidebar"
:class="{ 'preview-aside': editMode === 'preview' }"
>
<canvas-attr></canvas-attr>
</dv-sidebar>
<div
v-show="viewsPropertiesShow"
style="height: 100%"
:class="{ 'preview-aside': editMode === 'preview' }"
>
<editor
:view="canvasViewInfo[curComponent ? curComponent.id : 'default']"
themes="dark"
:dataset-tree="state.datasetTree"
></editor>
</div>
</div> </div>
</el-container> </el-container>
</div> </div>