修改刷新问题

This commit is contained in:
ival 2019-11-12 17:27:30 +08:00
parent ff6c1c67c4
commit 8eb4ac80a6
14 changed files with 1810 additions and 1827 deletions

View File

@ -1,5 +1,8 @@
module.exports = {
presets: [
'@vue/app'
]
}
presets: [
'@vue/app'
],
// plugins: [
// '@babel/plugin-syntax-dynamic-import'
// ]
};

View File

@ -31,7 +31,6 @@ export default {
},
mounted() {
this.prohibitSystemContextMenu();
this.subscribe();
const project = window.sessionStorage.getItem('project');
document.querySelector("link[rel*='icon']").href = ProjectIcon[project];
@ -50,10 +49,12 @@ export default {
await this.pageDestory();
}
});
this.subscribe();
},
methods: {
async pageDestory() {
this.unSubscribe();
this.clearSubscribe();
const token = handleToken();
Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken');
@ -69,24 +70,25 @@ export default {
return false;
};
},
subscribe() {
this.$nextTick(() => {
if (!this.$route.path.includes('/login') && this.$route.path != '/404') {
const header = { group: '', 'X-Token': handleToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
},
unSubscribe() {
clearSubscribe(perpetualTopic);
clearSubscribe(commonTopic);
},
subscribeMessage(res) {
if (this.$refs.deomonTopic) {
this.$refs.deomonTopic.doShow(res);
this.$store.dispatch('socket/setRoomInvite');
}
},
subscribe() {
this.$nextTick(() => {
const token = handleToken();
if (token && this.$route.path != '/404') {
const header = { group: '', 'X-Token': token };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
},
clearSubscribe() {
clearSubscribe(perpetualTopic);
clearSubscribe(commonTopic);
}
}
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,17 +34,17 @@ Vue.use(VueI18n);
Vue.config.productionTip = false;
export const i18n = new VueI18n({
locale: LangStorage.getLang('zh'),
messages
locale: LangStorage.getLang('zh'),
messages
});
ElementLocale.i18n((key, value) => i18n.t(key, value));
new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
el: '#app',
router,
store,
i18n,
render: h => h(App)
});

View File

@ -104,6 +104,7 @@ function handleRoute(to, from, next, routeInfo) {
router.beforeEach((to, from, next) => {
NProgress.start();
const routeInfo = getRouteInfo(to);
if (routeInfo.getTokenInfo()) {
// 已登录

View File

@ -74,7 +74,6 @@ const user = {
setDesignToken(token);
commit('SET_TOKENDESIGN', token);
const header = { group: '', 'X-Token': getDesignToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
};
} else {

View File

@ -3,305 +3,305 @@ import { timeFormat } from '@/utils/date';
/** 创建一个车次数据点*/
export function createMartPoint(opt) {
const rotate = opt.directionCode === '2' ? 45 : (opt.directionCode === '1' ? -45 : 0);
const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft';
return {
coord: opt.coord,
name: opt.name,
label: {
normal: {
rotate: rotate,
formatter: '{b}',
backgroundColor: 'rgb(242,242,242,0.1)',
color: 'black',
position: position
}
}
};
const rotate = opt.directionCode === '2' ? 45 : (opt.directionCode === '1' ? -45 : 0);
const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft';
return {
coord: opt.coord,
name: opt.name,
label: {
normal: {
rotate: rotate,
formatter: '{b}',
backgroundColor: 'rgb(242,242,242,0.1)',
color: 'black',
position: position
}
}
};
}
/** 创建一个车次数据序列*/
export function createSeriesModel(opt, lineStyle) {
if (opt) {
return {
z: opt.z || 5,
zlevel: opt.zlevel || 0,
type: 'line',
name: opt.name,
data: opt.data,
sampling: 'average',
lineStyle: lineStyle || {},
markPoint: {
symbol: 'roundRect',
symbolSize: 1,
data: opt.markPointData
}
};
}
if (opt) {
return {
z: opt.z || 5,
zlevel: opt.zlevel || 0,
type: 'line',
name: opt.name,
data: opt.data,
sampling: 'average',
lineStyle: lineStyle || {},
markPoint: {
symbol: 'roundRect',
symbolSize: 1,
data: opt.markPointData
}
};
}
}
/** 创建标记横线*/
export function createMarkLineModels(stations, computedYaxis) {
const markLineModel = {};
if (stations && stations.length) {
markLineModel.type = 'line';
markLineModel.name = 'markline';
markLineModel.markLine = {};
markLineModel.markLine.silent = true;
markLineModel.markLine.data = [];
markLineModel.markLine.lineStyle = { color: '#B0C4DE', width: 0.5 };
markLineModel.markLine.symbol = 'none';
stations.forEach((elem, index) => {
markLineModel.markLine.data.push(
{
label: {
show: true,
position: 'start',
formatter: elem.name,
color: 'black'
},
lineStyle: {
type: 'solid',
width: 0.5,
opacity: 0.5
},
yAxis: computedYaxis(elem, index)
}
);
});
}
return markLineModel;
const markLineModel = {};
if (stations && stations.length) {
markLineModel.type = 'line';
markLineModel.name = 'markline';
markLineModel.markLine = {};
markLineModel.markLine.silent = true;
markLineModel.markLine.data = [];
markLineModel.markLine.lineStyle = { color: '#B0C4DE', width: 0.5 };
markLineModel.markLine.symbol = 'none';
stations.forEach((elem, index) => {
markLineModel.markLine.data.push(
{
label: {
show: true,
position: 'start',
formatter: elem.name,
color: 'black'
},
lineStyle: {
type: 'solid',
width: 0.5,
opacity: 0.5
},
yAxis: computedYaxis(elem, index)
}
);
});
}
return markLineModel;
}
/** 创建不会重复颜色的内部对象*/
export const hexColor = {
colorIndex: 0,
difValue: 0.25, // 一般为0.25
oddColor: null,
eveColor: null,
oldColor: null,
newColor: null,
colorList: [
'#000000', '#0000FF', '#8A2BE2', '#A52A2A', '#DEB887', '#5F9EA0', '#7FFF00', '#FF7F50', '#6495ED', '#DC143C',
'#00FFFF', '#008B8B', '#B8860B', '#BDB76B', '#8B008B', '#FF8C00', '#9932CC', '#8FBC8F', '#FF1493', '#00BFFF',
'#FF00FF', '#FFD700', '#FF69B4', '#FF4500', '#DB7093', '#4169E1', '#6A5ACD', '#00FF7F', '#EE82EE', '#40E0D0'
],
colors: [
'#B9C671', '#6C9040', '#79C671', '#71A5C6', '#C6A071', '#71C689', '#'
],
randomHsl: function () {
const h = Math.random();
const s = Math.random();
const l = Math.random();
return [h, s, l];
},
hslToRgb: function (h, s, l) {
let r, g, b;
colorIndex: 0,
difValue: 0.25, // 一般为0.25
oddColor: null,
eveColor: null,
oldColor: null,
newColor: null,
colorList: [
'#000000', '#0000FF', '#8A2BE2', '#A52A2A', '#DEB887', '#5F9EA0', '#7FFF00', '#FF7F50', '#6495ED', '#DC143C',
'#00FFFF', '#008B8B', '#B8860B', '#BDB76B', '#8B008B', '#FF8C00', '#9932CC', '#8FBC8F', '#FF1493', '#00BFFF',
'#FF00FF', '#FFD700', '#FF69B4', '#FF4500', '#DB7093', '#4169E1', '#6A5ACD', '#00FF7F', '#EE82EE', '#40E0D0'
],
colors: [
'#B9C671', '#6C9040', '#79C671', '#71A5C6', '#C6A071', '#71C689', '#'
],
randomHsl: function () {
const h = Math.random();
const s = Math.random();
const l = Math.random();
return [h, s, l];
},
hslToRgb: function (h, s, l) {
let r, g, b;
if (s === 0) {
r = g = b = l; // achromatic
} else {
const hue2rgb = function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
};
if (s === 0) {
r = g = b = l; // achromatic
} else {
const hue2rgb = function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
};
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
}
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
},
rgbToHsl: function (r, g, b) {
// eslint-disable-next-line no-sequences
r /= 255, g /= 255, b /= 255;
const max = Math.max(r, g, b); const min = Math.min(r, g, b);
let h; let s; const l = (max + min) / 2;
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
},
rgbToHsl: function (r, g, b) {
// eslint-disable-next-line no-sequences
r /= 255, g /= 255, b /= 255;
const max = Math.max(r, g, b); const min = Math.min(r, g, b);
let h; let s; const l = (max + min) / 2;
if (max === min) {
h = s = 0; // achromatic
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
if (max === min) {
h = s = 0; // achromatic
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, l];
},
// 固定颜色
colorFixed() {
var color = this.colorList[this.colorIndex++ % this.colorList.length];
return color;
},
// 随机颜色
colorRandom() {
return '#' + (Math.random() * 0xffffff << 0).toString(16);
},
// 生成和前一个不同的随机颜色
colorContrast() {
this.newColor = this.randomHsl(); // 获取随机的hsl,并且给一个默认的hsl
this.newColor[1] = 0.7 + this.newColor[1] * 0.2; // [0.7 - 0.9] 排除过灰颜色
this.newColor[2] = 0.4 + this.newColor[2] * 0.2; // [0.4 - 0.8] 排除过亮过暗色
return [h, s, l];
},
// 固定颜色
colorFixed() {
var color = this.colorList[this.colorIndex++ % this.colorList.length];
return color;
},
// 随机颜色
colorRandom() {
return '#' + (Math.random() * 0xffffff << 0).toString(16);
},
// 生成和前一个不同的随机颜色
colorContrast() {
this.newColor = this.randomHsl(); // 获取随机的hsl,并且给一个默认的hsl
this.newColor[1] = 0.7 + this.newColor[1] * 0.2; // [0.7 - 0.9] 排除过灰颜色
this.newColor[2] = 0.4 + this.newColor[2] * 0.2; // [0.4 - 0.8] 排除过亮过暗色
/** 如果oldColor不为空时要根据车次号保证两次生成的颜色差值为difValue*/
this.oldColor = Number(this.colorIndex) % 2 ? this.oddColor : this.eveColor;
if (this.oldColor) {
/** 保证本次的颜色和上次的不一致*/
for (let i = 0; i < this.newColor.length && i < this.oldColor.length; i++) {
if (i === 0 && Math.abs(this.newColor[i].toFixed(2) - this.oldColor[i].toFixed(2)) < this.difValue) {
this.colorRandom();
break;
}
}
}
/** 如果oldColor不为空时要根据车次号保证两次生成的颜色差值为difValue*/
this.oldColor = Number(this.colorIndex) % 2 ? this.oddColor : this.eveColor;
if (this.oldColor) {
/** 保证本次的颜色和上次的不一致*/
for (let i = 0; i < this.newColor.length && i < this.oldColor.length; i++) {
if (i === 0 && Math.abs(this.newColor[i].toFixed(2) - this.oldColor[i].toFixed(2)) < this.difValue) {
this.colorRandom();
break;
}
}
}
/** 保存之前的颜色状态*/
if (Number(this.colorIndex) % 2) {
this.oddColor = this.newColor;
} else {
this.eveColor = this.newColor;
}
/** 保存之前的颜色状态*/
if (Number(this.colorIndex) % 2) {
this.oddColor = this.newColor;
} else {
this.eveColor = this.newColor;
}
this.colorIndex += 1;
return `#${this.hslToRgb(...this.newColor).map(e => { return Number(e).toString(16); }).join('')}`;
},
// 渐进颜色
colorProgressiveColor() {
},
toCreate: function () {
return this.colorRandom();
}
this.colorIndex += 1;
return `#${this.hslToRgb(...this.newColor).map(e => { return Number(e).toString(16); }).join('')}`;
},
// 渐进颜色
colorProgressiveColor() {
},
toCreate: function () {
return this.colorRandom();
}
};
/** 对list数据进行排序, 相同元素保持原有顺序*/
export function sortListByCallBack(list, callback) {
list.map((elem, index) => { elem[`oldIndex`] = index; });
list.sort((a, b) => {
return callback(a, b) || a.oldIndex - b.oldIndex;
});
return list;
list.map((elem, index) => { elem[`oldIndex`] = index; });
list.sort((a, b) => {
return callback(a, b) || a.oldIndex - b.oldIndex;
});
return list;
}
/** 将数字转换成asc码*/
export function numToAsc(num) {
const nmA = 'A'.charCodeAt(0);
const nmZ = 'Z'.charCodeAt(0);
const len = nmZ - nmA + 1;
let str = '';
const nmA = 'A'.charCodeAt(0);
const nmZ = 'Z'.charCodeAt(0);
const len = nmZ - nmA + 1;
let str = '';
while (num >= 0) {
str = String.fromCharCode(num % len + nmA) + str;
num = Math.floor(num / len) - 1;
}
while (num >= 0) {
str = String.fromCharCode(num % len + nmA) + str;
num = Math.floor(num / len) - 1;
}
return str;
return str;
}
/** 将asc码转换成数字*/
export function ascToNum(asc) {
const base = 'A'.charCodeAt() - 1;
let idx = asc.length - 1;
let num = 0;
let mulFactor = 1;
while (idx >= 0) {
num += (asc[idx].charCodeAt() - base) * mulFactor;
mulFactor *= 26;
idx -= 1;
}
const base = 'A'.charCodeAt() - 1;
let idx = asc.length - 1;
let num = 0;
let mulFactor = 1;
while (idx >= 0) {
num += (asc[idx].charCodeAt() - base) * mulFactor;
mulFactor *= 26;
idx -= 1;
}
return num;
return num;
}
/** 根据索引获取单元格的数据*/
export function getCellValue(Sheet, index) {
let value;
const cell = Sheet[index];
if (cell) {
value = cell.w || cell.v;
}
let value;
const cell = Sheet[index];
if (cell) {
value = cell.w || cell.v;
}
return value;
return value;
}
/** 转换sheet数据为json数据*/
export function convertSheetToList(Sheet, isReverse) {
const dataList = [];
const dataList = [];
if (Sheet) {
const refarea = Sheet['!ref'];
const regular = /([a-zA-Z]+)([0-9]+):([a-zA-Z]+)([0-9]+)/i;
if (Sheet) {
const refarea = Sheet['!ref'];
const regular = /([a-zA-Z]+)([0-9]+):([a-zA-Z]+)([0-9]+)/i;
if (refarea == null) return []; // "A1:M698"
if (regular.test(refarea)) {
/** 正则转换解析行列数据*/
const CoordList = regular.exec(refarea);
/** 转换数据为二维数组*/
const colBeg = ascToNum(CoordList[1]);
const colEnd = ascToNum(CoordList[3]);
const rowBeg = Number(CoordList[2]);
const rowEnd = Number(CoordList[4]);
if (refarea == null) return []; // "A1:M698"
if (regular.test(refarea)) {
/** 正则转换解析行列数据*/
const CoordList = regular.exec(refarea);
/** 转换数据为二维数组*/
const colBeg = ascToNum(CoordList[1]);
const colEnd = ascToNum(CoordList[3]);
const rowBeg = Number(CoordList[2]);
const rowEnd = Number(CoordList[4]);
if (isReverse) {
for (let i = colBeg - 1; i < colEnd; i++) {
dataList.push([]);
for (let j = rowBeg; j <= rowEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(i) + j));
}
}
} else {
for (let i = rowBeg; i <= rowEnd; i++) {
dataList.push([]);
for (let j = colBeg - 1; j < colEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(j) + i));
}
}
}
}
}
if (isReverse) {
for (let i = colBeg - 1; i < colEnd; i++) {
dataList.push([]);
for (let j = rowBeg; j <= rowEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(i) + j));
}
}
} else {
for (let i = rowBeg; i <= rowEnd; i++) {
dataList.push([]);
for (let j = colBeg - 1; j < colEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(j) + i));
}
}
}
}
}
return dataList;
return dataList;
}
/** 通过time将时间格式化*/
export function formatTime(time) {
if (Number.isInteger(time)) {
return timeFormat(time);
} else {
return '';
}
if (Number.isInteger(time)) {
return timeFormat(time);
} else {
return '';
}
}
/** 通过code将名称格式化*/
export function formatName(code) {
let name = '';
const device = store.getters['map/getDeviceByCode'](code);
if (device) {
name = device.name;
}
return name;
let name = '';
const device = store.getters['map/getDeviceByCode'](code);
if (device) {
name = device.name;
}
return name;
}
/** 将时间格式化前补零*/
export function prefixTime(time) {
let str = `${time}` || '';
if (str) {
const list = str.split(':');
str = list.map(elem => {
return `00000${elem}`.substr(-2);
}).join(':');
}
let str = `${time}` || '';
if (str) {
const list = str.split(':');
str = list.map(elem => {
return `00000${elem}`.substr(-2);
}).join(':');
}
return str;
return str;
}

View File

@ -2,12 +2,11 @@ import Vue from 'vue';
import StompClient from '@/utils/sock';
import store from '@/store';
export const perpetualTopic = '/user/topic/message'; // 公用topic
export const displayTopic = '/user/queue/simulation'; // 其他仿真topic
export const screenTopic = '/user/queue/simulation/bigScreen'; // 大屏仿真
export const planTopic = '/user/queue/simulation/plan'; // 测试运行仿真
export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
export const designDisplayTopic = '/user/queue/simulation/design'; // 设计平台仿真订阅路径
export const perpetualTopic = '/user/topic/message'; // 公用topic
export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
// 建立连接并订阅地址
export function creatSubscribe(topic, header) {
@ -15,6 +14,7 @@ export function creatSubscribe(topic, header) {
if (!Vue.prototype.$stomp) {
Vue.prototype.$stomp = new StompClient();
}
Vue.prototype.$stomp.subscribe(topic, callback, header);
} catch (error) {
console.error('websocket订阅失败');

View File

@ -177,7 +177,6 @@ export default {
},
mounted() {
getPublishMapInfo(this.$route.query.mapId).then(res=>{
// this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.lineCode);
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode);
this.loadChartPage();
});

View File

@ -70,279 +70,279 @@ import { hexColor } from '@/utils/runPlan';
import EditTable from '@/views/components/editTable/index';
export default {
name: 'AddQuest',
components: {
EditTable
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
show: false,
loading: false,
runPlanList: [],
groupNumberList: [],
formModel: {
id: '',
mode: '',
planDate: '',
runPlanName: ''
},
tableForm: {
index: true,
columns: [
{
title: this.$t('display.schedule.driverNumber'),
prop: 'driverCode',
type: 'text'
},
{
title: this.$t('display.schedule.trainNumber'),
prop: 'trainCode',
type: 'select',
width: '150',
options: () => { return this.groupNumberList; },
editable: true,
editing: true
},
{
title: this.$t('display.schedule.onlineSection'),
prop: 'onlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.onlineServerNumber'),
prop: 'onlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTargetNumber'),
prop: 'onlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTime'),
prop: 'onlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTripNumber'),
prop: 'onlineTripNumber',
type: 'text',
format: (row) => { return `${row.onlineDirectionCode}${row.onlineTripNumber}`; }
},
{
title: this.$t('display.schedule.outDepot'),
prop: 'outDepot',
type: 'text'
},
{
title: this.$t('display.schedule.outDepotStatus'),
prop: 'outStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.outStatus, 'Whether'); },
tagType: (row) => {
switch (row.outStatus) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('display.schedule.offlineSection'),
prop: 'offlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.offlineServerNumber'),
prop: 'offlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTargetNumber'),
prop: 'offlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTime'),
prop: 'offlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTripNumber'),
prop: 'offlineTripNumber',
type: 'text',
format: (row) => { return `${row.offlineDirectionCode}${row.offlineTripNumber}`; }
},
{
title: this.$t('display.schedule.inDepot'),
prop: 'inDepot',
type: 'text'
},
{
title: this.$t('display.schedule.inDepotStatus'),
prop: 'inStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.inStatus, 'Whether'); },
tagType: (row) => {
switch (row.inStatus) {
case true: return 'success';
case false: return 'danger';
}
}
}
]
},
tableData: []
};
},
computed: {
title() {
return this.$t('display.schedule.schedulePlan');
}
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.formModel.day = '';
this.show = true;
},
doClose() {
this.show = false;
},
loadInitData() {
this.groupNumberList = [];
getSchedulingAllTrains(this.group).then(resp => {
this.groupNumberList = resp.data.map(elem => { return {value: elem.code, label: elem.groupNumber}; });
});
},
handleQuery(day) {
if (day) {
this.loading = true;
querySecheduling(this.group, {day}).then(resp => {
if (!resp.data) {
this.$confirm(this.$t('display.schedule.noSchedulePlan'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
this.handleGenerate(day);
}).catch(() => {
this.clearData();
this.loading = false;
});
} else {
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(`${this.$t('display.schedule.loadData')} ${day} ${this.$t('display.schedule.schedulePlanSuccess')}`);
this.loading = false;
}
}).catch(error => {
this.clearData();
if (error.code == 30002) {
this.handleReGenerate(day);
} else {
this.$messageBox(`${error.message}`);
this.loading = false;
}
});
}
},
handleGenerate(day) {
generateScheduling(this.group, {day}).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.createSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleReGenerate(day) {
generateSchedulingAgain(this.group).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.regenerateSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleCheck() {
if (this.formModel.planDate) {
checkScheduling(this.group, this.tableData).then(resp => {
const data = resp.data;
this.setConflictList(data.conflictList);
if (data.pass) {
this.$message.success(this.$t('display.schedule.checkPassed'));
} else {
this.$message.warning(this.$t('display.schedule.checkFailed'));
}
}).catch(error => {
this.$messageBox(`${this.$t('display.schedule.checkSchedulePlanFailed')}: ${error.message}`);
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
},
handleSave() {
if (this.formModel.planDate) {
saveScheduling(this.group, this.tableData).then(resp => {
this.$message.success(this.$t('display.schedule.saveSchedulePlanSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.schedule.saveSchedulePlanFail'));
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
name: 'AddQuest',
components: {
EditTable
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
show: false,
loading: false,
runPlanList: [],
groupNumberList: [],
formModel: {
id: '',
mode: '',
planDate: '',
runPlanName: ''
},
tableForm: {
index: true,
columns: [
{
title: this.$t('display.schedule.driverNumber'),
prop: 'driverCode',
type: 'text'
},
{
title: this.$t('display.schedule.trainNumber'),
prop: 'trainCode',
type: 'select',
width: '150',
options: () => { return this.groupNumberList; },
editable: true,
editing: true
},
{
title: this.$t('display.schedule.onlineSection'),
prop: 'onlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.onlineServerNumber'),
prop: 'onlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTargetNumber'),
prop: 'onlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTime'),
prop: 'onlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTripNumber'),
prop: 'onlineTripNumber',
type: 'text',
format: (row) => { return `${row.onlineDirectionCode}${row.onlineTripNumber}`; }
},
{
title: this.$t('display.schedule.outDepot'),
prop: 'outDepot',
type: 'text'
},
{
title: this.$t('display.schedule.outDepotStatus'),
prop: 'outStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.outStatus, 'Whether'); },
tagType: (row) => {
switch (row.outStatus) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('display.schedule.offlineSection'),
prop: 'offlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.offlineServerNumber'),
prop: 'offlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTargetNumber'),
prop: 'offlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTime'),
prop: 'offlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTripNumber'),
prop: 'offlineTripNumber',
type: 'text',
format: (row) => { return `${row.offlineDirectionCode}${row.offlineTripNumber}`; }
},
{
title: this.$t('display.schedule.inDepot'),
prop: 'inDepot',
type: 'text'
},
{
title: this.$t('display.schedule.inDepotStatus'),
prop: 'inStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.inStatus, 'Whether'); },
tagType: (row) => {
switch (row.inStatus) {
case true: return 'success';
case false: return 'danger';
}
}
}
]
},
tableData: []
};
},
computed: {
title() {
return this.$t('display.schedule.schedulePlan');
}
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.formModel.day = '';
this.show = true;
},
doClose() {
this.show = false;
},
loadInitData() {
this.groupNumberList = [];
getSchedulingAllTrains(this.group).then(resp => {
this.groupNumberList = resp.data.map(elem => { return {value: elem.code, label: elem.groupNumber}; });
});
},
handleQuery(day) {
if (day) {
this.loading = true;
querySecheduling(this.group, {day}).then(resp => {
if (!resp.data) {
this.$confirm(this.$t('display.schedule.noSchedulePlan'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
this.handleGenerate(day);
}).catch(() => {
this.clearData();
this.loading = false;
});
} else {
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(`${this.$t('display.schedule.loadData')} ${day} ${this.$t('display.schedule.schedulePlanSuccess')}`);
this.loading = false;
}
}).catch(error => {
this.clearData();
if (error.code == 30002) {
this.handleReGenerate(day);
} else {
this.$messageBox(`${error.message}`);
this.loading = false;
}
});
}
},
handleGenerate(day) {
generateScheduling(this.group, {day}).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.createSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleReGenerate(day) {
generateSchedulingAgain(this.group).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.regenerateSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleCheck() {
if (this.formModel.planDate) {
checkScheduling(this.group, this.tableData).then(resp => {
const data = resp.data;
this.setConflictList(data.conflictList);
if (data.pass) {
this.$message.success(this.$t('display.schedule.checkPassed'));
} else {
this.$message.warning(this.$t('display.schedule.checkFailed'));
}
}).catch(error => {
this.$messageBox(`${this.$t('display.schedule.checkSchedulePlanFailed')}: ${error.message}`);
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
},
handleSave() {
if (this.formModel.planDate) {
saveScheduling(this.group, this.tableData).then(resp => {
this.$message.success(this.$t('display.schedule.saveSchedulePlanSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.schedule.saveSchedulePlanFail'));
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
},
handleRowStyle({rowIndex}) {
const row = this.tableData[rowIndex];
return row['$conflict']? `background: ${row['$conflict']}`: `background: #fff`;
},
setConflictList(list) {
this.tableData.forEach(elem => { elem['$conflict'] = null; });
if (list && list.length) {
list.forEach(idList => {
const color = hexColor.colorRandom();
this.tableData.forEach(elem => {
if (idList.includes(parseInt(elem.id))) {
elem['$conflict'] = color;
}
});
});
}
this.tableData = [...this.tableData];
},
initTableData(tableData) {
tableData.forEach(elem => {
elem['$conflict'] = null;
});
},
handleRowStyle({rowIndex}) {
const row = this.tableData[rowIndex];
return row['$conflict'] ? `background: ${row['$conflict']}` : `background: #fff`;
},
setConflictList(list) {
this.tableData.forEach(elem => { elem['$conflict'] = null; });
if (list && list.length) {
list.forEach(idList => {
const color = hexColor.colorRandom();
this.tableData.forEach(elem => {
if (idList.includes(parseInt(elem.id))) {
elem['$conflict'] = color;
}
});
});
}
this.tableData = [...this.tableData];
},
initTableData(tableData) {
tableData.forEach(elem => {
elem['$conflict'] = null;
});
return tableData;
},
clearData() {
this.formModel.planDate = '';
this.tableData = [];
}
}
return tableData;
},
clearData() {
this.formModel.planDate = '';
this.tableData = [];
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">

View File

@ -7,7 +7,7 @@
</div>
<div class="display-draft">
<el-button-group>
<el-button v-if="isShowScheduling" type="primary" @click="jumpScheduling">{{ $t('display.demon.dispatchingPlan') }}</el-button>
<el-button v-if="isShowScheduling" type="primary" @click="">{{ $t('display.demon.dispatchingPlan') }}</el-button>
<el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
<template v-if="isShowQuest">
<!-- && !isDesignPlatform -->

View File

@ -7,7 +7,7 @@
<script>
import MapCommon from './common/index';
import { handleToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic, screenTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, displayTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
import { sendCommand } from '@/api/jmap/training';
import { getSessionStorage } from '@/utils/auth';
@ -106,9 +106,7 @@ export default {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': handleToken() };
if (this.mode === 'dp') {
creatSubscribe(screenTopic, header);
} else if (this.mode === 'plan') {
if (this.mode === 'plan') {
creatSubscribe(planTopic, header);
} else {
creatSubscribe(this.isDesignPlatform ? designDisplayTopic : displayTopic, header);
@ -117,9 +115,7 @@ export default {
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
if (this.mode === 'dp') {
clearSubscribe(screenTopic);
} else if (this.mode === 'plan') {
if (this.mode === 'plan') {
clearSubscribe(planTopic);
} else {
clearSubscribe(this.isDesignPlatform ? designDisplayTopic : displayTopic);

View File

@ -59,8 +59,6 @@ export default {
}[this.roleType];
}
},
mounted() {
},
methods: {
doShow(roleType) {
this.roleType = roleType;
@ -71,7 +69,7 @@ export default {
},
commit() {
const userList = this.personList.filter(e => { return e.select; }).map(e=> { return e.node; });
this.$emit('dispatch', {roleType: this.roleType, userList: userList});
this.$emit('dispatch', {roleType: this.roleType, userList});
this.visible = false;
},
cancel() {