diff --git a/src/api/rpTools.js b/src/api/rpTools.js index e6837c471..247073215 100644 --- a/src/api/rpTools.js +++ b/src/api/rpTools.js @@ -84,6 +84,16 @@ export function modifyRpArea(areaNo, data) { }) } +/** + * 修改区域文字 + */ +export function modifyAreaNote(areaNo, data) { + return request({ + url: `/api/rpTools/${areaNo}/text`, + method: 'put', + data + }) +} /** * 删除区域 */ @@ -105,7 +115,6 @@ export function justTripNoRunning(tripNo, data) { }) } - /** * 修改停站时间 */ @@ -118,14 +127,33 @@ export function justTripNoStop(tripNo, data) { } /** - * 平移车次 + * 修改折返时间 */ -export function translateTrip(tripNo, data) { +export function justTripTurnBack(tripNo, data) { return request({ - url: `/api/rpTools/${tripNo}/trip`, + url: `/api/rpTools/${tripNo}/turnBack`, method: 'put', data }) } +/** + * 平移服务 + */ +export function translateService(serviceNo, data) { + return request({ + url: `/api/rpTools/${serviceNo}/service`, + method: 'put', + data + }) +} +/** + * 删除服务 + */ +export function deleteService(serviceNo) { + return request({ + url: `/api/rpTools/${serviceNo}/service`, + method: 'delete' + }) +} diff --git a/src/jmapNew/theme/aus_00/planConvert copy.js b/src/jmapNew/theme/aus_00/planConvert copy.js index e70629e38..6471969a0 100644 --- a/src/jmapNew/theme/aus_00/planConvert copy.js +++ b/src/jmapNew/theme/aus_00/planConvert copy.js @@ -32,7 +32,7 @@ export default { graphs.push({ type: 'rect', - subType: 'Area', + subType: 'area', areaNo: area.areaNo, position, point1, diff --git a/src/jmapNew/theme/aus_00/planConvert--.js b/src/jmapNew/theme/aus_00/planConvert--.js index 0bd3bbd02..9696965ab 100644 --- a/src/jmapNew/theme/aus_00/planConvert--.js +++ b/src/jmapNew/theme/aus_00/planConvert--.js @@ -32,7 +32,7 @@ export default { graphs.push({ type: 'rect', - subType: 'Area', + subType: 'area', areaNo: el.areaNo, position, point1, diff --git a/src/jmapNew/theme/aus_00/utils.js b/src/jmapNew/theme/aus_00/utils.js index 95a1a4fa6..09d2bc119 100644 --- a/src/jmapNew/theme/aus_00/utils.js +++ b/src/jmapNew/theme/aus_00/utils.js @@ -47,7 +47,7 @@ export function createSeriesModel(opt, lineStyle={}, itemStyle={}) { export function createRectArea(opt, style={}) { return { type: 'rect', - subType: 'Area', + subType: 'area', areaNo: opt.model.areaNo, position: opt.position, point1: opt.point1, diff --git a/src/views/planMonitor/editToolAUS - 副本/dialog/planJustRunning.vue b/src/views/planMonitor/editToolAUS - 副本/dialog/planJustRunning.vue deleted file mode 100644 index 7f906c7bc..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/dialog/planJustRunning.vue +++ /dev/null @@ -1,103 +0,0 @@ - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/dialog/planJustStop.vue b/src/views/planMonitor/editToolAUS - 副本/dialog/planJustStop.vue deleted file mode 100644 index 6cb994155..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/dialog/planJustStop.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/dialog/planModifyArea.vue b/src/views/planMonitor/editToolAUS - 副本/dialog/planModifyArea.vue deleted file mode 100644 index cf07414f4..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/dialog/planModifyArea.vue +++ /dev/null @@ -1,158 +0,0 @@ - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue b/src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue deleted file mode 100644 index 55b4f9dd0..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue +++ /dev/null @@ -1,127 +0,0 @@ - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/index.vue b/src/views/planMonitor/editToolAUS - 副本/index.vue deleted file mode 100644 index 355721fef..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/index.vue +++ /dev/null @@ -1,429 +0,0 @@ - - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/menus.vue b/src/views/planMonitor/editToolAUS - 副本/menus.vue deleted file mode 100644 index 71cea6157..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/menus.vue +++ /dev/null @@ -1,140 +0,0 @@ - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/monitor.js b/src/views/planMonitor/editToolAUS - 副本/monitor.js deleted file mode 100644 index a106172ef..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/monitor.js +++ /dev/null @@ -1,369 +0,0 @@ -import echarts from 'echarts'; -import * as utils from './utils' -import { MenuEnum } from './utils'; - -export default { - data() { - return { - callRegister: [], - markList: [], - buildModel: { - endStationCode: '', - startStationCode: '', - startTime: 0, - endTime: 0 - }, - selected: null, - target: null, - dragging: false - } - }, - watch: { - myChart: function() { - this.listenersBind(); - } - }, - beforeDestroy() { - this.listenersOff(); - }, - methods: { - pixelExecCb(e, cb) { - const event = e.componentType ? e.event: e; - const pointInPixel = [event.offsetX, event.offsetY] - if (this.myChart.containPixel('grid', pointInPixel) && this.planUtil) { - const pointInGrid = this.myChart.convertFromPixel({seriesIndex:0},pointInPixel); - const xIndex = pointInGrid[0]; - const yIndex = pointInGrid[1]; - const option = this.myChart.getOption(); - const minY = option.yAxis[0].min; - const xVal = option.xAxis[0].data[xIndex]; - const yObj = this.planUtil.getStationByCoordinate(this.stations, yIndex-minY); - if (yObj && cb) { - cb({yObj, xVal, pointInPixel, e}); - } - } - }, - listenersBind() { - if (this.myChart) { - const zr = this.myChart.getZr(); - - zr.on('mousedown', this.onZrMouseDown, this); - zr.on('mouseup', this.onZrMouseUp, this); - this.myChart.on('mousedown', this.onMouseDown); - this.myChart.on('mouseover', this.onMouseOver); - this.myChart.on('mouseout', this.onMouseOut); - this.myChart.on('mouseup', this.onMouseUP); - this.myChart.on('datazoom', this.onUpdatePosition); - window.addEventListener('resize', this.onUpdatePosition); - } - }, - listenersOff() { - if (this.myChart) { - const zr = this.myChart.getZr(); - - zr.off('mousedown', this.onZrMouseDown); - zr.off('mouseup', this.onZrMouseUp, this); - this.myChart.off('mousedown', this.onMouseDown); - this.myChart.off('mouseover', this.onMouseOver); - this.myChart.off('mouseout', this.onMouseOut); - this.myChart.off('mouseup', this.onMouseUP); - this.myChart.off('datazoom', this.onUpdatePosition); - window.removeEventListener('resize', this.onUpdatePosition); - } - }, - onUpdatePosition(e) { - const fixedList = ['Area']; - const option = this.myChart.getOption(); - const elements = option.graphic[0].elements - const graphic = echarts.util.map(elements, (el) => { - if (fixedList.includes(el.subType)) { - const position = this.myChart.convertToPixel('grid', el.point1); - const position2 = this.myChart.convertToPixel('grid', el.point2); - const width = Math.abs(position[0] - position2[0]); - const height = Math.abs(position[1] - position2[1]) - - return { - position, - shape: { width, height } - } - } else { - return { - position: this.myChart.convertToPixel('grid', el.point) - }; - } - }) - - this.myChart.setOption({graphic}); - }, - onZrMouseDown(e) { - if (e.target && ['Area'].includes(e.target.subType)) { - this.target = e.target; - this.$emit('tag', this.target); - if (this.model.choice == 'Construction') { - if (this.model.action == 'Edit') { - this.pixelExecCb(e, this.handlePopDialog); - } - } - } - - if (this.model.choice == 'Plan') { - if (this.model.action == 'Add') { - this.pixelExecCb(e, this.onCreateMark); - } - } else if (this.model.choice == 'Construction') { - if (this.model.action == 'Add') { - this.pixelExecCb(e, this.onCreateArea); - } - } - - if (!e.target) { - this.setLineReset(); - this.$emit('tag', null); - this.$emit('select', null); - } - }, - onZrMouseUp(e) { - if (['Plan', 'Construction'].includes(this.model.choice)) { - if(this.model.action == 'Translate' && this.dragging) { - this.dragging = false; - this.pixelExecCb(e, this.onTranslate) - } - } - }, - onMouseDown(e) { - if (this.model.choice == 'Plan') { - if (this.model.action == 'Edit') { - this.pixelExecCb(e, this.handlePopDialog); - } - } - }, - onMouseOver(e) { - this.pixelExecCb(e, ({e, pointInPixel}) => { - if (this.model.choice == 'Plan') { - this.handleSelectLine({e}); - if (this.model.action == 'Translate') { - this.onCreateDrag({e, pointInPixel}) - } - } - }); - - if (this.model.choice == 'Plan') { - if (this.model.action == 'Translate') { - setTimeout(_ => { this.onShapeMouseOver(e); }, 200); - } - } - }, - onMouseOut(e) { - this.pixelExecCb(e, ({e, pointInPixel}) => { - if (this.model.choice == 'Plan') { - this.handleSelectLine({e}); - if(this.model.action == 'Translate') { - this.onCreateDrag({e, pointInPixel}) - } - } - }); - - if (this.model.choice == 'Plan') { - if (this.model.action == 'Translate') { - this.onShapeMouseOver(e); - } - } - }, - onMouseUP(e) { - }, - onShapeDragging(e) { - if (this.selected) { - this.dragging = true; - if (this.model.choice == 'Plan') { - if (this.model.action == 'Translate') { - this.pixelExecCb(e, this.handleSeriesDragging); - } - } else if (this.model.choice == 'Construction') { - if (this.model.action == 'Translate') { - this.pixelExecCb(e, this.handleAreaDragging); - } - } - } - }, - onShapeMouseOver() { - if (this.selected) { - this.myChart.dispatchAction({ - type: 'showTip', - seriesIndex: this.selected.seriesIndex, - dataIndex: this.selected.dataIndex - }); - } - }, - onShapeMouseOut() { - if (this.selected) { - this.myChart.dispatchAction({ - type: 'hideTip', - }); - } - }, - onCreateDrag({e, pointInPixel}) { - if (this.selected) { - const option = this.myChart.getOption(); - const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'}); - filters.push(utils.buildDragDataObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this)) - option.graphic[0].elements = filters; - - this.myChart.setOption(option, {notMerge: true}); - - this.myChart.dispatchAction({ - type: 'showTip', - seriesIndex: this.selected.seriesIndex, - dataIndex: this.selected.dataIndex - }); - } - }, - onCreateMark({e, pointInPixel, yObj, xVal}) { - const option = this.myChart.getOption(); - const graphic = option.graphic; - const elements = graphic[0].elements; - - elements.push(utils.buildMarkPointObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this)) - - this.myChart.setOption(option, {notMerge: true}); - - const markList = this.markList = elements.filter(el => { return el.subType == 'mark'}); - const elemList = elements.filter(el => { return el.subType != 'mark'}); - - if (markList.length == 1) { - this.buildModel.startStationCode = yObj.code; - this.buildModel.startTime = xVal; - } else if (markList.length >= 2) { - this.buildModel.endStationCode = yObj.code; - this.buildModel.endTime = xVal; - option.graphic[0].elements = elemList; - this.$emit('create', this.buildModel); - } - }, - onCreateArea({e, pointInPixel, yObj, xVal}) { - if (!e.target) { - const option = this.myChart.getOption(); - const graphic = option.graphic; - const elements = graphic[0].elements; - - elements.push(utils.buildMarkPointObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this)) - - this.myChart.setOption(option, {notMerge: true}); - - const markList = this.markList = elements.filter(el => { return el.subType == 'mark'}); - const elemList = elements.filter(el => { return el.subType != 'mark'}); - - if (markList.length == 1) { - this.buildModel.startStationCode = yObj.code; - this.buildModel.startTime = xVal; - } else if (markList.length >= 2) { - this.buildModel.endStationCode = yObj.code; - this.buildModel.endTime = xVal; - option.graphic[0].elements = elemList; - this.$emit('create', this.buildModel); - } - } - }, - handlePopDialog({e, pointInPixel}) { - const point = { - x: pointInPixel[0], - y: pointInPixel[1] - } - - if (e.componentType == "series" && - e.componentSubType == "line" && - e.seriesName.includes('plan-')) { - - const option = this.myChart.getOption(); - const dataList = option.series[e.seriesIndex].data; - const length = dataList.length; - const nxt = dataList[e.dataIndex+1]; - const pre = dataList[e.dataIndex-1]; - const value = e.value; - - this.selected = { - dataIndex: e.dataIndex, - seriesIndex: e.seriesIndex, - seriesName: e.seriesName, - seriesId: e.seriesId, - depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - ...e.value[2], - _x: value[0], - dx: 0, - time: 0, - } - this.$emit('select', this.selected); - - if (e.dataIndex < length - 1 && value[1] == nxt[1]) { - this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustStop }); - } else if (e.dataIndex == 0 || e.dataIndex > 0 && value[1] == pre[1]) { - this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustRunning }); - } - } else if (e.target && e.target.subType == 'Area') { - this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planModifyArea }); - } - }, - handleSelectLine({e}) { - if (e.componentType == "series" && - e.componentSubType == "line" && - e.seriesName.includes('plan-')) { - const value = e.value; - const option = this.myChart.getOption(); - const dataList = option.series[e.seriesIndex].data; - const length = dataList.length; - const nxt = dataList[e.dataIndex+1]; - const pre = dataList[e.dataIndex-1]; - - if (this.selected && - this.selected.seriesName != e.seriesName) { - this.setLineReset(); - } - - this.selected = { - dataIndex: e.dataIndex, - seriesIndex: e.seriesIndex, - seriesName: e.seriesName, - seriesId: e.seriesId, - depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - ...e.value[2], - _x: value[0], - dx: 0, - time: 0 - } - this.$emit('select', this.selected); - - this.setLineLight(); - } - }, - handleSeriesDragging({e, xVal}) { - if (this.selected) { - this.selected.dx = xVal - this.selected._x; - this.selected.time += this.selected.dx; - this.selected._x = xVal; - - const option = this.myChart.getOption(); - const model = option.series[this.selected.seriesIndex] - model.data.forEach(el => { - el[0] += this.selected.dx; - }); - model.markPoint.data.forEach(el => { - el.coord[0] += this.selected.dx; - }) - - if (e.target && - e.target.point && - e.target.position) { - e.target.point[0] += this.selected.dx; - } - - this.myChart.setOption(option, {notMerge: true}); - } - }, - handleAreaDragging({e, xVal}) { - }, - onTranslate({e}) { - this.$emit('translate'); - } - } -} diff --git a/src/views/planMonitor/editToolAUS - 副本/schedule.vue b/src/views/planMonitor/editToolAUS - 副本/schedule.vue deleted file mode 100644 index c4da7b746..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/schedule.vue +++ /dev/null @@ -1,382 +0,0 @@ - - - - diff --git a/src/views/planMonitor/editToolAUS - 副本/utils.js b/src/views/planMonitor/editToolAUS - 副本/utils.js deleted file mode 100644 index d8cbdc10b..000000000 --- a/src/views/planMonitor/editToolAUS - 副本/utils.js +++ /dev/null @@ -1,46 +0,0 @@ -import echarts from 'echarts'; - -export const MenuEnum = { - planJustRunning: '1000', - planJustStop: '1001', - planSetParams: '1002', - planModifyArea: '1003' -} - -export function buildDragDataObj(position, point, that) { - return { - type: 'circle', - subType: 'drag', - position: [...position], - point: [...point], - shape: { - cx: 0, - cy: 0, - r: 10 - }, - invisible: true, - draggable: 'horizontal', - ondrag: echarts.util.curry(that.onShapeDragging), - onmouseover: echarts.util.curry(that.onShapeMouseOver), - onmouseout: echarts.util.curry(that.onShapeMouseOut), - z: 100 - } -} - -export function buildMarkPointObj(position, point, that) { - return { - type: 'circle', - subType: 'mark', - z: 100, - position: [...position], - point: [...point], - shape: { - cx: 0, - cy: 0, - r: 10 - }, - style: { - fill: 'rgba(0,0,0,0.3)' - } - } -} diff --git a/src/views/planMonitor/editToolAUS/dialog/planSetAreaNote.vue b/src/views/planMonitor/editToolAUS/dialog/planSetAreaNote.vue index e3448349f..c51fe0249 100644 --- a/src/views/planMonitor/editToolAUS/dialog/planSetAreaNote.vue +++ b/src/views/planMonitor/editToolAUS/dialog/planSetAreaNote.vue @@ -31,10 +31,6 @@ export default { dialogShow: false, formModel: { areaNo: '', - fartherStationCode: '', - closerStationCode: '', - startTime: '', - endTime: '', text: '' }, } @@ -55,10 +51,6 @@ export default { const model = this.target.model; this.formModel = { areaNo: model.areaNo, - fartherStationCode: model.fartherStationCode, - closerStationCode: model.closerStationCode, - startTime: model.startTime, - endTime: model.endTime, text: model.text }; } diff --git a/src/views/planMonitor/editToolAUS/index.vue b/src/views/planMonitor/editToolAUS/index.vue index b0a1d16e4..531d5f1da 100644 --- a/src/views/planMonitor/editToolAUS/index.vue +++ b/src/views/planMonitor/editToolAUS/index.vue @@ -55,9 +55,9 @@ import { getStationList } from '@/api/runplan'; import { getRpTools, clearRpPlan, addRpTrip, delRpTrip, justTripNoRunning, justTripNoStop, - translateTrip, + translateService, getRpConfig, modifyRpConfig, - createRpArea, modifyRpArea, delRpArea + createRpArea, modifyRpArea, modifyAreaNote, delRpArea } from '@/api/rpTools'; export default { @@ -161,8 +161,14 @@ export default { this.selected = null; this.target = null; this.$refs.schedule.setLineReset(); - this.$refs.schedule.clearGraphic(); this.$refs.schedule.clearTrip(); + if (this.model.action != 'Translate') { + this.$refs.schedule.clearDraggable(); + } + + if (this.model.action != 'Add') { + this.$refs.schedule.clearGraphic(); + } }, onDialog(menu) { this.$store.dispatch('menuOperation/setPopMenu', { position: {x: 0, y: 0}, menu }); @@ -186,7 +192,7 @@ export default { onTranslate(data) { switch(this.model.choice) { case 'Plan': - this.doTranslateTrip(data); + this.doTranslateService(data); break; case 'Construction': this.doTranslateArea(data); @@ -260,7 +266,11 @@ export default { }) }, doSetAreaNote(data) { - modifyRpArea(data.areaNo, data).then(resp => { + const model = { + text: data.text + } + + modifyAreaNote(data.areaNo, model).then(resp => { getRpTools().then(rest => { const planData = rest.data; this.$store.commit('rpTools/setPlanData', planData); @@ -366,13 +376,13 @@ export default { this.$refs.schedule.clearGraphic(['mark']); }) }, - doTranslateTrip() { + doTranslateService() { if (this.selected) { const model = { seconds : this.selected.sx } - translateTrip(this.selected.tripNo, model).then(resp => { + translateService(this.selected.serviceNo, model).then(resp => { getRpTools().then(rest => { const planData = rest.data; this.$store.commit('rpTools/setPlanData', planData); diff --git a/src/views/planMonitor/editToolAUS/menus.vue b/src/views/planMonitor/editToolAUS/menus.vue index 2dff36a23..7886c4990 100644 --- a/src/views/planMonitor/editToolAUS/menus.vue +++ b/src/views/planMonitor/editToolAUS/menus.vue @@ -129,17 +129,17 @@ export default { : ''; }, doSelChange() { - this.$emit('clear'); this.model.action = ''; + this.$emit('clear'); }, doBtnSelect(el, i) { if (this.option.radioList && this.model.action != el.value) { - this.$emit('clear') this.model.action = el.value; - } else { this.$emit('clear') + } else { this.model.action = ''; + this.$emit('clear') } } } diff --git a/src/views/planMonitor/editToolAUS/monitor.js b/src/views/planMonitor/editToolAUS/monitor.js index 7b6e4b6bf..689ea85e7 100644 --- a/src/views/planMonitor/editToolAUS/monitor.js +++ b/src/views/planMonitor/editToolAUS/monitor.js @@ -57,8 +57,8 @@ export default { this.myChart.on('mouseover', this.onMouseOver); this.myChart.on('mouseout', this.onMouseOut); this.myChart.on('mouseup', this.onMouseUP); - this.myChart.on('datazoom', this.onUpdatePosition); - window.addEventListener('resize', this.onUpdatePosition); + this.myChart.on('datazoom', this.onUpdateZoom); + window.addEventListener('resize', this.onUpdateZoom); } }, listenersOff() { @@ -73,12 +73,12 @@ export default { this.myChart.off('mouseover', this.onMouseOver); this.myChart.off('mouseout', this.onMouseOut); this.myChart.off('mouseup', this.onMouseUP); - this.myChart.off('datazoom', this.onUpdatePosition); - window.removeEventListener('resize', this.onUpdatePosition); + this.myChart.off('datazoom', this.onUpdateZoom); + window.removeEventListener('resize', this.onUpdateZoom); } }, - onUpdatePosition(e) { - const fixedList = ['Area']; + onUpdateZoom(e) { + const fixedList = ['area']; const option = this.myChart.getOption(); const elements = option.graphic[0].elements const graphic = echarts.util.map(elements, (el) => { @@ -104,38 +104,32 @@ export default { }, onZrMouseOver(e) { this.pixelExecCb(e, this.doSetTarget); - if (this.model.choice == 'Construction') { - if (this.model.action == 'Translate') { - this.pixelExecCb(e, this.doSetAreaTranslate); - } else if (this.model.action == 'Edit') { - this.pixelExecCb(e, this.doClrAreaDrags); - } - } }, onZrMouseDown(e) { - if (e.target && ['Area'].includes(e.target.subType)) { - this.onZrMouseOver(e); + if (e.target && ['area'].includes(e.target.subType)) { this.dragging = true; if (this.model.choice == 'Construction') { if (this.model.action == 'Note') { this.pixelExecCb(e, this.doPopDialog); } } - } else { - if (this.model.choice == 'Plan') { - if (this.model.action == 'Add') { - this.pixelExecCb(e, this.doCreateMark); - } else { - this.$emit('clear') - } - } else if (this.model.choice == 'Construction') { - if (this.model.action == 'Add') { - this.pixelExecCb(e, this.doCreateArea); - } else { - this.$emit('clear') - } - } else { - this.$emit('clear') + } + + if (!e.target) { + this.$emit('clear') + } + + if (this.model.choice == 'Plan') { + if (this.model.action == 'Add') { + this.pixelExecCb(e, this.doCreateMark); + } + } else if (this.model.choice == 'Construction') { + if (this.model.action == 'Add') { + this.pixelExecCb(e, this.doCreateArea); + } else if (this.model.action == 'Translate') { + this.pixelExecCb(e, this.doSetAreaTranslate); + } else if (this.model.action == 'Edit') { + this.pixelExecCb(e, this.doSetAreaDrags); } } }, @@ -148,13 +142,6 @@ export default { this.dragging = false; }, onZrMouseOut(e) { - if (this.model.choice == 'Construction') { - if (this.model.action == 'Translate') { - this.pixelExecCb(e, this.doClrAreaTranslate); - } else if (this.model.action == 'Edit') { - this.pixelExecCb(e, this.doClrAreaDrags); - } - } }, onMouseOver(e) { this.pixelExecCb(e, args => { @@ -180,6 +167,14 @@ export default { } } }, + onMouseUP(e) { + if (['Construction'].includes(this.model.choice)) { + if(this.model.action == 'Translate' && this.dragging) { + this.pixelExecCb(e, this.doTranslate) + this.dragging = false; + } + } + }, onMouseOut(e) { this.pixelExecCb(e, args => { if (this.model.choice == 'Plan') { @@ -189,20 +184,6 @@ export default { } } }); - - if (this.model.choice == 'Plan') { - if (this.model.action == 'Translate') { - this.onShapeMouseOver(e); - } - } - }, - onMouseUP(e) { - if (['Construction'].includes(this.model.choice)) { - if(this.model.action == 'Translate' && this.dragging) { - this.pixelExecCb(e, this.doTranslate) - this.dragging = false; - } - } }, onShapeMouseOver(e) { if (this.selected) { @@ -234,7 +215,10 @@ export default { } }, doCreateDrag({e, pointInGrid, pointInPixel}) { - if (this.selected) { + 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'}); filters.push(utils.buildDragDataObj(pointInPixel, pointInGrid, this)) @@ -295,7 +279,7 @@ export default { } }, doSetTarget({e, pointInGrid}) { - if (e.target && ['Area'].includes(e.target.subType)) { + if (e.target && ['area'].includes(e.target.subType)) { const target = e.target; const model = target.model Object.assign(model, { @@ -371,33 +355,20 @@ export default { } }, doSetAreaTranslate({e}) { - if (e.target && ['Area'].includes(e.target.subType)) { + if (e.target && ['area'].includes(e.target.subType)) { const option = this.myChart.getOption(); - const shape = option.graphic[0].elements.find(el => { return ['Area'].includes(el.subType) && el.areaNo == this.target.areaNo; }); + const shape = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.areaNo == this.target.areaNo; }); Object.assign(shape, { draggable: true, ondrag: echarts.util.curry(this.onShapeDragging) }) - this.myChart.setOption(option); - } - }, - doClrAreaTranslate({e}) { - if (e.target && ['Area'].includes(e.target.subType)) { - const option = this.myChart.getOption(); - const shape = option.graphic[0].elements.find(el => { return ['Area'].includes(el.subType) && el.areaNo == this.target.areaNo; }); - Object.assign(shape, { - draggable: false - }) - this.myChart.setOption(option); + this.myChart.setOption(option, {notMerge: true}); } }, doSetAreaDrags({e}) { console.log('set drag') }, - doClrAreaDrags({e}) { - console.log('clr drag') - }, doPopDialog({e, pointInGrid, pointInPixel}) { const point = { x: pointInPixel[0], @@ -421,7 +392,7 @@ export default { } else if (e.dataIndex == 0 || e.dataIndex > 0 && e.value[1] == prev[1]) { this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustRunning }); } - } else if (e.target && e.target.subType == 'Area') { + } else if (e.target && e.target.subType == 'area') { this.doSetTarget({e, pointInGrid}) if (this.model.action == 'Note') { @@ -465,11 +436,9 @@ export default { } }, doAreaDragging({e, pointInGrid}) { - if (this.target && ['Area'].includes(this.target.subType) && this.dragging) { + if (this.target && ['area'].includes(this.target.subType) && this.dragging) { const model = this.target.model; - if (model.sx == undefined || model.sy == undefined) { - this.onZrMouseOver(e); - } else { + if (model.sx != undefined && model.sy != undefined) { model.dx = pointInGrid[0] - model._x; model.dy = pointInGrid[1] - model._y; model.sx += model.dx; @@ -480,7 +449,7 @@ export default { } }, doTranslate({e}) { - if (this.target && ['Area'].includes(this.target.subType)) { + if (this.target && ['area'].includes(this.target.subType)) { const model = this.target.model; const sx = model.sx||0; const sy = model.sy||0; diff --git a/src/views/planMonitor/editToolAUS/schedule.vue b/src/views/planMonitor/editToolAUS/schedule.vue index 7971474ff..af7a05d5f 100644 --- a/src/views/planMonitor/editToolAUS/schedule.vue +++ b/src/views/planMonitor/editToolAUS/schedule.vue @@ -371,6 +371,19 @@ export default { const option = this.myChart.getOption(); const elements = option.graphic[0].elements; option.graphic[0].elements = elements.filter(el => { return !labels.includes(el.subType)}); + this.myChart.setOption(option, {notMerge: true}); + }, + clearDraggable(labels=['drag', 'area']) { + const option = this.myChart.getOption(); + const elements = option.graphic[0].elements; + const elemList = elements.filter(el => { return labels.includes(el.subType)}); + + elemList.forEach(el => { + el.draggable = false; + el.ondrag = null; + el.onmousemove = null; + }) + this.myChart.setOption(option, {notMerge: true}); } } diff --git a/src/views/planMonitor/editToolAUS/utils.js b/src/views/planMonitor/editToolAUS/utils.js index 4a7cbb0c5..82a033101 100644 --- a/src/views/planMonitor/editToolAUS/utils.js +++ b/src/views/planMonitor/editToolAUS/utils.js @@ -21,8 +21,8 @@ export function buildDragDataObj(position, point, that) { }, invisible: true, draggable: 'horizontal', - ondrag: echarts.util.curry(that.onShapeDragging), onmouseover: echarts.util.curry(that.onShapeMouseOver), + ondrag: echarts.util.curry(that.onShapeDragging), onmouseout: echarts.util.curry(that.onShapeMouseOut), z: 100 }