From 0516f856ef75a2d032d8f5a0854e6136f43aaf9d Mon Sep 17 00:00:00 2001 From: lVAL Date: Fri, 23 Oct 2020 17:48:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/planMonitor/editToolAUS/monitor.js | 83 +++++++++---------- .../planMonitor/editToolAUS/schedule.vue | 28 ++++++- src/views/planMonitor/editToolAUS/utils.js | 4 +- 3 files changed, 63 insertions(+), 52 deletions(-) diff --git a/src/views/planMonitor/editToolAUS/monitor.js b/src/views/planMonitor/editToolAUS/monitor.js index c3f8bab88..6212912dd 100644 --- a/src/views/planMonitor/editToolAUS/monitor.js +++ b/src/views/planMonitor/editToolAUS/monitor.js @@ -106,33 +106,23 @@ export default { }, onZrMouseOver(e) { this.pixelExecCb(e, args => { - if (this.model.choice == 'Plan') { - this.doSetSelected(args); - } - if (this.model.choice == 'Construction') { + this.doSetTarget(args); if (this.model.action == 'Translate') { - this.doSetTarget(args); this.doSetAreaTranslate(args); } else if (this.model.action == 'Edit') { - this.doSetTarget(args); this.doSetAreaHorns(args); } } }); }, onZrMouseDown(e) { + this.dragging = false; this.pixelExecCb(e, args => { if (this.model.choice == 'Plan') { if (this.model.action == 'Add') { this.doCreateMark(args); - } else if (this.model.action == 'Translate') { - this.doSetSelected(args); - this.doCreateDrag(args); - } else if (this.model.action == 'Edit') { - this.doSetSelected(args); } - } else if (this.model.choice == 'Construction') { if (this.model.action == 'Add') { this.doCreateArea(args); @@ -153,18 +143,15 @@ export default { }, onZrMouseUp(e) { this.pixelExecCb(e, args => { - if (this.dragging) { - this.dragging = false; - if(this.model.choice == 'Plan') { - if (this.model.action == 'Translate') { - this.doTranslate(args); - } - } else if(this.model.choice == 'Construction') { - if (this.model.action == 'Translate') { - this.doTranslate(args); - } else if (this.model.action == 'Edit') { - this.doTranslate(args); - } + if(this.model.choice == 'Plan') { + if (this.model.action == 'Translate') { + this.doTranslate(args); + } + } else if(this.model.choice == 'Construction') { + if (this.model.action == 'Translate') { + this.doTranslate(args); + } else if (this.model.action == 'Edit') { + this.doTranslate(args); } } }); @@ -174,7 +161,10 @@ export default { onMouseOver(e) { this.pixelExecCb(e, args => { if (this.model.choice == 'Plan') { + this.doSetSelected(args); if (this.model.action == 'Translate') { + this.doSetDrag(args); + this.doCreateDrag(args); setTimeout(_ => { this.onShapeMouseOver(e); }, 200); } } @@ -183,6 +173,7 @@ export default { onMouseDown(e) { this.pixelExecCb(e, args => { if (this.model.choice == 'Plan') { + this.doSetSelected(args); if (this.model.action == 'Edit') { this.doPopDialog(args); } @@ -195,8 +186,8 @@ export default { this.pixelExecCb(e, args => { if (this.model.choice == 'Plan') { this.doSetSelected(args); - if(this.model.action == 'Translate') { - this.doCreateDrag(args) + if (this.model.action == 'Translate') { + this.doCreateDrag(args); } } }); @@ -218,7 +209,9 @@ export default { this.doSeriesDragging(args); } } - } else if (this.target) { + } + + if (this.target) { if (this.model.choice == 'Construction') { if (this.model.action == 'Translate') { this.doAreaDragging(args); @@ -254,6 +247,17 @@ export default { }); } }, + doClearDrag({e}) { + if (this.selected && + e.componentType == "series" && + e.componentSubType == "line" && + e.seriesName.includes('service')) { + const option = this.myChart.getOption(); + const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'}); + option.graphic[0].elements = filters; + this.myChart.setOption(option, {notMerge: true}); + } + }, doCreateMark({e, pointInGrid, pointInPixel, yObj}) { const option = this.myChart.getOption(); const graphic = option.graphic; @@ -322,7 +326,8 @@ export default { _y: pointInGrid[1] }) - if (this.target && this.target.name != e.target.name) { + if (this.target && + this.target.model.areaNo != e.target.model.areaNo) { this.setTargetReset(); } @@ -467,6 +472,7 @@ export default { const option = this.myChart.getOption(); const model = option.series[this.selected.seriesIndex] + model.data.forEach(el => { if (el instanceof Array) { el[0] += this.selected.dx; @@ -586,23 +592,10 @@ export default { } }, doTranslate({e}) { - this.$emit('translate'); - }, - calcHornList(elemList, graph) { - const p = graph.position; - const w = graph.shape.width; - const h = graph.shape.height; - const point1 = [p[0], p[1]]; - const point2 = [p[0]+w, p[1]]; - const point3 = [p[0]+w, p[1]+h]; - const point4 = [p[0], p[1]+h]; - - elemList.push(utils.buildHornDataObj(point1, this.myChart.convertFromPixel('grid', point1), this, 'horn-1')); - elemList.push(utils.buildHornDataObj(point2, this.myChart.convertFromPixel('grid', point2), this, 'horn-2')); - elemList.push(utils.buildHornDataObj(point3, this.myChart.convertFromPixel('grid', point3), this, 'horn-3')); - elemList.push(utils.buildHornDataObj(point4, this.myChart.convertFromPixel('grid', point4), this, 'horn-4')); - - return elemList; + if (this.dragging) { + this.dragging = false; + this.$emit('translate'); + } } } } diff --git a/src/views/planMonitor/editToolAUS/schedule.vue b/src/views/planMonitor/editToolAUS/schedule.vue index 450690f5a..bd2332e30 100644 --- a/src/views/planMonitor/editToolAUS/schedule.vue +++ b/src/views/planMonitor/editToolAUS/schedule.vue @@ -11,6 +11,7 @@