|
|
@ -16,10 +16,12 @@
|
|
|
|
<!-- 左侧组件栏-->
|
|
|
|
<!-- 左侧组件栏-->
|
|
|
|
<el-tab-pane label="工具栏">
|
|
|
|
<el-tab-pane label="工具栏">
|
|
|
|
<!-- <el-divider content-position="center">html</el-divider>-->
|
|
|
|
<!-- <el-divider content-position="center">html</el-divider>-->
|
|
|
|
<draggable
|
|
|
|
<li
|
|
|
|
v-for="widget in widgetTools"
|
|
|
|
v-for="widget in widgetTools"
|
|
|
|
:key="widget.code"
|
|
|
|
:key="widget.code"
|
|
|
|
@end="evt => widgetOnDragged(evt, widget.code)"
|
|
|
|
draggable="true"
|
|
|
|
|
|
|
|
@dragstart="dragStart(widget.code)"
|
|
|
|
|
|
|
|
@dragend="dragEnd()"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div class="tools-item">
|
|
|
|
<div class="tools-item">
|
|
|
|
<span class="tools-item-icon">
|
|
|
|
<span class="tools-item-icon">
|
|
|
@ -27,7 +29,7 @@
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<span class="tools-item-text">{{ widget.label }}</span>
|
|
|
|
<span class="tools-item-text">{{ widget.label }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</draggable>
|
|
|
|
</li>
|
|
|
|
</el-tab-pane>
|
|
|
|
</el-tab-pane>
|
|
|
|
<!-- 左侧图层-->
|
|
|
|
<!-- 左侧图层-->
|
|
|
|
<el-tab-pane label="图层">
|
|
|
|
<el-tab-pane label="图层">
|
|
|
@ -197,7 +199,7 @@
|
|
|
|
'background-origin': 'initial',
|
|
|
|
'background-origin': 'initial',
|
|
|
|
'background-clip': 'initial'
|
|
|
|
'background-clip': 'initial'
|
|
|
|
}"
|
|
|
|
}"
|
|
|
|
@click.self="setOptionsOnClickScreen"
|
|
|
|
@click.self="setOptionsOnClickScreen" @drop="widgetOnDragged($event)" @dragover="dragOver($event)"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div v-if="grade" class="bg-grid"></div>
|
|
|
|
<div v-if="grade" class="bg-grid"></div>
|
|
|
|
<widget
|
|
|
|
<widget
|
|
|
@ -330,6 +332,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 大屏的标记
|
|
|
|
// 大屏的标记
|
|
|
|
screenCode: "",
|
|
|
|
screenCode: "",
|
|
|
|
|
|
|
|
dragWidgetCode:'', //从工具栏拖拽的组件code
|
|
|
|
// 大屏画布中的组件
|
|
|
|
// 大屏画布中的组件
|
|
|
|
widgets: [
|
|
|
|
widgets: [
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -660,14 +663,24 @@ export default {
|
|
|
|
getPXUnderScale(px) {
|
|
|
|
getPXUnderScale(px) {
|
|
|
|
return this.bigscreenScaleInWorkbench * px;
|
|
|
|
return this.bigscreenScaleInWorkbench * px;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
dragStart( widgetCode) {
|
|
|
|
|
|
|
|
this.dragWidgetCode =widgetCode;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
dragEnd() {
|
|
|
|
|
|
|
|
this.dragWidgetCode=''
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
dragOver(evt){
|
|
|
|
|
|
|
|
evt.preventDefault()
|
|
|
|
|
|
|
|
evt.stopPropagation()
|
|
|
|
|
|
|
|
evt.dataTransfer.dropEffect = 'copy'
|
|
|
|
|
|
|
|
},
|
|
|
|
// 拖动一个组件放到工作区中去,在拖动结束时,放到工作区对应的坐标点上去
|
|
|
|
// 拖动一个组件放到工作区中去,在拖动结束时,放到工作区对应的坐标点上去
|
|
|
|
widgetOnDragged(evt, widgetCode) {
|
|
|
|
widgetOnDragged(evt) {
|
|
|
|
let widgetType = widgetCode;
|
|
|
|
let widgetType = this.dragWidgetCode;
|
|
|
|
|
|
|
|
|
|
|
|
// 获取结束坐标和列名
|
|
|
|
// 获取结束坐标和列名
|
|
|
|
let eventX = evt.originalEvent.clientX; // 结束在屏幕的x坐标
|
|
|
|
let eventX = evt.clientX; // 结束在屏幕的x坐标
|
|
|
|
let eventY = evt.originalEvent.clientY; // 结束在屏幕的y坐标
|
|
|
|
let eventY = evt.clientY; // 结束在屏幕的y坐标
|
|
|
|
|
|
|
|
|
|
|
|
let workbenchPosition = this.getDomTopLeftById("workbench");
|
|
|
|
let workbenchPosition = this.getDomTopLeftById("workbench");
|
|
|
|
let widgetTopInWorkbench = eventY - workbenchPosition.top;
|
|
|
|
let widgetTopInWorkbench = eventY - workbenchPosition.top;
|
|
|
|