|
|
@@ -168,8 +168,10 @@
|
|
|
:node="item"
|
|
|
:root="node"
|
|
|
@focus="onWidgetFocus(index)"
|
|
|
+ @will-move="onWidgetWillMove"
|
|
|
@blur="onWidgetBlur"
|
|
|
@menu="onWidgetMenu($event, index)"
|
|
|
+ @dblclick.native="onWidgetDblclick"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -513,13 +515,18 @@ export default {
|
|
|
node.top = top
|
|
|
node.left = left
|
|
|
this.node.widgets.push(node)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex = this.widgets.length - 1
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
onWidgetFocus (index) {
|
|
|
this.selectedWidgetIndex = index
|
|
|
- this.grid = true
|
|
|
this.visibleContentMenu = false
|
|
|
},
|
|
|
+ onWidgetWillMove () {
|
|
|
+ this.grid = true
|
|
|
+ },
|
|
|
onWidgetBlur () {
|
|
|
this.grid = false
|
|
|
},
|
|
|
@@ -527,6 +534,12 @@ export default {
|
|
|
this.selectedWidgetIndex = index
|
|
|
this.onRightClick(evt)
|
|
|
},
|
|
|
+ onWidgetDblclick () {
|
|
|
+ const attr = this.dynamicOptions[0]?.list.find(({ type }) => type === 'data')
|
|
|
+ if (attr) {
|
|
|
+ this.onEditData(attr)
|
|
|
+ }
|
|
|
+ },
|
|
|
onLayerClick (evt, index) {
|
|
|
this.selectedWidgetIndex = this.widgets.length - 1 - index
|
|
|
this.onRightClick(evt)
|
|
|
@@ -552,11 +565,20 @@ export default {
|
|
|
// 删除
|
|
|
deleteLayer () {
|
|
|
this.widgets.splice(this.selectedWidgetIndex, 1)
|
|
|
- this.selectedWidgetIndex = -1
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex = -1
|
|
|
+ })
|
|
|
},
|
|
|
// 复制
|
|
|
copyLayer () {
|
|
|
this.widgets.splice(this.selectedWidgetIndex + 1, 0, copy(this.widget))
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '复制成功,已为您选择复制后的组件'
|
|
|
+ })
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex += 1
|
|
|
+ })
|
|
|
},
|
|
|
// 置顶
|
|
|
topLayer () {
|
|
|
@@ -565,7 +587,9 @@ export default {
|
|
|
this.selectedWidgetIndex,
|
|
|
1
|
|
|
)[0])
|
|
|
- this.selectedWidgetIndex = this.widgets.length - 1
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex = this.widgets.length - 1
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 置底
|
|
|
@@ -575,7 +599,9 @@ export default {
|
|
|
this.selectedWidgetIndex,
|
|
|
1
|
|
|
)[0])
|
|
|
- this.selectedWidgetIndex = 0
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex = 0
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 上移一层
|
|
|
@@ -586,7 +612,9 @@ export default {
|
|
|
1,
|
|
|
this.widgets[this.selectedWidgetIndex]
|
|
|
)[0]
|
|
|
- this.selectedWidgetIndex += 1
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex += 1
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 下移一层
|
|
|
@@ -597,7 +625,9 @@ export default {
|
|
|
1,
|
|
|
this.widgets[this.selectedWidgetIndex]
|
|
|
)[0]
|
|
|
- this.selectedWidgetIndex -= 1
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.selectedWidgetIndex -= 1
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
changeAttr (value) {
|