This commit is contained in:
zyy 2020-09-02 17:11:23 +08:00
commit 69388e4f91
21 changed files with 505 additions and 449 deletions

View File

@ -355,6 +355,7 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal' fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 停站时间方向
offset: { x: -8, y: 4 }, // 运行时间偏移量 offset: { x: -8, y: 4 }, // 运行时间偏移量
textColor: 'white', // 停站时间字体颜色 textColor: 'white', // 停站时间字体颜色
textFontSize: 10 // 停站时间字体大小 textFontSize: 10 // 停站时间字体大小

View File

@ -409,6 +409,7 @@ class SkinCode extends defaultStyle {
specialShape: 'rect' // 扣车标志形状 specialShape: 'rect' // 扣车标志形状
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 停站时间方向
offset: { x: -8, y: 4 }, // 运行时间偏移量 offset: { x: -8, y: 4 }, // 运行时间偏移量
textColor: 'white', // 停站时间字体颜色 textColor: 'white', // 停站时间字体颜色
textFontSize: 10 // 停站时间字体大小 textFontSize: 10 // 停站时间字体大小

View File

@ -29,7 +29,6 @@ class ETime extends Group {
textVerticalAlign: style.textStyle.textVerticalAlign textVerticalAlign: style.textStyle.textVerticalAlign
} }
}); });
this.add(this.time); this.add(this.time);
} }
} }
@ -45,13 +44,12 @@ class ETime extends Group {
} }
hideMode() { hideMode() {
this.create(); this.time && this.time.hide();
this.time.hide();
} }
showMode() { showMode() {
this.create(); this.create();
this.time.show(); this.time && this.time.show();
} }
} }

View File

@ -210,7 +210,7 @@ export default {
}, },
commit() { commit() {
this.loading = true; this.loading = true;
commitOperate(menuOperate.StationStand.setStopTime, {parkingTime: this.control == '01' ? -1 : this.parkingTime, parkingAlwaysValid: this.effective}, 2).then(({ valid })=>{ commitOperate(menuOperate.StationStand.setStopTime, {parkingTime: this.control == '01' ? -1 : this.time, parkingAlwaysValid: this.effective}, 2).then(({ valid })=>{
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();

View File

@ -87,8 +87,8 @@ export default {
stepVOList: [ stepVOList: [
{ deviceType: '06', orderNum: 1, operateCode: '502', tip: '鼠标右键菜单选择【设置跳停】' }, { deviceType: '06', orderNum: 1, operateCode: '502', tip: '鼠标右键菜单选择【设置跳停】' },
{ deviceType: '06', orderNum: 2, operateCode: '5024', tip: '鼠标左键点击' }, { deviceType: '06', orderNum: 2, operateCode: '5024', tip: '鼠标左键点击' },
{ deviceType: '06', orderNum: 2, operateCode: '5022', tip: '请选择001号车', val: '001' }, { deviceType: '06', orderNum: 3, operateCode: '5022', tip: '请选择001号车', val: '001' },
{ deviceType: '06', orderNum: 2, operateCode: '502', tip: '鼠标左键点击【确定】按钮' } { deviceType: '06', orderNum: 4, operateCode: '502', tip: '鼠标左键点击【确定】按钮' }
] ]
}, },
{ {

View File

@ -249,6 +249,7 @@ export default {
}, },
handleSwicthMenu() { // handleSwicthMenu() { //
// //
this.clearAllMenuShow();
const section = this.$store.getters['map/getDeviceByCode'](this.selectedObj.sectionParentCode); const section = this.$store.getters['map/getDeviceByCode'](this.selectedObj.sectionParentCode);
const sectionA = this.$store.getters['map/getDeviceByCode'](this.selectedObj.sectionACode); // const sectionA = this.$store.getters['map/getDeviceByCode'](this.selectedObj.sectionACode); //
const sectionB = this.$store.getters['map/getDeviceByCode'](this.selectedObj.sectionBCode); const sectionB = this.$store.getters['map/getDeviceByCode'](this.selectedObj.sectionBCode);
@ -274,6 +275,7 @@ export default {
}; };
}, },
handleSingalMenu() { handleSingalMenu() {
this.clearAllMenuShow();
this.deviceHighLight(this.oldDevice, false); this.deviceHighLight(this.oldDevice, false);
this.deviceHighLight(this.selectedObj, true); this.deviceHighLight(this.selectedObj, true);
this.oldDevice = this.selectedObj; this.oldDevice = this.selectedObj;
@ -351,6 +353,7 @@ export default {
} }
}, },
handleSectionMenu() { handleSectionMenu() {
this.clearAllMenuShow();
this.deviceHighLight(this.oldDevice, false); this.deviceHighLight(this.oldDevice, false);
this.deviceHighLight(this.selectedObj, true); this.deviceHighLight(this.selectedObj, true);
this.oldDevice = this.selectedObj; this.oldDevice = this.selectedObj;
@ -386,6 +389,7 @@ export default {
}; };
}, },
handleStationMenu() { handleStationMenu() {
this.clearAllMenuShow();
this.centralizedStationList = new Array(15).fill({}); this.centralizedStationList = new Array(15).fill({});
this.stationParamList.forEach((station, index) => { this.stationParamList.forEach((station, index) => {
this.centralizedStationList[index] = station; this.centralizedStationList[index] = station;
@ -398,6 +402,7 @@ export default {
this.param = { stationCode: this.selectedObj.code }; this.param = { stationCode: this.selectedObj.code };
}, },
handleStandMenu() { handleStandMenu() {
this.clearAllMenuShow();
this.centralizedStationList = new Array(15).fill({}); this.centralizedStationList = new Array(15).fill({});
this.standParamList.forEach((stand, index) => { this.standParamList.forEach((stand, index) => {
this.centralizedStationList[index] = stand; this.centralizedStationList[index] = stand;

View File

@ -70,7 +70,7 @@ export default {
cmdType:CMD.Stand.CMD_STAND_EARLY_DEPART cmdType:CMD.Stand.CMD_STAND_EARLY_DEPART
}, },
{ {
label: '站台详细信息', label: '查看站台信息',
handler: this.detail, handler: this.detail,
cmdType:CMD.Stand.CMD_STAND_VIEW_STATUS cmdType:CMD.Stand.CMD_STAND_VIEW_STATUS
} }

View File

@ -84,6 +84,22 @@ export default {
{ deviceType: '06', orderNum: 2, operateCode: '502', tip: '鼠标左键点击【确定】按钮' } { deviceType: '06', orderNum: 2, operateCode: '502', tip: '鼠标左键点击【确定】按钮' }
] ]
}, },
{
maxDuration: 15,
minDuration: 8,
operateType: 'Stand_Set_Jump_Stop',
skinCode: '06',
trainingName: '设置跳停({10}-{12}站台)',
trainingRemark: '设置指定001号列车跳停功能',
trainingType: 'Stand',
productTypes: ['02'],
stepVOList: [
{ deviceType: '06', orderNum: 1, operateCode: '502', tip: '鼠标右键菜单选择【设置跳停】' },
{ deviceType: '06', orderNum: 2, operateCode: '5024', tip: '鼠标左键点击' },
{ deviceType: '06', orderNum: 3, operateCode: '5022', tip: '请选择001号车', val: '001' },
{ deviceType: '06', orderNum: 4, operateCode: '502', tip: '鼠标左键点击【确定】按钮' }
]
},
{ {
maxDuration: 15, maxDuration: 15,
minDuration: 8, minDuration: 8,
@ -212,12 +228,12 @@ export default {
minDuration: 5, minDuration: 5,
operateType: 'Stand_View_Status', operateType: 'Stand_View_Status',
skinCode: '06', skinCode: '06',
trainingName: '站台详细信息({10}-{12}站台)', trainingName: '查看站台信息({10}-{12}站台)',
trainingRemark: '站台详细信息功能', trainingRemark: '查看站台信息功能',
trainingType: 'Stand', trainingType: 'Stand',
productTypes: ['01', '02'], productTypes: ['01', '02'],
stepVOList: [ stepVOList: [
{ deviceType: '06', orderNum: 1, operateCode: '507', tip: '鼠标右键菜单选择【站台详细信息】' }, { deviceType: '06', orderNum: 1, operateCode: '507', tip: '鼠标右键菜单选择【查看站台信息】' },
{ deviceType: '06', orderNum: 2, operateCode: '0012', tip: '鼠标左键点击【确定】按钮' } { deviceType: '06', orderNum: 2, operateCode: '0012', tip: '鼠标左键点击【确定】按钮' }
] ]
}, },
@ -808,6 +824,62 @@ export default {
{ deviceType: '10', orderNum: 5, operateCode: '8005', tip: '鼠标左键点击【关闭】'}, { deviceType: '10', orderNum: 5, operateCode: '8005', tip: '鼠标左键点击【关闭】'},
{ deviceType: '10', orderNum: 6, operateCode: '8006', tip: '鼠标左键点击【确认】' } { deviceType: '10', orderNum: 6, operateCode: '8006', tip: '鼠标左键点击【确认】' }
] ]
},
{
maxDuration: 15,
minDuration: 8,
operateType: 'Station_Close_Auto_Setting',
skinCode: '06',
trainingName: ' 所有进路自排关({26})',
trainingRemark: ' 所有进路自排关',
trainingType: 'Station',
productTypes: ['02'],
stepVOList: [
{ deviceType: '05', orderNum: 1, operateCode: '605', tip: '鼠标右键菜单选择【所有进路自排关】'},
{ deviceType: '05', orderNum: 2, operateCode: '605', tip: '鼠标左键点击【确定】' }
]
},
{
maxDuration: 15,
minDuration: 8,
operateType: 'Station_Open_Auto_Setting',
skinCode: '06',
trainingName: ' 所有进路自排开({26})',
trainingRemark: ' 所有进路自排开',
trainingType: 'Station',
productTypes: ['02'],
stepVOList: [
{ deviceType: '05', orderNum: 1, operateCode: '606', tip: '鼠标右键菜单选择【所有进路自排开】'},
{ deviceType: '05', orderNum: 2, operateCode: '606', tip: '鼠标左键点击【确定】' }
]
},
{
maxDuration: 15,
minDuration: 8,
operateType: 'Station_Cancel_CI_Auto_Trigger',
skinCode: '06',
trainingName: ' 全站取消联锁自动触发({26})',
trainingRemark: ' 全站取消联锁自动触发',
trainingType: 'Station',
productTypes: ['01'],
stepVOList: [
{ deviceType: '05', orderNum: 1, operateCode: '602', tip: '鼠标右键菜单选择【全站取消联锁自动触发】'},
{ deviceType: '05', orderNum: 2, operateCode: '602', tip: '鼠标左键点击【确定】' }
]
},
{
maxDuration: 15,
minDuration: 8,
operateType: 'Station_Set_CI_Auto_Trigger',
skinCode: '06',
trainingName: ' 全站设置联锁自动触发({26})',
trainingRemark: ' 全站设置联锁自动触发',
trainingType: 'Station',
productTypes: ['01'],
stepVOList: [
{ deviceType: '05', orderNum: 1, operateCode: '601', tip: '鼠标右键菜单选择【全站设置联锁自动触发】'},
{ deviceType: '05', orderNum: 2, operateCode: '601', tip: '鼠标左键点击【确定】' }
]
} }
] ]
}; };

View File

@ -1,44 +1,77 @@
<template> <template>
<el-dialog v-dialogDrag class="ningbo-01__systerm route-setting" :title="title" :visible.sync="show" width="600px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false"> <el-dialog v-dialogDrag class="ningbo-01__systerm route-setting" :title="title" :visible.sync="show" width="800px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row> <el-row>
<el-col :span="3"> <el-col :span="4" style="border-bottom: 1px solid #ACABAA;border-left: 1px solid #ACABAA;border-top: 1px solid #ACABAA;padding-left: 8px;padding-bottom: 8px;">
<el-row> <el-row>
<div>开始</div> <div style="color: #000;position: relative; top: 15px;left: 5px;width: 40px;background: #F0F0F0;text-align: center;">开始</div>
<el-table :data="signalList" height="150"> <div style="border: 1px solid #ACABAA;padding: 8px;">
<el-table-column prop="name" label="信号机" /> <el-table :data="signalList" height="150">
</el-table> <el-table-column prop="name" width="70" label="信号机" />
</el-table>
</div>
</el-row> </el-row>
<el-row> <el-row>
<div>结束</div> <div style="color: #000;position: relative; top: 15px;left: 5px;width: 40px;background: #F0F0F0;text-align: center;">结束</div>
<el-table :data="signalList" height="150"> <div style="border: 1px solid #ACABAA;padding: 8px;">
<el-table-column prop="name" label="信号机" /> <el-table :data="signalList" height="150">
</el-table> <el-table-column prop="name" width="70" label="信号机" />
</el-table>
</div>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" style="padding: 30px 10px 0;border-bottom: 1px solid #ACABAA;border-right: 1px solid #ACABAA;border-top: 1px solid #ACABAA;">
<el-table :data="tempData"> <el-table :data="tempData" height="344px">
<el-table-column prop="path" label="路径" /> <el-table-column prop="path" label="路径" />
<el-table-column prop="direction" label="运行方向" /> <el-table-column prop="direction" label="运行方向" />
</el-table> </el-table>
<el-checkbox v-model="checked">显示复制路径</el-checkbox>
</el-col> </el-col>
<el-col :span="15"> <el-col :span="14" style="padding-left: 8px;">
<el-tabs v-model="activeName" type="card"> <el-tabs v-model="activeName" type="card">
<el-tab-pane label="设置进路" name="first">用户管理</el-tab-pane> <el-tab-pane label="设置进路" name="first">
<el-tab-pane label="取消进路" name="second">配置管理</el-tab-pane> <el-row>
<el-tab-pane label="禁止进路" name="third">角色管理</el-tab-pane> <el-col :span="18">
<el-table :data="routeList" height="120px">
<el-table-column prop="name" width="140" label="进路" />
<el-table-column prop="area" label="区域" />
<el-table-column prop="status" label="状态" />
</el-table>
</el-col>
<el-col :span="6">
<div class="radio-box-title">解锁类型</div>
<div class="radio-box">
<el-radio v-model="unlockType" label="auto" style="display: block;margin-bottom: 10px;">自动</el-radio>
<el-radio v-model="unlockType" label="artificial" style="display: block;">人工</el-radio>
</div>
</el-col>
</el-row>
<el-row>
<el-table :data="routeList" height="120px">
<el-table-column prop="name" width="140" label="进路" />
<el-table-column prop="area" label="区域" />
<el-table-column prop="area" label="区域" />
<el-table-column prop="status" label="状态" />
</el-table>
</el-row>
</el-tab-pane>
<el-tab-pane label="取消进路" name="second">取消进路</el-tab-pane>
<el-tab-pane label="禁止进路" name="third">禁止进路</el-tab-pane>
</el-tabs> </el-tabs>
</el-col> </el-col>
</el-row> </el-row>
<el-row justify="center" class="button-group"> <el-row justify="center" class="button-group">
<el-col :span="6" :offset="2"> <el-col :span="4" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定(O)</el-button> <el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定(O)</el-button>
</el-col> </el-col>
<el-col :span="6" :offset="2"> <el-col :span="4" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">应用(A)</el-button> <el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">应用(A)</el-button>
</el-col> </el-col>
<el-col :span="6" :offset="2"> <el-col :span="4" :offset="2">
<el-button :id="domIdCancel" @click="cancel">关闭(C)</el-button> <el-button :id="domIdCancel" @click="cancel">关闭(C)</el-button>
</el-col> </el-col>
<el-col :span="4" :offset="2">
<el-button>帮助(H)</el-button>
</el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" /> <notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" />
</el-dialog> </el-dialog>
@ -65,12 +98,15 @@ export default {
selected: null, selected: null,
active: false, active: false,
activeName: 'first', activeName: 'first',
tempData: [] tempData: [],
checked: false,
unlockType: ''
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'signalList' 'signalList',
'routeList'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
@ -147,15 +183,14 @@ export default {
.radio-box { .radio-box {
position: relative; position: relative;
border: 1px solid #BBBBBB; border: 1px solid #BBBBBB;
width: 130px; width: 100px;
top: 100px;
left: 8px; left: 8px;
padding: 15px; padding: 15px;
} }
.radio-box-title { .radio-box-title {
position: relative; position: relative;
left: 18px; left: 18px;
top: 115px; top: 15px;
text-align: center; text-align: center;
color: #000; color: #000;
width: 60px; width: 60px;

View File

@ -40,7 +40,6 @@ const training = {
memberList: [], // 综合仿真成员列表 memberList: [], // 综合仿真成员列表
memberData: {}, // 综合仿真成员列表 memberData: {}, // 综合仿真成员列表
simulationUserList: [], // 综合仿真用户列表 simulationUserList: [], // 综合仿真用户列表
addMemberInScript:{}, // 剧本录制新增角色
orignalUserRoleId:'' // 设置旧的角色的id orignalUserRoleId:'' // 设置旧的角色的id
}, },
@ -253,13 +252,6 @@ const training = {
state.memberData[newMemberId].disabled = true; state.memberData[newMemberId].disabled = true;
}, },
addMemberListInScript:(state, newMember) => {
if (!state.memberData[newMember.id]) {
// state.memberData[newMember.id] = newMember;
state.addMemberInScript = newMember;
}
},
updateMemberAndUser: (state, {simulationUserList, userId}) => { updateMemberAndUser: (state, {simulationUserList, userId}) => {
simulationUserList.forEach(item => { simulationUserList.forEach(item => {
let memberIndex = -1; let memberIndex = -1;
@ -720,10 +712,6 @@ const training = {
setRoleDeviceCode:({ commit }, roleDeviceCode) => { setRoleDeviceCode:({ commit }, roleDeviceCode) => {
commit('setRoleDeviceCode', roleDeviceCode); commit('setRoleDeviceCode', roleDeviceCode);
}, },
/** 添加新成员(剧本录制)*/
addMemberListInScript:({ commit }, data) => {
commit('addMemberListInScript', data);
},
/** 剧本仿真 设置旧的角色的id */ /** 剧本仿真 设置旧的角色的id */
setOrignalUserRoleId:({ commit }, data) => { setOrignalUserRoleId:({ commit }, data) => {
commit('setOrignalUserRoleId', data); commit('setOrignalUserRoleId', data);

View File

@ -72,7 +72,7 @@ export default {
getSimulationMemberList(this.group).then(resp => { getSimulationMemberList(this.group).then(resp => {
this.driverList = []; this.driverList = [];
this.treeData = []; this.treeData = [];
const result = covertMemberData(this.activeTrainList, resp); const result = covertMemberData(this.activeTrainList, resp.data);
this.driverList = result.driverList; this.driverList = result.driverList;
this.treeData = [{ this.treeData = [{
label: '行调', label: '行调',
@ -207,6 +207,7 @@ export default {
}); });
} }
this.treeData[2].children = driverList; this.treeData[2].children = driverList;
this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
} else { } else {
this.activeTrainList = activeTrainList; this.activeTrainList = activeTrainList;
} }

View File

@ -117,8 +117,29 @@ export const operateEnum = {
type:'车站' type:'车站'
}, },
Driver:{ Driver:{
// code:'stationCode', code:'groupNumber',
type:'司机' type:'司机',
Driver_Door_On_Off:{
isList:true,
params:[
{
code:'open',
name:'',
result:[
{data:true, name:'开', judge:'='},
{data:false, name:'关', judge:'='}
]
},
{
code:'right',
name:'',
result:[
{data:true, name:'左门', judge:'='},
{data:false, name:'右门', judge:'='}
]
}
]
}
} }
}; };

View File

@ -36,6 +36,7 @@
<script> <script>
import DemonMenu from '@/views/newMap/displayNew/demonMenu'; import DemonMenu from '@/views/newMap/displayNew/demonMenu';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { OperateMode } from '@/scripts/ConstDic'; import { OperateMode } from '@/scripts/ConstDic';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation'; import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
@ -74,6 +75,7 @@ export default {
faultMode: false, faultMode: false,
viewDisabled: true, viewDisabled: true,
firstLoad:true, firstLoad:true,
activeTrainList:[],
isscriptRun:false // isscriptRun:false //
}; };
}, },
@ -191,98 +193,40 @@ export default {
if (resp.code == 200) { if (resp.code == 200) {
if (resp.data.memberList && resp.data.memberList.length > 0) { if (resp.data.memberList && resp.data.memberList.length > 0) {
this.$store.dispatch('training/setMemberList', {memberList:resp.data.memberList, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:resp.data.memberList, userId:this.$store.state.user.id});
// if (this.$store.state.training.started) {
const memberList = this.$store.state.training.memberData; this.activeTrainList = this.$store.state.map.activeTrainList;
// if (data.id) { }
// memberList[data.id].userId = this.$store.state.user.id; const memberList = resp.data.memberList;
// memberList[data.id].name = this.$store.state.user.nickname; // 仿
// memberList[data.id].disabled = true; const result = covertMemberData(this.activeTrainList, memberList);
// } this.driverList = result.driverList;
let lastData = JSON.stringify(memberList);
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
} else {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
}
});
lastData = JSON.parse(lastData);
lastData = Object.values(lastData);
const lastMemberList = [];
const dispatcherList = [];
// const electricDispatcherList = [];
// const depotDispatcherList = [];
const stationSupervisorList = [];
const driverList = [];
const maintainerList = [];
this.treeData = [];
lastData.forEach((member, index)=>{
if (!member.userId) {
member.userId = '';
member.disabled = false;
} else {
member.disabled = true;
member.userName = this.$store.state.user.nickname;
}
if (member.type != '观众') {
const userName = member.userName ? '-' + member.userName : '';
const name = member.name == undefined ? '' : '-' + member.name;
if (member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
if (device) {
if (device._type == 'Train') {
member.deviceName = device.groupNumber;
member.label = member.type + device.groupNumber + name + userName;
lastMemberList.push(member);
driverList.push(member);
} else {
member.deviceName = device.name;
member.label = member.type + device.name + name + userName;
lastMemberList.push(member);
if (device._type == 'Station') {
stationSupervisorList.push(member);
}
}
} else {
member.deviceName = member.deviceCode;
member.label = member.type + member.deviceCode + name + userName;
lastMemberList.push(member);
}
} else {
member.label = member.type + name + userName;
member.deviceName = '';
if (member.type == '行调') {
dispatcherList.push(member);
} else if (member.type == '通号') {
maintainerList.push(member);
}
lastMemberList.push(member);
}
}
});
const treeData = [{ const treeData = [{
label: '行调', label: '行调',
id: 'dispatcher', id: 'dispatcher',
type: 'role', type: 'role',
children: dispatcherList children: result.deviceListData[0]
}, { }, {
label: '车站值班员', label: '车站值班员',
id: 'stationSupervisor', id: 'stationSupervisor',
type: 'role', type: 'role',
children: stationSupervisorList children: result.deviceListData[2]
}, { }, {
label: '司机', label: '司机',
id: 'driver', id: 'driver',
type: 'role', type: 'role',
children: driverList children: result.deviceListData[3]
}, { }, {
label: '通号', label: '通号',
id: 'maintainer', id: 'maintainer',
type: 'role', type: 'role',
children: maintainerList children: result.deviceListData[1]
}, {
label: '车辆段',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}]; }];
const lastMemberList = result.lastMemberList;
this.$emit('setTreeData', treeData); this.$emit('setTreeData', treeData);
this.$emit('setMemberData', lastMemberList); this.$emit('setMemberData', lastMemberList);
} }

View File

@ -27,9 +27,25 @@
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
/> />
<script-chat ref="chatbox" :group="group" :user-role="userRole" /> <script-chat
ref="chatbox"
:group="group"
:user-role="userRole"
:tree-data="treeData"
:member-data="memberData"
/>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" /> <set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<tip-script-record-new ref="tipTaskRecordNew" :group="group" :offset-bottom="offsetBottom" :offset="offset" /> <tip-script-record-new
ref="tipTaskRecordNew"
:group="group"
:offset-bottom="offsetBottom"
:offset="offset"
:tree-data="treeData"
:member-list="memberData"
@changeTreeData="changeTreeData"
@addScriptMember="addScriptMember"
@resetChat="resetChat"
/>
</div> </div>
</template> </template>
@ -43,7 +59,8 @@ import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from '@/views/newMap/displayNew/demon/setTime'; import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation'; import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import { mapGetters } from 'vuex'; import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { getSimulationMemberList} from '@/api/simulation';
export default { export default {
name: 'MenuScript', name: 'MenuScript',
@ -85,7 +102,12 @@ export default {
data() { data() {
return { return {
isDisable: false, isDisable: false,
isScriptCommand:false isScriptCommand:false,
driverList:[],
treeData:[],
memberData:[],
activeTrainList:[],
userRole:''
}; };
}, },
@ -93,17 +115,14 @@ export default {
scriptId() { scriptId() {
return this.$route.query.scriptId; return this.$route.query.scriptId;
}, },
...mapGetters('map', [
'trainList'
]),
group() { group() {
return this.$route.query.group; return this.$route.query.group;
}, },
userRole() { // userRole() {
return this.$store.state.scriptRecord.userRole ? this.$store.state.scriptRecord.userRole : 'DISPATCHER'; // return this.$store.state.scriptRecord.userRole ? this.$store.state.scriptRecord.userRole : 'DISPATCHER';
}, // },
isDriver() { isDriver() {
return this.$store.state.scriptRecord.userRole == 'DRIVER'; return this.userRole == 'DRIVER';
}, },
isShowScheduling() { isShowScheduling() {
return this.$store.state.training.prdType == '05'; return this.$store.state.training.prdType == '05';
@ -115,26 +134,108 @@ export default {
watch: { watch: {
'$store.state.scriptRecord.bgSet':function (val) { '$store.state.scriptRecord.bgSet':function (val) {
this.isScriptCommand = val; this.isScriptCommand = val;
},
// ()
'$store.state.map.activeTrainListChange': function (val) {
// driverList
const activeTrainList = this.$store.state.map.activeTrainList;
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
this.memberData.push(drivers);
}
});
}
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
},
'$store.state.map.mapViewLoadedCount': function (val) { //
getSimulationMemberList(this.group).then(resp => {
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;
}
// 仿
const result = covertMemberData(this.activeTrainList, resp.data);
this.driverList = result.driverList;
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: result.deviceListData[0]
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: result.deviceListData[2]
}, {
label: '司机',
id: 'driver',
type: 'role',
children: result.deviceListData[3]
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: result.deviceListData[1]
}, {
label: '车辆段',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}];
this.memberData = result.lastMemberList;
//
const member = resp.data.find(mem=>{
return mem.userId != '' && mem.userId != undefined;
});
if (member) {
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
const prdTypeList = ['01', '02', '04', '', ''];
const index = memberType.indexOf(member.type);
let prdType;
if (index >= 0) {
prdType = prdTypeList[index];
}
this.userRole = member.type;
this.$store.dispatch('training/setRoles', member.type);
this.$store.dispatch('scriptRecord/updateRole', member.type + ':' + member.id);
this.$store.dispatch('training/setPrdType', prdType);
}
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
} }
}, },
beforeDestroy() { beforeDestroy() {
// this.clearAutoSave();
this.$store.dispatch('training/setMemberList', {memberList:[], userId:this.$store.state.user.id});
this.$store.dispatch('map/resetActiveTrainList', true);
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$store.dispatch('scriptRecord/updateRole', null);
this.$store.dispatch('training/setRoles', null);
}, },
mounted() { mounted() {
// this.$store.state.training.prdType
this.isScriptCommand = this.$store.state.scriptRecord.bgSet; this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
// if (!this.isScriptCommand) {
// this.$store.dispatch('training/setPrdType', '02');
// }
this.$store.dispatch('training/end', TrainingMode.NORMAL); this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/setPrdType', '01');
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.demonMenu.menuClick(); this.$refs.demonMenu.menuClick();
}); });
}, },
methods: { methods: {
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
selectBeginTime() { selectBeginTime() {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },
@ -196,6 +297,51 @@ export default {
history.go(-1); history.go(-1);
Notification.closeAll(); Notification.closeAll();
}); });
},
resetChat() {
this.$refs.chatbox.resetCoversition();
},
changeTreeData({newRole, oldRole}) {
const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
if (oldRole.id) {
const oldIndex = deviceTypeList.indexOf(oldRole.type);
if (oldIndex >= 0) {
const oldTreeDataIn = this.treeData[oldIndex];
oldTreeDataIn.children.map(device=>{
if (device.id == oldRole.id) {
device.userName = '';
delete device.userId;
device.disabled = false;
device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '');
}
});
this.treeData[oldIndex] = oldTreeDataIn;
}
}
const newIndex = deviceTypeList.indexOf(newRole.type);
if (newIndex >= 0) {
const newTreeDataIn = this.treeData[newIndex];
newTreeDataIn.children.map(device=>{
if (device.id == newRole.id) {
device.userName = this.$store.state.user.nickname;
device.userId = this.$store.state.user.id;
device.disabled = true;
device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '') + '-' + device.userName;
}
});
this.treeData[newIndex] = newTreeDataIn;
}
this.userRole = newRole.type;
},
addScriptMember(member) {
this.memberData.push(member);
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度'];
const index = deviceTypeList.indexOf(member.type);
if (index >= 0) {
const treeDataIn = this.treeData[index];
treeDataIn.children.push(member);
this.treeData[index] = treeDataIn;
}
} }
} }
}; };

View File

@ -15,9 +15,7 @@
</template> </template>
<script> <script>
import ChatBox from '@/views/newMap/chatView/chatBox.vue'; import ChatBox from '@/views/newMap/chatView/chatBox.vue';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import {getAllConversition} from '@/api/chat'; import {getAllConversition} from '@/api/chat';
import { getSimulationMemberList} from '@/api/simulation';
export default { export default {
name:'ScriptChat', name:'ScriptChat',
components:{ components:{
@ -31,6 +29,14 @@ export default {
userRole: { userRole: {
type: String, type: String,
required: true required: true
},
treeData:{
type:Array,
required:true
},
memberData:{
type:Array,
required:true
} }
}, },
data() { data() {
@ -38,15 +44,15 @@ export default {
isHasCoversition:false, isHasCoversition:false,
conversitionId:'', conversitionId:'',
currentMemberList:[], currentMemberList:[],
memberData:{}, // memberData:{},
chatContentList:[], chatContentList:[],
activeTrainList:[], activeTrainList:[],
isStartRecord:false, isStartRecord:false,
inviteUserName:'', inviteUserName:'',
inviteUser:{}, inviteUser:{},
isQuitShow:false, isQuitShow:false
treeData:[], // treeData:[],
driverList:[] // driverList:[]
}; };
}, },
computed:{ computed:{
@ -57,80 +63,6 @@ export default {
} }
}, },
watch:{ watch:{
'$store.state.map.mapViewLoadedCount': function (val) { // 仿
getSimulationMemberList(this.group).then(resp => {
this.driverList = [];
this.treeData = [];
const result = covertMemberData(this.activeTrainList, resp);
this.driverList = result.driverList;
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: result.deviceListData[0]
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: result.deviceListData[2]
}, {
label: '司机',
id: 'driver',
type: 'role',
children: result.deviceListData[3]
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: result.deviceListData[1]
}, {
label: '车辆段',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}];
this.memberData = result.lastMemberList;
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
},
'$store.state.training.addMemberInScript':function(val, oldval) {
this.memberData.push(val);
const roleList = ['行调', '车站值班员', '司机', '通号', '车辆段'];
const roleIndex = roleList.indexOf(val.type);
if (roleIndex >= 0) {
this.treeData[roleIndex].children.push(val);
}
},
'userRole':function(val, oldval) {
//
this.changeRole(oldval, val);
},
'$store.state.scriptRecord.updateRoleStatus':function(val) {
//
this.changeRole(this.$store.state.scriptRecord.userRole, this.$store.state.scriptRecord.userRole);
},
// ()
'$store.state.map.activeTrainListChange': function (val) {
const activeTrainList = this.$store.state.map.activeTrainList;
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
},
// //
'$store.state.socket.createConversition':function(val) { '$store.state.socket.createConversition':function(val) {
if (this.memberData.length > 0) { if (this.memberData.length > 0) {
@ -214,31 +146,6 @@ export default {
this.inviteUser = {}; this.inviteUser = {};
this.isQuitShow = false; this.isQuitShow = false;
}, },
changeRole(oldval, val) {
const userList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
//
this.getAllConversition();
const oldIndex = userList.indexOf(oldval);
if (oldIndex >= 0) {
this.treeData[oldIndex].children.forEach(child=>{
if (child.userId) {
child.userId = '';
child.disabled = false;
child.label = child.type + (child.deviceName ? child.deviceName : '');
}
});
}
const index = userList.indexOf(val);
if (index >= 0) {
this.treeData[index].children.forEach(child=>{
if (child.id == this.$store.state.scriptRecord.updateRoleId) {
child.userId = this.$store.state.user.id;
child.disabled = true;
child.label = child.label + '-' + this.$store.state.user.nickname;
}
});
}
},
getAllConversition() { getAllConversition() {
// //
getAllConversition(this.$route.query.group).then(resp=>{ getAllConversition(this.$route.query.group).then(resp=>{

View File

@ -2,7 +2,7 @@ import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import store from '@/store/index_APP_TARGET'; import store from '@/store/index_APP_TARGET';
export function covertMemberData (activeTrainList, resp) { export function covertMemberData (activeTrainList, resp) {
let lastData = JSON.stringify(resp.data); let lastData = JSON.stringify(resp);
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew; const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
roleTypeList.forEach(function(element) { roleTypeList.forEach(function(element) {
const rolename = element.value; const rolename = element.value;
@ -18,25 +18,26 @@ export function covertMemberData (activeTrainList, resp) {
const deviceListData = [[], [], [], [], []]; const deviceListData = [[], [], [], [], []];
const driverList = []; const driverList = [];
lastData.forEach((member, index)=>{ lastData.forEach((member, index)=>{
if (!member.userId) { if (member.userId && member.userId == store.state.user.id) {
member.disabled = false;
} else {
member.disabled = true; member.disabled = true;
member.userName = store.state.user.nickname; member.userName = store.state.user.nickname;
store.dispatch('training/setOrignalUserRoleId', member.id); store.dispatch('training/setOrignalUserRoleId', member.id);
} else {
member.disabled = false;
} }
const userName = member.userName ? '-' + member.userName : ''; const userName = member.userName ? '-' + member.userName : '';
const name = member.name ? '-' + member.name : ''; const name = member.name ? '-' + member.name : '';
if (member.deviceCode) { if (member.deviceCode) {
const device = store.getters['map/getDeviceByCode'](member.deviceCode); const device = store.getters['map/getDeviceByCode'](member.deviceCode);
const deviceName = device.name || device.groupNumber; member.deviceName = device.name || device.groupNumber;
member.deviceName = deviceName; member.label = member.type + member.deviceName + name + userName;
member.label = member.type + deviceName + name + userName; member.normalName = member.type + member.deviceName + name;
} else { } else {
member.deviceName = ''; member.deviceName = '';
member.label = member.type + name + userName; member.label = member.type + name + userName;
member.normalName = member.type + name;
} }
lastMemberList.push(member);
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度']; const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度'];
const deviceTypeIndex = deviceType.indexOf(member.type); const deviceTypeIndex = deviceType.indexOf(member.type);
if (deviceTypeIndex >= 0) { if (deviceTypeIndex >= 0) {
@ -44,12 +45,13 @@ export function covertMemberData (activeTrainList, resp) {
if (activeTrainList.length > 0) { if (activeTrainList.length > 0) {
if (activeTrainList.includes(member.deviceCode)) { if (activeTrainList.includes(member.deviceCode)) {
deviceListData[deviceTypeIndex].push(member); deviceListData[deviceTypeIndex].push(member);
lastMemberList.push(member);
} }
} else {
driverList.push(member);
} }
driverList.push(member);
} else { } else {
deviceListData[deviceTypeIndex].push(member); deviceListData[deviceTypeIndex].push(member);
lastMemberList.push(member);
} }
} }
}); });

View File

@ -355,7 +355,7 @@ export default {
async simulationReset() { async simulationReset() {
await this.$store.dispatch('map/clearJlmapTrainView'); await this.$store.dispatch('map/clearJlmapTrainView');
await this.$store.dispatch('map/setTrainWindowShow', false); await this.$store.dispatch('map/setTrainWindowShow', false);
// await this.$store.dispatch('training/over'); await this.$store.dispatch('map/resetActiveTrainList');
await this.$store.dispatch('socket/setSimulationReset'); // await this.$store.dispatch('socket/setSimulationReset'); //
await this.$store.dispatch('socket/setSimulationStart'); await this.$store.dispatch('socket/setSimulationStart');
await this.$store.dispatch('training/setMapDefaultState'); await this.$store.dispatch('training/setMapDefaultState');
@ -392,7 +392,6 @@ export default {
}, },
// //
mapViewLoaded(loading) { mapViewLoaded(loading) {
// console.log(loading, '**************');
this.loading = loading; this.loading = loading;
if (loading) { if (loading) {
this.$refs.progressBar && this.$refs.progressBar.start(); this.$refs.progressBar && this.$refs.progressBar.start();

View File

@ -59,11 +59,7 @@ export default {
} }
}, },
methods: { methods: {
initData(row) {
},
doShow(row) { doShow(row) {
this.initData(row);
this.dialogVisible = true; this.dialogVisible = true;
}, },
doSave() { doSave() {
@ -71,9 +67,9 @@ export default {
if (valid) { if (valid) {
this.lodaing = true; this.lodaing = true;
addSimulationMember(this.formModel, this.$route.query.group).then((res) => { addSimulationMember(this.formModel, this.$route.query.group).then((res) => {
this.lodaing = false;
this.$message.success('添加仿真角色成员成功!'); this.$message.success('添加仿真角色成员成功!');
this.$emit('addScriptMember', res.data); this.$emit('addScriptMember', res.data);
this.lodaing = false;
this.handleClose(); this.handleClose();
}).catch(() => { }).catch(() => {
this.lodaing = false; this.lodaing = false;

View File

@ -8,7 +8,7 @@
</div> </div>
<el-tree <el-tree
ref="tree" ref="tree"
:data="covertMemberList" :data="treeData"
:props="defaultProps" :props="defaultProps"
node-key="id" node-key="id"
default-expand-all default-expand-all
@ -16,24 +16,28 @@
style="margin: 10px;overflow-y:auto;height:255px;margin-right: 0;" style="margin: 10px;overflow-y:auto;height:255px;margin-right: 0;"
> >
<span :id="data.id" slot-scope="{ node, data }" style="width:100%"> <span :id="data.id" slot-scope="{ node, data }" style="width:100%">
<span style="font-size: 14px">{{ data.label }}</span> <span v-if="data.children">
<span v-if="data.type!='role'" class="setGroup"> <span style="font-size: 14px">{{ data.label }}</span>
<span v-if="data.id!=memberId" class="settingBtn" @click="changeRole(data)">设置</span>
<span v-else class="hasSetted">已设置</span>
</span> </span>
<span v-else>
<span style="font-size: 14px">{{ data.normalName }}</span>
<span v-if="data.type!='role'" class="setGroup">
<span v-if="!data.disabled" class="settingBtn" @click="changeRole(data)">设置</span>
<span v-else class="hasSetted">已设置</span>
</span>
</span>
</span> </span>
</el-tree> </el-tree>
</div> </div>
</template> </template>
<script> <script>
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import ConstConfig from '@/scripts/ConstConfig';
import {changeScriptRole} from '@/api/script'; import {changeScriptRole} from '@/api/script';
export default { export default {
name:'AllScriptRole', name:'AllScriptRole',
props:{ props:{
memberList:{ treeData:{
type: Array, type: Array,
default() { default() {
return []; return [];
@ -54,8 +58,8 @@ export default {
return { return {
covertMemberList:[], covertMemberList:[],
driverList:[], driverList:[],
oldMember:{id:null, type:''},
queryMember:'', queryMember:'',
oldMemberId:'',
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'label' label: 'label'
@ -63,117 +67,51 @@ export default {
}; };
}, },
watch:{ watch:{
'memberList':function(val) {
if (val && val.length > 0) {
this.covertMember();
}
},
queryMember(val) { queryMember(val) {
if (this.$refs.tree) { if (this.$refs.tree) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
} }
},
'treeData':function(val) {
const roleName = this.$store.state.scriptRecord.userRole;
this.oldMember = {id:this.memberId, type:roleName};
} }
}, },
methods:{ methods:{
filterNode(value, data) { filterNode(value, data) {
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
covertMember() {
// if (this.covertMemberList.length > 0) {
// this.setMemmberList(this.driverList, this.memberList[0].children, this.memberList[1].children, this.memberList[3].children);
// } else {
const dispatcherList = [];
// const electricDispatcherList = [];
// const depotDispatcherList = [];
const stationSupervisorList = [];
const driverList = [];
const maintainerList = [];
this.memberList.forEach((member, index)=>{
if (member.type != '观众') {
if (member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
if (device) {
if (device._type == 'Train') {
driverList.push(member);
} else {
if (device._type == 'Station') {
stationSupervisorList.push(member);
}
}
}
} else {
if (member.type == '行调') {
dispatcherList.push(member);
} else if (member.type == '通号') {
maintainerList.push(member);
}
}
}
});
this.driverList = driverList;
this.setMemmberList(driverList, dispatcherList, stationSupervisorList, maintainerList);
// }
},
setMemmberList(driverList, dispatcherList, stationSupervisorList, maintainerList) {
this.oldMemberId = this.memberId;
// if (this.$store.state.training.started) {
// const activeList = this.$store.state.map.activeTrainList;
// driverList = driverList.filter(driver=>{
// return activeList.length > 0 && activeList.includes(driver.deviceCode);
// });
// } else {
// driverList = [];
// }
this.covertMemberList = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: dispatcherList
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: stationSupervisorList
}, {
label: '司机',
id: 'driver',
type: 'role',
children: driverList
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: maintainerList
}];
},
changeRole(member) { changeRole(member) {
if (member) { if (member) {
// this.$store.dispatch('scriptRecord/updateIsScriptCommand', true);
this.switchMode(member); this.switchMode(member);
} }
}, },
addMember() { addMember() {
this.$emit('addMember'); this.$emit('addMember');
}, },
switchMode(role) { switchMode(member) {
changeScriptRole(this.group, role.id).then(res=>{ changeScriptRole(this.group, member.id).then(res=>{
let prdType = ''; let prdType = '';
if (this.openWindow) { if (this.openWindow) {
this.openWindow.close(); this.openWindow.close();
} }
const role = Object.assign({}, member);
if (role.type == '行值') { if (role.type == '行值') {
prdType = '01'; prdType = '01';
role.type = 'STATION_SUPERVISOR';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode); this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (role.type == '行调') { } else if (role.type == '行调') {
prdType = '02'; prdType = '02';
role.type = 'DISPATCHER';
this.$store.dispatch('training/setRoles', 'DISPATCHER'); this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (role.type == '司机') { } else if (role.type == '司机') {
prdType = '04'; prdType = '04';
role.type = 'DRIVER';
this.$store.dispatch('training/setRoles', 'DRIVER'); this.$store.dispatch('training/setRoles', 'DRIVER');
} else if (role.type == '通号') { } else if (role.type == '通号') {
prdType = ''; prdType = '';
role.type = 'MAINTAINER';
this.$store.dispatch('training/setRoles', 'MAINTAINER'); this.$store.dispatch('training/setRoles', 'MAINTAINER');
const routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer', path:'/jlmap3d/maintainer',
@ -186,25 +124,25 @@ export default {
} }
}); });
this.openWindow = window.open(routeData.href); this.openWindow = window.open(routeData.href);
} else if (role.type == '车辆段') {
prdType = '05';
role.type = 'DEPOT_DISPATCHER';
this.$store.dispatch('training/setRoles', 'DEPOT_DISPATCHER');
} else { } else {
prdType = ''; prdType = '';
} }
this.$store.dispatch('training/updateMemberListInScript', this.$store.dispatch('training/updateMemberListInScript',
{ {
oldMemberId:this.oldMemberId, oldMemberId:this.oldMember.id,
newMemberId:role.id, newMemberId:role.id,
userId:this.$store.state.user.id, userId:this.$store.state.user.id,
name:this.$store.state.user.nickname name:this.$store.state.user.nickname
} }
); );
this.oldMemberId = role.id;
this.$store.dispatch('training/setPrdType', prdType); this.$store.dispatch('training/setPrdType', prdType);
ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{ this.$store.dispatch('scriptRecord/updateRole', role.type + ':' + role.id);
if (each.label == role.type) { this.$emit('setMemberId', {newRole:role, oldRole:this.oldMember});
this.$store.dispatch('scriptRecord/updateRole', each.value + ':' + role.id); this.oldMember = {id:role.id, type:role.type};
}
});
this.$emit('setMemberId', role);
this.$message('切换角色成功'); this.$message('切换角色成功');
// this.$refs.changeScriptRole.blur(); // this.$refs.changeScriptRole.blur();
}).catch(()=>{ }).catch(()=>{

View File

@ -86,12 +86,6 @@ export default {
memberName: '' memberName: ''
}; };
}, },
computed:{
// drawWay() {
// const drawWay = this.$route.query.drawWay;
// return drawWay && JSON.parse(drawWay);
// }
},
watch: { watch: {
actionInfoList: function(val) { actionInfoList: function(val) {
this.$nextTick(function() { this.$nextTick(function() {
@ -114,7 +108,7 @@ export default {
}, },
covertData(memberList, element) { covertData(memberList, element) {
const member = memberList.find(elem=>{ return elem.id == element.memberId; }); const member = memberList.find(elem=>{ return elem.id == element.memberId; });
const memberName = member.name; const memberName = member.type + member.deviceName + (member.name ? member.name : '');
switch (element.type) { switch (element.type) {
case 'Start_Conversation': { case 'Start_Conversation': {
// isStartCoversition // isStartCoversition
@ -122,7 +116,7 @@ export default {
element.conversationMemberIds.forEach(id=>{ element.conversationMemberIds.forEach(id=>{
if (member.id != id) { if (member.id != id) {
const userName = memberList.find(elem=>{ return elem.id == id; }); const userName = memberList.find(elem=>{ return elem.id == id; });
targetNameList.push(userName.name); targetNameList.push(userName.type + userName.deviceName + (userName.name ? userName.name : ''));
} }
}); });
this.actionInfoList.push({id: element.id, isStartCoversition: true, memberName: memberName, targetName:targetNameList.toString() }); this.actionInfoList.push({id: element.id, isStartCoversition: true, memberName: memberName, targetName:targetNameList.toString() });

View File

@ -14,11 +14,11 @@
<div class="quickChange"> <div class="quickChange">
<!-- <div class="quickChange_head">快捷切换</div> --> <!-- <div class="quickChange_head">快捷切换</div> -->
<div class="quickChangeList" style="margin:10px 0px 10px 0px;overflow-y:auto;height:200px;"> <div class="quickChangeList" style="margin:10px 0px 10px 0px;overflow-y:auto;height:200px;">
<div v-for="member in quickChangeMember" :key="member.id" class="setGroupOut"> <div v-for="member in quickChangeMember.list" :key="member.id" class="setGroupOut">
<span style="font-size: 14px">{{ member.label }}</span> <span style="font-size: 14px">{{ member.normalName }}</span>
<span class="setGroup"> <span class="setGroup">
<span v-if="member.id!=memberId" class="settingBtn" @click="changeRole(member)">设置</span> <span v-if="member.userId" class="hasSetted">设置</span>
<span v-else class="hasSetted">设置</span> <span v-else class="settingBtn" @click="changeRole(member)">设置</span>
</span> </span>
</div> </div>
</div> </div>
@ -39,7 +39,14 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="所有成员"> <el-tab-pane label="所有成员">
<div class="eachScriptPanel"> <div class="eachScriptPanel">
<all-script-role ref="allScriptRole" :member-list="memberList" :member-id="memberId" :group="group" @setMemberId="setMemberId" @addMember="addMember" /> <all-script-role
ref="allScriptRole"
:member-id="memberId"
:tree-data="treeData"
:group="group"
@setMemberId="setMemberId"
@addMember="addMember"
/>
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -54,7 +61,8 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import GetActionNew from './getAction'; import GetActionNew from './getAction';
import {getSimulationMemberList, executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation'; // getSimulationMemberList
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script'; import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script';
import AddScriptMember from './addScriptMember'; import AddScriptMember from './addScriptMember';
@ -80,11 +88,20 @@ export default {
offset:{ offset:{
type: Number, type: Number,
required: true required: true
},
treeData:{
type:Array,
required: true
},
memberList:{
type:Array,
required: true
} }
}, },
data() { data() {
return { return {
isShow:true, isShow:true,
isFirst:true,
language:'', language:'',
isPause:false, isPause:false,
executeDisabled: false, executeDisabled: false,
@ -92,11 +109,7 @@ export default {
autoSaveScript: null, autoSaveScript: null,
isSavingScript: false, isSavingScript: false,
mapLocation:null, mapLocation:null,
memberId:'', quickChangeMember:{list:[]},
oldMemberId:'',
allMemberList:[],
memberList:[],
quickChangeMember:[],
size: { size: {
width: 300, width: 300,
height: 300 height: 300
@ -104,6 +117,14 @@ export default {
openWindow:null openWindow:null
}; };
}, },
computed:{
memberId() {
return this.$store.state.scriptRecord.updateRoleId;
},
orignalUserRoleId() {
return this.$store.state.training.orignalUserRoleId;
}
},
watch:{ watch:{
'$store.state.map.mapViewLoadedCount': function (val) { '$store.state.map.mapViewLoadedCount': function (val) {
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation); Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
@ -112,10 +133,6 @@ export default {
const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale}; const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(newMapLocation); Vue.prototype.$jlmap.setOptions(newMapLocation);
} }
// if (this.$store.state.scriptRecord.bgSet) {
// this.$store.dispatch('training/setPrdType', null);
// }
this.initData();
}, },
'$store.state.scriptRecord.bgSet': function (val) { '$store.state.scriptRecord.bgSet': function (val) {
this.backDisabled = val; this.backDisabled = val;
@ -123,17 +140,13 @@ export default {
'$store.state.scriptRecord.simulationPause': function(val) { '$store.state.scriptRecord.simulationPause': function(val) {
this.isPause = !(this.$store.state.scriptRecord.simulationPause); this.isPause = !(this.$store.state.scriptRecord.simulationPause);
}, },
'$store.state.map.activeTrainListChange':function (val) { 'memberList':function(val) {
this.changeRunPlanStatus(); if (this.isFirst) {
this.isFirst = false;
this.initData();
}
} }
}, },
beforeDestroy() {
// this.clearAutoSave();
this.$store.dispatch('training/setMemberList', {memberList:[], userId:this.$store.state.user.id});
this.$store.dispatch('map/resetActiveTrainList', true);
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$store.dispatch('scriptRecord/updateRole', null);
},
mounted() { mounted() {
this.language = this.$route.query.lang == 'en' ? this.$t('scriptRecord.english') : this.$t('scriptRecord.chinese'); this.language = this.$route.query.lang == 'en' ? this.$t('scriptRecord.english') : this.$t('scriptRecord.chinese');
getDraftScriptByGroupNew(this.group).then(response=>{ getDraftScriptByGroupNew(this.group).then(response=>{
@ -144,27 +157,13 @@ export default {
}, },
methods:{ methods:{
initData() { initData() {
getSimulationMemberList(this.group).then(resp => { getAllSelectedScriptRole(this.group).then(res=>{
const lastData = JSON.stringify(resp.data); res.data.forEach(each=>{
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id}); const eachMember = this.memberList.find(member=>{ return member.id == each.id; });
this.allMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); if (eachMember) {
this.changeRunPlanStatus(); this.quickChangeMember.list.push(eachMember);
const member = this.memberList.find(mem=>{ }
return mem.type == '行调';
}); });
if (member) {
this.memberId = member.id;
this.oldMemberId = member.id;
}
this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('training/setRoles', 'DISPATCHER');
this.$store.dispatch('scriptRecord/updateRole', 'DISPATCHER' + ':' + this.memberId);
getAllSelectedScriptRole(this.group).then(res=>{
const lastData = JSON.stringify(res.data);
this.quickChangeMember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
});
}).catch(error => {
this.$message(error.message);
}); });
}, },
addScriptMember(member) { addScriptMember(member) {
@ -172,39 +171,28 @@ export default {
member.disabled = false; member.disabled = false;
const lastData = JSON.stringify([member]); const lastData = JSON.stringify([member]);
const covertmember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); const covertmember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
covertmember.forEach(each=>{ this.$emit('addScriptMember', covertmember[0]);
this.memberList.push(each);
this.$store.dispatch('training/addMemberListInScript', each);
});
}, },
setMemberId(member) { setMemberId({newRole, oldRole}) {
this.memberId = member.id; this.$emit('changeTreeData', {newRole:newRole, oldRole:oldRole});
const memberdata = this.quickChangeMember.find(mem=>{ return mem.id == member.id; }); const quickChangeMember = this.quickChangeMember.list;
if (!memberdata) { this.quickChangeMember.push(member); } quickChangeMember.forEach((mem, index)=>{
if (oldRole.id && mem.id == oldRole.id) {
delete mem.userId;
}
if (newRole.id == mem.id) {
mem.userId = this.$store.state.user.id;
}
});
this.quickChangeMember = {list:quickChangeMember};
const memberdata = this.quickChangeMember.list.find(mem=>{ return mem.id == newRole.id; });
if (!memberdata) {
newRole.userId = this.$store.state.user.id; this.quickChangeMember.list.push(newRole);
}
}, },
addMember() { addMember() {
this.$refs.addScriptMember.doShow(); this.$refs.addScriptMember.doShow();
}, },
changeRunPlanStatus() {
this.memberList = [];
if (this.$store.state.training.started) {
const activeList = this.$store.state.map.activeTrainList;
this.allMemberList.forEach(allmember=>{
if (allmember.type == '司机') {
if (activeList.length > 0 && activeList.includes(allmember.deviceCode)) {
this.memberList.push(allmember);
}
} else {
this.memberList.push(allmember);
}
});
} else {
this.memberList = this.allMemberList.filter(member=>{
return member.type != '司机';
});
}
},
changeRole(member) { changeRole(member) {
this.$refs.allScriptRole.changeRole(member); this.$refs.allScriptRole.changeRole(member);
}, },
@ -213,7 +201,7 @@ export default {
return member.id == memberId; return member.id == memberId;
}); });
if (currentMember) { if (currentMember) {
return currentMember.name; return currentMember.type + currentMember.deviceName + (currentMember.name ? currentMember.name : '');
} }
return ''; return '';
}, },
@ -236,7 +224,6 @@ export default {
}); });
lastData = JSON.parse(lastData); lastData = JSON.parse(lastData);
lastData.forEach(each=>{ lastData.forEach(each=>{
// const name = each.name == undefined ? '' : '-' + each.name;
let deviceName = ''; let deviceName = '';
if (each.deviceCode) { if (each.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](each.deviceCode); const device = this.$store.getters['map/getDeviceByCode'](each.deviceCode);
@ -250,7 +237,8 @@ export default {
deviceName = each.deviceCode; deviceName = each.deviceCode;
} }
} }
each.name = each.type + deviceName + (each.name ? '' + each.name : ''); each.normalName = each.type + deviceName + (each.name ? '' + each.name : '');
each.name = each.normalName;
each.label = each.name; each.label = each.name;
}); });
return lastData; return lastData;
@ -338,21 +326,41 @@ export default {
dumpScriptDataNew(group).then(resp => { dumpScriptDataNew(group).then(resp => {
this.$parent.resetBeginTime(); this.$parent.resetBeginTime();
this.$refs['getAction'].loadInitData(); this.$refs['getAction'].loadInitData();
this.changeRunPlanStatus(); // this.changeRunPlanStatus();
this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('training/updateMemberListInScript', this.$store.dispatch('training/updateMemberListInScript',
{ {
oldMemberId:this.memberId, oldMemberId:this.memberId,
newMemberId:this.oldMemberId, newMemberId:this.orignalUserRoleId,
userId:this.$store.state.user.id, userId:this.$store.state.user.id,
name:this.$store.state.user.nickname name:this.$store.state.user.nickname
} }
); );
const new_member = this.memberList.find(mem=>{ return mem.id == this.orignalUserRoleId; });
const old_member = this.memberList.find(mem=>{ return mem.id == this.memberId; });
if (new_member && old_member) {
new_member.userId = this.$store.state.user.id;
new_member.disabled = true;
this.quickChangeMember.list = [new_member];
const deviceList = ['行值', '行调', '司机', '通号', '车辆段'];
const deviceType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
const new_index = deviceList.indexOf(new_member.type);
const old_index = deviceList.indexOf(old_member.type);
let oldType, newType;
if (new_index >= 0) {
newType = deviceType[new_index];
}
if (old_index >= 0) {
oldType = deviceType[old_index];
}
this.$emit('changeTreeData', {oldRole:{id:this.memberId, type:oldType }, newRole:{id:this.orignalUserRoleId, type:newType}});
this.$emit('resetChat');
}
// this.initAutoSaveScript(); // this.initAutoSaveScript();
this.$store.dispatch('scriptRecord/updateRole', 'DISPATCHER:' + this.oldMemberId); this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('scriptRecord/updateRole', new_member.type + ':' + this.orignalUserRoleId);
this.$store.dispatch('scriptRecord/updateBgSet', false); this.$store.dispatch('scriptRecord/updateBgSet', false);
this.memberId = this.oldMemberId; // this.memberId = this.orignalUserRoleId;
this.$message.success(this.$t('scriptRecord.resetDataSuccess')); this.$message.success(this.$t('scriptRecord.resetDataSuccess'));
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('scriptRecord.resetDataFail')); this.$messageBox(this.$t('scriptRecord.resetDataFail'));