From db98a53907e198c447c51b9afbd5932c1fbd587a Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Tue, 16 Jun 2020 14:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=8F=E5=B7=9E=E9=81=93=E5=B2=94&=E5=88=97?= =?UTF-8?q?=E8=BD=A6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../menus/dialog/speedCmdControl.vue | 2 +- .../menus/dialog/switchCmdControl.vue | 15 +- .../fuzhou_01/menus/dialog/switchControl.vue | 124 ++--------- .../fuzhou_01/menus/dialog/trainControl.vue | 198 ++++++++---------- .../theme/fuzhou_01/menus/menuTrain.vue | 156 +++++++------- .../fuzhou_01/menus/utils/menuOperate.js | 20 ++ .../theme/xian_01/menus/utils/menuOperate.js | 2 +- 7 files changed, 211 insertions(+), 306 deletions(-) diff --git a/src/jmapNew/theme/fuzhou_01/menus/dialog/speedCmdControl.vue b/src/jmapNew/theme/fuzhou_01/menus/dialog/speedCmdControl.vue index 3aee1dd5a..f4cd11712 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/dialog/speedCmdControl.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/dialog/speedCmdControl.vue @@ -296,7 +296,7 @@ export default { this.timer = null; }, methods: { - doShow(operate, selected, tempData) { + doShow(operate, selected) { if (!this.dialogShow) { this.name = ''; this.stationName = ''; diff --git a/src/jmapNew/theme/fuzhou_01/menus/dialog/switchCmdControl.vue b/src/jmapNew/theme/fuzhou_01/menus/dialog/switchCmdControl.vue index f55a1a53d..53c043c2f 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/dialog/switchCmdControl.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/dialog/switchCmdControl.vue @@ -302,7 +302,7 @@ export default { }, commandNoPopUp() { const operate = { - + operation: '' }; if (this.operation == OperationEvent.Switch.unlock.menu.operation) { @@ -321,7 +321,7 @@ export default { this.setMessage(this.$t('tip.firstConfirmTip')); this.writeRecord({ order: ++this.order, date: now(), context: this.$t('menu.clickReleaseCommand'), result: '' }); - this.$store.dispatch('training/next', operate).then(({ valid }) => { + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.setButtonEnable({ step: 1 }); @@ -335,7 +335,7 @@ export default { }, confirm1() { const operate = { - + operation: '' }; if (this.operation == OperationEvent.Switch.unlock.menu.operation) { @@ -354,7 +354,7 @@ export default { this.setMessage(this.$t('tip.secondConfirmTip')); this.writeRecord({ order: ++this.order, date: now(), context: this.$t('menu.clickFirstConfirm'), result: '' }); - this.$store.dispatch('training/next', operate).then(({ valid }) => { + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.timeCountCommand = -1; @@ -392,7 +392,7 @@ export default { } this.setMessage(''); this.writeRecord({ order: ++this.order, date: now(), context: this.$t('menu.clickSecondConfirm'), result: '' }); - this.$store.dispatch('training/next', operate).then(({ valid }) => { + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.timeCountCommand = -1; this.timeCountConfirm = -1; this.setButtonEnable({ step: -1 }); @@ -428,7 +428,7 @@ export default { } this.writeRecord({ order: ++this.order, date: now(), context: this.$t('menu.clickSuspend'), result: '' }); - this.$store.dispatch('training/next', operate).then(({ valid }) => { + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.setButtonEnable({ step: 0 }); @@ -444,8 +444,7 @@ export default { const operate = { operation: OperationEvent.Command.close.menu.operation }; - - this.$store.dispatch('training/next', operate).then(({ valid }) => { + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.doClose(); } diff --git a/src/jmapNew/theme/fuzhou_01/menus/dialog/switchControl.vue b/src/jmapNew/theme/fuzhou_01/menus/dialog/switchControl.vue index acdfa7ced..6311ae4bc 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/dialog/switchControl.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/dialog/switchControl.vue @@ -49,6 +49,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import OperationHandler from '@/scripts/cmdPlugin/OperationHandler'; import NoticeInfo from './childDialog/childDialog/noticeInfo'; import CMD from '@/scripts/cmdPlugin/CommandEnum'; +import { menuOperate, commitOperate } from '../utils/menuOperate'; export default { name: 'SwitchControl', @@ -153,133 +154,52 @@ export default { }, // 道岔单锁 lock() { - const operate = { - over: true, - operation: OperationEvent.Switch.lock.menu.operation, - cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK - }; - - this.loading = true; - this.$store.dispatch('training/next', operate).then(({ valid }) => { - this.loading = false; - if (valid) { - this.doClose(); - } - }).catch(() => { - this.loading = false; - this.doClose(); - this.$refs.noticeInfo.doShow(operate); - }); + this.sendCommand(menuOperate.Switch.lock); }, // 道岔封锁 block() { - const operate = { - over: true, - operation: OperationEvent.Switch.block.menu.operation, - cmdType: CMD.Switch.CMD_SWITCH_BLOCK - }; - - this.loading = true; - this.$store.dispatch('training/next', operate).then(({ valid }) => { - this.loading = false; - if (valid) { - this.doClose(); - } - }).catch(() => { - this.loading = false; - this.doClose(); - this.$refs.noticeInfo.doShow(operate); - }); + this.sendCommand(menuOperate.Switch.block); }, // 道岔转动 - turnout(operation) { - const operate = { - over: true, - operation: OperationEvent.Switch.turnout.menu.operation, - cmdType: CMD.Switch.CMD_SWITCH_TURN - }; - - this.loading = true; - this.$store.dispatch('training/next', operate).then(({ valid }) => { - this.loading = false; - if (valid) { - this.doClose(); - } - }).catch(() => { - this.loading = false; - this.doClose(); - this.$refs.noticeInfo.doShow(operate); - }); + turnout() { + this.sendCommand(menuOperate.Switch.turnout); }, // 道岔强扮 turnoutForce() { - const operate = { - over: true, - operation: OperationEvent.Switch.turnoutForce.menu.operation, - cmdType: CMD.Switch.CMD_SWITCH_FORCE_TURN - }; - this.loading = true; - this.$store.dispatch('training/next', operate).then(({ valid }) => { - this.loading = false; - if (valid) { - this.doClose(); - } - }).catch(() => { - this.loading = false; - this.doClose(); - this.$refs.noticeInfo.doShow(operate); - }); + this.sendCommand(menuOperate.Switch.turnoutForce); }, // 区段切除 split() { - const operate = { - over: true, - operation: OperationEvent.Switch.split.menu.operation, - cmdType: CMD.Switch.CMD_SWITCH_CUT_OFF - }; - this.loading = true; - this.$store.dispatch('training/next', operate).then(({ valid }) => { - this.loading = false; - if (valid) { - this.doClose(); - } - }).catch(() => { - this.loading = false; - this.doClose(); - this.$refs.noticeInfo.doShow(operate); - }); + this.sendCommand(menuOperate.Switch.split); }, // 区段激活 active() { - const operate = { - over: true, - operation: OperationEvent.Switch.active.menu.operation, - cmdType: CMD.Switch.CMD_SWITCH_ACTIVE - }; - this.loading = true; - this.$store.dispatch('training/next', operate).then(({ valid }) => { - this.loading = false; - if (valid) { - this.doClose(); - } - }).catch(() => { - this.loading = false; - this.doClose(); - this.$refs.noticeInfo.doShow(operate); - }); + this.sendCommand(menuOperate.Switch.active); }, cancel() { const operate = { operation: OperationEvent.Command.cancel.menu.operation }; - - this.$store.dispatch('training/next', operate).then(({ valid }) => { + this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.doClose(); } }).catch(() => { this.doClose(); }); + }, + sendCommand(operate) { // 发送指令 + this.loading = true; + commitOperate(operate, {}, 2).then(({valid})=>{ + this.loading = false; + if (valid) { + this.doClose(); + } + }).catch((error) => { + this.loading = false; + this.doClose(); + this.$refs.noticeInfo.doShow(error.message); + }); } } }; diff --git a/src/jmapNew/theme/fuzhou_01/menus/dialog/trainControl.vue b/src/jmapNew/theme/fuzhou_01/menus/dialog/trainControl.vue index 87286986a..1498f89d1 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/dialog/trainControl.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/dialog/trainControl.vue @@ -17,42 +17,41 @@ /> - + - {{ $t('menu.planTrain') }} - {{ $t('menu.headCodeTrain') }} - {{ $t('menu.artificialTrain') }} + {{ $t('menu.planTrain') }} + {{ $t('menu.headCodeTrain') }} + {{ $t('menu.artificialTrain') }} - - {{ $t('menu.serviceNumber') }} + + {{ $t('menu.serviceNumber') + ':' }} - + - + - + - {{ $t('global.confirm') }} + {{ $t('global.confirm') }} {{ $t('global.cancel') }} @@ -84,10 +83,11 @@