mirror of
https://gitee.com/dromara/go-view.git
synced 2026-05-30 00:00:05 +08:00
feat: 合并1.1.1
This commit is contained in:
@@ -111,6 +111,7 @@ export type EditCanvasConfigType = {
|
||||
[FilterEnum.ROTATE_Y]: number
|
||||
[FilterEnum.SKEW_X]: number
|
||||
[FilterEnum.SKEW_Y]: number
|
||||
[FilterEnum.BLEND_MODE]: string
|
||||
// 大屏宽度
|
||||
[EditCanvasConfigEnum.WIDTH]: number
|
||||
// 大屏高度
|
||||
|
||||
@@ -115,6 +115,8 @@ export const useChartEditStore = defineStore({
|
||||
rotateY: 0,
|
||||
skewX: 0,
|
||||
skewY: 0,
|
||||
// 混合模式
|
||||
blendMode: 'normal',
|
||||
// 默认背景色
|
||||
background: undefined,
|
||||
backgroundImage: undefined,
|
||||
@@ -557,6 +559,10 @@ export const useChartEditStore = defineStore({
|
||||
return
|
||||
}
|
||||
|
||||
// 取消选中
|
||||
this.setTargetSelectChart()
|
||||
|
||||
// 重新选中
|
||||
let historyData = HistoryItem.historyData as Array<CreateComponentType | CreateComponentGroupType>
|
||||
if (isArray(historyData)) {
|
||||
// 选中目标元素,支持多个
|
||||
@@ -627,7 +633,8 @@ export const useChartEditStore = defineStore({
|
||||
ids.push(item.id)
|
||||
})
|
||||
} else {
|
||||
(historyData[0] as CreateComponentGroupType).groupList.forEach(item => {
|
||||
const group = historyData[0] as CreateComponentGroupType
|
||||
group.groupList.forEach(item => {
|
||||
ids.push(item.id)
|
||||
})
|
||||
}
|
||||
@@ -642,6 +649,38 @@ export const useChartEditStore = defineStore({
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 处理锁定
|
||||
const isLock = HistoryItem.actionType === HistoryActionTypeEnum.LOCK
|
||||
const isUnLock = HistoryItem.actionType === HistoryActionTypeEnum.UNLOCK
|
||||
if (isLock || isUnLock) {
|
||||
if ((isLock && isForward) || (isUnLock && !isForward)) {
|
||||
historyData.forEach(item => {
|
||||
this.setLock(!item.status.lock, false)
|
||||
})
|
||||
return
|
||||
}
|
||||
historyData.forEach(item => {
|
||||
this.setUnLock(false)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 处理隐藏
|
||||
const isHide = HistoryItem.actionType === HistoryActionTypeEnum.HIDE
|
||||
const isShow = HistoryItem.actionType === HistoryActionTypeEnum.SHOW
|
||||
if (isHide || isShow) {
|
||||
if ((isHide && isForward) || (isShow && !isForward)) {
|
||||
historyData.forEach(item => {
|
||||
this.setHide(!item.status.hide, false)
|
||||
})
|
||||
return
|
||||
}
|
||||
historyData.forEach(item => {
|
||||
this.setShow(false)
|
||||
})
|
||||
return
|
||||
}
|
||||
},
|
||||
// * 撤回
|
||||
setBack() {
|
||||
@@ -820,7 +859,73 @@ export const useChartEditStore = defineStore({
|
||||
loadingFinish()
|
||||
}
|
||||
},
|
||||
// * 页面缩放设置-----------------
|
||||
// * 锁定
|
||||
setLock(status: boolean = true, isHistory: boolean = true) {
|
||||
try {
|
||||
// 暂不支持多选
|
||||
if (this.getTargetChart.selectId.length > 1) return
|
||||
|
||||
loadingStart()
|
||||
const index: number = this.fetchTargetIndex()
|
||||
if (index !== -1) {
|
||||
// 更新状态
|
||||
const targetItem = this.getComponentList[index]
|
||||
targetItem.status.lock = status
|
||||
|
||||
// 历史记录
|
||||
if (isHistory) {
|
||||
status
|
||||
? chartHistoryStore.createLockHistory([targetItem])
|
||||
: chartHistoryStore.createUnLockHistory([targetItem])
|
||||
}
|
||||
this.updateComponentList(index, targetItem)
|
||||
// 锁定添加失焦效果
|
||||
if (status) this.setTargetSelectChart(undefined)
|
||||
loadingFinish()
|
||||
return
|
||||
}
|
||||
} catch (value) {
|
||||
loadingError()
|
||||
}
|
||||
},
|
||||
// * 解除锁定
|
||||
setUnLock(isHistory: boolean = true) {
|
||||
this.setLock(false, isHistory)
|
||||
},
|
||||
// * 隐藏
|
||||
setHide(status: boolean = true, isHistory: boolean = true) {
|
||||
try {
|
||||
// 暂不支持多选
|
||||
if (this.getTargetChart.selectId.length > 1) return
|
||||
|
||||
loadingStart()
|
||||
const index: number = this.fetchTargetIndex()
|
||||
if (index !== -1) {
|
||||
// 更新状态
|
||||
const targetItem = this.getComponentList[index]
|
||||
targetItem.status.hide = status
|
||||
|
||||
// 历史记录
|
||||
if (isHistory) {
|
||||
status
|
||||
? chartHistoryStore.createHideHistory([targetItem])
|
||||
: chartHistoryStore.createShowHistory([targetItem])
|
||||
}
|
||||
this.updateComponentList(index, targetItem)
|
||||
loadingFinish()
|
||||
|
||||
// 隐藏添加失焦效果
|
||||
if (status) this.setTargetSelectChart(undefined)
|
||||
}
|
||||
} catch (value) {
|
||||
loadingError()
|
||||
}
|
||||
},
|
||||
// * 显示
|
||||
setShow(isHistory: boolean = true) {
|
||||
this.setHide(false, isHistory)
|
||||
},
|
||||
// ----------------
|
||||
// * 设置页面大小
|
||||
setPageSize(scale: number): void {
|
||||
this.setPageStyle('height', `${this.editCanvasConfig.height * scale}px`)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import {
|
||||
HistoryTargetTypeEnum,
|
||||
HistoryActionTypeEnum
|
||||
} from './chartHistoryStore.d'
|
||||
import { HistoryTargetTypeEnum, HistoryActionTypeEnum } from './chartHistoryStore.d'
|
||||
|
||||
export const historyActionTypeName = {
|
||||
[HistoryActionTypeEnum.ADD]: '新增图表',
|
||||
[HistoryActionTypeEnum.DELETE]: '删除图表',
|
||||
[HistoryActionTypeEnum.UPDATE]: '修改属性',
|
||||
[HistoryActionTypeEnum.MOVE]: '移动图表',
|
||||
[HistoryActionTypeEnum.PASTE]: '粘贴图表',
|
||||
[HistoryActionTypeEnum.COPY]: '复制图表',
|
||||
[HistoryActionTypeEnum.CUT]: '剪切图表',
|
||||
[HistoryActionTypeEnum.TOP]: '层级置顶',
|
||||
[HistoryActionTypeEnum.BOTTOM]: '层级置底',
|
||||
[HistoryActionTypeEnum.UP]: '层级上移',
|
||||
[HistoryActionTypeEnum.DOWN]: '层级下移',
|
||||
[HistoryActionTypeEnum.GROUP]: '创建分组',
|
||||
[HistoryActionTypeEnum.UN_GROUP]: '解除分组',
|
||||
[HistoryActionTypeEnum.SELECT_HISTORY]: '选择记录',
|
||||
|
||||
[HistoryActionTypeEnum.ADD]: '新增',
|
||||
[HistoryActionTypeEnum.DELETE]: '删除',
|
||||
[HistoryActionTypeEnum.UPDATE]: '更新',
|
||||
[HistoryActionTypeEnum.MOVE]: '移动',
|
||||
[HistoryActionTypeEnum.PASTE]: '粘贴',
|
||||
[HistoryActionTypeEnum.COPY]: '复制',
|
||||
[HistoryActionTypeEnum.CUT]: '剪切',
|
||||
[HistoryActionTypeEnum.TOP]: '置顶',
|
||||
[HistoryActionTypeEnum.BOTTOM]: '置底',
|
||||
[HistoryActionTypeEnum.UP]: '上移',
|
||||
[HistoryActionTypeEnum.DOWN]: '下移',
|
||||
[HistoryActionTypeEnum.GROUP]: '成组',
|
||||
[HistoryActionTypeEnum.UN_GROUP]: '解组',
|
||||
[HistoryActionTypeEnum.LOCK]: '锁定',
|
||||
[HistoryActionTypeEnum.UNLOCK]: '解锁',
|
||||
[HistoryActionTypeEnum.HIDE]: '隐藏',
|
||||
[HistoryActionTypeEnum.SHOW]: '显示',
|
||||
|
||||
[HistoryTargetTypeEnum.CANVAS]: '画布初始化'
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.
|
||||
import { EditCanvasType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
|
||||
// 操作类型枚举
|
||||
|
||||
export enum HistoryActionTypeEnum {
|
||||
// 新增
|
||||
ADD = 'add',
|
||||
@@ -29,8 +30,14 @@ export enum HistoryActionTypeEnum {
|
||||
GROUP = 'group',
|
||||
// 解组
|
||||
UN_GROUP = 'unGroup',
|
||||
// 选择历史记录
|
||||
SELECT_HISTORY = 'selectHistory'
|
||||
// 锁定
|
||||
LOCK = 'lock',
|
||||
// 解除锁定
|
||||
UNLOCK = 'unLock',
|
||||
// 隐藏
|
||||
HIDE = 'hide',
|
||||
// 显示
|
||||
SHOW = 'show'
|
||||
}
|
||||
|
||||
// 对象类型
|
||||
|
||||
@@ -167,6 +167,22 @@ export const useChartHistoryStore = defineStore({
|
||||
// * 解除分组
|
||||
createUnGroupHistory(item: Array<CreateComponentType | CreateComponentGroupType>) {
|
||||
this.createStackItem(item, HistoryActionTypeEnum.UN_GROUP, HistoryTargetTypeEnum.CHART)
|
||||
},
|
||||
// * 锁定记录
|
||||
createLockHistory(item: Array<CreateComponentType | CreateComponentGroupType>) {
|
||||
this.createStackItem(item, HistoryActionTypeEnum.LOCK, HistoryTargetTypeEnum.CHART)
|
||||
},
|
||||
// * 解锁记录
|
||||
createUnLockHistory(item: Array<CreateComponentType | CreateComponentGroupType>) {
|
||||
this.createStackItem(item, HistoryActionTypeEnum.UNLOCK, HistoryTargetTypeEnum.CHART)
|
||||
},
|
||||
// * 隐藏记录
|
||||
createHideHistory(item: Array<CreateComponentType | CreateComponentGroupType>) {
|
||||
this.createStackItem(item, HistoryActionTypeEnum.HIDE, HistoryTargetTypeEnum.CHART)
|
||||
},
|
||||
// * 展示记录
|
||||
createShowHistory(item: Array<CreateComponentType | CreateComponentGroupType>) {
|
||||
this.createStackItem(item, HistoryActionTypeEnum.SHOW, HistoryTargetTypeEnum.CHART)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
export enum LayerModeEnum {
|
||||
THUMBNAIL = 'thumbnail',
|
||||
TEXT = 'text'
|
||||
}
|
||||
|
||||
export enum ChartLayoutStoreEnum {
|
||||
LAYERS = 'layers',
|
||||
CHARTS = 'charts',
|
||||
DETAILS = 'details',
|
||||
LAYER_TYPE = 'layerType'
|
||||
}
|
||||
|
||||
export interface ChartLayoutType {
|
||||
@@ -11,4 +17,6 @@ export interface ChartLayoutType {
|
||||
[ChartLayoutStoreEnum.CHARTS]: boolean
|
||||
// 详情设置
|
||||
[ChartLayoutStoreEnum.DETAILS]: boolean
|
||||
// 层级展示方式
|
||||
[ChartLayoutStoreEnum.LAYER_TYPE]: LayerModeEnum
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ChartLayoutType } from './chartLayoutStore.d'
|
||||
import { ChartLayoutType, LayerModeEnum } from './chartLayoutStore.d'
|
||||
import { setLocalStorage, getLocalStorage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
@@ -20,7 +20,9 @@ export const useChartLayoutStore = defineStore({
|
||||
// 图表组件
|
||||
charts: true,
|
||||
// 详情设置(收缩为true)
|
||||
details: false
|
||||
details: false,
|
||||
// 图层类型(默认图片)
|
||||
layerType: LayerModeEnum.THUMBNAIL
|
||||
},
|
||||
getters: {
|
||||
getLayers(): boolean {
|
||||
@@ -31,6 +33,9 @@ export const useChartLayoutStore = defineStore({
|
||||
},
|
||||
getDetails(): boolean {
|
||||
return this.details
|
||||
},
|
||||
getLayerType(): LayerModeEnum {
|
||||
return this.layerType
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
Reference in New Issue
Block a user