Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
4f567c474a
@ -12,235 +12,128 @@ export default {
|
|||||||
|
|
||||||
/** excel解析配置*/
|
/** excel解析配置*/
|
||||||
ExcelConfig: {
|
ExcelConfig: {
|
||||||
// beginRow: 1,
|
|
||||||
// beginCol: 0,
|
|
||||||
// fieldNum: 10,
|
|
||||||
// trainId: '车次号',
|
|
||||||
// columns: ['备注', '车次号']
|
|
||||||
beginRow: 1,
|
beginRow: 1,
|
||||||
beginCol: 0,
|
beginCol: 0,
|
||||||
// fieldNum: 10,
|
// fieldNum: 10,
|
||||||
columns: {
|
trainId: '车次号',
|
||||||
'默认上行折返轨': { key: 'upTrack', formatter: (val) => { return val; } },
|
columns: ['备注', '车次号']
|
||||||
'默认下行折返轨': { key: 'downTrack', formatter: (val) => { return val; } }
|
// 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后台数据*/
|
// /** 解析exal数据转换为Json后台数据*/
|
||||||
// importData(Sheet, JsonData) {
|
// importData(Sheet, JsonData) {
|
||||||
// const dataList = convertSheetToList(Sheet, true);
|
// const dataList = convertSheetToList(Sheet, true);
|
||||||
|
// const needList = Object.keys(this.ExcelConfig.columns);
|
||||||
|
// const tripObj = { upTrack: '', downTrack: '' };
|
||||||
// if (dataList && dataList.length && dataList[1] && dataList[0]) {
|
// if (dataList && dataList.length && dataList[1] && dataList[0]) {
|
||||||
// const tIndex = 8; // 设置不用过滤行数
|
// const tIndex = dataList.findIndex(it => { return it[0]; });
|
||||||
// /** 解析二维数组为json对象*/
|
// if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) {
|
||||||
// const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00
|
// for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) {
|
||||||
// const reg4 = /[▼|▲|¡|ø|¨|]+/; // ▲
|
// var isContinue = true;
|
||||||
// dataList.forEach((elem, i) => {
|
|
||||||
// var begin = -1;
|
// for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
|
||||||
// /** 跳过名称所在的行*/
|
// isContinue = false;
|
||||||
// if (i != tIndex && elem && elem.length > 0) {
|
|
||||||
// let flag = false;
|
// var title = dataList[colIndex][0];
|
||||||
// let param = { begTime: '', endTime: '' };
|
// var value = dataList[colIndex][rowIndex];
|
||||||
// if (i > tIndex) { elem.reverse(); }
|
|
||||||
// let interval = 1;
|
// if (title && value) {
|
||||||
// for (let j = 0; j < elem.length;) {
|
// // 数据列解析
|
||||||
// const item = elem[j];
|
// isContinue = true;
|
||||||
// let title = '';
|
// var titleStr = `${title}`.replace(/\s*/g, '');
|
||||||
// var value = `${item}`.trim();
|
// var valueStr = `${value}`.replace(/\s*/g, '');
|
||||||
// if (i > tIndex) { // 上行线
|
|
||||||
// title = `${dataList[tIndex][dataList[tIndex].length - j - 1]}`.replace(/\s*/g, '');
|
// // 取需要的字段
|
||||||
// if (title == 'undefined') {
|
// if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
|
||||||
// title = `${dataList[tIndex][dataList[tIndex].length - j - 2]}`.replace(/\s*/g, '');
|
// tripObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
|
||||||
// }
|
|
||||||
// } 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) {
|
// } else {
|
||||||
// interval = 2;
|
// /** 解析二维数组为json对象*/
|
||||||
// flag = true;
|
// const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; // ↑|↓
|
||||||
// begin = value; // 设置初始索引
|
// const reg1 = /^([▼|▲|¡ø|¨]+)\s*(\d+:\d+:\d+)/; // ▲ 06:10:00
|
||||||
// JsonData.push({
|
// const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨]+)/; // 06:10:00 ▲
|
||||||
// code: value,
|
// const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; // 06:10:00 06:12:00
|
||||||
// destinationCode: '',
|
// const reg4 = /[▼|▲|¡|ø|¨|]+/; // ▲
|
||||||
// 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) {
|
// dataList.forEach((elem, i) => {
|
||||||
// need = true;
|
// 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数据*/
|
// /** 添加json数据*/
|
||||||
@ -248,27 +141,140 @@ export default {
|
|||||||
// var stationObj = {
|
// var stationObj = {
|
||||||
// stationName: stationName
|
// stationName: stationName
|
||||||
// };
|
// };
|
||||||
// if (reg4.test(param.begTime)) {
|
|
||||||
// param.begTime = '';
|
// if (begTime) { stationObj['arriveTime'] = prefixTime(begTime); }
|
||||||
// }
|
// if (endTime) { stationObj['departureTime'] = prefixTime(endTime); }
|
||||||
// if (reg4.test(param.endTime)) {
|
// if (flag) { stationObj['flag'] = flag; } // 是否转换轨
|
||||||
// param.endTime = '';
|
|
||||||
// }
|
|
||||||
// stationObj['arriveTime'] = prefixTime(param.begTime);
|
|
||||||
// stationObj['departureTime'] = prefixTime(param.endTime);
|
|
||||||
// JsonData[JsonData.length - 1].arrivalList.push(stationObj);
|
// 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;
|
// 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) {
|
convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) {
|
||||||
|
@ -95,9 +95,9 @@ export default {
|
|||||||
{label: '司机', value: 'DRIVER', enLabel: 'Driver '},
|
{label: '司机', value: 'DRIVER', enLabel: 'Driver '},
|
||||||
{label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '},
|
{label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '},
|
||||||
{label: '车辆段调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher '},
|
{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: 'DISPATCHER', enLabel: 'Dispatcher '},
|
||||||
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent_department'}
|
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent department'}
|
||||||
|
|
||||||
],
|
],
|
||||||
SimulationType: [
|
SimulationType: [
|
||||||
|
@ -375,6 +375,8 @@ export default {
|
|||||||
dispatcherList[item.id] = this.memberData[item.id];
|
dispatcherList[item.id] = this.memberData[item.id];
|
||||||
break;
|
break;
|
||||||
case 'ELECTRIC_DISPATCHER':
|
case 'ELECTRIC_DISPATCHER':
|
||||||
|
this.memberData[item.id].label = '电力调度' + (item.name || '');
|
||||||
|
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
|
||||||
electricDispatcherList[item.id] = this.memberData[item.id];
|
electricDispatcherList[item.id] = this.memberData[item.id];
|
||||||
break;
|
break;
|
||||||
case 'DEPOT_DISPATCHER':
|
case 'DEPOT_DISPATCHER':
|
||||||
@ -439,6 +441,11 @@ export default {
|
|||||||
id: 'parentDepartment',
|
id: 'parentDepartment',
|
||||||
type: 'role',
|
type: 'role',
|
||||||
children: parentDepartmentList
|
children: parentDepartmentList
|
||||||
|
}, {
|
||||||
|
label: '电力调度',
|
||||||
|
id: 'electricDispatcher',
|
||||||
|
type: 'role',
|
||||||
|
children: electricDispatcherList
|
||||||
}];
|
}];
|
||||||
this.initCommonMemberList();
|
this.initCommonMemberList();
|
||||||
this.filterNode();
|
this.filterNode();
|
||||||
|
@ -168,6 +168,10 @@ export default {
|
|||||||
member.label = '上级部门' + (member.name ? member.name : '');
|
member.label = '上级部门' + (member.name ? member.name : '');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'ELECTRIC_DISPATCHER': {
|
||||||
|
member.label = '电力调度' + (member.name ? member.name : '');
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if (member.type === 'DISPATCHER') {
|
// if (member.type === 'DISPATCHER') {
|
||||||
// this.memberId = member.id;
|
// this.memberId = member.id;
|
||||||
|
@ -222,6 +222,12 @@ export default {
|
|||||||
id: 'parentDepartment',
|
id: 'parentDepartment',
|
||||||
type: 'role',
|
type: 'role',
|
||||||
children: result.deviceListData[5]
|
children: result.deviceListData[5]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电力调度',
|
||||||
|
id: 'electricDispatcher',
|
||||||
|
type: 'role',
|
||||||
|
children: result.deviceListData[6]
|
||||||
}];
|
}];
|
||||||
const lastMemberList = result.lastMemberList;
|
const lastMemberList = result.lastMemberList;
|
||||||
this.$emit('setTreeData', treeData);
|
this.$emit('setTreeData', treeData);
|
||||||
|
@ -28,15 +28,12 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||||
|
|
||||||
<tip-script-record-new
|
<tip-script-record-new
|
||||||
ref="tipTaskRecordNew"
|
ref="tipTaskRecordNew"
|
||||||
:group="group"
|
:group="group"
|
||||||
:offset-bottom="offsetBottom"
|
:offset-bottom="offsetBottom"
|
||||||
:offset="offset"
|
:offset="offset"
|
||||||
:tree-data="treeData"
|
|
||||||
:member-list="memberData"
|
|
||||||
@changeTreeData="changeTreeData"
|
|
||||||
@addScriptMember="addScriptMember"
|
|
||||||
@resetChat="resetChat"
|
@resetChat="resetChat"
|
||||||
/>
|
/>
|
||||||
<chat-box
|
<chat-box
|
||||||
@ -56,7 +53,6 @@ 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 {covertMemberData} from '@/views/newMap/displayNew/utils';
|
|
||||||
import { getSimulationMemberList} from '@/api/simulation';
|
import { getSimulationMemberList} from '@/api/simulation';
|
||||||
import ChatBox from '@/views/newMap/chatView/chatBox.vue';
|
import ChatBox from '@/views/newMap/chatView/chatBox.vue';
|
||||||
|
|
||||||
@ -101,10 +97,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
isScriptCommand:false,
|
isScriptCommand:false,
|
||||||
driverList:[],
|
|
||||||
treeData:[],
|
|
||||||
memberData:[],
|
|
||||||
activeTrainList:[],
|
|
||||||
userRole:''
|
userRole:''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -133,82 +125,16 @@ export default {
|
|||||||
'$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 = [...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) { // 地图视图加载完成标识
|
'$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识
|
||||||
getSimulationMemberList(this.group).then(resp => {
|
getSimulationMemberList(this.group).then(resp => {
|
||||||
// this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
|
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;
|
|
||||||
// 设置当前角色
|
// 设置当前角色
|
||||||
const member = resp.data.find(mem=>{
|
const member = resp.data.find(mem=>{
|
||||||
return mem.userId != '' && mem.userId != undefined;
|
return mem.userId != '' && mem.userId != undefined;
|
||||||
});
|
});
|
||||||
if (member) {
|
if (member) {
|
||||||
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
|
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT', 'ELECTRIC_DISPATCHER'];
|
||||||
const prdTypeList = ['01', '02', '04', '', '', ''];
|
const prdTypeList = ['01', '02', '04', '', '05', '', ''];
|
||||||
const index = memberType.indexOf(member.type);
|
const index = memberType.indexOf(member.type);
|
||||||
let prdType;
|
let prdType;
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@ -223,6 +149,9 @@ export default {
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox('获取仿真成员列表失败!');
|
this.$messageBox('获取仿真成员列表失败!');
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
'$store.state.scriptRecord.userRole':function (val) {
|
||||||
|
this.userRole = val;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
@ -305,48 +234,6 @@ export default {
|
|||||||
},
|
},
|
||||||
resetChat() {
|
resetChat() {
|
||||||
// this.$refs.chatbox.resetCoversition();
|
// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ export function covertMemberData (activeTrainList, resp) {
|
|||||||
lastData = JSON.parse(lastData);
|
lastData = JSON.parse(lastData);
|
||||||
const lastMemberList = [];
|
const lastMemberList = [];
|
||||||
// const electricDispatcherList = [];
|
// const electricDispatcherList = [];
|
||||||
const deviceListData = [[], [], [], [], [], []];
|
const deviceListData = [[], [], [], [], [], [], []];
|
||||||
const driverList = [];
|
const driverList = [];
|
||||||
lastData.forEach((member, index)=>{
|
lastData.forEach((member, index)=>{
|
||||||
if (member.userId && member.userId == store.state.user.id) {
|
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.label = member.type + name + userName;
|
||||||
member.normalName = member.type + name;
|
member.normalName = member.type + name;
|
||||||
}
|
}
|
||||||
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门'];
|
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门', '电力调度'];
|
||||||
const deviceTypeIndex = deviceType.indexOf(member.type);
|
const deviceTypeIndex = deviceType.indexOf(member.type);
|
||||||
if (deviceTypeIndex >= 0) {
|
if (deviceTypeIndex >= 0) {
|
||||||
if (deviceTypeIndex == 3) {
|
if (deviceTypeIndex == 3) {
|
||||||
|
@ -154,9 +154,11 @@ export default {
|
|||||||
dispatcherList.push(this.memberData[item.id]);
|
dispatcherList.push(this.memberData[item.id]);
|
||||||
break;
|
break;
|
||||||
case 'ELECTRIC_DISPATCHER':
|
case 'ELECTRIC_DISPATCHER':
|
||||||
|
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
|
||||||
electricDispatcherList.push(this.memberData[item.id]);
|
electricDispatcherList.push(this.memberData[item.id]);
|
||||||
break;
|
break;
|
||||||
case 'DEPOT_DISPATCHER':
|
case 'DEPOT_DISPATCHER':
|
||||||
|
this.memberData[item.id].labelName = '车辆段调度' + (item.name || '');
|
||||||
depotDispatcherList.push(this.memberData[item.id]);
|
depotDispatcherList.push(this.memberData[item.id]);
|
||||||
break;
|
break;
|
||||||
case 'STATION_SUPERVISOR':
|
case 'STATION_SUPERVISOR':
|
||||||
@ -193,7 +195,12 @@ export default {
|
|||||||
labelName: '车辆段',
|
labelName: '车辆段',
|
||||||
id: 'depotDispatcher',
|
id: 'depotDispatcher',
|
||||||
children: depotDispatcherList
|
children: depotDispatcherList
|
||||||
}];
|
}, {
|
||||||
|
labelName: '电力调度',
|
||||||
|
id: 'electricDispatcher',
|
||||||
|
children: electricDispatcherList
|
||||||
|
}
|
||||||
|
];
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.tree) {
|
if (this.$refs.tree) {
|
||||||
this.$refs.tree.filter(this.queryMember);
|
this.$refs.tree.filter(this.queryMember);
|
||||||
|
@ -220,22 +220,22 @@ export default {
|
|||||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
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.loadingDig.close();
|
||||||
that.$message.warning(`运行图暂无默认上行折返轨或默认下行折返轨,请输入`);
|
if (response && response.code == 200) {
|
||||||
} else {
|
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||||
importRunPlan({ mapId: that.$route.params.mapId || that.$route.query.mapId || '02', runPlanList: jsonData }).then(response => {
|
that.$emit('refresh');
|
||||||
that.loadingDig.close();
|
|
||||||
if (response && response.code == 200) {
|
|
||||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
|
||||||
that.$emit('refresh');
|
|
||||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
that.loadingDig.close();
|
that.loadingDig.close();
|
||||||
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
||||||
});
|
});
|
||||||
}
|
// }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
that.loadingDig.close();
|
that.loadingDig.close();
|
||||||
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);
|
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);
|
||||||
|
@ -80,6 +80,7 @@ export default {
|
|||||||
listLines().then(resp => {
|
listLines().then(resp => {
|
||||||
this.lineList = resp.data;
|
this.lineList = resp.data;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -88,6 +89,7 @@ export default {
|
|||||||
listStations(this.lineId).then(resp => {
|
listStations(this.lineId).then(resp => {
|
||||||
this.stationList = resp.data;
|
this.stationList = resp.data;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -103,6 +105,7 @@ export default {
|
|||||||
this.refreshStationList();
|
this.refreshStationList();
|
||||||
this.$message.success('修改成功。')
|
this.$message.success('修改成功。')
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -264,15 +264,18 @@ export default {
|
|||||||
turnBackTime: data.turnBackTime
|
turnBackTime: data.turnBackTime
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$refs.schedule.clear();
|
this.$refs.schedule.clear();
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$messageBox(error.message);
|
this.$messageBox(error.message);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -396,6 +399,7 @@ export default {
|
|||||||
this.$router.replace({ path: 'AUStool'});
|
this.$router.replace({ path: 'AUStool'});
|
||||||
this.$message.success('Run plan group created successfully.')
|
this.$message.success('Run plan group created successfully.')
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -412,13 +416,16 @@ export default {
|
|||||||
? this.$router.replace({ path: 'AUStool'})
|
? this.$router.replace({ path: 'AUStool'})
|
||||||
: this.loadPlanData();
|
: this.loadPlanData();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(error => {
|
||||||
this.$message({ type: 'info', message: 'Deletion cancelled.' });
|
console.error(error);
|
||||||
|
this.$message.info('Deletion cancelled.');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
doSetPlanParams(data) {
|
doSetPlanParams(data) {
|
||||||
@ -426,6 +433,7 @@ export default {
|
|||||||
this.config = data;
|
this.config = data;
|
||||||
this.$message.success('Parameters of plan were modified successfully.');
|
this.$message.success('Parameters of plan were modified successfully.');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -437,6 +445,7 @@ export default {
|
|||||||
modifyAreaNote(this.planId, data.id, model).then(resp => {
|
modifyAreaNote(this.planId, data.id, model).then(resp => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
});
|
});
|
||||||
@ -451,6 +460,7 @@ export default {
|
|||||||
justTripNoRunning(this.planId, this.selected.tripNo, model).then(resp => {
|
justTripNoRunning(this.planId, this.selected.tripNo, model).then(resp => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
});
|
});
|
||||||
@ -466,6 +476,7 @@ export default {
|
|||||||
justTripNoStop(this.planId, this.selected.tripNo, model).then(resp => {
|
justTripNoStop(this.planId, this.selected.tripNo, model).then(resp => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
});
|
});
|
||||||
@ -481,6 +492,7 @@ export default {
|
|||||||
justTripTurnBack(this.planId, this.selected.tripNo, model).then(resp => {
|
justTripTurnBack(this.planId, this.selected.tripNo, model).then(resp => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
});
|
});
|
||||||
@ -497,6 +509,7 @@ export default {
|
|||||||
addRpTrip(this.planId, model).then(resp => {
|
addRpTrip(this.planId, model).then(resp => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.$refs.schedule.clearGraphic(['mark']);
|
this.$refs.schedule.clearGraphic(['mark']);
|
||||||
@ -518,6 +531,7 @@ export default {
|
|||||||
createRpArea(this.planId, model).then(resp => {
|
createRpArea(this.planId, model).then(resp => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.$refs.schedule.clearGraphic(['mark']);
|
this.$refs.schedule.clearGraphic(['mark']);
|
||||||
@ -532,7 +546,8 @@ export default {
|
|||||||
translateRpService(this.planId, this.selected.serviceNo, model).then(resp => {
|
translateRpService(this.planId, this.selected.serviceNo, model).then(resp => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -551,7 +566,8 @@ export default {
|
|||||||
modifyRpArea(this.planId, data.areaNo, model).then(resp => {
|
modifyRpArea(this.planId, data.areaNo, model).then(resp => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.refresh(false);
|
this.refresh(false);
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -566,11 +582,13 @@ export default {
|
|||||||
delRpService(this.planId, this.selected.serviceNo).then(resp => {
|
delRpService(this.planId, this.selected.serviceNo).then(resp => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch(error => {
|
||||||
this.$message({ type: 'info', message: 'Deletion cancelled.' });
|
console.error(error);
|
||||||
|
this.$message.info('Deletion cancelled.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -585,11 +603,13 @@ export default {
|
|||||||
delRpTrip(this.planId, this.selected.tripNo).then(resp => {
|
delRpTrip(this.planId, this.selected.tripNo).then(resp => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch(error => {
|
||||||
this.$message({ type: 'info', message: 'Deletion cancelled.' });
|
console.error(error);
|
||||||
|
this.$message.info('Deletion cancelled.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -604,11 +624,13 @@ export default {
|
|||||||
delRpArea(this.planId, data.areaNo).then(resp => {
|
delRpArea(this.planId, data.areaNo).then(resp => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
console.error(error);
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch(error => {
|
||||||
this.$message({ type: 'info', message: 'Deletion cancelled.' });
|
console.error(error);
|
||||||
|
this.$message.info('Deletion cancelled.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -620,7 +642,8 @@ export default {
|
|||||||
if (cls) {
|
if (cls) {
|
||||||
this.onClear();
|
this.onClear();
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
this.$messageBox('Failed to load the plan.');
|
this.$messageBox('Failed to load the plan.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,8 @@ export default {
|
|||||||
const mw = this.myChart.getWidth()-100;
|
const mw = this.myChart.getWidth()-100;
|
||||||
|
|
||||||
const view = this.myChart.getViewOfComponentModel({__viewId: "_ec_shape_graphic"});
|
const view = this.myChart.getViewOfComponentModel({__viewId: "_ec_shape_graphic"});
|
||||||
if (view.group) {
|
if (view &&
|
||||||
|
view.group) {
|
||||||
view.group.eachChild(el => {
|
view.group.eachChild(el => {
|
||||||
if (['area'].includes(el.subType)) {
|
if (['area'].includes(el.subType)) {
|
||||||
const position1 = this.myChart.convertToPixel('grid', el.point1);
|
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 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; });
|
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);
|
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 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; });
|
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
|
||||||
|
|
||||||
elem.position = args.position;
|
if (elem) {
|
||||||
elem.point1 = args.point1;
|
elem.position = args.position;
|
||||||
elem.point2 = args.point2;
|
elem.point1 = args.point1;
|
||||||
elem.shape.width = args.width;
|
elem.point2 = args.point2;
|
||||||
elem.shape.height = args.height;
|
elem.shape.width = args.width;
|
||||||
elem.style.textOffset = [ -args.width/2, -args.height/2 ];
|
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);
|
this.myChart.setOption(option, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,7 @@ export default {
|
|||||||
this.myChart.hideLoading();
|
this.myChart.hideLoading();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
this.$messageBox(error.message);
|
this.$messageBox(error.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -286,7 +287,9 @@ export default {
|
|||||||
this.target.model) {
|
this.target.model) {
|
||||||
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
|
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; });
|
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();
|
this.setTargetLight();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
this.$messageBox(error.message);
|
this.$messageBox(error.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
<span v-else>
|
<span v-else>
|
||||||
<span style="font-size: 14px">{{ data.normalName }}</span>
|
<span style="font-size: 14px">{{ data.normalName }}</span>
|
||||||
<span v-if="data.type!='role'" class="setGroup">
|
<span v-if="data.type!='role'" class="setGroup">
|
||||||
<span v-if="!data.disabled" class="settingBtn" @click="changeRole(data)">设置</span>
|
<span v-if="data.id==memberId" class="hasSetted">已设置</span>
|
||||||
<span v-else class="hasSetted">已设置</span>
|
<span v-else class="settingBtn" @click="changeRole(data)">设置</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@ -33,7 +33,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getToken } from '@/utils/auth';
|
|
||||||
import {changeScriptRole} from '@/api/script';
|
import {changeScriptRole} from '@/api/script';
|
||||||
export default {
|
export default {
|
||||||
name:'AllScriptRole',
|
name:'AllScriptRole',
|
||||||
@ -59,7 +58,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
covertMemberList:[],
|
covertMemberList:[],
|
||||||
driverList:[],
|
driverList:[],
|
||||||
oldMember:{id:null, type:''},
|
// oldMember:{id:null, type:''},
|
||||||
queryMember:'',
|
queryMember:'',
|
||||||
loading:false,
|
loading:false,
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
@ -73,11 +72,11 @@ export default {
|
|||||||
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};
|
|
||||||
}
|
}
|
||||||
|
// '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) {
|
||||||
@ -91,68 +90,16 @@ export default {
|
|||||||
addMember() {
|
addMember() {
|
||||||
this.$emit('addMember');
|
this.$emit('addMember');
|
||||||
},
|
},
|
||||||
|
updateLoading() {
|
||||||
|
this.loading = false;
|
||||||
|
this.$message('切换角色成功');
|
||||||
|
},
|
||||||
switchMode(member) {
|
switchMode(member) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
changeScriptRole(this.group, member.id).then(res=>{
|
changeScriptRole(this.group, member.id).then(res=>{
|
||||||
let prdType = '';
|
this.$emit('changeMode', member);
|
||||||
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('切换角色成功');
|
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
this.loading = false;
|
||||||
this.$messageBox('切换角色失败');
|
this.$messageBox('切换角色失败');
|
||||||
// this.$refs.changeScriptRole.blur();
|
// this.$refs.changeScriptRole.blur();
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="scriptPanelRight">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
:member-id="memberId"
|
:member-id="memberId"
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
:group="group"
|
:group="group"
|
||||||
@setMemberId="setMemberId"
|
@changeMode="changeMode"
|
||||||
@addMember="addMember"
|
@addMember="addMember"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -60,14 +60,15 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue';
|
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 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 AllScriptRole from './allScriptRole';
|
||||||
|
import { getToken } from '@/utils/auth';
|
||||||
|
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation';
|
||||||
export default {
|
export default {
|
||||||
name:'TipScriptRecord',
|
name:'TipScriptRecord',
|
||||||
components: {
|
components: {
|
||||||
@ -87,14 +88,6 @@ export default {
|
|||||||
offset:{
|
offset:{
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
|
||||||
treeData:{
|
|
||||||
type:Array,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
memberList:{
|
|
||||||
type:Array,
|
|
||||||
required: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -113,13 +106,21 @@ export default {
|
|||||||
width: 300,
|
width: 300,
|
||||||
height: 300
|
height: 300
|
||||||
},
|
},
|
||||||
openWindow:null
|
openWindow:null,
|
||||||
|
treeData:[],
|
||||||
|
memberList:[],
|
||||||
|
driverList:[],
|
||||||
|
activeTrainList:[],
|
||||||
|
oldMember:{id:null, type:''}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
memberId() {
|
memberId() {
|
||||||
return this.$store.state.scriptRecord.updateRoleId;
|
return this.$store.state.scriptRecord.updateRoleId;
|
||||||
},
|
},
|
||||||
|
memberType() {
|
||||||
|
return this.$store.state.scriptRecord.userRole;
|
||||||
|
},
|
||||||
orignalUserRoleId() {
|
orignalUserRoleId() {
|
||||||
return this.$store.state.training.orignalUserRoleId;
|
return this.$store.state.training.orignalUserRoleId;
|
||||||
}
|
}
|
||||||
@ -144,6 +145,82 @@ export default {
|
|||||||
this.isFirst = false;
|
this.isFirst = false;
|
||||||
this.initData();
|
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() {
|
mounted() {
|
||||||
@ -163,6 +240,7 @@ export default {
|
|||||||
this.quickChangeMember.list.push(eachMember);
|
this.quickChangeMember.list.push(eachMember);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.oldMember = {id:this.memberId, type:this.memberType};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addScriptMember(member) {
|
addScriptMember(member) {
|
||||||
@ -170,33 +248,14 @@ 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);
|
||||||
this.$emit('addScriptMember', covertmember[0]);
|
const newMember = covertmember[0];
|
||||||
},
|
this.memberList.push(newMember);
|
||||||
setMemberId({newRole, oldRole}) {
|
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度', '上级部门', '电力调度'];
|
||||||
this.$emit('changeTreeData', {newRole:newRole, oldRole:oldRole});
|
const index = deviceTypeList.indexOf(newMember.type);
|
||||||
const quickChangeMember = this.quickChangeMember.list;
|
if (index >= 0) {
|
||||||
quickChangeMember.forEach((mem, index)=>{
|
const treeDataIn = this.treeData[index];
|
||||||
if (oldRole.id && mem.id == oldRole.id) {
|
treeDataIn.children.push(newMember);
|
||||||
delete mem.userId;
|
this.treeData[index] = treeDataIn;
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addMember() {
|
addMember() {
|
||||||
@ -251,9 +310,6 @@ export default {
|
|||||||
each.label = each.normalName;
|
each.label = each.normalName;
|
||||||
});
|
});
|
||||||
return lastData;
|
return lastData;
|
||||||
},
|
|
||||||
setAction() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
pauseScript() {
|
pauseScript() {
|
||||||
simulationPause(this.group).then(resp => {
|
simulationPause(this.group).then(resp => {
|
||||||
@ -325,7 +381,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
dumpScenesData() {
|
dumpScenesData() {
|
||||||
this.clearAutoSave();
|
// this.clearAutoSave();
|
||||||
const group = this.group;
|
const group = this.group;
|
||||||
this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), {
|
this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), {
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
@ -335,7 +391,6 @@ 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.$store.dispatch('training/updateMemberListInScript',
|
this.$store.dispatch('training/updateMemberListInScript',
|
||||||
{
|
{
|
||||||
oldMemberId:this.memberId,
|
oldMemberId:this.memberId,
|
||||||
@ -350,31 +405,108 @@ export default {
|
|||||||
new_member.userId = this.$store.state.user.id;
|
new_member.userId = this.$store.state.user.id;
|
||||||
new_member.disabled = true;
|
new_member.disabled = true;
|
||||||
this.quickChangeMember.list = [new_member];
|
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.$emit('resetChat');
|
||||||
}
|
}
|
||||||
// this.initAutoSaveScript();
|
|
||||||
this.$store.dispatch('training/setPrdType', '02');
|
this.$store.dispatch('training/setPrdType', '02');
|
||||||
this.$store.dispatch('map/resetActiveTrainList');
|
this.$store.dispatch('map/resetActiveTrainList');
|
||||||
this.$store.dispatch('scriptRecord/updateRole', new_member.type + ':' + this.orignalUserRoleId);
|
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.orignalUserRoleId;
|
// this.memberId = this.orignalUserRoleId;
|
||||||
|
this.oldMember = {id:this.orignalUserRoleId, type:new_member.type};
|
||||||
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'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
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;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user