From 681ac5e8866d69055afb4168be060be853fbdfab Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 31 Oct 2019 13:56:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=B0=83=E6=95=B4=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.js | 1 + src/router/index.js | 3 +- .../SignalRouteOperationConverter.js | 981 +++++++++--------- src/views/designPlatform/demonList.vue | 5 +- src/views/jlmap3d/drive/jl3ddrive.vue | 343 +++--- src/views/lesson/trainingRule/addEdit.vue | 4 +- src/views/lesson/trainingmanage/draft.vue | 1 - .../scriptManage/display/tipScriptRecord.vue | 294 +++--- src/views/scriptManage/home.vue | 510 +++++---- src/views/scriptManage/publish.vue | 124 +-- .../scriptManage/scriptRecord/addAction.vue | 577 +++++----- .../scriptManage/scriptRecord/addRole.vue | 190 ++-- .../scriptManage/scriptRecord/getAction.vue | 212 ++-- 13 files changed, 1614 insertions(+), 1631 deletions(-) diff --git a/src/permission.js b/src/permission.js index 3caafc04c..2b2ad0c7f 100644 --- a/src/permission.js +++ b/src/permission.js @@ -91,6 +91,7 @@ function handleRoute(to, from, next, routeInfo) { } else { // 除没有动态改变权限的需求可直接next() 删下方权限判断 if (hasPermission(store.getters.roles, to.meta.roles)) { + debugger; if (to.path === '/404' && to.redirectedFrom === '/') { next(localStore.get('trainingPlatformRoute' + store.getters.id) || '/trainingPlatform'); } else { diff --git a/src/router/index.js b/src/router/index.js index 2cce2b1da..9c1751a71 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -338,7 +338,8 @@ export const asyncRouter = [ hidden: true }, { - path: 'lesson/home/:mapId/:skinCode', + path: 'lesson/home/:mapId', + // /:skinCode component: LessonHome, hidden: true }, diff --git a/src/scripts/plugin/converter/SignalRouteOperationConverter.js b/src/scripts/plugin/converter/SignalRouteOperationConverter.js index 33e85c4e9..3baa1c8ae 100644 --- a/src/scripts/plugin/converter/SignalRouteOperationConverter.js +++ b/src/scripts/plugin/converter/SignalRouteOperationConverter.js @@ -7,95 +7,95 @@ const SignalOperation = OperationEvent.Signal; const SignalType = MapDeviceType.Signal.type; export default { - test: function (operates) { - const operateType = getOperateTypeBy('Signal', operates[0].operation); - if (operateType) { - return true; - } else { - return false; - } - }, - /** + test: function (operates) { + const operateType = getOperateTypeBy('Signal', operates[0].operation); + if (operateType) { + return true; + } else { + return false; + } + }, + /** * 验证前预处理 */ - preHandle: function (operates) { - if (operates && operates.length) { - const curOperate = operates[operates.length - 1]; - switch (operates[0].operation) { - case SignalOperation.arrangementRoute.button: { - if (curOperate.model) { - curOperate.val = curOperate.model._viewVal; - } - return curOperate; - } - case SignalOperation.cancelTrainRoute.button: { - if (curOperate.model) { - curOperate.val = curOperate.model._viewVal; - } - return curOperate; - } - case SignalOperation.reopenSignal.button: { - return curOperate; - } - case SignalOperation.humanTrainRoute.button: { - if (curOperate.model) { - curOperate.val = curOperate.model._viewVal; - } - return curOperate; - } - default: { - return curOperate; - } - } - } - }, - convert: function (operates) { - if (operates && operates.length) { - switch (operates[0].operation) { - case SignalOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); + preHandle: function (operates) { + if (operates && operates.length) { + const curOperate = operates[operates.length - 1]; + switch (operates[0].operation) { + case SignalOperation.arrangementRoute.button: { + if (curOperate.model) { + curOperate.val = curOperate.model._viewVal; + } + return curOperate; + } + case SignalOperation.cancelTrainRoute.button: { + if (curOperate.model) { + curOperate.val = curOperate.model._viewVal; + } + return curOperate; + } + case SignalOperation.reopenSignal.button: { + return curOperate; + } + case SignalOperation.humanTrainRoute.button: { + if (curOperate.model) { + curOperate.val = curOperate.model._viewVal; + } + return curOperate; + } + default: { + return curOperate; + } + } + } + }, + convert: function (operates) { + if (operates && operates.length) { + switch (operates[0].operation) { + case SignalOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); - case SignalOperation.stoppage.menu.operation: return handleMenuStoppage(operates); + case SignalOperation.stoppage.menu.operation: return handleMenuStoppage(operates); - case SignalOperation.arrangementRoute.button.operation: return handleButtonArrangementRoute(operates); // 排列进路按钮操作 - case SignalOperation.arrangementRoute.menu.operation: return handleMenuArrangementRoute(operates); + case SignalOperation.arrangementRoute.button.operation: return handleButtonArrangementRoute(operates); // 排列进路按钮操作 + case SignalOperation.arrangementRoute.menu.operation: return handleMenuArrangementRoute(operates); - case SignalOperation.cancelTrainRoute.button.operation: return handleButtonCancelTrainRoute(operates); // 取消进路按钮操作 - case SignalOperation.cancelTrainRoute.menu.operation: return handleMenuCancelTrainRoute(operates); + case SignalOperation.cancelTrainRoute.button.operation: return handleButtonCancelTrainRoute(operates); // 取消进路按钮操作 + case SignalOperation.cancelTrainRoute.menu.operation: return handleMenuCancelTrainRoute(operates); - case SignalOperation.reopenSignal.button.operation: return handleButtonReopenSignal(operates); // 信号重开按钮操作 - case SignalOperation.reopenSignal.menu.operation: return handleMenuReopenSignal(operates); + case SignalOperation.reopenSignal.button.operation: return handleButtonReopenSignal(operates); // 信号重开按钮操作 + case SignalOperation.reopenSignal.menu.operation: return handleMenuReopenSignal(operates); - case SignalOperation.humanTrainRoute.button.operation: return handleButtonHumanTrainRoute(operates); // 人解列车进路按钮操作 - case SignalOperation.humanTrainRoute.menu.operation: return handleMenuHumanTrainRoute(operates); + case SignalOperation.humanTrainRoute.button.operation: return handleButtonHumanTrainRoute(operates); // 人解列车进路按钮操作 + case SignalOperation.humanTrainRoute.menu.operation: return handleMenuHumanTrainRoute(operates); - case SignalOperation.lock.menu.operation: return handleMenuLock(operates); + case SignalOperation.lock.menu.operation: return handleMenuLock(operates); - case SignalOperation.unlock.menu.operation: return handleMenuUnlock(operates); + case SignalOperation.unlock.menu.operation: return handleMenuUnlock(operates); - case SignalOperation.guide.menu.operation: return handleMenuGuideRoute(operates); - case SignalOperation.guide.button.operation: return handleButtonGuideRoute(operates); // 引导进路按钮操作 + case SignalOperation.guide.menu.operation: return handleMenuGuideRoute(operates); + case SignalOperation.guide.button.operation: return handleButtonGuideRoute(operates); // 引导进路按钮操作 - case SignalOperation.signalClose.menu.operation: return handleMenuSignalClose(operates); + case SignalOperation.signalClose.menu.operation: return handleMenuSignalClose(operates); - case SignalOperation.setAutoInterlock.menu.operation: return handleMenuSetAutoInterlock(operates); - case SignalOperation.setAutoInterlock.button.operation: return handleButtonSetAutoInterlock(operates); // 设置联锁自动进路按钮 + case SignalOperation.setAutoInterlock.menu.operation: return handleMenuSetAutoInterlock(operates); + case SignalOperation.setAutoInterlock.button.operation: return handleButtonSetAutoInterlock(operates); // 设置联锁自动进路按钮 - case SignalOperation.cancelAutoInterlock.menu.operation: return handleMenuCancelAutoInterlock(operates); + case SignalOperation.cancelAutoInterlock.menu.operation: return handleMenuCancelAutoInterlock(operates); - case SignalOperation.setAutoTrigger.menu.operation: return handleMenuSetAutoTrigger(operates); + case SignalOperation.setAutoTrigger.menu.operation: return handleMenuSetAutoTrigger(operates); - case SignalOperation.cancelAutoTrigger.menu.operation: return handleMenuCancelAutoTrigger(operates); + case SignalOperation.cancelAutoTrigger.menu.operation: return handleMenuCancelAutoTrigger(operates); - case SignalOperation.humanControl.menu.operation: return handleMenuHumanControl(operates); - case SignalOperation.humanControl.button.operation: return handleButtonHumanControl(operates); // 人工控按钮操作 + case SignalOperation.humanControl.menu.operation: return handleMenuHumanControl(operates); + case SignalOperation.humanControl.button.operation: return handleButtonHumanControl(operates); // 人工控按钮操作 - case SignalOperation.atsAutoControl.menu.operation: return handleMenuAtsAutoControl(operates); - case SignalOperation.atsAutoControl.button.operation: return handleButtonAtsAutoControl(operates); // 自动控按钮操作 + case SignalOperation.atsAutoControl.menu.operation: return handleMenuAtsAutoControl(operates); + case SignalOperation.atsAutoControl.button.operation: return handleButtonAtsAutoControl(operates); // 自动控按钮操作 - case SignalOperation.detail.menu.operation: return handleMenuDetail(operates); - } - } - } + case SignalOperation.detail.menu.operation: return handleMenuDetail(operates); + } + } + } }; /** @@ -103,37 +103,37 @@ export default { * @param {*} operates */ function handleButtonArrangementRoute(operates) { - if (operates.length === 2) { - const operate = operates[1]; - if (operate.type == SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.arrangementRoute.event.query - // val: operate.model._viewVal - }; - } - return { error: true }; - } else if (operates.length >= 3) { - const operateBeg = operates[1]; // 起始信号灯 - const operateEnd = operates[operates.length - 1]; // 终端信号灯 - if (operateEnd.type == SignalType && operateEnd.code && operateEnd.tempData && operateEnd.tempData.length) { - for (let i = 0; i < operateEnd.tempData.length; i++) { - const elem = operateEnd.tempData[i]; - if (elem.startSignalCode === operateBeg.code && elem.endSignalCode == operateEnd.code) { - return { - type: operateEnd.type, - code: operateEnd.code, - over: true, - operation: SignalOperation.arrangementRoute.event.confirm - // val: elem.code - }; - } - } - } - return { error: true }; - } - return null; + if (operates.length === 2) { + const operate = operates[1]; + if (operate.type == SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.arrangementRoute.event.query + // val: operate.model._viewVal + }; + } + return { error: true }; + } else if (operates.length >= 3) { + const operateBeg = operates[1]; // 起始信号灯 + const operateEnd = operates[operates.length - 1]; // 终端信号灯 + if (operateEnd.type == SignalType && operateEnd.code && operateEnd.tempData && operateEnd.tempData.length) { + for (let i = 0; i < operateEnd.tempData.length; i++) { + const elem = operateEnd.tempData[i]; + if (elem.startSignalCode === operateBeg.code && elem.endSignalCode == operateEnd.code) { + return { + type: operateEnd.type, + code: operateEnd.code, + over: true, + operation: SignalOperation.arrangementRoute.event.confirm + // val: elem.code + }; + } + } + } + return { error: true }; + } + return null; } /** @@ -141,31 +141,31 @@ function handleButtonArrangementRoute(operates) { * @param {*} operates */ function handleMenuArrangementRoute(operates) { - if (operates.length == 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.arrangementRoute.event.query - }; - } - return { error: true }; - } else if (operates.length >= 3) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operates[0].code && (operates[operates.length - 2].val || operates[operates.length - 3].val)) { - return { - over: true, - type: operate.type, - code: operates[0].code, - operation: SignalOperation.arrangementRoute.event.confirm, - val: operates[operates.length - 2].val || operates[operates.length - 3].val - }; - } - return { error: true }; - } + if (operates.length == 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.arrangementRoute.event.query + }; + } + return { error: true }; + } else if (operates.length >= 3) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operates[0].code && (operates[operates.length - 2].val || operates[operates.length - 3].val)) { + return { + over: true, + type: operate.type, + code: operates[0].code, + operation: SignalOperation.arrangementRoute.event.confirm, + val: operates[operates.length - 2].val || operates[operates.length - 3].val + }; + } + return { error: true }; + } - return null; + return null; } /** @@ -173,19 +173,19 @@ function handleMenuArrangementRoute(operates) { * @param {*} operates */ function handleButtonCancelTrainRoute(operates) { - if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.cancelTrainRoute.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.cancelTrainRoute.event + }; + } + return { error: true }; + } + return null; } /** @@ -193,19 +193,19 @@ function handleButtonCancelTrainRoute(operates) { * @param {*} operates */ function handleButtonReopenSignal(operates) { - if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.reopenSignal.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.reopenSignal.event + }; + } + return { error: true }; + } + return null; } /** @@ -213,26 +213,25 @@ function handleButtonReopenSignal(operates) { * @param {*} operates */ function handleButtonHumanTrainRoute(operates) { - debugger; - if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - if (operate.code) { - // const counter = store.getters['map/getCounterBySingalCode'](operate.code, '02'); - // if (counter) { - // const val = localStore.get(counter.code) || ''; - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.humanTrainRoute.event - }; - // } - } - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + if (operate.code) { + // const counter = store.getters['map/getCounterBySingalCode'](operate.code, '02'); + // if (counter) { + // const val = localStore.get(counter.code) || ''; + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.humanTrainRoute.event + }; + // } + } + } + return { error: true }; + } + return null; } /** @@ -240,19 +239,19 @@ function handleButtonHumanTrainRoute(operates) { * @param {*} operates */ function handleMenuCancelStopPage(operates) { - if (operates.length >= 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.cancelStoppage.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.cancelStoppage.event + }; + } + return { error: true }; + } + return null; } /** @@ -260,19 +259,19 @@ function handleMenuCancelStopPage(operates) { * @param {*} operates */ function handleMenuStoppage(operates) { - if (operates.length >= 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.stoppage.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.stoppage.event + }; + } + return { error: true }; + } + return null; } /** @@ -280,19 +279,19 @@ function handleMenuStoppage(operates) { * @param {*} operates */ function handleMenuCancelTrainRoute(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.cancelTrainRoute.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.cancelTrainRoute.event + }; + } + return { error: true }; + } + return null; } /** @@ -300,19 +299,19 @@ function handleMenuCancelTrainRoute(operates) { * @param {*} operates */ function handleMenuReopenSignal(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.reopenSignal.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.reopenSignal.event + }; + } + return { error: true }; + } + return null; } /** @@ -320,26 +319,26 @@ function handleMenuReopenSignal(operates) { * @param {*} operates */ function handleMenuHumanTrainRoute(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - if (operate.code) { - // const counter = store.getters['map/getCounterBySingalCode'](operate.code, '02'); - // if (counter) { - // const val = localStore.get(counter.code) || ''; - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.humanTrainRoute.event - // val: val - }; - // } - } - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + if (operate.code) { + // const counter = store.getters['map/getCounterBySingalCode'](operate.code, '02'); + // if (counter) { + // const val = localStore.get(counter.code) || ''; + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.humanTrainRoute.event + // val: val + }; + // } + } + } + return { error: true }; + } + return null; } /** @@ -347,18 +346,18 @@ function handleMenuHumanTrainRoute(operates) { * @param {*} operates */ function handleMenuLock(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.lock.event - }; - } - return { error: true }; - } + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.lock.event + }; + } + return { error: true }; + } } /** @@ -366,18 +365,18 @@ function handleMenuLock(operates) { * @param {*} operates */ function handleMenuUnlock(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.unlock.event - }; - } - return { error: true }; - } + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.unlock.event + }; + } + return { error: true }; + } } /** @@ -385,28 +384,28 @@ function handleMenuUnlock(operates) { * @param {*} operates */ function handleMenuGuideRoute(operates) { - if (operates.length == 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.guide.event.query - }; - } - return { error: true }; - } else if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.guide.event.confirm - }; - } - return { error: true }; - } + if (operates.length == 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.guide.event.query + }; + } + return { error: true }; + } else if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.guide.event.confirm + }; + } + return { error: true }; + } } /** @@ -414,19 +413,19 @@ function handleMenuGuideRoute(operates) { * @param {*} operates */ function handleMenuSignalClose(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.signalClose.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.signalClose.event + }; + } + return { error: true }; + } + return null; } /** @@ -434,19 +433,19 @@ function handleMenuSignalClose(operates) { * @param {*} operates */ function handleMenuSetAutoInterlock(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.setAutoInterlock.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.setAutoInterlock.event + }; + } + return { error: true }; + } + return null; } /** @@ -454,19 +453,19 @@ function handleMenuSetAutoInterlock(operates) { * @param {*} operates */ function handleMenuCancelAutoInterlock(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.cancelAutoInterlock.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.cancelAutoInterlock.event + }; + } + return { error: true }; + } + return null; } /** @@ -474,19 +473,19 @@ function handleMenuCancelAutoInterlock(operates) { * @param {*} operates */ function handleMenuSetAutoTrigger(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.setAutoTrigger.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.setAutoTrigger.event + }; + } + return { error: true }; + } + return null; } /** @@ -494,19 +493,19 @@ function handleMenuSetAutoTrigger(operates) { * @param {*} operates */ function handleMenuCancelAutoTrigger(operates) { - if (operates.length >= 2) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.cancelAutoTrigger.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.cancelAutoTrigger.event + }; + } + return { error: true }; + } + return null; } /** @@ -514,52 +513,52 @@ function handleMenuCancelAutoTrigger(operates) { * @param {*} operates */ function handleMenuHumanControl(operates) { - if (operates.length == 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.humanControl.event.query - }; - } - return { error: true }; - } else if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - let val = null; - val = operates[operates.length - 3] && operates[operates.length - 3].val ? operates[operates.length - 3].val : val; - val = operates[operates.length - 2] && operates[operates.length - 2].val ? operates[operates.length - 2].val : val; - val = operates[operates.length - 1] && operates[operates.length - 1].val ? operates[operates.length - 1].val : val; + if (operates.length == 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.humanControl.event.query + }; + } + return { error: true }; + } else if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + let val = null; + val = operates[operates.length - 3] && operates[operates.length - 3].val ? operates[operates.length - 3].val : val; + val = operates[operates.length - 2] && operates[operates.length - 2].val ? operates[operates.length - 2].val : val; + val = operates[operates.length - 1] && operates[operates.length - 1].val ? operates[operates.length - 1].val : val; - if (operate.type === SignalType && operates[0].code && val) { - return { - over: true, - type: operate.type, - code: operates[0].code, - operation: SignalOperation.humanControl.event.confirm, - val: val - }; - } - return { error: true }; - } - return null; + if (operate.type === SignalType && operates[0].code && val) { + return { + over: true, + type: operate.type, + code: operates[0].code, + operation: SignalOperation.humanControl.event.confirm, + val: val + }; + } + return { error: true }; + } + return null; } // 人工控按钮 操作 function handleButtonHumanControl(operates) { - if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.humanControl.event.confirm - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.humanControl.event.confirm + }; + } + return { error: true }; + } + return null; } /** @@ -567,52 +566,52 @@ function handleButtonHumanControl(operates) { * @param {*} operates */ function handleMenuAtsAutoControl(operates) { - if (operates.length == 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.atsAutoControl.event.query - }; - } - return { error: true }; - } else if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - let val = null; - val = operates[operates.length - 3] && operates[operates.length - 3].val ? operates[operates.length - 3].val : val; - val = operates[operates.length - 2] && operates[operates.length - 2].val ? operates[operates.length - 2].val : val; - val = operates[operates.length - 1] && operates[operates.length - 1].val ? operates[operates.length - 1].val : val; + if (operates.length == 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.atsAutoControl.event.query + }; + } + return { error: true }; + } else if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + let val = null; + val = operates[operates.length - 3] && operates[operates.length - 3].val ? operates[operates.length - 3].val : val; + val = operates[operates.length - 2] && operates[operates.length - 2].val ? operates[operates.length - 2].val : val; + val = operates[operates.length - 1] && operates[operates.length - 1].val ? operates[operates.length - 1].val : val; - if (operate.type === SignalType && operates[0].code && val) { - return { - over: true, - type: operate.type, - code: operates[0].code, - operation: SignalOperation.atsAutoControl.event.confirm, - val: val - }; - } - return { error: true }; - } - return null; + if (operate.type === SignalType && operates[0].code && val) { + return { + over: true, + type: operate.type, + code: operates[0].code, + operation: SignalOperation.atsAutoControl.event.confirm, + val: val + }; + } + return { error: true }; + } + return null; } // 自动控 按钮操作 function handleButtonAtsAutoControl(operates) { - if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.atsAutoControl.event.confirm - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.atsAutoControl.event.confirm + }; + } + return { error: true }; + } + return null; } /** @@ -620,18 +619,18 @@ function handleButtonAtsAutoControl(operates) { * @param {*} operates */ function handleMenuDetail(operates) { - if (operates.length == 1) { - const operate = operates[0]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.detail.event.query - }; - } - return { error: true }; - } - return null; + if (operates.length == 1) { + const operate = operates[0]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.detail.event.query + }; + } + return { error: true }; + } + return null; } /** @@ -639,19 +638,19 @@ function handleMenuDetail(operates) { * @param {*} operates */ function handleButtonSetAutoInterlock(operates) { - if (operates.length >= 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - over: true, - operation: SignalOperation.setAutoInterlock.event - }; - } - return { error: true }; - } - return null; + if (operates.length >= 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + over: true, + operation: SignalOperation.setAutoInterlock.event + }; + } + return { error: true }; + } + return null; } /** @@ -659,34 +658,34 @@ function handleButtonSetAutoInterlock(operates) { * @param {*} operates */ function handleButtonGuideRoute(operates) { - if (operates.length == 2) { - const operate = operates[operates.length - 1]; - if (operate.type === SignalType && operate.code) { - return { - type: operate.type, - code: operate.code, - operation: SignalOperation.guide.event.confirm - }; - } - return { error: true }; - } else if (operates.length >= 3) { - const operateBeg = operates[1]; - const operateEnd = operates[operates.length - 1]; - if (operateEnd.type === SignalType && operateEnd.code && operateEnd.tempData && operateEnd.tempData.length) { - for (let i = 0; i < operateEnd.tempData.length; i++) { - const elem = operateEnd.tempData[i]; - if (elem.startSignalCode === operateBeg.code && elem.endSignalCode == operateEnd.code) { - return { - type: operateEnd.type, - code: operateEnd.code, - over: true, - operation: SignalOperation.guide.event.confirm - }; - } - } - } - return { error: true }; - } - return null; + if (operates.length == 2) { + const operate = operates[operates.length - 1]; + if (operate.type === SignalType && operate.code) { + return { + type: operate.type, + code: operate.code, + operation: SignalOperation.guide.event.confirm + }; + } + return { error: true }; + } else if (operates.length >= 3) { + const operateBeg = operates[1]; + const operateEnd = operates[operates.length - 1]; + if (operateEnd.type === SignalType && operateEnd.code && operateEnd.tempData && operateEnd.tempData.length) { + for (let i = 0; i < operateEnd.tempData.length; i++) { + const elem = operateEnd.tempData[i]; + if (elem.startSignalCode === operateBeg.code && elem.endSignalCode == operateEnd.code) { + return { + type: operateEnd.type, + code: operateEnd.code, + over: true, + operation: SignalOperation.guide.event.confirm + }; + } + } + } + return { error: true }; + } + return null; } diff --git a/src/views/designPlatform/demonList.vue b/src/views/designPlatform/demonList.vue index 6e1a4ece1..ec1d5dd15 100644 --- a/src/views/designPlatform/demonList.vue +++ b/src/views/designPlatform/demonList.vue @@ -95,12 +95,13 @@ export default { switch (obj.type) { case 'scriptDesign': { setSessionStorage('designType', 'scriptDesign'); - this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?skinCode=${obj.skinCode}` }); + this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}` }); break; } case 'lessonDesign': { setSessionStorage('designType', 'lessonDesign'); - this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}/${obj.skinCode}`, query: {cityCode: obj.cityCode} }); + // /${obj.skinCode} + this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}`, query: {cityCode: obj.cityCode} }); break; } case 'runPlanDesign': { diff --git a/src/views/jlmap3d/drive/jl3ddrive.vue b/src/views/jlmap3d/drive/jl3ddrive.vue index 0f22e8fd8..9a0d4e0db 100644 --- a/src/views/jlmap3d/drive/jl3ddrive.vue +++ b/src/views/jlmap3d/drive/jl3ddrive.vue @@ -3,14 +3,14 @@
- {{$t('jlmap3d.trainGroupNumber')}}{{ trainnum }} {{ stoptimes }} + {{ $t('jlmap3d.trainGroupNumber') }}{{ trainnum }} {{ stoptimes }}
{{ cctvbuttonmsg }} {{ showbuttonmsg }} - {{$t('global.back')}} + {{ $t('global.back') }}
@@ -20,8 +20,7 @@
-
-
+
@@ -53,185 +52,185 @@ import DriveTms from '@/views/jlmap3d/drive/sceneview/tmsview'; var train; export default { - name: 'Jl3dDrive', - components: { - DriveMmi, - DriveTms - }, - data() { - return { - trainlist: null, - stationlist: null, - msgdata: null, - training: { - id: '', - name: '', - remarks: '' - }, - mapdata: null, - jlmap3d: null, - selectmodel: null, - cctvshow:true, - cctvbuttonmsg: this.$t('jlmap3d.surveillanceHidden'), - mmishow: false, - showbuttonmsg: this.$t('jlmap3d.trainInstrumentationDisplay'), - trainnum: '', - stoptimes: '' - }; - }, - watch: { - 'jlmap3d.nowspeed': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - if (this.mmishow == true) { - this.$refs.mmiui.updatespeed(newVal); - } - } - } - }, - 'jlmap3d.nowmxlen': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - if (this.mmishow == true) { - this.$refs.mmiui.updatelen(newVal); - } - } - } - }, - 'jlmap3d.atpspeed': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - if (this.mmishow == true) { - this.$refs.mmiui.updateatpspeed(newVal); - } - } - } - }, - 'jlmap3d.atospeed': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - if (this.mmishow == true) { - this.$refs.mmiui.updateatospeed(newVal); - } - } - } - }, - 'jlmap3d.trainnum': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - this.trainnum = newVal; - } - } - }, - 'jlmap3d.stime': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - this.stoptimes = newVal; - } - } - }, - 'jlmap3d.drivecount': { - handler: function (newVal, oldVal) { - if (newVal != oldVal) { - this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata); - } - } - } - }, - beforeDestroy() { - if (this.jlmap3d) { - this.jlmap3d.webwork.postMessage('off'); - this.jlmap3d.endsocket(); - this.jlmap3d.dispose(); - this.jlmap3d = null; + name: 'Jl3dDrive', + components: { + DriveMmi, + DriveTms + }, + data() { + return { + trainlist: null, + stationlist: null, + msgdata: null, + training: { + id: '', + name: '', + remarks: '' + }, + mapdata: null, + jlmap3d: null, + selectmodel: null, + cctvshow:true, + cctvbuttonmsg: this.$t('jlmap3d.surveillanceHidden'), + mmishow: false, + showbuttonmsg: this.$t('jlmap3d.trainInstrumentationDisplay'), + trainnum: '', + stoptimes: '' + }; + }, + watch: { + 'jlmap3d.nowspeed': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + if (this.mmishow == true) { + this.$refs.mmiui.updatespeed(newVal); + } + } + } + }, + 'jlmap3d.nowmxlen': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + if (this.mmishow == true) { + this.$refs.mmiui.updatelen(newVal); + } + } + } + }, + 'jlmap3d.atpspeed': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + if (this.mmishow == true) { + this.$refs.mmiui.updateatpspeed(newVal); + } + } + } + }, + 'jlmap3d.atospeed': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + if (this.mmishow == true) { + this.$refs.mmiui.updateatospeed(newVal); + } + } + } + }, + 'jlmap3d.trainnum': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + this.trainnum = newVal; + } + } + }, + 'jlmap3d.stime': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + this.stoptimes = newVal; + } + } + }, + 'jlmap3d.drivecount': { + handler: function (newVal, oldVal) { + if (newVal != oldVal) { + this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata); + } + } + } + }, + beforeDestroy() { + if (this.jlmap3d) { + this.jlmap3d.webwork.postMessage('off'); + this.jlmap3d.endsocket(); + this.jlmap3d.dispose(); + this.jlmap3d = null; - // this.$destroy(); - } - }, + // this.$destroy(); + } + }, - mounted() { - this.mmishow = true; + mounted() { + this.mmishow = true; - // this.$refs.mmiui.init(); - }, - methods: { - show: function (skinCode) { - // console.log("show"); - // console.log(skinCode); - // console.log(this.jlmap3d); + // this.$refs.mmiui.init(); + }, + methods: { + show: function (skinCode) { + // console.log("show"); + // console.log(skinCode); + // console.log(this.jlmap3d); - if (this.jlmap3d == null) { - this.init(skinCode); - } else { - // this.jlmap3d.restart(); - this.jlmap3d.eventon(); - this.jlmap3d.animateon(); + if (this.jlmap3d == null) { + this.init(skinCode); + } else { + // this.jlmap3d.restart(); + this.jlmap3d.eventon(); + this.jlmap3d.animateon(); - } - }, - init: function (skinCode) { - const mapdata = this.$store.getters['map/map']; - const dom = document.getElementById('app'); - this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode,this.$store); - this.jlmap3d.eventon(); - this.cctvshow = false; + } + }, + init: function (skinCode) { + const mapdata = this.$store.getters['map/map']; + const dom = document.getElementById('app'); + this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode, this.$store); + this.jlmap3d.eventon(); + this.cctvshow = false; - }, - raystand() { - this.jlmap3d.rayswitch('stand'); - }, - raytrain() { - this.jlmap3d.rayswitch('train'); - }, - raysection() { - this.jlmap3d.rayswitch('section'); - }, - raysignal() { - this.jlmap3d.rayswitch('signal'); - }, - rayswitch() { - this.jlmap3d.rayswitch('switch'); - }, - sstation(changedata) { - this.jlmap3d.updatecamera(changedata.mesh, 'station'); - }, - strain(changedata) { - if (changedata.dispose == false) { - this.jlmap3d.updatecamera(changedata, 'train'); - } + }, + raystand() { + this.jlmap3d.rayswitch('stand'); + }, + raytrain() { + this.jlmap3d.rayswitch('train'); + }, + raysection() { + this.jlmap3d.rayswitch('section'); + }, + raysignal() { + this.jlmap3d.rayswitch('signal'); + }, + rayswitch() { + this.jlmap3d.rayswitch('switch'); + }, + sstation(changedata) { + this.jlmap3d.updatecamera(changedata.mesh, 'station'); + }, + strain(changedata) { + if (changedata.dispose == false) { + this.jlmap3d.updatecamera(changedata, 'train'); + } - }, + }, - back() { - this.$emit('showdriving'); - this.jlmap3d.eventoff(); - this.jlmap3d.animateoff(); - // this.jlmap3d = null; - }, - showplane() { - if (this.mmishow == true) { - this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationHidden'); - this.mmishow = false; - } else { - this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationDisplay'); - this.mmishow = true; - } + back() { + this.$emit('showdriving'); + this.jlmap3d.eventoff(); + this.jlmap3d.animateoff(); + // this.jlmap3d = null; + }, + showplane() { + if (this.mmishow == true) { + this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationHidden'); + this.mmishow = false; + } else { + this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationDisplay'); + this.mmishow = true; + } - }, - cctvplane() { - if (this.cctvshow == true) { - this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceHidden'); - this.cctvshow = false; - this.jlmap3d.cctvoff(); - } else { - this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceDisplay'); - this.cctvshow = true; - this.jlmap3d.cctvon(); - } + }, + cctvplane() { + if (this.cctvshow == true) { + this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceHidden'); + this.cctvshow = false; + this.jlmap3d.cctvoff(); + } else { + this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceDisplay'); + this.cctvshow = true; + this.jlmap3d.cctvon(); + } - } + } - } + } }; diff --git a/src/views/lesson/trainingRule/addEdit.vue b/src/views/lesson/trainingRule/addEdit.vue index eceda8f21..68d9261bf 100644 --- a/src/views/lesson/trainingRule/addEdit.vue +++ b/src/views/lesson/trainingRule/addEdit.vue @@ -197,6 +197,7 @@ export default { // 获取操作占位列表 const res = await getPlaceholderList({ trainingType: data.trainingType }); this.placeholderList = res.data; + debugger; this.formModel = { id: data.id, trainingName: this.repliceName(data.trainingName, this.placeholderList), @@ -227,7 +228,6 @@ export default { }, changeList(val) { // 获取操作占位列表 - debugger; getPlaceholderList({ trainingType: val}).then(res => { this.placeholderList = res.data; }); @@ -250,6 +250,7 @@ export default { }, create() { const self = this; + this.loading = true; this.placeholderList.forEach(item => { if (this.formModel.trainingName.includes(`{${item.name}}`)) { const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`); @@ -261,7 +262,6 @@ export default { } }); - this.loading = true; postTrainingRulesData(this.formModel).then(response => { self.loading = false; self.$message.success(this.$t('lesson.createOperateSuccess')); diff --git a/src/views/lesson/trainingmanage/draft.vue b/src/views/lesson/trainingmanage/draft.vue index 386b1d465..0f6ea7360 100644 --- a/src/views/lesson/trainingmanage/draft.vue +++ b/src/views/lesson/trainingmanage/draft.vue @@ -287,7 +287,6 @@ export default { addAutoTraining(data).then(response => { this.$message.success(this.$t('tip.automaticGenerationTrainingSuccess')); - debugger; this.$emit('refresh'); this.close(); }).catch(() => { diff --git a/src/views/scriptManage/display/tipScriptRecord.vue b/src/views/scriptManage/display/tipScriptRecord.vue index b9d5fd057..11884dc22 100644 --- a/src/views/scriptManage/display/tipScriptRecord.vue +++ b/src/views/scriptManage/display/tipScriptRecord.vue @@ -5,7 +5,7 @@ {{ $t('scriptRecord.scriptRecordTitle') }} - ( {{$t('scriptRecord.language')}}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} ) + ( {{ $t('scriptRecord.language') }}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} ) @@ -34,153 +34,153 @@ import AddRole from '../scriptRecord/addRole'; import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation'; export default { - name: 'TipScriptRecord', - components: { - GetAction, - AddRole, - AddAction - }, - props: { - group: { - type: String, - required: true - }, - width: { - type: Number || String, - required: true - } - }, - data() { - return { - title: this.$t('scriptRecord.scriptRecordTitle'), - isShrink: false, - mapLocation: {}, - autoSaveScript: null, - isSavingScript: false, - isPause: true, - executeDisabled: false, - backDisabled: false, - size: { - width: 350, - height: window.innerHeight-342 - } - }; - }, - watch: { - '$store.state.scriptRecord.bgSet': function (val) { - this.backDisabled=val; - }, - '$store.state.app.windowSizeCount': function() { - this.size = { width: 350, height: window.innerHeight-342}; - }, - width: function(val) { - this.size = { width: val / 2 - 20, height: window.innerHeight - 342}; - } - }, - mounted() { - this.initAutoSaveScript(); - this.backDisabled=this.$store.state.scriptRecord.bgSet; - }, - beforeDestroy() { - this.clearAutoSave(); - }, - methods: { - setIsParse(isPause) { - this.isPause=isPause; - }, - setDisabled(data) { - this.executeDisabled=!data; - }, - initAutoSaveScript() { - const timeout = 1000 * 20; - this.clearAutoSave(this.autoSaveScript); - this.autoSaveScript = setInterval(this.saveScenesData, timeout); - }, - clearAutoSave() { - if (this.autoSaveScript) { - clearInterval(this.autoSaveScript); - this.autoSaveScript = null; - } - }, - pauseScript() { - scriptPause(this.group).then(resp => { - this.$store.dispatch('scriptRecord/updateSimulationPause', true); - }).catch(() => { - this.$messageBox(this.$t('scriptRecord.pauseFail')); - }); - }, - executePlayScript() { - executeScript(this.group).then(resp => { - this.$store.dispatch('scriptRecord/updateSimulationPause', false); - }).catch(() => { - this.$messageBox(this.$t('scriptRecord.recoverFail')); - }); - }, - saveScenesStage() { - const data=Vue.prototype.$jlmap.$options; - const group=this.$route.query.group; - const dataZoom={scale: data.scaleRate, x: data.offsetX, y: data.offsetY}; - saveScriptScenes(this.group).then(resp => { - updateMapLocation(group, dataZoom).then(response=>{ - this.$store.dispatch('scriptRecord/updateBgSet', true); - this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess')); - }).catch(error => { - this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`); - }); - }).catch(() => { - this.$messageBox(this.$t('scriptRecord.saveBackgroundFail')); - }); + name: 'TipScriptRecord', + components: { + GetAction, + AddRole, + AddAction + }, + props: { + group: { + type: String, + required: true + }, + width: { + type: Number || String, + required: true + } + }, + data() { + return { + title: this.$t('scriptRecord.scriptRecordTitle'), + isShrink: false, + mapLocation: {}, + autoSaveScript: null, + isSavingScript: false, + isPause: true, + executeDisabled: false, + backDisabled: false, + size: { + width: 350, + height: window.innerHeight - 342 + } + }; + }, + watch: { + '$store.state.scriptRecord.bgSet': function (val) { + this.backDisabled = val; + }, + '$store.state.app.windowSizeCount': function() { + this.size = { width: 350, height: window.innerHeight - 342}; + }, + width: function(val) { + this.size = { width: val / 2 - 20, height: window.innerHeight - 342}; + } + }, + mounted() { + this.initAutoSaveScript(); + this.backDisabled = this.$store.state.scriptRecord.bgSet; + }, + beforeDestroy() { + this.clearAutoSave(); + }, + methods: { + setIsParse(isPause) { + this.isPause = isPause; + }, + setDisabled(data) { + this.executeDisabled = !data; + }, + initAutoSaveScript() { + const timeout = 1000 * 20; + this.clearAutoSave(this.autoSaveScript); + this.autoSaveScript = setInterval(this.saveScenesData, timeout); + }, + clearAutoSave() { + if (this.autoSaveScript) { + clearInterval(this.autoSaveScript); + this.autoSaveScript = null; + } + }, + pauseScript() { + scriptPause(this.group).then(resp => { + this.$store.dispatch('scriptRecord/updateSimulationPause', true); + }).catch(() => { + this.$messageBox(this.$t('scriptRecord.pauseFail')); + }); + }, + executePlayScript() { + executeScript(this.group).then(resp => { + this.$store.dispatch('scriptRecord/updateSimulationPause', false); + }).catch(() => { + this.$messageBox(this.$t('scriptRecord.recoverFail')); + }); + }, + saveScenesStage() { + const data = Vue.prototype.$jlmap.$options; + const group = this.$route.query.group; + const dataZoom = {scale: data.scaleRate, x: data.offsetX, y: data.offsetY}; + saveScriptScenes(this.group).then(resp => { + updateMapLocation(group, dataZoom).then(response=>{ + this.$store.dispatch('scriptRecord/updateBgSet', true); + this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess')); + }).catch(error => { + this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`); + }); + }).catch(() => { + this.$messageBox(this.$t('scriptRecord.saveBackgroundFail')); + }); - }, - saveScenesData() { - this.isSavingScript=true; - saveScriptData(this.group).then(resp => { - this.$message.success(this.$t('scriptRecord.saveDataSucess')); - this.isSavingScript=false; - this.initAutoSaveScript(); - }).catch(error => { - this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); - this.isSavingScript=false; - if (error.code === 40004 || error.code === 40005 || error.code === 40003) { - this.clearAutoSave(); - } else { - this.initAutoSaveScript(); - } - }); - }, - dumpScenesData() { - this.clearAutoSave(); - const group=this.group; - this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), { - confirmButtonText: this.$t('global.confirm'), - cancelButtonText: this.$t('global.cancel'), - type: 'warning' - }).then(() => { - dumpScriptData(group).then(resp => { - this.$parent.$refs['display'].$refs['menuScript'].resetBeginTime(); - this.$refs['getAction'].loadInitData(); - this.$refs['addRole'].initData(); - this.$refs['addAction'].initData(); - this.initAutoSaveScript(); - this.$store.dispatch('scriptRecord/updateBgSet', false); - this.$message.success(this.$t('scriptRecord.resetDataSuccess')); - }).catch(() => { - this.$messageBox(this.$t('scriptRecord.resetDataFail')); - }); - }).catch(() => { - this.initAutoSaveScript(); - }); - }, - refresh() { - this.$refs['addAction'].initData(); - }, - create() { - this.$refs['getAction'].loadInitData(); - }, - setAction(row) { - this.$refs['addAction'].doShow(row); - } - } + }, + saveScenesData() { + this.isSavingScript = true; + saveScriptData(this.group).then(resp => { + this.$message.success(this.$t('scriptRecord.saveDataSucess')); + this.isSavingScript = false; + this.initAutoSaveScript(); + }).catch(error => { + this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); + this.isSavingScript = false; + if (error.code === 40004 || error.code === 40005 || error.code === 40003) { + this.clearAutoSave(); + } else { + this.initAutoSaveScript(); + } + }); + }, + dumpScenesData() { + this.clearAutoSave(); + const group = this.group; + this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + cancelButtonText: this.$t('global.cancel'), + type: 'warning' + }).then(() => { + dumpScriptData(group).then(resp => { + this.$parent.$refs['display'].$refs['menuScript'].resetBeginTime(); + this.$refs['getAction'].loadInitData(); + this.$refs['addRole'].initData(); + this.$refs['addAction'].initData(); + this.initAutoSaveScript(); + this.$store.dispatch('scriptRecord/updateBgSet', false); + this.$message.success(this.$t('scriptRecord.resetDataSuccess')); + }).catch(() => { + this.$messageBox(this.$t('scriptRecord.resetDataFail')); + }); + }).catch(() => { + this.initAutoSaveScript(); + }); + }, + refresh() { + this.$refs['addAction'].initData(); + }, + create() { + this.$refs['getAction'].loadInitData(); + }, + setAction(row) { + this.$refs['addAction'].doShow(row); + } + } };