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