mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 增加右键菜单功能及处理逻辑
This commit is contained in:
@@ -602,7 +602,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)
|
||||
})
|
||||
}
|
||||
@@ -795,6 +796,70 @@ 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) {
|
||||
chartHistoryStore.createLayerHistory(
|
||||
[targetItem],
|
||||
status ? HistoryActionTypeEnum.LOCK : HistoryActionTypeEnum.UNLOCK
|
||||
)
|
||||
}
|
||||
this.updateComponentList(index, targetItem)
|
||||
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) {
|
||||
chartHistoryStore.createLayerHistory(
|
||||
[targetItem],
|
||||
status ? HistoryActionTypeEnum.HIDE : HistoryActionTypeEnum.SHOW
|
||||
)
|
||||
}
|
||||
this.updateComponentList(index, targetItem)
|
||||
loadingFinish()
|
||||
return
|
||||
}
|
||||
} catch (value) {
|
||||
loadingError()
|
||||
}
|
||||
},
|
||||
// * 显示
|
||||
setShow(isHistory: boolean = true) {
|
||||
this.setHide(false, isHistory)
|
||||
},
|
||||
// ----------------
|
||||
// * 设置页面大小
|
||||
setPageSize(scale: number): void {
|
||||
|
||||
+10
-1
@@ -2,6 +2,7 @@ import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.
|
||||
import { EditCanvasType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
|
||||
// 操作类型枚举
|
||||
|
||||
export enum HistoryActionTypeEnum {
|
||||
// 新增
|
||||
ADD = 'add',
|
||||
@@ -30,7 +31,15 @@ export enum HistoryActionTypeEnum {
|
||||
// 解组
|
||||
UN_GROUP = 'unGroup',
|
||||
// 选择历史记录
|
||||
SELECT_HISTORY = 'selectHistory'
|
||||
SELECT_HISTORY = 'selectHistory',
|
||||
// 锁定
|
||||
LOCK = 'lock',
|
||||
// 解除锁定
|
||||
UNLOCK = 'unLock',
|
||||
// 隐藏
|
||||
HIDE = 'hide',
|
||||
// 显示
|
||||
SHOW = 'show'
|
||||
}
|
||||
|
||||
// 对象类型
|
||||
|
||||
@@ -153,6 +153,10 @@ export const useChartHistoryStore = defineStore({
|
||||
| HistoryActionTypeEnum.DOWN
|
||||
| HistoryActionTypeEnum.UP
|
||||
| HistoryActionTypeEnum.BOTTOM
|
||||
| HistoryActionTypeEnum.LOCK
|
||||
| HistoryActionTypeEnum.UNLOCK
|
||||
| HistoryActionTypeEnum.HIDE
|
||||
| HistoryActionTypeEnum.SHOW
|
||||
) {
|
||||
this.createStackItem(item, type, HistoryTargetTypeEnum.CHART)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user