From 667bca7aa20e2c802fb2bed7ddc24c8774509701 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 16 Jun 2022 16:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E9=93=81=E9=A1=B9=E7=9B=AE=20ctc=20?= =?UTF-8?q?=E8=BD=A6=E5=8A=A1=E7=AE=A1=E7=90=86=E7=AB=AF=20=E5=88=97?= =?UTF-8?q?=E8=BD=A6=E5=9B=BA=E5=AE=9A=E8=B7=AF=E5=BE=84=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=87=B3ctc=20=E5=AF=BC=E5=85=A5=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/socket.js | 20 ++--- .../bigTrainRunplanManage/trainFixedPath.vue | 80 ++++++++++++++++++- 2 files changed, 88 insertions(+), 12 deletions(-) diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index b3d89fa43..05e32be8d 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -235,10 +235,12 @@ function handle(state, data) { break; // 大铁项目 ctc 车务管理端 初始化消息 case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT': + state.railCtcStationManageRpMsg = {}; msg.forEach(element => { const code = element.stationCode + '' + element.tripNumber; state.railCtcStationManageRpMsg[code] = element; }); + // state.railCtcStationManageRpChange++; break; // 大铁项目 ctc 车务管理端 修改/增加消息 case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE': @@ -256,15 +258,15 @@ function handle(state, data) { }); state.railCtcStationManageRpChange++; break; - // 大铁项目 ctc 车务管理端 覆盖消息 - case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_COVER': - state.railCtcStationManageRpMsg = {}; - msg.forEach(element => { - const code = element.stationCode + '' + element.tripNumber; - state.railCtcStationManageRpMsg[code] = element; - }); - state.railCtcStationManageRpChange++; - break; + // // 大铁项目 ctc 车务管理端 覆盖消息 + // case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_COVER': + // state.railCtcStationManageRpMsg = {}; + // msg.forEach(element => { + // const code = element.stationCode + '' + element.tripNumber; + // state.railCtcStationManageRpMsg[code] = element; + // }); + // state.railCtcStationManageRpChange++; + // break; } } diff --git a/src/views/bigTrainRunplanManage/trainFixedPath.vue b/src/views/bigTrainRunplanManage/trainFixedPath.vue index 5e161c112..b7f5cf17c 100644 --- a/src/views/bigTrainRunplanManage/trainFixedPath.vue +++ b/src/views/bigTrainRunplanManage/trainFixedPath.vue @@ -22,8 +22,11 @@
版本号 备份 - 更新至生效区 - 导入 + 更新至生效区 + + 导入 + + 比较
@@ -236,6 +239,7 @@ import { now} from '@/utils/date'; import TerminalStationList from './terminalStationList'; import AddRunplan from './addRunplan'; import { copyAssign } from '@/utils/index'; +import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; export default { name:'TrainFixedPath', components: { @@ -281,6 +285,62 @@ export default { el.click(); urlObject.revokeObjectURL(url); }, + importf() { + const that = this; + setTimeout(() => { + const obj = this.$refs.files; + if (!obj.files) return; + const f = obj.files[0]; + if (f.type != 'application/json') { + this.$message.error('请上传json格式的文件'); + return; + } + const loading = this.$loading({ + lock: true, + text: '正在导入中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + const reader = new FileReader(); + reader.readAsText(f, 'utf-8'); + reader.onload = function(e) { + const data = e.target.result; + that.formDisplay = true; + const json = JSON.parse(data); + if (json && json.runPlanParamList && json.stationCode) { + if (json.runPlanParamList.length > 0) { + const param = {stationCode:json.stationCode, runPlanParamList:json.runPlanParamList}; + commitOperate(menuOperate.CTC.importTrainFixedPath, param, 3).then(({valid})=>{ + if (valid) { + loading.close(); + that.$message.success('导入成功!'); + } + }).catch(() => { + loading.close(); + that.$message.error('导入失败'); + }); + + } else { + that.$message.error('该文件数据为空'); + loading.close(); + } + } else { + that.$message.error('该文件数据结构不正确'); + loading.close(); + } + }; + }); + }, + releaseTrainFixedPath() { + const that = this; + commitOperate(menuOperate.CTC.releaseTrainFixedPath, { stationCode:this.currentStationCode}, 3).then(({valid})=>{ + if (valid) { + that.$message.success('发布成功!'); + } + }).catch(() => { + that.$message.error('发布失败'); + }); + }, handleData() { this.tableData = []; const railCtcStationManageRpMsg = copyAssign({}, this.$store.state.socket.railCtcStationManageRpMsg); @@ -343,6 +403,21 @@ export default { background-image: linear-gradient(#efffff,#a8daf3); } .trainFixedPathRTable{background:#a9a9a9;border-left: 1px #707070 solid;} +.trainFixedPathUpload { + position: relative; + overflow: hidden; + cursor: pointer; + input { + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; + opacity: 0; + cursor: pointer; + font-size: 0; + } +}