修改代码
This commit is contained in:
parent
f2dd239467
commit
50e9a242e7
@ -242,7 +242,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
|
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
|
||||||
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
|
import OperateHandler from '@/scripts/plugin/OperateHandler';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MapButtonMenu',
|
name: 'MapButtonMenu',
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
|
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
|
||||||
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
|
import OperateHandler from '@/scripts/plugin/OperateHandler';
|
||||||
import { deepAssign } from '@/utils/index';
|
import { deepAssign } from '@/utils/index';
|
||||||
import PasswordBox from './dialog/childDialog/passwordInputBox.vue';
|
import PasswordBox from './dialog/childDialog/passwordInputBox.vue';
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ import { mapGetters } from 'vuex';
|
|||||||
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
|
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
|
||||||
import ConfirmTrain from './childDialog/confirmTrain';
|
import ConfirmTrain from './childDialog/confirmTrain';
|
||||||
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
||||||
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
|
import OperateHandler from '@/scripts/plugin/OperateHandler';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TrainControl',
|
name: 'TrainControl',
|
||||||
|
@ -6,7 +6,7 @@ const StationType = MapDeviceType.Station.type;
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
test: function (operates) {
|
test: function (operates) {
|
||||||
let operateType = getOperateTypeBy('Station', operates[0].operation);
|
const operateType = getOperateTypeBy('Station', operates[0].operation);
|
||||||
if (operateType) {
|
if (operateType) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -15,7 +15,7 @@ export default {
|
|||||||
},
|
},
|
||||||
convert: function (operates) {
|
convert: function (operates) {
|
||||||
if (operates && operates.length) {
|
if (operates && operates.length) {
|
||||||
let operation = operates[0].operation;
|
const operation = operates[0].operation;
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case StationOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
|
case StationOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
|
||||||
|
|
||||||
@ -43,13 +43,13 @@ export default {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelStopPage(operates) {
|
function handleMenuCancelStopPage(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
code: operate.code,
|
code: operate.code,
|
||||||
over: true,
|
over: true,
|
||||||
operation: StationOperation.cancelStoppage.event,
|
operation: StationOperation.cancelStoppage.event
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { error: true };
|
return { error: true };
|
||||||
@ -57,14 +57,13 @@ function handleMenuCancelStopPage(operates) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理右键菜单 设置故障 操作
|
* 处理右键菜单 设置故障 操作
|
||||||
* @param {*} operates
|
* @param {*} operates
|
||||||
*/
|
*/
|
||||||
function handleMenuStoppage(operates) {
|
function handleMenuStoppage(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -84,7 +83,7 @@ function handleMenuStoppage(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuSetAutoTrigger(operates) {
|
function handleMenuSetAutoTrigger(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -104,7 +103,7 @@ function handleMenuSetAutoTrigger(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelAutoTrigger(operates) {
|
function handleMenuCancelAutoTrigger(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -124,7 +123,7 @@ function handleMenuCancelAutoTrigger(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuPowerUnLock(operates) {
|
function handleMenuPowerUnLock(operates) {
|
||||||
if (operates.length >= 2) {
|
if (operates.length >= 2) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -144,7 +143,7 @@ function handleMenuPowerUnLock(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuExecKeyOperationTest(operates) {
|
function handleMenuExecKeyOperationTest(operates) {
|
||||||
if (operates.length >= 2) {
|
if (operates.length >= 2) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -158,14 +157,13 @@ function handleMenuExecKeyOperationTest(operates) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理右键菜单 所有进路自排关 操作
|
* 处理右键菜单 所有进路自排关 操作
|
||||||
* @param {*} operates
|
* @param {*} operates
|
||||||
*/
|
*/
|
||||||
function handleMenuHumanControlAll(operates) {
|
function handleMenuHumanControlAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationType && operate.code) {
|
if (operate.type === StationType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -185,7 +183,7 @@ function handleMenuHumanControlAll(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuAtsAutoControlAll(operates) {
|
function handleMenuAtsAutoControlAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationType && operates[0].code) {
|
if (operate.type === StationType && operates[0].code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
|
@ -6,7 +6,7 @@ const StationStandType = MapDeviceType.StationStand.type;
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
test: function (operates) {
|
test: function (operates) {
|
||||||
let operateType = getOperateTypeBy('StationStand', operates[0].operation);
|
const operateType = getOperateTypeBy('StationStand', operates[0].operation);
|
||||||
if (operateType) {
|
if (operateType) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -15,7 +15,7 @@ export default {
|
|||||||
},
|
},
|
||||||
convert: function (operates) {
|
convert: function (operates) {
|
||||||
if (operates && operates.length) {
|
if (operates && operates.length) {
|
||||||
let operation = operates[0].operation;
|
const operation = operates[0].operation;
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case StationStandOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
|
case StationStandOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
|
||||||
|
|
||||||
@ -61,13 +61,13 @@ export default {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelStopPage(operates) {
|
function handleMenuCancelStopPage(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationStandType && operate.code) {
|
if (operate.type === StationStandType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
code: operate.code,
|
code: operate.code,
|
||||||
over: true,
|
over: true,
|
||||||
operation: StationStandOperation.cancelStoppage.event,
|
operation: StationStandOperation.cancelStoppage.event
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { error: true };
|
return { error: true };
|
||||||
@ -81,7 +81,7 @@ function handleMenuCancelStopPage(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuStoppage(operates) {
|
function handleMenuStoppage(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -101,7 +101,7 @@ function handleMenuStoppage(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuEarlyDeparture(operates) {
|
function handleMenuEarlyDeparture(operates) {
|
||||||
if (operates.length > 0) {
|
if (operates.length > 0) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -122,7 +122,7 @@ function handleMenuEarlyDeparture(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuSetJumpStop(operates) {
|
function handleMenuSetJumpStop(operates) {
|
||||||
if (operates.length > 1) {
|
if (operates.length > 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -143,7 +143,7 @@ function handleMenuSetJumpStop(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelJumpStop(operates) {
|
function handleMenuCancelJumpStop(operates) {
|
||||||
if (operates.length > 1) {
|
if (operates.length > 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -158,14 +158,13 @@ function handleMenuCancelJumpStop(operates) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理右键菜单 设置扣车 操作
|
* 处理右键菜单 设置扣车 操作
|
||||||
* @param {*} operates
|
* @param {*} operates
|
||||||
*/
|
*/
|
||||||
function handleMenuSetDetainTrain(operates) {
|
function handleMenuSetDetainTrain(operates) {
|
||||||
if (operates.length > 1) {
|
if (operates.length > 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -185,7 +184,7 @@ function handleMenuSetDetainTrain(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelDetainTrain(operates) {
|
function handleMenuCancelDetainTrain(operates) {
|
||||||
if (operates.length > 1) {
|
if (operates.length > 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -207,7 +206,7 @@ function handleMenuCancelDetainTrain(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelDetainTrainForce(operates) {
|
function handleMenuCancelDetainTrainForce(operates) {
|
||||||
if (operates.length > 1) {
|
if (operates.length > 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -227,7 +226,7 @@ function handleMenuCancelDetainTrainForce(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuDetail(operates) {
|
function handleMenuDetail(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -247,14 +246,14 @@ function handleMenuDetail(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuCancelDetainTrainAll(operates) {
|
function handleMenuCancelDetainTrainAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
code: operates[0].code,
|
code: operates[0].code,
|
||||||
over: true,
|
over: true,
|
||||||
operation: StationStandOperation.cancelDetainTrainAll.event,
|
operation: StationStandOperation.cancelDetainTrainAll.event,
|
||||||
val: operate.val,
|
val: operate.val
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { error: true };
|
return { error: true };
|
||||||
@ -268,17 +267,17 @@ function handleMenuCancelDetainTrainAll(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuSetStopTime(operates) {
|
function handleMenuSetStopTime(operates) {
|
||||||
if (operates.length == 1) {
|
if (operates.length == 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationStandType && operate.code) {
|
if (operate.type === StationStandType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
code: operate.code,
|
code: operate.code,
|
||||||
operation: StationStandOperation.setStopTime.event.query,
|
operation: StationStandOperation.setStopTime.event.query
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { error: true };
|
return { error: true };
|
||||||
} else if (operates.length >= 2) {
|
} else if (operates.length >= 2) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType && operate.val) {
|
if (operate.type === StationStandType && operate.val) {
|
||||||
return {
|
return {
|
||||||
over: true,
|
over: true,
|
||||||
@ -300,17 +299,17 @@ function handleMenuSetStopTime(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuSetRunLevel(operates) {
|
function handleMenuSetRunLevel(operates) {
|
||||||
if (operates.length == 1) {
|
if (operates.length == 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationStandType && operate.code) {
|
if (operate.type === StationStandType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
code: operate.code,
|
code: operate.code,
|
||||||
operation: StationStandOperation.setRunLevel.event.query,
|
operation: StationStandOperation.setRunLevel.event.query
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { error: true };
|
return { error: true };
|
||||||
} else if (operates.length >= 2) {
|
} else if (operates.length >= 2) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType && operate.val) {
|
if (operate.type === StationStandType && operate.val) {
|
||||||
return {
|
return {
|
||||||
over: true,
|
over: true,
|
||||||
@ -331,17 +330,17 @@ function handleMenuSetRunLevel(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMenuSetBackStrategy(operates) {
|
function handleMenuSetBackStrategy(operates) {
|
||||||
if (operates.length == 1) {
|
if (operates.length == 1) {
|
||||||
let operate = operates[0];
|
const operate = operates[0];
|
||||||
if (operate.type === StationStandType && operate.code) {
|
if (operate.type === StationStandType && operate.code) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
code: operate.code,
|
code: operate.code,
|
||||||
operation: StationStandOperation.setBackStrategy.event.query,
|
operation: StationStandOperation.setBackStrategy.event.query
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { error: true };
|
return { error: true };
|
||||||
} else if (operates.length >= 2) {
|
} else if (operates.length >= 2) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType && operate.val) {
|
if (operate.type === StationStandType && operate.val) {
|
||||||
return {
|
return {
|
||||||
over: true,
|
over: true,
|
||||||
@ -356,14 +355,13 @@ function handleMenuSetBackStrategy(operates) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理菜单栏 设置全线扣车 操作
|
* 处理菜单栏 设置全线扣车 操作
|
||||||
* @param {*} operates
|
* @param {*} operates
|
||||||
*/
|
*/
|
||||||
function handleMbarSetDetainTrainAll(operates) {
|
function handleMbarSetDetainTrainAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -383,7 +381,7 @@ function handleMbarSetDetainTrainAll(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMbarCancelDetainTrainAll(operates) {
|
function handleMbarCancelDetainTrainAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -403,7 +401,7 @@ function handleMbarCancelDetainTrainAll(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMbarCancelUpDetainTrainAll(operates) {
|
function handleMbarCancelUpDetainTrainAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
@ -423,7 +421,7 @@ function handleMbarCancelUpDetainTrainAll(operates) {
|
|||||||
*/
|
*/
|
||||||
function handleMbarCancelDownDetainTrainAll(operates) {
|
function handleMbarCancelDownDetainTrainAll(operates) {
|
||||||
if (operates.length >= 1) {
|
if (operates.length >= 1) {
|
||||||
let operate = operates[operates.length - 1];
|
const operate = operates[operates.length - 1];
|
||||||
if (operate.type === StationStandType) {
|
if (operate.type === StationStandType) {
|
||||||
return {
|
return {
|
||||||
type: operate.type,
|
type: operate.type,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
import OperateHandler from '@/scripts/plugin/OperateHandler';
|
||||||
import { sendCommand } from '@/api/jmap/training';
|
import { sendCommand } from '@/api/jmap/training';
|
||||||
import { OperationEvent } from '@/scripts/ConstDic';
|
import { OperationEvent } from '@/scripts/ConstDic';
|
||||||
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
|
import { getConverter } from '@/scripts/plugin/Converter/manager';
|
||||||
import { getConverter } from '@/scripts/plugin/converter/manager';
|
|
||||||
|
|
||||||
var OperateConverter = function () { };
|
var OperateConverter = function () { };
|
||||||
OperateConverter.prototype = {
|
OperateConverter.prototype = {
|
||||||
|
@ -1,147 +0,0 @@
|
|||||||
import store from '@/store';
|
|
||||||
import router from '@/router';
|
|
||||||
import OperateConverter from '@/scripts/plugin/operateConvert2Command';
|
|
||||||
import { TrainingMode } from '@/scripts/ConstDic';
|
|
||||||
import { getConverter } from '@/scripts/plugin/converter/manager';
|
|
||||||
import { sendTrainingNextStep } from '@/api/jmap/training';
|
|
||||||
import { Message } from 'element-ui';
|
|
||||||
import LangStorage from '@/utils/lang';
|
|
||||||
|
|
||||||
var OperateHandler = function () {
|
|
||||||
};
|
|
||||||
|
|
||||||
OperateHandler.prototype = {
|
|
||||||
/** 操作组 */
|
|
||||||
operates: [],
|
|
||||||
|
|
||||||
backStep: function(num) {
|
|
||||||
this.operates = this.operates.slice(0, num);
|
|
||||||
},
|
|
||||||
|
|
||||||
/** 清空操作组 */
|
|
||||||
cleanOperates: function () {
|
|
||||||
this.operates.splice(0, this.operates.length);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断操作步骤是否正确
|
|
||||||
*/
|
|
||||||
judge: function (operate) {
|
|
||||||
let valid = false;
|
|
||||||
const steps = this.getSteps();
|
|
||||||
const order = this.getOrder();
|
|
||||||
if (order >= steps) {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
// debugger;
|
|
||||||
const standard = steps[order];
|
|
||||||
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
|
|
||||||
operate.operation == standard.operation &&
|
|
||||||
operate.val == standard.val) {
|
|
||||||
valid = true;
|
|
||||||
}
|
|
||||||
return valid;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据模式验证操作步骤
|
|
||||||
*/
|
|
||||||
validate: function (operate) {
|
|
||||||
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
|
|
||||||
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是正常的第一步操作,需要清空operates数组
|
|
||||||
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
|
|
||||||
this.cleanOperates();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.operates.push(operate);
|
|
||||||
|
|
||||||
// 预处理
|
|
||||||
const converter = getConverter(this.operates);
|
|
||||||
if (converter && converter.preHandle instanceof Function) {
|
|
||||||
operate = converter.preHandle(this.operates);
|
|
||||||
}
|
|
||||||
|
|
||||||
let valid = true;
|
|
||||||
const mode = this.getTrainingMode();
|
|
||||||
if (TrainingMode.EDIT === mode) {
|
|
||||||
// 编辑制作模式
|
|
||||||
if (this.getOperateBreakStatus()) {
|
|
||||||
valid = false;
|
|
||||||
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
|
|
||||||
Message.error(tip);
|
|
||||||
this.operates.pop();
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
if (this.getTrainingStart()) {
|
|
||||||
store.dispatch('training/setTempStep', operate);
|
|
||||||
}
|
|
||||||
} else if (TrainingMode.TEACH === mode || TrainingMode.PRACTICE === mode) {
|
|
||||||
// 教学模式/练习模式
|
|
||||||
if (this.getTrainingStart()) {
|
|
||||||
valid = this.judge(operate);
|
|
||||||
} else {
|
|
||||||
this.cleanOperates();
|
|
||||||
valid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送每一步的步骤数据;
|
|
||||||
const basicInfo = store.getters['training/basicInfo'];
|
|
||||||
if (basicInfo.id && valid) {
|
|
||||||
const group = router.currentRoute.query.group;
|
|
||||||
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valid) {
|
|
||||||
// 如果操作校验不正确,回退
|
|
||||||
this.operates.pop();
|
|
||||||
} else {
|
|
||||||
if (operate.cancel === true) {
|
|
||||||
this.cleanOperates();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return valid;
|
|
||||||
},
|
|
||||||
handle: function (operate) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const rtn = { valid: false, response: null };
|
|
||||||
const valid = this.validate(operate);
|
|
||||||
|
|
||||||
rtn.valid = valid;
|
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// 改变状态开始请求
|
|
||||||
OperateConverter.convertAndSend(operate).then(response => {
|
|
||||||
rtn.response = response;
|
|
||||||
resolve(rtn);
|
|
||||||
}).catch(error => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
resolve(rtn);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getTrainingMode: function () {
|
|
||||||
return store.state.training.mode;
|
|
||||||
},
|
|
||||||
getSteps: function () {
|
|
||||||
return store.state.training.steps;
|
|
||||||
},
|
|
||||||
getOrder: function () {
|
|
||||||
return store.state.training.order;
|
|
||||||
},
|
|
||||||
getTrainingStart: function () {
|
|
||||||
return store.state.training.started;
|
|
||||||
},
|
|
||||||
getOperateBreakStatus: function () {
|
|
||||||
return store.state.menuOperation.break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default new OperateHandler();
|
|
@ -1,6 +1,6 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { TrainingMode } from '@/scripts/ConstDic';
|
import { TrainingMode } from '@/scripts/ConstDic';
|
||||||
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
|
import OperateHandler from '@/scripts/plugin/OperateHandler';
|
||||||
import deviceType from '../../jmap/constant/deviceType';
|
import deviceType from '../../jmap/constant/deviceType';
|
||||||
import LangStorage from '@/utils/lang';
|
import LangStorage from '@/utils/lang';
|
||||||
// const lang = LangStorage.getLang();
|
// const lang = LangStorage.getLang();
|
||||||
|
@ -3,11 +3,11 @@ export function getBaseUrl() {
|
|||||||
let BASE_API;
|
let BASE_API;
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// BASE_API = 'https://joylink.club/jlcloud';
|
// BASE_API = 'https://joylink.club/jlcloud';
|
||||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||||
// BASE_API = 'http://192.168.3.41:9000'; // 杜闪
|
// BASE_API = 'http://192.168.3.41:9000'; // 杜闪
|
||||||
BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||||
} else {
|
} else {
|
||||||
BASE_API = process.env.VUE_APP_BASE_API;
|
BASE_API = process.env.VUE_APP_BASE_API;
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,7 @@ export function creatSubscribe(topic, header) {
|
|||||||
Vue.prototype.$stomp = new StompClient();
|
Vue.prototype.$stomp = new StompClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.prototype.$stomp.subscribe(
|
Vue.prototype.$stomp.subscribe(topic, callback, header);
|
||||||
[displayTopic].includes(topic) ? `${topic}/${header.group}` : topic,
|
|
||||||
callback,
|
|
||||||
header
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('websocket订阅失败');
|
console.error('websocket订阅失败');
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ import { PermissionType } from '@/scripts/ConstDic';
|
|||||||
import { getCountTime } from '@/utils/index';
|
import { getCountTime } from '@/utils/index';
|
||||||
import { runDiagramIsStart, quitScript } from '@/api/simulation';
|
import { runDiagramIsStart, quitScript } from '@/api/simulation';
|
||||||
import { timeFormat } from '@/utils/date';
|
import { timeFormat } from '@/utils/date';
|
||||||
import { EventBus } from '@/scripts/event-bus';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MenuDemon',
|
name: 'MenuDemon',
|
||||||
@ -186,8 +185,6 @@ export default {
|
|||||||
},
|
},
|
||||||
back() {
|
back() {
|
||||||
this.$store.dispatch('training/over').then(() => {
|
this.$store.dispatch('training/over').then(() => {
|
||||||
EventBus.$emit('runPlanStop');
|
|
||||||
EventBus.$emit('chatSubscribeStop');
|
|
||||||
history.go(-1);
|
history.go(-1);
|
||||||
Notification.closeAll();
|
Notification.closeAll();
|
||||||
});
|
});
|
||||||
|
@ -178,7 +178,6 @@ export default {
|
|||||||
back() {
|
back() {
|
||||||
this.$emit('quit');
|
this.$emit('quit');
|
||||||
Notification.closeAll();
|
Notification.closeAll();
|
||||||
// exitFullscreen();
|
|
||||||
|
|
||||||
if (this.$route.params.mode == 'record') {
|
if (this.$route.params.mode == 'record') {
|
||||||
/** 如果是演示返回时,需要重新创建仿真*/
|
/** 如果是演示返回时,需要重新创建仿真*/
|
||||||
|
@ -22,12 +22,10 @@ export default {
|
|||||||
stomp: null,
|
stomp: null,
|
||||||
currentMap: null,
|
currentMap: null,
|
||||||
mode: '',
|
mode: '',
|
||||||
isDesignPlatform: false
|
isDesignPlatform: false,
|
||||||
|
group: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
group() { return this.$route.query.group; }
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
'$store.state.map.mapViewLoadedCount': function (val) {
|
'$store.state.map.mapViewLoadedCount': function (val) {
|
||||||
this.subscribe();
|
this.subscribe();
|
||||||
@ -56,6 +54,7 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
window.onbeforeunload = this.clearSubscribe;
|
window.onbeforeunload = this.clearSubscribe;
|
||||||
this.mode = this.$route.params.mode || '';
|
this.mode = this.$route.params.mode || '';
|
||||||
|
this.group = this.$route.query.group || '';
|
||||||
this.currentMap = this.$refs.mapCommon;
|
this.currentMap = this.$refs.mapCommon;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -105,12 +104,12 @@ export default {
|
|||||||
async subscribe() {
|
async subscribe() {
|
||||||
this.clearSubscribe();
|
this.clearSubscribe();
|
||||||
const header = { group: this.group || '', 'X-Token': getToken() };
|
const header = { group: this.group || '', 'X-Token': getToken() };
|
||||||
creatSubscribe(displayTopic, header);
|
creatSubscribe(`${displayTopic}\/${this.group}`, header);
|
||||||
|
|
||||||
await this.$store.dispatch('training/setHasSubscribed');
|
await this.$store.dispatch('training/setHasSubscribed');
|
||||||
},
|
},
|
||||||
clearSubscribe() {
|
clearSubscribe() {
|
||||||
clearSubscribe(displayTopic);
|
clearSubscribe(`${displayTopic}\/${this.group}`);
|
||||||
},
|
},
|
||||||
sendDeviceChangeEvent(data, header) {
|
sendDeviceChangeEvent(data, header) {
|
||||||
// 发送设备操作事件到服务器
|
// 发送设备操作事件到服务器
|
||||||
|
Loading…
Reference in New Issue
Block a user