调整ibp盘流程

This commit is contained in:
zyy 2020-09-16 14:26:04 +08:00
parent 3ce1418f89
commit 64c322751c
7 changed files with 183 additions and 12 deletions

View File

@ -24,6 +24,8 @@ class IbpPan {
// 展示的画布大小 // 展示的画布大小
this.canvasSize = {}; this.canvasSize = {};
this.optsPan = {};
this.initIbpPage(opts); this.initIbpPage(opts);
} }
initIbpPage(opts) { initIbpPage(opts) {
@ -98,6 +100,7 @@ class IbpPan {
if (this.$options.disabled == true) { if (this.$options.disabled == true) {
this.$mouseController.disable(); this.$mouseController.disable();
} else { } else {
opts = Object.assign(opts, this.optsPan);
this.$mouseController.enable(opts); this.$mouseController.enable(opts);
} }
@ -199,6 +202,13 @@ class IbpPan {
this.$mouseController.setAllowDragging(true); this.$mouseController.setAllowDragging(true);
} }
setMoveOnMouseMove(data) {
this.$mouseController.setMoveOnMouseMove(data);
this.optsPan = {
moveOnMouseMove: data || false
};
}
pullBack(payload) { pullBack(payload) {
if (payload.type === 'zoom') { if (payload.type === 'zoom') {
const zrWidth = this.$ibpZr.getWidth(); const zrWidth = this.$ibpZr.getWidth();
@ -283,6 +293,9 @@ class IbpPan {
case this.events.DataZoom: case this.events.DataZoom:
this.$mouseController.on(this.events.DataZoom, cb, context); this.$mouseController.on(this.events.DataZoom, cb, context);
break; break;
case this.events.__Pan:
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
break;
} }
} }
} }
@ -300,6 +313,9 @@ class IbpPan {
case this.events.DataZoom: case this.events.DataZoom:
this.$mouseController.off(this.events.DataZoom, cb); this.$mouseController.off(this.events.DataZoom, cb);
break; break;
case this.events.__Pan:
this.$mouseController.off(this.events.__Pan, cb);
break;
} }
} }
} }

View File

@ -46,7 +46,7 @@ class MouseController extends Eventful {
this.enable = function (opts) { this.enable = function (opts) {
opts = opts || {}; opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true; this._moveOnMouseMove = opts.moveOnMouseMove || false;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true; this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.disable(); this.disable();
@ -83,6 +83,10 @@ class MouseController extends Eventful {
this.isAllowDragging = data; this.isAllowDragging = data;
} }
setMoveOnMouseMove(data) {
this._moveOnMouseMove = data;
}
mousedown(e) { mousedown(e) {
e.event.preventDefault(); e.event.preventDefault();
e.event.stopPropagation(); e.event.stopPropagation();
@ -232,6 +236,13 @@ class MouseController extends Eventful {
} }
/** 处理左键拖动事件--- 图形移动 */ /** 处理左键拖动事件--- 图形移动 */
handleMouseMoveLeft(e, dx, dy, oldX, oldY) { handleMouseMoveLeft(e, dx, dy, oldX, oldY) {
console.log(this._moveOnMouseMove);
if (this._dragging && this.eventTarget && this._moveOnMouseMove) {
if (( this.eventTarget._type == deviceType.Background)) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
}
}
if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) { if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) {
return; return;
} }
@ -241,10 +252,7 @@ class MouseController extends Eventful {
item.grouper.drift(dx, dy, e); item.grouper.drift(dx, dy, e);
}); });
} else if (this._dragging && this.eventTarget) { // 选中元素图形移动 } else if (this._dragging && this.eventTarget) { // 选中元素图形移动
if (( this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) { if (this.isAllowDragging && this.eventTarget.grouper) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (this.isAllowDragging) {
this.eventTarget.grouper.drift(dx, dy, e); this.eventTarget.grouper.drift(dx, dy, e);
} }
} }

View File

@ -281,7 +281,7 @@ export const publicAsyncRoute = [
}, },
{ {
path: '/ibpShow', path: '/ibpShow',
computed: IbpShow, component: IbpShow,
hidden: true hidden: true
}, },
{ {

View File

@ -49,6 +49,7 @@ export default {
mounted() { mounted() {
this.$refs.ibpPlate.show(); this.$refs.ibpPlate.show();
this.$refs.ibpPlate.drawIbpInit(); this.$refs.ibpPlate.drawIbpInit();
this.$refs.ibpPlate.setMoveInit(true);
}, },
beforeDestroy() { beforeDestroy() {
@ -57,11 +58,13 @@ export default {
ibpChange(stationCode) { ibpChange(stationCode) {
this.$refs.ibpPlate.show(stationCode); this.$refs.ibpPlate.show(stationCode);
this.$refs.ibpPlate.drawIbpInit(); this.$refs.ibpPlate.drawIbpInit();
this.$refs.ibpPlate.setMoveInit(true);
}, },
setIbpShow(data) { setIbpShow(data) {
const newData = parser(data, {width: this.canvasWidth, height: this.canvasHeight}); const newData = parser(data, {width: this.canvasWidth, height: this.canvasHeight});
this.$refs.ibpPlate.setIbp(newData, data); this.$refs.ibpPlate.setIbp(newData, data);
this.$refs.ibpPlate.drawIbpInit(); this.$refs.ibpPlate.drawIbpInit();
this.$refs.ibpPlate.setMoveInit(true);
}, },
setEmptyShow() { setEmptyShow() {
this.$nextTick(() => { // this.$ibp this.$nextTick(() => { // this.$ibp

View File

@ -86,10 +86,14 @@ export default {
} }
} }
}, },
mounted() { async mounted() {
console.log(3333333);
this.setWindowSize(); this.setWindowSize();
this.initIbp(); this.initIbp();
if (this.$route.query.loadAll && this.$route.query.stationCode) {
await this.show(this.$route.query.stationCode);
await this.setMoveInit(true);
this.showBackButton = false;
}
}, },
beforeDestroy() { beforeDestroy() {
this.ibpDestroy(); this.ibpDestroy();
@ -220,6 +224,10 @@ export default {
this.$ibp && this.$ibp.drawIbpInit(); this.$ibp && this.$ibp.drawIbpInit();
this.showBackButton = false; this.showBackButton = false;
}, },
//
setMoveInit(data) {
this.$ibp && this.$ibp.setMoveOnMouseMove(data);
},
// //
initClockTime(initTime) { initClockTime(initTime) {
this.$ibp.initClockTime(initTime); this.$ibp.initClockTime(initTime);

View File

@ -0,0 +1,130 @@
<template>
<div>
<el-dialog
v-dialogDrag
:title="$t('display.script.scriptList')"
:visible.sync="show"
top="50px"
width="60%"
:before-do-close="doClose"
:close-on-click-modal="false"
:z-index="2000"
>
<QueryListPage
ref="queryListPage"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
/>
</el-dialog>
</div>
</template>
<script>
import {getScriptPageListOnlineNew } from '@/api/script';
//
export default {
name: 'AddQuest',
props: {
trainings: {
type: Array,
default() {
return [];
}
},
detail: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
show: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: false,
show: false,
queryObject: {
}
},
queryList: {
query: this.listQuest,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '关联站台',
prop: 'name'
},
// {
// title: '',
// prop: 'createTime'
// },
{
type: 'button',
title: '操作',
width: '250',
buttons: [
{
name: '预览',
type: 'primary',
handleClick: this.handleLoad
}
]
}
],
actions: [
]
},
currentModel: {}
};
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
listQuest(params) {
params['mapId'] = this.$route.query.mapId;
return getScriptPageListOnlineNew(params);
},
async loadInitData() {
},
async handleLoad(index, row) {
this.row = row;
// const routeData = this.$router.resolve({
// path:`/ibpShow`,
// query:{
// lineCode: this.$route.query.lineCode,
// mapId: this.$route.query.mapId,
// group: this.$route.query.group
// }
// });
// window.open(routeData.href, '_blank', 'noopener noreferrer');
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>

View File

@ -5,7 +5,7 @@
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" /> <el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
</el-select> </el-select>
<el-button-group> <el-button-group>
<!-- <el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice" size="small" @click="goIbp">IBP盘</el-button> --> <el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice" size="small" @click="goIbp">IBP盘</el-button>
<el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice" size="small" @click="goBigScreen">大屏</el-button> <el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice" size="small" @click="goBigScreen">大屏</el-button>
<el-button v-if="running && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button> <el-button v-if="running && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
<template v-if="isAdmin"> <template v-if="isAdmin">
@ -21,6 +21,7 @@
<el-button v-if="isShowDirective" size="small" :type="directiveMode ? 'primary' : ''" @click="changeDirectiveMode()">{{ directiveMode? '切换到普通模式':'切换到指令模式' }}</el-button> <el-button v-if="isShowDirective" size="small" :type="directiveMode ? 'primary' : ''" @click="changeDirectiveMode()">{{ directiveMode? '切换到普通模式':'切换到指令模式' }}</el-button>
</div> </div>
<join-run-plan-view v-if="running && !dataError" ref="runPlanView" :group="group" /> <join-run-plan-view v-if="running && !dataError" ref="runPlanView" :group="group" />
<select-ibp ref="selectIbp" />
</div> </div>
</template> </template>
@ -31,10 +32,12 @@ import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanNew } from '@/api/simulation'; import { getEveryDayRunPlanNew } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView'; import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
import SelectIbp from '@/views/newMap/displayNew/demon/selectIbp';
export default { export default {
name: 'MenuDemonSchema', name: 'MenuDemonSchema',
components:{ components:{
JoinRunPlanView JoinRunPlanView,
SelectIbp
}, },
props: { props: {
group: { group: {
@ -203,12 +206,15 @@ export default {
}, },
// ibp // ibp
goIbp() { goIbp() {
// this.$refs.selectIbp.doShow();
const routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path:`/ibpShow`, path:`/ibpShow`,
query:{ query:{
lineCode: this.$route.query.lineCode, lineCode: this.$route.query.lineCode,
mapId:this.$route.query.mapId, mapId: this.$route.query.mapId,
group:this.$route.query.group group: this.$route.query.group,
stationCode: 'Station25166',
loadAll: true
} }
}); });
window.open(routeData.href, '_blank', 'noopener noreferrer'); window.open(routeData.href, '_blank', 'noopener noreferrer');