解决大屏拖拽卡顿的问题

This commit is contained in:
aixianling
2022-11-09 14:40:36 +08:00
parent 8e7a8488b3
commit d39f1d793b
2 changed files with 22 additions and 30 deletions

View File

@@ -48,14 +48,13 @@
v-model="dashboard.presetLine"
class="vueRuler"
:step-length="50"
:parent="true"
:position="'relative'"
:is-scale-revise="true"
parent
is-scale-revise
position="relative"
:visible.sync="dashboard.presetLineVisible">
<div
id="workbench"
class="workbench"
:style="{
<div id="workbench"
class="workbench"
:style="{
transform: workbenchTransform,
width: bigscreenWidth + 'px',
height: bigscreenHeight + 'px'
@@ -80,8 +79,8 @@
:class="[activeIndex === index ? 'drag-active' : '']"
class="draggable"
@contextmenu.native.stop="e => onContextmenu(e, index)"
@dragging="(x, y) => onDrag(x, y, index)"
@resizing="(x, y, w, h) => onResizing(x, y, w, h, index, item.type)"
@dragstop="(x, y) => onDrag(x, y,item)"
@resizestop="(x, y, w, h) => onResizing(x, y, w, h, item)"
@activated="onActivated(index)"
@click.native.stop="activeIndex = index"
v-for="(item, index) in componentList"
@@ -587,22 +586,15 @@ export default {
onActivated(index) {
this.activeIndex = index
},
onDrag(x, y, index) {
this.$set(this.componentList[index], 'left', x)
this.$set(this.componentList[index], 'top', y)
onDrag(x, y, item) {
item.left = x
item.top = y
},
onResizing(x, y, w, h, index, type) {
this.$set(this.componentList[index], 'left', x)
this.$set(this.componentList[index], 'top', y)
this.$set(this.componentList[index], 'width', w)
this.$set(this.componentList[index], 'height', h)
if (type.indexOf('Chart') > -1) {
// this.$refs[`chart${index}`][0].watchResize()
}
onResizing(x, y, w, h, item) {
item.left = x
item.top = y
item.width = w
item.height = h
},
initCanvas() {
@@ -1052,6 +1044,7 @@ export default {
.draggable {
position: absolute;
border: none;
transition: none;
&::after {
position: absolute;

View File

@@ -122,14 +122,13 @@
import 'bin-code-editor/lib/styles/index.css'
export default {
name: 'dataCofing',
name: 'dataConfig',
props: {
options: Object,
instance: Function,
dict: Object,
params: Object,
urlPrefix: String
},
data () {
@@ -168,7 +167,7 @@
this.getDataList()
if ((this.options.dataY && this.options.dataY.length && this.options.dataX) || this.options.type === 'monitor') {
const api = this.options.dataType === 'apiData' ? this.options.api : `${this.urlPrefix}/appdiylargescreen/statisticsByLsid?id=${this.options.sourceDataId}`
const api = this.options.dataType === 'apiData' ? this.options.api : `/app/appdiylargescreen/statisticsByLsid?id=${this.options.sourceDataId}`
this.instance.post(api).then(res => {
if (res.code == 0) {
if (res.data.length && this.options.type !== 'monitor') {
@@ -201,7 +200,7 @@
},
onMoniterId (e) {
this.instance.post(`${this.urlPrefix}/appzyvideoequipment/getWebSdkUrl?deviceId=${e}`).then(res => {
this.instance.post(`/app/appzyvideoequipment/getWebSdkUrl?deviceId=${e}`).then(res => {
if (res.code == 0) {
this.options.src = JSON.parse(res.data).url
}
@@ -209,7 +208,7 @@
},
getDataList () {
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allDatasourceByPage`, null, {
this.instance.post(`/app/appdiylargescreen/allDatasourceByPage`, null, {
params: {
current: 1,
size: 10000
@@ -286,7 +285,7 @@
onDataChange (e) {
this.options.dataX = ''
this.options.dataY = []
this.instance.post(`${this.urlPrefix}/appdiylargescreen/statisticsByLsid?id=${e}`).then(res => {
this.instance.post(`/app/appdiylargescreen/statisticsByLsid?id=${e}`).then(res => {
if (res.code == 0) {
if (res.data.length) {
if (this.options.type === 'table') {