This commit is contained in:
fan 2020-10-30 14:15:12 +08:00
commit 4f567c474a
15 changed files with 553 additions and 520 deletions

View File

@ -12,235 +12,128 @@ export default {
/** excel解析配置*/
ExcelConfig: {
// beginRow: 1,
// beginCol: 0,
// fieldNum: 10,
// trainId: '车次号',
// columns: ['备注', '车次号']
beginRow: 1,
beginCol: 0,
// fieldNum: 10,
columns: {
'默认上行折返轨': { key: 'upTrack', formatter: (val) => { return val; } },
'默认下行折返轨': { key: 'downTrack', formatter: (val) => { return val; } }
}
trainId: '车次号',
columns: ['备注', '车次号']
// beginRow: 1,
// beginCol: 0,
// // fieldNum: 10,
// columns: {
// '默认上行折返轨': { key: 'upTrack', formatter: (val) => { return val; } },
// '默认下行折返轨': { key: 'downTrack', formatter: (val) => { return val; } }
// }
},
/** 解析exal数据转换为Json后台数据*/
importData(Sheet, JsonData) {
const dataList = convertSheetToList(Sheet, true);
const needList = Object.keys(this.ExcelConfig.columns);
const tripObj = { upTrack: '', downTrack: '' };
if (dataList && dataList.length && dataList[1] && dataList[0]) {
const tIndex = dataList.findIndex(it => { return it[0]; });
if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) {
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) {
var isContinue = true;
for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
isContinue = false;
var title = dataList[colIndex][0];
var value = dataList[colIndex][rowIndex];
if (title && value) {
// 数据列解析
isContinue = true;
var titleStr = `${title}`.replace(/\s*/g, '');
var valueStr = `${value}`.replace(/\s*/g, '');
// 取需要的字段
if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
tripObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
}
}
}
}
} else {
/** 解析二维数组为json对象*/
const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; // ↑|↓
const reg1 = /^([▼|▲|¡ø|¨‹]+)\s*(\d+:\d+:\d+)/; // ▲ 06:10:00
const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨‹]+)/; // 06:10:00 ▲
const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; // 06:10:00 06:12:00
const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲
dataList.forEach((elem, i) => {
var begin = -1;
/** 跳过名称所在的行*/
if (i != tIndex && elem && elem.length > 0) {
elem.forEach((item, j) => {
/** 过滤空值*/
if (item) {
var value = `${item}`.trim();
var title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
/** 匹配到开始位置或者结束位置*/
if (reg0.test(value)) {
if (begin == -1) {
begin = value; // 设置初始索引
JsonData.push({
code: reg0.exec(value)[1],
arrivalList: []
});
} else if (begin === value) {
begin = -1; // 清空初始索引
}
} else if (begin !== -1) {
/** 匹配到中间位置*/
var begTime, endTime;
var runFlag = JsonData[JsonData.length - 1].code[2];
var stationName = title.replace(/\s/, '');
var need = false;
var flag = false;
if (reg1.test(value)) {
/** 含有特殊字符的时间格式*/
[, begTime, endTime] = reg1.exec(value);
begTime = reg4.test(begTime) ? '' : begTime;
endTime = reg4.test(endTime) ? '' : endTime;
/** 下行方向时间互换*/
if (runFlag === '2') {
[begTime, endTime] = [endTime, begTime];
}
/** 设置标志*/
[need, flag] = [true, true];
} else if (reg2.test(value)) {
/** 含有特殊字符的时间格式*/
[, begTime, endTime] = reg2.exec(value);
begTime = reg4.test(begTime) ? '' : begTime;
endTime = reg4.test(endTime) ? '' : endTime;
/** 下行方向时间互换*/
if (runFlag === '2') {
[begTime, endTime] = [endTime, begTime];
}
/** 设置标志*/
[need, flag] = [true, true];
} else if (reg3.test(value)) {
/** 正常时间格式*/
[, begTime, endTime] = reg3.exec(value);
/** 如果只存在一个数据时,则开始和结束设置一样*/
endTime = endTime || begTime;
/** 下行方向时间互换*/
if (runFlag === '2') {
[begTime, endTime] = [endTime, begTime];
}
/** 设置标志*/
[need, flag] = [true, false];
}
/** 添加json数据*/
if (need) { // 储存非空 数据
var stationObj = {
stationName: stationName
};
if (begTime) { stationObj['arriveTime'] = prefixTime(begTime); }
if (endTime) { stationObj['departureTime'] = prefixTime(endTime); }
if (flag) { stationObj['flag'] = flag; } // 是否转换轨
JsonData[JsonData.length - 1].arrivalList.push(stationObj);
}
}
}
});
}
});
}
}
JsonData.forEach(item => {
item['upTrack'] = tripObj.upTrack;
item['downTrack'] = tripObj.downTrack;
});
return JsonData;
},
// /** 解析exal数据转换为Json后台数据*/
// importData(Sheet, JsonData) {
// const dataList = convertSheetToList(Sheet, true);
// const needList = Object.keys(this.ExcelConfig.columns);
// const tripObj = { upTrack: '', downTrack: '' };
// if (dataList && dataList.length && dataList[1] && dataList[0]) {
// const tIndex = 8; // 设置不用过滤行数
// /** 解析二维数组为json对象*/
// const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00
// const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲
// dataList.forEach((elem, i) => {
// var begin = -1;
// /** 跳过名称所在的行*/
// if (i != tIndex && elem && elem.length > 0) {
// let flag = false;
// let param = { begTime: '', endTime: '' };
// if (i > tIndex) { elem.reverse(); }
// let interval = 1;
// for (let j = 0; j < elem.length;) {
// const item = elem[j];
// let title = '';
// var value = `${item}`.trim();
// if (i > tIndex) { // 上行线
// title = `${dataList[tIndex][dataList[tIndex].length - j - 1]}`.replace(/\s*/g, '');
// if (title == 'undefined') {
// title = `${dataList[tIndex][dataList[tIndex].length - j - 2]}`.replace(/\s*/g, '');
// }
// } else { // 下行线
// title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
// if (title == 'undefined') {
// title = `${dataList[tIndex][j - 1]}`.replace(/\s*/g, '');
// const tIndex = dataList.findIndex(it => { return it[0]; });
// if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) {
// for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) {
// var isContinue = true;
// for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
// isContinue = false;
// var title = dataList[colIndex][0];
// var value = dataList[colIndex][rowIndex];
// if (title && value) {
// // 数据列解析
// isContinue = true;
// var titleStr = `${title}`.replace(/\s*/g, '');
// var valueStr = `${value}`.replace(/\s*/g, '');
// // 取需要的字段
// if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
// tripObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
// }
// }
// /** 匹配到开始位置或者结束位置*/
// if (title == this.ExcelConfig.trainId && value != 'undefined') {
// if (begin == -1) {
// interval = 2;
// flag = true;
// begin = value; // 设置初始索引
// JsonData.push({
// code: value,
// destinationCode: '',
// arrivalList: []
// });
// } else if (flag) {
// interval = 1;
// begin = -1; // 清空初始索引
// JsonData[JsonData.length - 1].destinationCode = value;
// flag = false;
// }
// } else if (title == this.ExcelConfig.columns[0]) {
// interval = 1;
// } else if (begin !== -1) {
// const item1 = `${elem[j]}`.trim();
// const item2 = `${elem[j + 1]}`.trim();
// if (item1 != 'undefined' || item2 != 'undefined') {
// /** 匹配到中间位置*/
// var stationName = title.replace(/\s/, '');
// const flag = reg3.test(item1) || reg3.test(item2);
// if (this.ExcelConfig.columns.indexOf(stationName) == -1 && flag) {
// let need = false;
// if (value.split(':')[0] == '24') { // 24:XX:XX 类似这种数据 变24为00
// const arr = value.split(':');
// arr[0] = '00';
// value = arr.join(':');
// }
// const item1 = elem[j] ? `${elem[j]}`.trim() : '';
// const item2 = elem[j + 1] ? `${elem[j + 1]}`.trim() : '';
// if (item1 && item2) {
// param.begTime = item1;
// param.endTime = item2;
// } else if (item1 && !item2) {
// param.begTime = item1;
// param.endTime = item1;
// } else if (!item1 && item2) {
// param.begTime = item2;
// param.endTime = item2;
// }
// }
// }
// } else {
// /** 解析二维数组为json对象*/
// const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; // ↑|↓
// const reg1 = /^([▼|▲|¡ø|¨‹]+)\s*(\d+:\d+:\d+)/; // ▲ 06:10:00
// const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨‹]+)/; // 06:10:00 ▲
// const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; // 06:10:00 06:12:00
// const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲
// if (param.begTime && param.endTime) {
// need = true;
// dataList.forEach((elem, i) => {
// var begin = -1;
// /** 跳过名称所在的行*/
// if (i != tIndex && elem && elem.length > 0) {
// elem.forEach((item, j) => {
// /** 过滤空值*/
// if (item) {
// var value = `${item}`.trim();
// var title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
// /** 匹配到开始位置或者结束位置*/
// if (reg0.test(value)) {
// if (begin == -1) {
// begin = value; // 设置初始索引
// JsonData.push({
// code: reg0.exec(value)[1],
// arrivalList: []
// });
// } else if (begin === value) {
// begin = -1; // 清空初始索引
// }
// } else if (begin !== -1) {
// /** 匹配到中间位置*/
// var begTime, endTime;
// var runFlag = JsonData[JsonData.length - 1].code[2];
// var stationName = title.replace(/\s/, '');
// var need = false;
// var flag = false;
// if (reg1.test(value)) {
// /** 含有特殊字符的时间格式*/
// [, begTime, endTime] = reg1.exec(value);
// begTime = reg4.test(begTime) ? '' : begTime;
// endTime = reg4.test(endTime) ? '' : endTime;
// /** 下行方向时间互换*/
// if (runFlag === '2') {
// [begTime, endTime] = [endTime, begTime];
// }
// /** 设置标志*/
// [need, flag] = [true, true];
// } else if (reg2.test(value)) {
// /** 含有特殊字符的时间格式*/
// [, begTime, endTime] = reg2.exec(value);
// begTime = reg4.test(begTime) ? '' : begTime;
// endTime = reg4.test(endTime) ? '' : endTime;
// /** 下行方向时间互换*/
// if (runFlag === '2') {
// [begTime, endTime] = [endTime, begTime];
// }
// /** 设置标志*/
// [need, flag] = [true, true];
// } else if (reg3.test(value)) {
// /** 正常时间格式*/
// [, begTime, endTime] = reg3.exec(value);
// /** 如果只存在一个数据时,则开始和结束设置一样*/
// endTime = endTime || begTime;
// /** 下行方向时间互换*/
// if (runFlag === '2') {
// [begTime, endTime] = [endTime, begTime];
// }
// /** 设置标志*/
// [need, flag] = [true, false];
// }
// /** 添加json数据*/
@ -248,27 +141,140 @@ export default {
// var stationObj = {
// stationName: stationName
// };
// if (reg4.test(param.begTime)) {
// param.begTime = '';
// }
// if (reg4.test(param.endTime)) {
// param.endTime = '';
// }
// stationObj['arriveTime'] = prefixTime(param.begTime);
// stationObj['departureTime'] = prefixTime(param.endTime);
// if (begTime) { stationObj['arriveTime'] = prefixTime(begTime); }
// if (endTime) { stationObj['departureTime'] = prefixTime(endTime); }
// if (flag) { stationObj['flag'] = flag; } // 是否转换轨
// JsonData[JsonData.length - 1].arrivalList.push(stationObj);
// param = { begTime: '', endTime: '' };
// }
// }
// }
// }
// j = j + interval;
// });
// }
// }
// });
// });
// }
// }
// JsonData.forEach(item => {
// item['upTrack'] = tripObj.upTrack;
// item['downTrack'] = tripObj.downTrack;
// });
// return JsonData;
// },
/** 解析exal数据转换为Json后台数据*/
importData(Sheet, JsonData) {
const dataList = convertSheetToList(Sheet, true);
if (dataList && dataList.length && dataList[1] && dataList[0]) {
const tIndex = 8; // 设置不用过滤行数
/** 解析二维数组为json对象*/
const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00
const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲
dataList.forEach((elem, i) => {
var begin = -1;
/** 跳过名称所在的行*/
if (i != tIndex && elem && elem.length > 0) {
let flag = false;
let param = { begTime: '', endTime: '' };
if (i > tIndex) { elem.reverse(); }
let interval = 1;
for (let j = 0; j < elem.length;) {
const item = elem[j];
let title = '';
var value = `${item}`.trim();
if (i > tIndex) { // 上行线
title = `${dataList[tIndex][dataList[tIndex].length - j - 1]}`.replace(/\s*/g, '');
if (title == 'undefined') {
title = `${dataList[tIndex][dataList[tIndex].length - j - 2]}`.replace(/\s*/g, '');
}
} else { // 下行线
title = `${dataList[tIndex][j]}`.replace(/\s*/g, '');
if (title == 'undefined') {
title = `${dataList[tIndex][j - 1]}`.replace(/\s*/g, '');
}
}
/** 匹配到开始位置或者结束位置*/
if (title == this.ExcelConfig.trainId && value != 'undefined') {
if (begin == -1) {
interval = 2;
flag = true;
begin = value; // 设置初始索引
JsonData.push({
code: value,
destinationCode: '',
arrivalList: []
});
} else if (flag) {
interval = 1;
begin = -1; // 清空初始索引
JsonData[JsonData.length - 1].destinationCode = value;
flag = false;
}
} else if (title == this.ExcelConfig.columns[0]) {
interval = 1;
} else if (begin !== -1) {
const item1 = `${elem[j]}`.trim();
const item2 = `${elem[j + 1]}`.trim();
if (item1 != 'undefined' || item2 != 'undefined') {
/** 匹配到中间位置*/
var stationName = title.replace(/\s/, '');
const flag = reg3.test(item1) || reg3.test(item2);
if (this.ExcelConfig.columns.indexOf(stationName) == -1 && flag) {
let need = false;
if (value.split(':')[0] == '24') { // 24:XX:XX 类似这种数据 变24为00
const arr = value.split(':');
arr[0] = '00';
value = arr.join(':');
}
const item1 = elem[j] ? `${elem[j]}`.trim() : '';
const item2 = elem[j + 1] ? `${elem[j + 1]}`.trim() : '';
if (item1 && item2) {
param.begTime = item1;
param.endTime = item2;
} else if (item1 && !item2) {
param.begTime = item1;
param.endTime = item1;
} else if (!item1 && item2) {
param.begTime = item2;
param.endTime = item2;
}
if (param.begTime && param.endTime) {
need = true;
}
/** 添加json数据*/
if (need) { // 储存非空 数据
var stationObj = {
stationName: stationName
};
if (reg4.test(param.begTime)) {
param.begTime = '';
}
if (reg4.test(param.endTime)) {
param.endTime = '';
}
stationObj['arriveTime'] = prefixTime(param.begTime);
stationObj['departureTime'] = prefixTime(param.endTime);
JsonData[JsonData.length - 1].arrivalList.push(stationObj);
param = { begTime: '', endTime: '' };
}
}
}
}
j = j + interval;
}
}
});
}
const arr = [];
JsonData.forEach((item, i) => {
if (item.code) {
arr.push(item);
}
});
return arr;
},
/** 将后台数据解析成图表*/
convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) {

View File

@ -95,9 +95,9 @@ export default {
{label: '司机', value: 'DRIVER', enLabel: 'Driver '},
{label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '},
{label: '车辆段调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher '},
{label: '电调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'},
{label: '调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'},
{label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '},
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent_department'}
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent department'}
],
SimulationType: [

View File

@ -375,6 +375,8 @@ export default {
dispatcherList[item.id] = this.memberData[item.id];
break;
case 'ELECTRIC_DISPATCHER':
this.memberData[item.id].label = '电力调度' + (item.name || '');
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
electricDispatcherList[item.id] = this.memberData[item.id];
break;
case 'DEPOT_DISPATCHER':
@ -439,6 +441,11 @@ export default {
id: 'parentDepartment',
type: 'role',
children: parentDepartmentList
}, {
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: electricDispatcherList
}];
this.initCommonMemberList();
this.filterNode();

View File

@ -168,6 +168,10 @@ export default {
member.label = '上级部门' + (member.name ? member.name : '');
break;
}
case 'ELECTRIC_DISPATCHER': {
member.label = '电力调度' + (member.name ? member.name : '');
break;
}
}
// if (member.type === 'DISPATCHER') {
// this.memberId = member.id;

View File

@ -222,6 +222,12 @@ export default {
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
},
{
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: result.deviceListData[6]
}];
const lastMemberList = result.lastMemberList;
this.$emit('setTreeData', treeData);

View File

@ -28,15 +28,12 @@
/>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<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"
/>
<chat-box
@ -56,7 +53,6 @@ import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { getSimulationMemberList} from '@/api/simulation';
import ChatBox from '@/views/newMap/chatView/chatBox.vue';
@ -101,10 +97,6 @@ export default {
return {
isDisable: false,
isScriptCommand:false,
driverList:[],
treeData:[],
memberData:[],
activeTrainList:[],
userRole:''
};
},
@ -133,82 +125,16 @@ export default {
'$store.state.scriptRecord.bgSet':function (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 = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
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]
}, {
label: '上级部门',
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
}
// PARENT_DEPARTMENT
];
this.memberData = result.lastMemberList;
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
//
const member = resp.data.find(mem=>{
return mem.userId != '' && mem.userId != undefined;
});
if (member) {
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
const prdTypeList = ['01', '02', '04', '', '', ''];
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT', 'ELECTRIC_DISPATCHER'];
const prdTypeList = ['01', '02', '04', '', '05', '', ''];
const index = memberType.indexOf(member.type);
let prdType;
if (index >= 0) {
@ -223,6 +149,9 @@ export default {
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
},
'$store.state.scriptRecord.userRole':function (val) {
this.userRole = val;
}
},
beforeDestroy() {
@ -305,48 +234,6 @@ export default {
},
resetChat() {
// this.$refs.chatbox.resetCoversition();
},
changeTreeData({newRole, oldRole}) {
const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
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,7 +15,7 @@ export function covertMemberData (activeTrainList, resp) {
lastData = JSON.parse(lastData);
const lastMemberList = [];
// const electricDispatcherList = [];
const deviceListData = [[], [], [], [], [], []];
const deviceListData = [[], [], [], [], [], [], []];
const driverList = [];
lastData.forEach((member, index)=>{
if (member.userId && member.userId == store.state.user.id) {
@ -37,7 +37,7 @@ export function covertMemberData (activeTrainList, resp) {
member.label = member.type + name + userName;
member.normalName = member.type + name;
}
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门'];
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门', '电力调度'];
const deviceTypeIndex = deviceType.indexOf(member.type);
if (deviceTypeIndex >= 0) {
if (deviceTypeIndex == 3) {

View File

@ -154,9 +154,11 @@ export default {
dispatcherList.push(this.memberData[item.id]);
break;
case 'ELECTRIC_DISPATCHER':
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
electricDispatcherList.push(this.memberData[item.id]);
break;
case 'DEPOT_DISPATCHER':
this.memberData[item.id].labelName = '车辆段调度' + (item.name || '');
depotDispatcherList.push(this.memberData[item.id]);
break;
case 'STATION_SUPERVISOR':
@ -193,7 +195,12 @@ export default {
labelName: '车辆段',
id: 'depotDispatcher',
children: depotDispatcherList
}];
}, {
labelName: '电力调度',
id: 'electricDispatcher',
children: electricDispatcherList
}
];
this.$nextTick(() => {
if (this.$refs.tree) {
this.$refs.tree.filter(this.queryMember);

View File

@ -220,22 +220,22 @@ export default {
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
}
if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
// if (that.$route.query.lineCode == '02' && !jsonData[0].downTrack && !jsonData[0].upTrack) {
// that.loadingDig.close();
// that.$message.warning(``);
// } else {
importRunPlan({ mapId: that.$route.params.mapId || that.$route.query.mapId || '02', runPlanList: jsonData }).then(response => {
that.loadingDig.close();
that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`);
} else {
importRunPlan({ mapId: that.$route.params.mapId || that.$route.query.mapId || '02', runPlanList: jsonData }).then(response => {
that.loadingDig.close();
if (response && response.code == 200) {
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
that.$emit('refresh');
if (response && response.code == 200) {
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
that.$emit('refresh');
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
}
}).catch(error => {
that.loadingDig.close();
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
});
}
}
}).catch(error => {
that.loadingDig.close();
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
});
// }
} catch (error) {
that.loadingDig.close();
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);

View File

@ -80,6 +80,7 @@ export default {
listLines().then(resp => {
this.lineList = resp.data;
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
},
@ -88,6 +89,7 @@ export default {
listStations(this.lineId).then(resp => {
this.stationList = resp.data;
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}
@ -103,6 +105,7 @@ export default {
this.refreshStationList();
this.$message.success('修改成功。')
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}

View File

@ -264,15 +264,18 @@ export default {
turnBackTime: data.turnBackTime
}
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
} else {
this.$refs.schedule.clear();
}
}).catch(error => {
console.error(error);
this.$messageBox(error.message);
})
} else {
@ -396,6 +399,7 @@ export default {
this.$router.replace({ path: 'AUStool'});
this.$message.success('Run plan group created successfully.')
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
},
@ -412,13 +416,16 @@ export default {
? this.$router.replace({ path: 'AUStool'})
: this.loadPlanData();
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
},
doSetPlanParams(data) {
@ -426,6 +433,7 @@ export default {
this.config = data;
this.$message.success('Parameters of plan were modified successfully.');
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
},
@ -437,6 +445,7 @@ export default {
modifyAreaNote(this.planId, data.id, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -451,6 +460,7 @@ export default {
justTripNoRunning(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -466,6 +476,7 @@ export default {
justTripNoStop(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -481,6 +492,7 @@ export default {
justTripTurnBack(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -497,6 +509,7 @@ export default {
addRpTrip(this.planId, model).then(resp => {
this.refresh();
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh();
this.$refs.schedule.clearGraphic(['mark']);
@ -518,6 +531,7 @@ export default {
createRpArea(this.planId, model).then(resp => {
this.refresh();
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh();
this.$refs.schedule.clearGraphic(['mark']);
@ -532,7 +546,8 @@ export default {
translateRpService(this.planId, this.selected.serviceNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
this.refresh(false);
this.refresh(false);
console.error(error);
this.$message.info(error.message);
});
}
@ -551,7 +566,8 @@ export default {
modifyRpArea(this.planId, data.areaNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
this.refresh(false);
this.refresh(false);
console.error(error);
this.$message.info(error.message);
});
}
@ -566,11 +582,13 @@ export default {
delRpService(this.planId, this.selected.serviceNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.refresh();
console.error(error);
this.$message.info(error.message);
});
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
}
},
@ -585,11 +603,13 @@ export default {
delRpTrip(this.planId, this.selected.tripNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.refresh();
console.error(error);
this.$message.info(error.message);
});
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
}
},
@ -604,11 +624,13 @@ export default {
delRpArea(this.planId, data.areaNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.refresh();
console.error(error);
this.$message.info(error.message);
});
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
}
},
@ -620,7 +642,8 @@ export default {
if (cls) {
this.onClear();
}
}).catch(() => {
}).catch(error => {
console.error(error);
this.$messageBox('Failed to load the plan.');
});
}

View File

@ -203,7 +203,8 @@ export default {
const mw = this.myChart.getWidth()-100;
const view = this.myChart.getViewOfComponentModel({__viewId: "_ec_shape_graphic"});
if (view.group) {
if (view &&
view.group) {
view.group.eachChild(el => {
if (['area'].includes(el.subType)) {
const position1 = this.myChart.convertToPixel('grid', el.point1);
@ -452,7 +453,10 @@ export default {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == e.target.model.areaNo; });
option.graphic[0].elements = this.calcHornList(elemList, elem);
if (elem) {
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
this.myChart.setOption(option, true);
}
},
@ -642,14 +646,16 @@ export default {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
elem.position = args.position;
elem.point1 = args.point1;
elem.point2 = args.point2;
elem.shape.width = args.width;
elem.shape.height = args.height;
elem.style.textOffset = [ -args.width/2, -args.height/2 ];
if (elem) {
elem.position = args.position;
elem.point1 = args.point1;
elem.point2 = args.point2;
elem.shape.width = args.width;
elem.shape.height = args.height;
elem.style.textOffset = [ -args.width/2, -args.height/2 ];
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
option.graphic[0].elements = this.calcHornList(elemList, elem);
this.myChart.setOption(option, true);
}
}

View File

@ -250,6 +250,7 @@ export default {
this.myChart.hideLoading();
}
} catch (error) {
console.error(error);
this.$messageBox(error.message);
}
},
@ -286,7 +287,9 @@ export default {
this.target.model) {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == this.target.model.areaNo; });
option.graphic[0].elements = this.calcHornList(elemList, elem);
if (elem) {
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
}
}
@ -300,6 +303,7 @@ export default {
this.setTargetLight();
}
} catch (error) {
console.error(error);
this.$messageBox(error.message);
}
},

View File

@ -23,8 +23,8 @@
<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 v-if="data.id==memberId" class="hasSetted">设置</span>
<span v-else class="settingBtn" @click="changeRole(data)">设置</span>
</span>
</span>
@ -33,7 +33,6 @@
</div>
</template>
<script>
import { getToken } from '@/utils/auth';
import {changeScriptRole} from '@/api/script';
export default {
name:'AllScriptRole',
@ -59,7 +58,7 @@ export default {
return {
covertMemberList:[],
driverList:[],
oldMember:{id:null, type:''},
// oldMember:{id:null, type:''},
queryMember:'',
loading:false,
defaultProps: {
@ -73,11 +72,11 @@ export default {
if (this.$refs.tree) {
this.$refs.tree.filter(val);
}
},
'treeData':function(val) {
const roleName = this.$store.state.scriptRecord.userRole;
this.oldMember = {id:this.memberId, type:roleName};
}
// 'treeData':function(val) {
// const roleName = this.$store.state.scriptRecord.userRole;
// this.oldMember = {id:this.memberId, type:roleName};
// }
},
methods:{
filterNode(value, data) {
@ -91,68 +90,16 @@ export default {
addMember() {
this.$emit('addMember');
},
updateLoading() {
this.loading = false;
this.$message('切换角色成功');
},
switchMode(member) {
this.loading = true;
changeScriptRole(this.group, member.id).then(res=>{
let prdType = '';
if (this.openWindow) {
this.openWindow.close();
}
const role = Object.assign({}, member);
if (role.type == '行值') {
prdType = '01';
role.type = 'STATION_SUPERVISOR';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (role.type == '行调') {
prdType = '02';
role.type = 'DISPATCHER';
this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (role.type == '司机') {
prdType = '04';
role.type = 'DRIVER';
this.$store.dispatch('training/setRoles', 'DRIVER');
} else if (role.type == '通号') {
prdType = '';
role.type = 'MAINTAINER';
this.$store.dispatch('training/setRoles', 'MAINTAINER');
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.$route.query.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
} else if (role.type == '车辆段调度') {
prdType = '05';
role.type = 'DEPOT_DISPATCHER';
this.$store.dispatch('training/setRoles', 'DEPOT_DISPATCHER');
} else if (role.type == '上级部门') {
prdType = '';
role.type = 'PARENT_DEPARTMENT';
this.$store.dispatch('training/setRoles', 'PARENT_DEPARTMENT');
} else {
prdType = '';
}
this.$store.dispatch('training/setPrdType', prdType);
this.$store.dispatch('scriptRecord/updateRole', role.type + ':' + role.id);
this.$emit('setMemberId', {newRole:role, oldRole:this.oldMember});
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:Object.assign({}, this.oldMember).id,
newMemberId:role.id,
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}
);
this.oldMember = Object.assign({}, role);
this.loading = false;
this.$message('切换角色成功');
this.$emit('changeMode', member);
}).catch(()=>{
this.loading = false;
this.$messageBox('切换角色失败');
// this.$refs.changeScriptRole.blur();
});

View File

@ -33,7 +33,7 @@
</el-button-group>
</div>
<div class="scriptPanelRight">
<get-action-new ref="getAction" :group="group" :size="size" :member-list="memberList" @setAction="setAction" />
<get-action-new ref="getAction" :group="group" :size="size" :member-list="memberList" />
</div>
</div>
</el-tab-pane>
@ -44,7 +44,7 @@
:member-id="memberId"
:tree-data="treeData"
:group="group"
@setMemberId="setMemberId"
@changeMode="changeMode"
@addMember="addMember"
/>
</div>
@ -60,14 +60,15 @@
</template>
<script>
import Vue from 'vue';
import GetActionNew from './getAction';
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation';
import ConstConfig from '@/scripts/ConstConfig';
import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script';
import AddScriptMember from './addScriptMember';
import Cookies from 'js-cookie';
import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script';
import ConstConfig from '@/scripts/ConstConfig';
import AddScriptMember from './addScriptMember';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import GetActionNew from './getAction';
import AllScriptRole from './allScriptRole';
import { getToken } from '@/utils/auth';
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation';
export default {
name:'TipScriptRecord',
components: {
@ -87,14 +88,6 @@ export default {
offset:{
type: Number,
required: true
},
treeData:{
type:Array,
required: true
},
memberList:{
type:Array,
required: true
}
},
data() {
@ -113,13 +106,21 @@ export default {
width: 300,
height: 300
},
openWindow:null
openWindow:null,
treeData:[],
memberList:[],
driverList:[],
activeTrainList:[],
oldMember:{id:null, type:''}
};
},
computed:{
memberId() {
return this.$store.state.scriptRecord.updateRoleId;
},
memberType() {
return this.$store.state.scriptRecord.userRole;
},
orignalUserRoleId() {
return this.$store.state.training.orignalUserRoleId;
}
@ -144,6 +145,82 @@ export default {
this.isFirst = false;
this.initData();
}
},
'$store.state.training.memberList': function (val) {
if (val && val.length) {
const memberData = this.$store.state.training.memberData;
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;
}
// 仿
const result = covertMemberData(this.activeTrainList, Object.values(memberData));
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]
}, {
label: '上级部门',
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
}, {
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: result.deviceListData[6]
}
// PARENT_DEPARTMENT
];
this.memberList = result.lastMemberList;
}
},
// ()
'$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 = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
}
},
mounted() {
@ -163,6 +240,7 @@ export default {
this.quickChangeMember.list.push(eachMember);
}
});
this.oldMember = {id:this.memberId, type:this.memberType};
});
},
addScriptMember(member) {
@ -170,33 +248,14 @@ export default {
member.disabled = false;
const lastData = JSON.stringify([member]);
const covertmember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
this.$emit('addScriptMember', covertmember[0]);
},
setMemberId({newRole, oldRole}) {
this.$emit('changeTreeData', {newRole:newRole, oldRole:oldRole});
const quickChangeMember = this.quickChangeMember.list;
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;
const roleTypeEnumMap = {
'STATION_SUPERVISOR':'行值',
'DISPATCHER':'行调',
'DRIVER':'司机',
'MAINTAINER':'通号',
'DEPOT_DISPATCHER':'车辆段调度',
'PARENT_DEPARTMENT':'上级部门'
};
newRole.type = roleTypeEnumMap[newRole.type];
this.quickChangeMember.list.push(newRole);
const newMember = covertmember[0];
this.memberList.push(newMember);
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度', '上级部门', '电力调度'];
const index = deviceTypeList.indexOf(newMember.type);
if (index >= 0) {
const treeDataIn = this.treeData[index];
treeDataIn.children.push(newMember);
this.treeData[index] = treeDataIn;
}
},
addMember() {
@ -251,9 +310,6 @@ export default {
each.label = each.normalName;
});
return lastData;
},
setAction() {
},
pauseScript() {
simulationPause(this.group).then(resp => {
@ -325,7 +381,7 @@ export default {
});
},
dumpScenesData() {
this.clearAutoSave();
// this.clearAutoSave();
const group = this.group;
this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
@ -335,7 +391,6 @@ export default {
dumpScriptDataNew(group).then(resp => {
this.$parent.resetBeginTime();
this.$refs['getAction'].loadInitData();
// this.changeRunPlanStatus();
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.memberId,
@ -350,31 +405,108 @@ export default {
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', 'PARENT_DEPARTMENT'];
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.$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.memberId = this.orignalUserRoleId;
this.oldMember = {id:this.orignalUserRoleId, type:new_member.type};
this.$message.success(this.$t('scriptRecord.resetDataSuccess'));
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.resetDataFail'));
});
});
},
changeMode(member) {
let prdType = '';
if (this.openWindow) {
this.openWindow.close();
}
const role = Object.assign({}, member);
if (role.type == '行值') {
prdType = '01';
role.type = 'STATION_SUPERVISOR';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (role.type == '行调') {
prdType = '02';
role.type = 'DISPATCHER';
this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (role.type == '司机') {
prdType = '04';
role.type = 'DRIVER';
this.$store.dispatch('training/setRoles', 'DRIVER');
} else if (role.type == '通号') {
prdType = '';
role.type = 'MAINTAINER';
this.$store.dispatch('training/setRoles', 'MAINTAINER');
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.$route.query.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
} else if (role.type == '车辆段调度') {
prdType = '05';
role.type = 'DEPOT_DISPATCHER';
this.$store.dispatch('training/setRoles', 'DEPOT_DISPATCHER');
} else if (role.type == '上级部门') {
prdType = '';
role.type = 'PARENT_DEPARTMENT';
this.$store.dispatch('training/setRoles', 'PARENT_DEPARTMENT');
} else if (role.type == '电力调度') {
prdType = '';
role.type = 'ELECTRIC_DISPATCHER';
this.$store.dispatch('training/setRoles', 'ELECTRIC_DISPATCHER');
} else {
prdType = '';
}
this.$store.dispatch('training/setPrdType', prdType);
this.$store.dispatch('scriptRecord/updateRole', role.type + ':' + role.id);
const newRole = role;
const oldRole = this.oldMember;
const quickChangeMember = this.quickChangeMember.list;
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;
const roleTypeEnumMap = {
'STATION_SUPERVISOR':'行值',
'DISPATCHER':'行调',
'DRIVER':'司机',
'MAINTAINER':'通号',
'DEPOT_DISPATCHER':'车辆段调度',
'PARENT_DEPARTMENT':'上级部门',
'ELECTRIC_DISPATCHER':'电力调度'
};
newRole.type = roleTypeEnumMap[newRole.type];
this.quickChangeMember.list.push(newRole);
}
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.oldMember.id,
newMemberId:role.id,
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}
);
this.oldMember = Object.assign({}, role);
this.$refs.allScriptRole.updateLoading();
}
}
};
@ -458,3 +590,4 @@ export default {
margin-bottom: 5px;
}
</style>