mirror of
https://gitee.com/dromara/go-view.git
synced 2025-06-30 00:29:16 +08:00
fix: 优化组态 创建时固定位置
This commit is contained in:
parent
0a343ad794
commit
23bf1d2af4
@ -16,7 +16,7 @@ export const option = {
|
||||
// 展示标题
|
||||
isThereATitleComponet: false,
|
||||
// 控制内层 使外层选中失效
|
||||
enableInner: false
|
||||
enableInner: true
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType
|
||||
@ -27,6 +27,8 @@ 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.isFixedInit = true
|
||||
}
|
||||
public key = EngineeringConfig.key
|
||||
public chartConfig = cloneDeep(EngineeringConfig)
|
||||
|
@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<CollapseItem name="组态" :expanded="true">
|
||||
<SettingItemBox name="移动组态" :alone="true">
|
||||
<n-space justify="start">
|
||||
<n-switch v-model:value="optionData.enableInner" size="small"></n-switch>
|
||||
</n-space>
|
||||
<SettingItem name="开启后能移动组态,但无法选中组件,可以在左侧图层栏选中">
|
||||
<n-space justify="start">
|
||||
<n-switch v-model:value="optionData.enableInner" size="small"></n-switch>
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标题">
|
||||
<SettingItem name="如果有标题将展示">
|
||||
|
4
src/packages/index.d.ts
vendored
4
src/packages/index.d.ts
vendored
@ -118,7 +118,9 @@ export const BlendModeEnumList = [
|
||||
export interface PublicConfigType {
|
||||
id: string
|
||||
isGroup: boolean
|
||||
attr: { x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number }
|
||||
// isHeadInsert 组件置底
|
||||
// isFixedInit 组件初始时位置以x,y为准 不以鼠标位置为准
|
||||
attr: { x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number, isHeadInsert?: boolean, isFixedInit?: boolean }
|
||||
styles: {
|
||||
[FilterEnum.FILTERS_SHOW]: boolean
|
||||
[FilterEnum.OPACITY]: number
|
||||
|
@ -129,9 +129,7 @@ const dblclickHandle = async (item: ConfigType) => {
|
||||
newComponent.chartConfig.chartFrame = item.chartFrame
|
||||
}
|
||||
// 组件置底插入
|
||||
let isHead = false
|
||||
let isHeadList = ['EngineeringConfig']
|
||||
if(isHeadList.includes(newComponent.chartConfig.key)) isHead = true
|
||||
let isHead = !!newComponent.chartConfig.isHeadInsert
|
||||
// 添加
|
||||
chartEditStore.addComponentList(newComponent, isHead, true)
|
||||
// 选中
|
||||
|
@ -40,8 +40,15 @@ export const dragHandle = async (e: DragEvent) => {
|
||||
newComponent.chartConfig.chartFrame = dropData.chartFrame
|
||||
}
|
||||
|
||||
setComponentPosition(newComponent, e.offsetX - newComponent.attr.w / 2, e.offsetY - newComponent.attr.h / 2)
|
||||
chartEditStore.addComponentList(newComponent, false, true)
|
||||
if(newComponent.attr.isFixedInit) {
|
||||
setComponentPosition(newComponent, newComponent.attr.x, newComponent.attr.y)
|
||||
}
|
||||
else {
|
||||
setComponentPosition(newComponent, e.offsetX - newComponent.attr.w / 2, e.offsetY - newComponent.attr.h / 2)
|
||||
}
|
||||
|
||||
let isHead = !!newComponent.attr.isHeadInsert
|
||||
chartEditStore.addComponentList(newComponent, isHead, true)
|
||||
chartEditStore.setTargetSelectChart(newComponent.id)
|
||||
loadingFinish()
|
||||
} catch (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user