mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
feat: 新增工作区域内容模块
This commit is contained in:
parent
825b3bf2ea
commit
ceb8cd5158
@ -3,7 +3,3 @@
|
|||||||
<Skeleton :repeat="3" :load="true"/>
|
<Skeleton :repeat="3" :load="true"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { Skeleton } from '@/components/Skeleton/index'
|
|
||||||
</script>
|
|
@ -1,5 +1,6 @@
|
|||||||
import type { App } from 'vue'
|
import type { App } from 'vue'
|
||||||
import { Skeleton } from '@/components/Skeleton'
|
import { Skeleton } from '@/components/Skeleton'
|
||||||
|
import { LoadingComponent } from '@/components/LoadingComponent'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局注册自定义组件
|
* 全局注册自定义组件
|
||||||
@ -7,4 +8,5 @@ import { Skeleton } from '@/components/Skeleton'
|
|||||||
*/
|
*/
|
||||||
export function setupCustomComponents(app: App) {
|
export function setupCustomComponents(app: App) {
|
||||||
app.component('Skeleton', Skeleton)
|
app.component('Skeleton', Skeleton)
|
||||||
|
app.component('LoadingComponent', LoadingComponent)
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,50 @@
|
|||||||
export interface chartEditStoreType {
|
// 编辑区域大小
|
||||||
|
export enum EditCanvasTypeEnum {
|
||||||
|
EDITLAYOUTDOM = 'editLayoutDom',
|
||||||
|
EDITCONTENTDON = 'editContentDom',
|
||||||
|
WIDTH = 'width',
|
||||||
|
HEIGHT = 'height',
|
||||||
|
OFFSET = 'offset',
|
||||||
|
SCALE = 'scale',
|
||||||
|
LOCKSCALE = 'lockScale',
|
||||||
|
BACKGROUND = 'background'
|
||||||
|
}
|
||||||
|
export type EditCanvasType = {
|
||||||
|
// 编辑区域 DOM
|
||||||
|
[EditCanvasTypeEnum.EDITLAYOUTDOM]?: HTMLElement
|
||||||
|
[EditCanvasTypeEnum.EDITCONTENTDON]?: HTMLElement
|
||||||
|
// 大屏宽度
|
||||||
|
[EditCanvasTypeEnum.WIDTH]: number
|
||||||
|
// 大屏高度
|
||||||
|
[EditCanvasTypeEnum.HEIGHT]: number
|
||||||
|
// 偏移大小
|
||||||
|
[EditCanvasTypeEnum.OFFSET]: number
|
||||||
|
// 缩放
|
||||||
|
[EditCanvasTypeEnum.SCALE]: number
|
||||||
|
// 锁定缩放
|
||||||
|
[EditCanvasTypeEnum.LOCKSCALE]: boolean
|
||||||
|
// 背景色
|
||||||
|
[EditCanvasTypeEnum.BACKGROUND]?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 坐标轴信息
|
||||||
|
export enum EditCanvasTypeEnum {
|
||||||
|
X = 'x',
|
||||||
|
Y = 'y'
|
||||||
|
}
|
||||||
|
export type MousePositionType = {
|
||||||
|
// X 轴
|
||||||
|
[EditCanvasTypeEnum.X]: number
|
||||||
|
// y 轴
|
||||||
|
[EditCanvasTypeEnum.Y]: number
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store 类型
|
||||||
|
export enum chartEditStoreEnum {
|
||||||
|
EDITCANVAS = 'editCanvas',
|
||||||
|
MOUSEPOSITION = 'mousePosition'
|
||||||
|
}
|
||||||
|
export interface chartEditStoreType {
|
||||||
|
[chartEditStoreEnum.EDITCANVAS]: EditCanvasType
|
||||||
|
[chartEditStoreEnum.MOUSEPOSITION]: MousePositionType
|
||||||
}
|
}
|
@ -1,11 +1,118 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { chartEditStoreType } from './chartEditStore.d'
|
import debounce from 'lodash/debounce'
|
||||||
import { setLocalStorage, getLocalStorage } from '@/utils'
|
import {
|
||||||
import { StorageEnum } from '@/enums/storageEnum'
|
chartEditStoreType,
|
||||||
|
EditCanvasType,
|
||||||
|
MousePositionType
|
||||||
|
} from './chartEditStore.d'
|
||||||
|
|
||||||
|
// 编辑区域内容
|
||||||
export const useChartEditStoreStore = defineStore({
|
export const useChartEditStoreStore = defineStore({
|
||||||
id: 'useChartEditStoreStore',
|
id: 'useChartEditStoreStore',
|
||||||
state: (): chartEditStoreType => ({}),
|
state: (): chartEditStoreType => ({
|
||||||
getters: {},
|
editCanvas: {
|
||||||
actions: {}
|
// 编辑区域 Dom
|
||||||
|
editLayoutDom: undefined,
|
||||||
|
editContentDom: undefined,
|
||||||
|
// 默认宽度
|
||||||
|
width: 1920,
|
||||||
|
// 默认高度
|
||||||
|
height: 1080,
|
||||||
|
// 偏移量
|
||||||
|
offset: 20,
|
||||||
|
// 默认缩放
|
||||||
|
scale: 1,
|
||||||
|
// 锁定缩放
|
||||||
|
lockScale: false,
|
||||||
|
// 默认背景色
|
||||||
|
background: undefined
|
||||||
|
},
|
||||||
|
mousePosition: {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
getters: {
|
||||||
|
getMousePosition(): MousePositionType {
|
||||||
|
return this.mousePosition
|
||||||
|
},
|
||||||
|
getEditCanvas(): EditCanvasType {
|
||||||
|
return this.editCanvas
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
// * 设置数据项
|
||||||
|
setEditCanvasItem<T extends keyof EditCanvasType>(key: T, value: any) {
|
||||||
|
this.editCanvas[key] = value
|
||||||
|
},
|
||||||
|
// * 设置页面属性
|
||||||
|
setPageAttribute<T extends keyof CSSStyleDeclaration>(
|
||||||
|
key: T,
|
||||||
|
value: any
|
||||||
|
): void {
|
||||||
|
const dom = this.editCanvas.editContentDom
|
||||||
|
if (dom) {
|
||||||
|
// @ts-ignore
|
||||||
|
dom.style[key] = value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// * 设置页面大小
|
||||||
|
setPageSize(): void {
|
||||||
|
this.setPageAttribute('height', `${this.editCanvas.height}px`)
|
||||||
|
this.setPageAttribute('width', `${this.editCanvas.width}px`)
|
||||||
|
},
|
||||||
|
// * 设置鼠标位置
|
||||||
|
setMousePosition(x: number, y: number): void {
|
||||||
|
this.mousePosition.x = x
|
||||||
|
this.mousePosition.y = y
|
||||||
|
},
|
||||||
|
// * 计算缩放
|
||||||
|
computedScale() {
|
||||||
|
if (this.editCanvas.editLayoutDom) {
|
||||||
|
|
||||||
|
// 现有展示区域
|
||||||
|
const width = this.editCanvas.editLayoutDom.clientWidth - this.editCanvas.offset * 2
|
||||||
|
const height = this.editCanvas.editLayoutDom.clientHeight - this.editCanvas.offset * 4
|
||||||
|
|
||||||
|
// 用户设定大小
|
||||||
|
const editCanvasWidth = this.editCanvas.width
|
||||||
|
const editCanvasHeight = this.editCanvas.height
|
||||||
|
|
||||||
|
// 需保持的比例
|
||||||
|
const baseProportion = parseFloat((editCanvasWidth / editCanvasHeight).toFixed(5))
|
||||||
|
const currentRate = parseFloat((width / height).toFixed(5))
|
||||||
|
|
||||||
|
if (currentRate > baseProportion) {
|
||||||
|
// 表示更宽
|
||||||
|
const scaleWidth = parseFloat(((height * baseProportion) / editCanvasWidth).toFixed(5))
|
||||||
|
this.setScale(parseFloat((scaleWidth).toFixed(5)))
|
||||||
|
} else {
|
||||||
|
// 表示更高
|
||||||
|
const scaleHeight = parseFloat(((width / baseProportion) / editCanvasHeight).toFixed(5))
|
||||||
|
this.setScale(parseFloat((scaleHeight).toFixed(5)))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
window['$message'].warning('找不到元素')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// * 监听缩放
|
||||||
|
listenerScale(): Function {
|
||||||
|
const resize = debounce(this.computedScale, 200)
|
||||||
|
// 默认执行一次
|
||||||
|
resize()
|
||||||
|
// 开始监听
|
||||||
|
window.addEventListener('resize', resize)
|
||||||
|
// 销毁函数
|
||||||
|
const remove = () => {
|
||||||
|
window.removeEventListener('resize', resize)
|
||||||
|
}
|
||||||
|
return remove
|
||||||
|
},
|
||||||
|
// * 设置缩放
|
||||||
|
setScale(scale: number): void {
|
||||||
|
this.getEditCanvas.scale = scale
|
||||||
|
// 设置页面元素
|
||||||
|
this.setPageAttribute('transform', `scale(${scale})`)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
@ -1,35 +1,43 @@
|
|||||||
import { ThemeEnum } from '@/enums/styleEnum'
|
import { ThemeEnum } from '@/enums/styleEnum'
|
||||||
|
|
||||||
|
export enum ChartLayoutFilterEnum {
|
||||||
|
HUEROTATE = 'hueRotate',
|
||||||
|
SATURATE = 'saturate',
|
||||||
|
BRIGHTNESS = 'brightness',
|
||||||
|
CONTRAST = 'contrast',
|
||||||
|
UNOPACITY = 'unOpacity',
|
||||||
|
}
|
||||||
|
|
||||||
export interface ChartLayoutFilterType {
|
export interface ChartLayoutFilterType {
|
||||||
// 色相
|
// 色相
|
||||||
hueRotate: number
|
[ChartLayoutFilterEnum.HUEROTATE]: number
|
||||||
// 饱和度
|
// 饱和度
|
||||||
saturate: number
|
[ChartLayoutFilterEnum.SATURATE]: number
|
||||||
// 亮度
|
// 亮度
|
||||||
brightness: number
|
[ChartLayoutFilterEnum.BRIGHTNESS]: number
|
||||||
// 对比度
|
// 对比度
|
||||||
contrast: number
|
[ChartLayoutFilterEnum.CONTRAST]: number
|
||||||
// 不透明度
|
// 不透明度
|
||||||
unOpacity: number
|
[ChartLayoutFilterEnum.UNOPACITY]: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChartLayoutType {
|
export enum ChartLayoutStoreEnum {
|
||||||
// 图层控制
|
|
||||||
layers: boolean
|
|
||||||
// 图表组件
|
|
||||||
charts: boolean
|
|
||||||
// 详情设置
|
|
||||||
details: boolean
|
|
||||||
// 对齐线
|
|
||||||
alignLine: boolean
|
|
||||||
// 滤镜
|
|
||||||
filter: ChartLayoutFilterType
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum ChartLayoutStoreEnums {
|
|
||||||
LAYERS = 'layers',
|
LAYERS = 'layers',
|
||||||
CHARTS = 'charts',
|
CHARTS = 'charts',
|
||||||
DETAILS = 'details',
|
DETAILS = 'details',
|
||||||
ALIGNLINE = 'alignLine',
|
ALIGNLINE = 'alignLine',
|
||||||
FILTER = 'filter',
|
FILTER = 'filter',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ChartLayoutType {
|
||||||
|
// 图层控制
|
||||||
|
[ChartLayoutStoreEnum.LAYERS]: boolean
|
||||||
|
// 图表组件
|
||||||
|
[ChartLayoutStoreEnum.CHARTS]: boolean
|
||||||
|
// 详情设置
|
||||||
|
[ChartLayoutStoreEnum.DETAILS]: boolean
|
||||||
|
// 对齐线
|
||||||
|
[ChartLayoutStoreEnum.ALIGNLINE]: boolean
|
||||||
|
// 滤镜
|
||||||
|
[ChartLayoutStoreEnum.FILTER]: ChartLayoutFilterType
|
||||||
|
}
|
||||||
|
@ -2,6 +2,9 @@ import { defineStore } from 'pinia'
|
|||||||
import { ChartLayoutType, ChartLayoutFilterType } from './chartLayoutStore.d'
|
import { ChartLayoutType, ChartLayoutFilterType } from './chartLayoutStore.d'
|
||||||
import { setLocalStorage, getLocalStorage } from '@/utils'
|
import { setLocalStorage, getLocalStorage } from '@/utils'
|
||||||
import { StorageEnum } from '@/enums/storageEnum'
|
import { StorageEnum } from '@/enums/storageEnum'
|
||||||
|
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
|
||||||
|
const chartEditStore = useChartEditStoreStore()
|
||||||
|
|
||||||
const { GO_CHART_LAYOUT_STORE } = StorageEnum
|
const { GO_CHART_LAYOUT_STORE } = StorageEnum
|
||||||
|
|
||||||
@ -9,6 +12,7 @@ const storageChartLayout: ChartLayoutType = getLocalStorage(
|
|||||||
GO_CHART_LAYOUT_STORE
|
GO_CHART_LAYOUT_STORE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 编辑区域布局和静态设置
|
||||||
export const useChartLayoutStore = defineStore({
|
export const useChartLayoutStore = defineStore({
|
||||||
id: 'useChartLayoutStore',
|
id: 'useChartLayoutStore',
|
||||||
state: (): ChartLayoutType =>
|
state: (): ChartLayoutType =>
|
||||||
@ -32,8 +36,8 @@ export const useChartLayoutStore = defineStore({
|
|||||||
// 对比度
|
// 对比度
|
||||||
contrast: 100,
|
contrast: 100,
|
||||||
// 不透明度
|
// 不透明度
|
||||||
unOpacity: 100,
|
unOpacity: 100
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getLayers(): boolean {
|
getLayers(): boolean {
|
||||||
@ -50,16 +54,23 @@ export const useChartLayoutStore = defineStore({
|
|||||||
},
|
},
|
||||||
getFilter(): ChartLayoutFilterType {
|
getFilter(): ChartLayoutFilterType {
|
||||||
return this.filter
|
return this.filter
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setItem(key: string, value: boolean): void {
|
setItem(key: string, value: boolean): void {
|
||||||
;(this as any)[key] = value
|
;(this as any)[key] = value
|
||||||
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
|
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
|
||||||
|
// 重新计算拖拽区域缩放比例
|
||||||
|
setTimeout(() => {
|
||||||
|
chartEditStore.computedScale()
|
||||||
|
}, 500)
|
||||||
},
|
},
|
||||||
setFilter<T extends keyof ChartLayoutFilterType>(key: T, value: boolean): void {
|
setFilter<T extends keyof ChartLayoutFilterType>(
|
||||||
|
key: T,
|
||||||
|
value: boolean
|
||||||
|
): void {
|
||||||
;(this.filter as any)[key] = value
|
;(this.filter as any)[key] = value
|
||||||
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
|
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
|
@ -25,4 +25,7 @@ $dark: (
|
|||||||
),
|
),
|
||||||
// hover 边框颜色
|
// hover 边框颜色
|
||||||
hover-border-color: #55606e,
|
hover-border-color: #55606e,
|
||||||
|
// 阴影
|
||||||
|
box-shadow: 0 8px 20px #5252521f
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -26,5 +26,7 @@ $light: (
|
|||||||
linear-gradient(90deg, transparent 14px, $--color-dark-bg-5 0)
|
linear-gradient(90deg, transparent 14px, $--color-dark-bg-5 0)
|
||||||
),
|
),
|
||||||
// hover 边框颜色
|
// hover 边框颜色
|
||||||
hover-border-color: $--color-light-bg-1
|
hover-border-color: $--color-light-bg-1,
|
||||||
|
// 阴影
|
||||||
|
box-shadow: 0 8px 20px #0000001a
|
||||||
);
|
);
|
||||||
|
@ -9,6 +9,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin goId($block) {
|
||||||
|
$B: $namespace + '-' + $block;
|
||||||
|
##{$B} {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@mixin deep() {
|
@mixin deep() {
|
||||||
:deep {
|
:deep {
|
||||||
@content;
|
@content;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
@import './animation.scss';
|
@import './animation.scss';
|
||||||
@import './mixins/mixins.scss';
|
@import './mixins/mixins.scss';
|
||||||
|
|
||||||
// extends
|
|
||||||
// 过度
|
// 过度
|
||||||
.go-transition {
|
.go-transition {
|
||||||
transition: all 0.4s;
|
transition: all 0.4s;
|
||||||
|
@ -3,3 +3,4 @@ export * from '@/utils/page'
|
|||||||
export * from '@/utils/storage'
|
export * from '@/utils/storage'
|
||||||
export * from '@/utils/style'
|
export * from '@/utils/style'
|
||||||
export * from '@/utils/plugin'
|
export * from '@/utils/plugin'
|
||||||
|
export * from '@/utils/componets'
|
@ -56,7 +56,7 @@ export const requireFallbackImg = (path?: string, name?: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全屏操作函数
|
* * 全屏操作函数
|
||||||
* @param isFullscreen
|
* @param isFullscreen
|
||||||
* @param isEnabled
|
* @param isEnabled
|
||||||
* @returns
|
* @returns
|
||||||
@ -76,6 +76,23 @@ export const screenfullFn = (isFullscreen?: boolean, isEnabled?: boolean) => {
|
|||||||
window['$message'].warning('您的浏览器不支持全屏功能!')
|
window['$message'].warning('您的浏览器不支持全屏功能!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 设置元素属性
|
||||||
|
* @param HTMLElement 元素
|
||||||
|
* @param key 键名
|
||||||
|
* @param value 键值
|
||||||
|
*/
|
||||||
|
export const setDomAttribute = <T extends keyof CSSStyleDeclaration>(
|
||||||
|
HTMLElement: HTMLElement,
|
||||||
|
key: T,
|
||||||
|
value: any
|
||||||
|
) => {
|
||||||
|
if (HTMLElement) {
|
||||||
|
// @ts-ignore
|
||||||
|
HTMLElement.style[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 挂载监听
|
* * 挂载监听
|
||||||
*/
|
*/
|
||||||
|
@ -23,9 +23,11 @@
|
|||||||
</n-space>
|
</n-space>
|
||||||
</div>
|
</div>
|
||||||
<aside class="content">
|
<aside class="content">
|
||||||
|
<n-scrollbar x-scrollable>
|
||||||
<n-scrollbar>
|
<n-scrollbar>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</n-scrollbar>
|
</n-scrollbar>
|
||||||
|
</n-scrollbar>
|
||||||
</aside>
|
</aside>
|
||||||
<div v-if="showBottom" class="bottom go-mt-0">
|
<div v-if="showBottom" class="bottom go-mt-0">
|
||||||
<slot name="bottom"></slot>
|
<slot name="bottom"></slot>
|
||||||
|
@ -5,7 +5,7 @@ import { themeColor, setItem, getCharts } from './layoutHook'
|
|||||||
import { PackagesCategoryEnum, PackagesCategoryName } from '@/packages/index.d'
|
import { PackagesCategoryEnum, PackagesCategoryName } from '@/packages/index.d'
|
||||||
// 图表
|
// 图表
|
||||||
import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore'
|
import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore'
|
||||||
import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||||
// 图标
|
// 图标
|
||||||
const { BarChartIcon } = icon.ionicons5
|
const { BarChartIcon } = icon.ionicons5
|
||||||
const {
|
const {
|
||||||
@ -68,9 +68,9 @@ const clickItemHandle = (key: string, item: any) => {
|
|||||||
selectOptions.value = item
|
selectOptions.value = item
|
||||||
// 处理折叠
|
// 处理折叠
|
||||||
if (beforeSelect === key) {
|
if (beforeSelect === key) {
|
||||||
setItem(ChartLayoutStoreEnums.CHARTS, !getCharts.value)
|
setItem(ChartLayoutStoreEnum.CHARTS, !getCharts.value)
|
||||||
} else {
|
} else {
|
||||||
setItem(ChartLayoutStoreEnums.CHARTS, true)
|
setItem(ChartLayoutStoreEnum.CHARTS, true)
|
||||||
}
|
}
|
||||||
beforeSelect = key
|
beforeSelect = key
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-layout has-sider sider-placement="right">
|
<n-layout has-sider sider-placement="right">
|
||||||
<n-layout-content>
|
<n-layout-content>
|
||||||
<!-- 为了展示折叠的按钮,放在了这里 呜呜呜 -->
|
<!-- 图表拖拽区域 -->
|
||||||
<ContentDrag />
|
<ContentEdit />
|
||||||
</n-layout-content>
|
</n-layout-content>
|
||||||
<n-layout-sider
|
<n-layout-sider
|
||||||
collapse-mode="transform"
|
collapse-mode="transform"
|
||||||
@ -43,11 +43,11 @@ import { shallowRef, ref, toRefs, watch, reactive } from 'vue'
|
|||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
import { ContentBox } from '../ContentBox/index'
|
import { ContentBox } from '../ContentBox/index'
|
||||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||||
import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||||
import { Setting } from './components/Setting/index'
|
import { Setting } from './components/Setting/index'
|
||||||
import { Behind } from './components/Behind/index'
|
import { Behind } from './components/Behind/index'
|
||||||
import { Page } from './components/Page/index'
|
import { Page } from './components/Page/index'
|
||||||
import { ContentDrag } from '../ContentDrag/index'
|
import { ContentEdit } from '../ContentEdit/index'
|
||||||
|
|
||||||
const { getDetails } = toRefs(useChartLayoutStore())
|
const { getDetails } = toRefs(useChartLayoutStore())
|
||||||
const { setItem } = useChartLayoutStore()
|
const { setItem } = useChartLayoutStore()
|
||||||
@ -58,12 +58,12 @@ const collapsed = ref<boolean>(getDetails.value)
|
|||||||
|
|
||||||
const collapsedHindle = () => {
|
const collapsedHindle = () => {
|
||||||
collapsed.value = true
|
collapsed.value = true
|
||||||
setItem(ChartLayoutStoreEnums.DETAILS, true)
|
setItem(ChartLayoutStoreEnum.DETAILS, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const expandHindle = () => {
|
const expandHindle = () => {
|
||||||
collapsed.value = false
|
collapsed.value = false
|
||||||
setItem(ChartLayoutStoreEnums.DETAILS, false)
|
setItem(ChartLayoutStoreEnum.DETAILS, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(getDetails, (newData) => {
|
watch(getDetails, (newData) => {
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
import ContentDrag from './index.vue'
|
|
||||||
|
|
||||||
export { ContentDrag }
|
|
@ -1,25 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ContentBox
|
|
||||||
class="go-content-draw"
|
|
||||||
:flex="true"
|
|
||||||
:showTop="false"
|
|
||||||
:showBottom="true"
|
|
||||||
:depth="1"
|
|
||||||
>
|
|
||||||
<template #bottom>
|
|
||||||
</template>
|
|
||||||
</ContentBox>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { reactive } from 'vue'
|
|
||||||
import { ContentBox } from '../ContentBox/index'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@include go(content-draw) {
|
|
||||||
overflow: hidden;
|
|
||||||
@include background-image('background-point');
|
|
||||||
@extend .go-point-bg;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -0,0 +1,3 @@
|
|||||||
|
import EditRange from './index.vue'
|
||||||
|
|
||||||
|
export { EditRange }
|
@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<div class="go-edit-range">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@include go(edit-range) {
|
||||||
|
position: relative;
|
||||||
|
height: 1080px;
|
||||||
|
width: 1920px;
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 15px;
|
||||||
|
background-color: #333;
|
||||||
|
@include filter-bg-color('background-color2');
|
||||||
|
@include fetch-theme('box-shadow');
|
||||||
|
@include filter-border-color('hover-border-color');
|
||||||
|
@include fetch-theme-custom('border-color', 'background-color4');
|
||||||
|
}
|
||||||
|
</style>
|
6
src/views/chart/components/ContentEdit/hooks/useStore.ts
Normal file
6
src/views/chart/components/ContentEdit/hooks/useStore.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
const chartEditStore = useChartEditStoreStore()
|
||||||
|
|
||||||
|
export const getChartEditStore = () => {
|
||||||
|
return chartEditStore
|
||||||
|
}
|
3
src/views/chart/components/ContentEdit/index.ts
Normal file
3
src/views/chart/components/ContentEdit/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import ContentEdit from './index.vue'
|
||||||
|
|
||||||
|
export { ContentEdit }
|
68
src/views/chart/components/ContentEdit/index.vue
Normal file
68
src/views/chart/components/ContentEdit/index.vue
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<template>
|
||||||
|
<ContentBox
|
||||||
|
id="go-chart-edit-layout"
|
||||||
|
ref="editDomRef"
|
||||||
|
:flex="true"
|
||||||
|
:showTop="false"
|
||||||
|
:showBottom="true"
|
||||||
|
:depth="1"
|
||||||
|
>
|
||||||
|
<div id="go-chart-edit-content">
|
||||||
|
<!-- 中间区域 -->
|
||||||
|
<EditRange>
|
||||||
|
</EditRange>
|
||||||
|
</div>
|
||||||
|
<!-- 底部控制 -->
|
||||||
|
<template #bottom> </template>
|
||||||
|
</ContentBox>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, onUnmounted, onMounted, computed } from 'vue'
|
||||||
|
import { ContentBox } from '../ContentBox/index'
|
||||||
|
import { EditRange } from './components/EditRange'
|
||||||
|
import { getChartEditStore } from './hooks/useStore'
|
||||||
|
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||||
|
|
||||||
|
const chartEditStore = getChartEditStore()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 设置 Dom 值(ref 不生效先用document)
|
||||||
|
chartEditStore.setEditCanvasItem(
|
||||||
|
EditCanvasTypeEnum.EDITLAYOUTDOM,
|
||||||
|
document.getElementById('go-chart-edit-layout')
|
||||||
|
)
|
||||||
|
chartEditStore.setEditCanvasItem(
|
||||||
|
EditCanvasTypeEnum.EDITCONTENTDON,
|
||||||
|
document.getElementById('go-chart-edit-content')
|
||||||
|
)
|
||||||
|
|
||||||
|
// 大小初始化
|
||||||
|
chartEditStore.setPageSize()
|
||||||
|
|
||||||
|
// 监听初始化
|
||||||
|
const removeScale = chartEditStore.listenerScale()
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
removeScale()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
computed(() => {})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@include goId(chart-edit-layout) {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
@include background-image('background-point');
|
||||||
|
@extend .go-point-bg;
|
||||||
|
@include goId(chart-edit-content) {
|
||||||
|
position: relative;
|
||||||
|
top: 20px;
|
||||||
|
left: 20px;
|
||||||
|
transform-origin: left top;
|
||||||
|
@extend .go-transition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -18,13 +18,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ContentBox } from '../ContentBox/index'
|
import { ContentBox } from '../ContentBox/index'
|
||||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||||
import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
const { LayersIcon } = icon.ionicons5
|
const { LayersIcon } = icon.ionicons5
|
||||||
const chartLayoutStore = useChartLayoutStore()
|
const chartLayoutStore = useChartLayoutStore()
|
||||||
|
|
||||||
const backHandle = () => {
|
const backHandle = () => {
|
||||||
chartLayoutStore.setItem(ChartLayoutStoreEnums.LAYERS, false)
|
chartLayoutStore.setItem(ChartLayoutStoreEnum.LAYERS, false)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import { renderIcon, goDialog, goHome } from '@/utils'
|
|||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon } = icon.ionicons5
|
const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon } = icon.ionicons5
|
||||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||||
import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||||
|
|
||||||
const { setItem } = useChartLayoutStore()
|
const { setItem } = useChartLayoutStore()
|
||||||
const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore())
|
const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore())
|
||||||
@ -40,19 +40,19 @@ type ItemType = {
|
|||||||
|
|
||||||
const btnList = reactive<ItemType[]>([
|
const btnList = reactive<ItemType[]>([
|
||||||
{
|
{
|
||||||
key: ChartLayoutStoreEnums.CHARTS,
|
key: ChartLayoutStoreEnum.CHARTS,
|
||||||
select: getCharts,
|
select: getCharts,
|
||||||
title: '图表组件',
|
title: '图表组件',
|
||||||
icon: renderIcon(BarChartIcon)
|
icon: renderIcon(BarChartIcon)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: ChartLayoutStoreEnums.LAYERS,
|
key: ChartLayoutStoreEnum.LAYERS,
|
||||||
select: getLayers,
|
select: getLayers,
|
||||||
title: '图层控制',
|
title: '图层控制',
|
||||||
icon: renderIcon(LayersIcon)
|
icon: renderIcon(LayersIcon)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: ChartLayoutStoreEnums.DETAILS,
|
key: ChartLayoutStoreEnum.DETAILS,
|
||||||
select: getDetails,
|
select: getDetails,
|
||||||
title: '详情设置',
|
title: '详情设置',
|
||||||
icon: renderIcon(PrismIcon)
|
icon: renderIcon(PrismIcon)
|
||||||
@ -62,7 +62,7 @@ const btnList = reactive<ItemType[]>([
|
|||||||
|
|
||||||
// store 描述的是展示的值,所以和 ContentDetails 的 collapsed 是相反的
|
// store 描述的是展示的值,所以和 ContentDetails 的 collapsed 是相反的
|
||||||
const styleHandle = (item: ItemType) => {
|
const styleHandle = (item: ItemType) => {
|
||||||
if (item.key === ChartLayoutStoreEnums.DETAILS) {
|
if (item.key === ChartLayoutStoreEnum.DETAILS) {
|
||||||
return item.select ? '' : 'success'
|
return item.select ? '' : 'success'
|
||||||
}
|
}
|
||||||
return item.select ? 'success' : ''
|
return item.select ? 'success' : ''
|
||||||
|
@ -22,17 +22,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { loadAsyncComponent } from '@/utils'
|
||||||
import { HeaderPro } from '@/layout/components/HeaderPro'
|
import { HeaderPro } from '@/layout/components/HeaderPro'
|
||||||
import { HeaderLeftBtn } from './components/HeaderLeftBtn/index'
|
|
||||||
import { HeaderRightBtn } from './components/HeaderRightBtn/index'
|
const HeaderLeftBtn = loadAsyncComponent(() =>
|
||||||
import { HeaderTitle } from './components/HeaderTitle/index'
|
import('./components/HeaderLeftBtn/index.vue')
|
||||||
import { ContentLayers } from './components/ContentLayers/index'
|
)
|
||||||
import { ContentCharts } from './components/ContentCharts/index'
|
const HeaderRightBtn = loadAsyncComponent(() =>
|
||||||
import { ContentDetails } from './components/ContentDetails/index'
|
import('./components/HeaderRightBtn/index.vue')
|
||||||
|
)
|
||||||
|
const HeaderTitle = loadAsyncComponent(() =>
|
||||||
|
import('./components/HeaderTitle/index.vue')
|
||||||
|
)
|
||||||
|
const ContentLayers = loadAsyncComponent(() =>
|
||||||
|
import('./components/ContentLayers/index.vue')
|
||||||
|
)
|
||||||
|
const ContentCharts = loadAsyncComponent(() =>
|
||||||
|
import('./components/ContentCharts/index.vue')
|
||||||
|
)
|
||||||
|
const ContentDetails = loadAsyncComponent(() =>
|
||||||
|
import('./components/ContentDetails/index.vue')
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@include go("chart") {
|
@include go('chart') {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -104,7 +104,6 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref, onMounted } from 'vue'
|
import { reactive, ref, onMounted } from 'vue'
|
||||||
import { useMessage } from 'naive-ui'
|
|
||||||
import { requireUrl } from '@/utils'
|
import { requireUrl } from '@/utils'
|
||||||
import { routerTurnByName } from '@/utils'
|
import { routerTurnByName } from '@/utils'
|
||||||
import shuffle from 'lodash/shuffle'
|
import shuffle from 'lodash/shuffle'
|
||||||
@ -125,7 +124,6 @@ interface FormState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const message = useMessage()
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const autoLogin = ref(true)
|
const autoLogin = ref(true)
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
@ -199,10 +197,10 @@ const handleSubmit = (e: Event) => {
|
|||||||
if (!errors) {
|
if (!errors) {
|
||||||
const { username, password } = formInline
|
const { username, password } = formInline
|
||||||
loading.value = true
|
loading.value = true
|
||||||
message.success(`${t('login.login_success')}!`)
|
window['$message'].success(`${t('login.login_success')}!`)
|
||||||
routerTurnByName(PageEnum.BASE_HOME_NAME, true)
|
routerTurnByName(PageEnum.BASE_HOME_NAME, true)
|
||||||
} else {
|
} else {
|
||||||
message.error(`${t('login.login_message')}!`)
|
window['$message'].error(`${t('login.login_message')}!`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, toRefs } from 'vue'
|
import { ref, computed, onMounted, onUnmounted, toRefs } from 'vue'
|
||||||
import { Create } from '../Create/index'
|
import { Create } from '../Create/index'
|
||||||
import { AsideFooter } from '../AsideFooter/index'
|
import { AsideFooter } from '../AsideFooter/index'
|
||||||
import { asideWidth, asideCollapsedWidth } from '@/settings/designSetting'
|
import { asideWidth, asideCollapsedWidth } from '@/settings/designSetting'
|
||||||
@ -62,6 +62,10 @@ const watchWidth = () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('resize', watchWidth)
|
window.addEventListener('resize', watchWidth)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onUnmounted(()=> {
|
||||||
|
window.removeEventListener('resize', watchWidth)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user