更新前端src/views/dashboard目录文件
This commit is contained in:
parent
6ab590073a
commit
ca0e601c54
@ -9,7 +9,6 @@ import EmptyBackground from '@/components/empty-background/src/EmptyBackground.v
|
|||||||
import ArrowSide from '@/views/common/DeResourceArrow.vue'
|
import ArrowSide from '@/views/common/DeResourceArrow.vue'
|
||||||
import { initCanvasData, initCanvasDataPrepare, onInitReady } from '@/utils/canvasUtils'
|
import { initCanvasData, initCanvasDataPrepare, onInitReady } from '@/utils/canvasUtils'
|
||||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||||
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
|
||||||
import { useMoveLine } from '@/hooks/web/useMoveLine'
|
import { useMoveLine } from '@/hooks/web/useMoveLine'
|
||||||
import { Icon } from '@/components/icon-custom'
|
import { Icon } from '@/components/icon-custom'
|
||||||
import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils'
|
import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils'
|
||||||
@ -19,6 +18,7 @@ import AppExportForm from '@/components/de-app/AppExportForm.vue'
|
|||||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import CanvasOptBar from '@/components/visualization/CanvasOptBar.vue'
|
||||||
const userStore = useUserStoreWithOut()
|
const userStore = useUserStoreWithOut()
|
||||||
|
|
||||||
const userName = computed(() => userStore.getName)
|
const userName = computed(() => userStore.getName)
|
||||||
@ -28,7 +28,6 @@ const dvMainStore = dvMainStoreWithOut()
|
|||||||
const previewCanvasContainer = ref(null)
|
const previewCanvasContainer = ref(null)
|
||||||
const dashboardPreview = ref(null)
|
const dashboardPreview = ref(null)
|
||||||
const slideShow = ref(true)
|
const slideShow = ref(true)
|
||||||
const permissionStore = usePermissionStoreWithOut()
|
|
||||||
const appStore = useAppStoreWithOut()
|
const appStore = useAppStoreWithOut()
|
||||||
const dataInitState = ref(true)
|
const dataInitState = ref(true)
|
||||||
const downloadStatus = ref(false)
|
const downloadStatus = ref(false)
|
||||||
@ -37,7 +36,11 @@ const state = reactive({
|
|||||||
canvasStylePreview: null,
|
canvasStylePreview: null,
|
||||||
canvasViewInfoPreview: null,
|
canvasViewInfoPreview: null,
|
||||||
dvInfo: null,
|
dvInfo: null,
|
||||||
curPreviewGap: 0
|
curPreviewGap: 0,
|
||||||
|
showOffset: {
|
||||||
|
top: 110,
|
||||||
|
left: 280
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { fullscreenFlag, canvasViewDataInfo } = storeToRefs(dvMainStore)
|
const { fullscreenFlag, canvasViewDataInfo } = storeToRefs(dvMainStore)
|
||||||
@ -55,10 +58,15 @@ const props = defineProps({
|
|||||||
required: false,
|
required: false,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
resourceTable: {
|
||||||
|
required: false,
|
||||||
|
type: String,
|
||||||
|
default: 'core'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { showPosition } = toRefs(props)
|
const { showPosition, resourceTable } = toRefs(props)
|
||||||
|
|
||||||
const resourceTreeRef = ref()
|
const resourceTreeRef = ref()
|
||||||
|
|
||||||
@ -93,7 +101,7 @@ const loadCanvasData = (dvId, weight?) => {
|
|||||||
dataInitState.value = false
|
dataInitState.value = false
|
||||||
initMethod(
|
initMethod(
|
||||||
dvId,
|
dvId,
|
||||||
'dashboard',
|
{ busiFlag: 'dashboard', resourceTable: 'core' },
|
||||||
function ({
|
function ({
|
||||||
canvasDataResult,
|
canvasDataResult,
|
||||||
canvasStyleResult,
|
canvasStyleResult,
|
||||||
@ -115,13 +123,20 @@ const loadCanvasData = (dvId, weight?) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// 地图类图表,需要预先准备图片
|
||||||
|
const mapChartTypes = ['bubble-map', 'flow-map', 'heat-map', 'map', 'symbolic-map']
|
||||||
const downloadH2 = type => {
|
const downloadH2 = type => {
|
||||||
downloadStatus.value = true
|
downloadStatus.value = true
|
||||||
|
const mapElementIds =
|
||||||
|
state.canvasDataPreview
|
||||||
|
?.filter(ele => mapChartTypes.includes(ele.innerType))
|
||||||
|
.map(ele => ele.id) || []
|
||||||
|
mapElementIds.forEach(id => useEmitt().emitter.emit('l7-prepare-picture', id))
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const vueDom = previewCanvasContainer.value.querySelector('.canvas-container')
|
const vueDom = previewCanvasContainer.value.querySelector('.canvas-container')
|
||||||
downloadCanvas2(type, vueDom, state.dvInfo.name, () => {
|
downloadCanvas2(type, vueDom, state.dvInfo.name, () => {
|
||||||
downloadStatus.value = false
|
downloadStatus.value = false
|
||||||
|
mapElementIds.forEach(id => useEmitt().emitter.emit('l7-unprepare-picture', id))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -214,13 +229,18 @@ const downLoadApp = appAttachInfo => {
|
|||||||
fileDownload('app', appAttachInfo)
|
fileDownload('app', appAttachInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const freezeStyle = computed(() => [
|
||||||
|
{ '--top-show-offset': state.showOffset.top },
|
||||||
|
{ '--left-show-offset': state.showOffset.left }
|
||||||
|
])
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
getPreviewStateInfo
|
getPreviewStateInfo
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="dv-preview dv-teleport-query">
|
<div class="dv-preview dv-teleport-query" :style="freezeStyle">
|
||||||
<ArrowSide
|
<ArrowSide
|
||||||
v-if="!noClose"
|
v-if="!noClose"
|
||||||
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
|
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
|
||||||
@ -246,12 +266,13 @@ defineExpose({
|
|||||||
v-show="slideShow"
|
v-show="slideShow"
|
||||||
:cur-canvas-type="'dashboard'"
|
:cur-canvas-type="'dashboard'"
|
||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
|
:resource-table="resourceTable"
|
||||||
@node-click="resourceNodeClick"
|
@node-click="resourceNodeClick"
|
||||||
/>
|
/>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-container
|
<el-container
|
||||||
class="preview-area"
|
class="preview-area"
|
||||||
:class="{ 'no-data': !hasTreeData }"
|
:class="{ 'no-data': !state.dvInfo?.id }"
|
||||||
v-loading="!dataInitState"
|
v-loading="!dataInitState"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -276,6 +297,11 @@ defineExpose({
|
|||||||
id="de-preview-content"
|
id="de-preview-content"
|
||||||
:class="{ 'de-screen-full': fullscreenFlag }"
|
:class="{ 'de-screen-full': fullscreenFlag }"
|
||||||
>
|
>
|
||||||
|
<canvas-opt-bar
|
||||||
|
canvas-id="canvas-main"
|
||||||
|
:canvas-style-data="state.canvasStylePreview || {}"
|
||||||
|
:component-data="state.canvasDataPreview || []"
|
||||||
|
></canvas-opt-bar>
|
||||||
<de-preview
|
<de-preview
|
||||||
ref="dashboardPreview"
|
ref="dashboardPreview"
|
||||||
v-if="state.canvasStylePreview && dataInitState"
|
v-if="state.canvasStylePreview && dataInitState"
|
||||||
@ -286,6 +312,7 @@ defineExpose({
|
|||||||
:canvas-view-info="state.canvasViewInfoPreview"
|
:canvas-view-info="state.canvasViewInfoPreview"
|
||||||
:show-position="showPosition"
|
:show-position="showPosition"
|
||||||
:download-status="downloadStatus"
|
:download-status="downloadStatus"
|
||||||
|
:show-linkage-button="false"
|
||||||
></de-preview>
|
></de-preview>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -347,6 +374,7 @@ defineExpose({
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -215,7 +215,7 @@ const setMobileStyle = debounce(() => {
|
|||||||
transformOrigin: '0 0'
|
transformOrigin: '0 0'
|
||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
const curComponentChangeHandle = info => {
|
const curComponentChangeHandle = () => {
|
||||||
// do change
|
// do change
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -332,7 +332,7 @@ const save = () => {
|
|||||||
:canvas-view-info-mobile="canvasViewInfoMobile"
|
:canvas-view-info-mobile="canvasViewInfoMobile"
|
||||||
></component-style-editor>
|
></component-style-editor>
|
||||||
</div>
|
</div>
|
||||||
<div class="config-mobile-tab" v-show="activeCollapse === 'com'">
|
<div class="config-mobile-tab" v-if="activeCollapse === 'com'">
|
||||||
<div
|
<div
|
||||||
:style="{ height: '196px', width: '196px' }"
|
:style="{ height: '196px', width: '196px' }"
|
||||||
class="mobile-wrapper-inner-adaptor"
|
class="mobile-wrapper-inner-adaptor"
|
||||||
@ -541,7 +541,7 @@ const save = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ed-tabs__item):not(.is-active) {
|
:deep(.ed-tabs__item):not(.is-active) {
|
||||||
color: #A6A6A6;
|
color: #646a73;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-mobile-sidebar {
|
.config-mobile-sidebar {
|
||||||
@ -636,39 +636,4 @@ const save = () => {
|
|||||||
width: 90% !important;
|
width: 90% !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ed-tabs__nav-wrap::after{
|
|
||||||
background-color: rgba(235, 235, 235, 0.15) !important;
|
|
||||||
}
|
|
||||||
.ed-checkbox__input.is-disabled .ed-checkbox__inner{
|
|
||||||
background-color: #373737;
|
|
||||||
border-color: #5f5f5f;
|
|
||||||
}
|
|
||||||
.ed-color-picker.is-custom.is-disabled .ed-color-picker__trigger{
|
|
||||||
border-color: #5f5f5f;
|
|
||||||
}
|
|
||||||
.mobile-background-selector .avatar-uploader .ed-upload--picture-card {
|
|
||||||
background: #373737 !important;
|
|
||||||
border: 1px dashed #373737 !important;
|
|
||||||
}
|
|
||||||
.mobile-background-selector .avatar-uploader .ed-upload--picture-card .ed-icon{
|
|
||||||
color: #ebebeb !important;
|
|
||||||
}
|
|
||||||
.ed-message-box{
|
|
||||||
background: #212121 ;
|
|
||||||
}
|
|
||||||
.ed-message-box__content{
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
.ed-message-box__btns .ed-button--primary{
|
|
||||||
background: #0089ff;
|
|
||||||
border-color: #0089ff;
|
|
||||||
}
|
|
||||||
.ed-message-box__btns .ed-button.is-secondary{
|
|
||||||
color: #F2F4F5 !important;
|
|
||||||
background-color: #212121 !important;
|
|
||||||
border: 1px solid #434343 !important;
|
|
||||||
}
|
|
||||||
.custom-popover-light{
|
|
||||||
border: 1px solid#363636 !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -33,6 +33,7 @@ import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
|||||||
import eventBus from '@/utils/eventBus'
|
import eventBus from '@/utils/eventBus'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import DashboardHiddenComponent from '@/components/dashboard/DashboardHiddenComponent.vue'
|
import DashboardHiddenComponent from '@/components/dashboard/DashboardHiddenComponent.vue'
|
||||||
|
import { recoverToPublished } from '@/api/visualization/dataVisualization'
|
||||||
const embeddedStore = useEmbedded()
|
const embeddedStore = useEmbedded()
|
||||||
const { wsCache } = useCache()
|
const { wsCache } = useCache()
|
||||||
const canvasCacheOutRef = ref(null)
|
const canvasCacheOutRef = ref(null)
|
||||||
@ -115,7 +116,7 @@ const checkPer = async resourceId => {
|
|||||||
if (!window.DataEaseBi || !resourceId) {
|
if (!window.DataEaseBi || !resourceId) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const request = { busiFlag: 'dashboard' }
|
const request = { busiFlag: 'dashboard', resourceTable: 'core' }
|
||||||
await interactiveStore.setInteractive(request)
|
await interactiveStore.setInteractive(request)
|
||||||
return check(wsCache.get('panel-weight'), resourceId, 4)
|
return check(wsCache.get('panel-weight'), resourceId, 4)
|
||||||
}
|
}
|
||||||
@ -162,21 +163,26 @@ const doUseCache = flag => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const initLocalCanvasData = () => {
|
const initLocalCanvasData = callBack => {
|
||||||
const { resourceId, opt, sourcePid } = state
|
const { resourceId, opt, sourcePid } = state
|
||||||
const busiFlg = opt === 'copy' ? 'dashboard-copy' : 'dashboard'
|
const busiFlag = opt === 'copy' ? 'dashboard-copy' : 'dashboard'
|
||||||
initCanvasData(resourceId, busiFlg, function () {
|
initCanvasData(
|
||||||
dataInitState.value = true
|
resourceId,
|
||||||
if (dvInfo.value && opt === 'copy') {
|
{ busiFlag, resourceTable: 'snapshot', source: 'main-edit' },
|
||||||
dvInfo.value.dataState = 'prepare'
|
function () {
|
||||||
dvInfo.value.optType = 'copy'
|
dataInitState.value = true
|
||||||
dvInfo.value.pid = sourcePid
|
if (dvInfo.value && opt === 'copy') {
|
||||||
setTimeout(() => {
|
dvInfo.value.dataState = 'prepare'
|
||||||
snapshotStore.recordSnapshotCache('initLocalCanvasData')
|
dvInfo.value.optType = 'copy'
|
||||||
}, 1500)
|
dvInfo.value.pid = sourcePid
|
||||||
|
setTimeout(() => {
|
||||||
|
snapshotStore.recordSnapshotCache('initLocalCanvasData')
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
onInitReady({ resourceId: resourceId })
|
||||||
|
callBack && callBack()
|
||||||
}
|
}
|
||||||
onInitReady({ resourceId: resourceId })
|
)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
dvMainStore.setCurComponent({ component: null, index: null })
|
dvMainStore.setCurComponent({ component: null, index: null })
|
||||||
@ -216,7 +222,9 @@ onMounted(async () => {
|
|||||||
if (canvasCache) {
|
if (canvasCache) {
|
||||||
canvasCacheOutRef.value?.dialogInit({ canvasType: 'dashboard', resourceId: resourceId })
|
canvasCacheOutRef.value?.dialogInit({ canvasType: 'dashboard', resourceId: resourceId })
|
||||||
} else {
|
} else {
|
||||||
initLocalCanvasData()
|
initLocalCanvasData(() => {
|
||||||
|
// do init
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else if (opt && opt === 'create') {
|
} else if (opt && opt === 'create') {
|
||||||
dataInitState.value = false
|
dataInitState.value = false
|
||||||
@ -296,6 +304,23 @@ const cancelHidden = item => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const doRecoverToPublished = () => {
|
||||||
|
recoverToPublished({ id: dvInfo.value.id, type: 'dashboard', name: dvInfo.value.name }).then(
|
||||||
|
() => {
|
||||||
|
state.resourceId = dvInfo.value.id
|
||||||
|
state.sourcePid = dvInfo.value.pid
|
||||||
|
state.opt = null
|
||||||
|
initLocalCanvasData(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
deCanvasRef.value.canvasInit(false)
|
||||||
|
dvMainStore.updateDvInfoCall(1)
|
||||||
|
useEmitt().emitter.emit('calcData-all')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener('storage', eventCheck)
|
window.removeEventListener('storage', eventCheck)
|
||||||
window.removeEventListener('message', winMsgHandle)
|
window.removeEventListener('message', winMsgHandle)
|
||||||
@ -309,7 +334,7 @@ onUnmounted(() => {
|
|||||||
v-loading="requestStore.loadingMap[permissionStore.currentPath]"
|
v-loading="requestStore.loadingMap[permissionStore.currentPath]"
|
||||||
v-if="loadFinish && !mobileConfig"
|
v-if="loadFinish && !mobileConfig"
|
||||||
>
|
>
|
||||||
<DbToolbar />
|
<DbToolbar @recoverToPublished="doRecoverToPublished" />
|
||||||
<el-container
|
<el-container
|
||||||
class="dv-layout-container"
|
class="dv-layout-container"
|
||||||
:class="{ 'preview-content': editMode === 'preview' }"
|
:class="{ 'preview-content': editMode === 'preview' }"
|
||||||
|
Loading…
Reference in New Issue
Block a user