解决大屏拖拽卡顿的问题

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

View File

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