大铁项目 ctc 车务管理端 列车固定路径 更新至ctc 导入 代码调整

This commit is contained in:
joylink_cuiweidong 2022-06-16 16:36:18 +08:00
parent a48698877d
commit 667bca7aa2
2 changed files with 88 additions and 12 deletions

View File

@ -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;
}
}

View File

@ -22,8 +22,11 @@
<div class="trainFixedPathRMenuR">
<span class="trainFixedPathRVer">版本号</span>
<el-button class="trainFixedPathButton" size="small" @click="exportData">备份</el-button>
<el-button class="trainFixedPathButton" size="small">更新至生效区</el-button>
<el-button class="trainFixedPathButton" size="small">导入</el-button>
<el-button class="trainFixedPathButton" size="small" @click="releaseTrainFixedPath">更新至生效区</el-button>
<el-button class="trainFixedPathButton trainFixedPathUpload" size="small">
导入
<input ref="files" type="file" class="file_box" accept=".json, application/json" @change="importf">
</el-button>
<el-button class="trainFixedPathButton" size="small">比较</el-button>
</div>
</div>
@ -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;
}
}
</style>
<style lang="scss">
#trainFixedPathTableIn.el-table td, #trainFixedPathTableIn.el-table th{
@ -351,6 +426,5 @@ export default {
border-color: #a5a5a5;
}
#trainFixedPathTableIn.el-table .cell{ padding-left: 5px;padding-right: 5px; text-align: center;}
</style>