mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 14:02:10 +08:00
fix: 工程组态置于背景前插入
This commit is contained in:
parent
f194dc3995
commit
702cc105a3
@ -22,6 +22,8 @@ export default class Config extends PublicConfigClass implements CreateComponent
|
||||
h: 1080,
|
||||
x: 0,
|
||||
y: 0,
|
||||
// 置于工程组态前插入
|
||||
isBeforeEngineerging: true
|
||||
}
|
||||
}
|
||||
public key = BackgroundsConfig.key
|
||||
|
@ -27,8 +27,12 @@ export default class Config extends PublicConfigClass implements CreateComponent
|
||||
this.attr.h = 1080
|
||||
this.attr.x = 0
|
||||
this.attr.y = 0
|
||||
this.attr.isHeadInsert = true
|
||||
// 置底插入
|
||||
// this.attr.isHeadInsert = true
|
||||
// 初始时固定 拖拽组件会在鼠标处生成组件 此处为true就是固定位置以attr位置生成组件
|
||||
this.attr.isFixedInit = true
|
||||
// 在自定义组件背景 前插入
|
||||
this.attr.isAfterBGInsert = true
|
||||
}
|
||||
public key = EngineeringConfig.key
|
||||
public chartConfig = cloneDeep(EngineeringConfig)
|
||||
|
3
src/packages/index.d.ts
vendored
3
src/packages/index.d.ts
vendored
@ -115,7 +115,8 @@ export const BlendModeEnumList = [
|
||||
]
|
||||
|
||||
export interface PublicConfigAttrType {
|
||||
x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number, isHeadInsert?: boolean, isFixedInit?: boolean
|
||||
x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number, isHeadInsert?: boolean, isFixedInit?: boolean,
|
||||
isAfterBGInsert?: boolean, isBeforeEngineerging?: boolean
|
||||
}
|
||||
|
||||
// 组件实例类
|
||||
|
@ -320,6 +320,22 @@ export const useChartEditStore = defineStore({
|
||||
if (isHistory) {
|
||||
chartHistoryStore.createAddHistory([componentInstance])
|
||||
}
|
||||
let isAfterBGInsert = !!componentInstance.attr.isAfterBGInsert
|
||||
if(isAfterBGInsert) {
|
||||
let index = this.componentList.length
|
||||
this.componentList.forEach((item, i) => {
|
||||
if(item.chartConfig.key === 'Backgrounds') index = i + 1
|
||||
})
|
||||
this.componentList.splice(index, 0, componentInstance)
|
||||
return
|
||||
}
|
||||
let isBeforeEngineerging = !!componentInstance.attr.isBeforeEngineerging
|
||||
if(isBeforeEngineerging) {
|
||||
let index = this.componentList.findIndex(_ => _.chartConfig.key === 'EngineeringConfig')
|
||||
index = index > -1 ? index : 0
|
||||
this.componentList.splice(index, 0, componentInstance)
|
||||
return
|
||||
}
|
||||
if (isHead) {
|
||||
this.componentList.unshift(componentInstance)
|
||||
return
|
||||
|
@ -129,9 +129,9 @@ const dblclickHandle = async (item: ConfigType) => {
|
||||
newComponent.chartConfig.chartFrame = item.chartFrame
|
||||
}
|
||||
// 组件置底插入
|
||||
let isHead = !!newComponent.attr.isHeadInsert
|
||||
// let isHead = !!newComponent.attr.isHeadInsert
|
||||
// 添加
|
||||
chartEditStore.addComponentList(newComponent, isHead, true)
|
||||
chartEditStore.addComponentList(newComponent, false, true)
|
||||
// 选中
|
||||
chartEditStore.setTargetSelectChart(newComponent.id)
|
||||
loadingFinish()
|
||||
|
@ -47,8 +47,8 @@ export const dragHandle = async (e: DragEvent) => {
|
||||
setComponentPosition(newComponent, e.offsetX - newComponent.attr.w / 2, e.offsetY - newComponent.attr.h / 2)
|
||||
}
|
||||
|
||||
let isHead = !!newComponent.attr.isHeadInsert
|
||||
chartEditStore.addComponentList(newComponent, isHead, true)
|
||||
// let isHead = !!newComponent.attr.isHeadInsert
|
||||
chartEditStore.addComponentList(newComponent, false, true)
|
||||
chartEditStore.setTargetSelectChart(newComponent.id)
|
||||
loadingFinish()
|
||||
} catch (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user