仿真调整

This commit is contained in:
joylink_fanyuhong 2020-02-24 17:04:39 +08:00
parent 247e7e1e19
commit aa0f770630
13 changed files with 112 additions and 108 deletions

View File

@ -504,3 +504,18 @@ export function getServiceNumbersByTripNum(group, tripNumber) {
}
});
}
/** 根据计划时间获取此时间点可加载的最大列车数量 */
export function getLoadTrainNumber(params, group) {
return request({
url: `/simulation/${group}/loadTrainNumber`,
method: 'get',
params
});
}
/** 推出按计划行车 */
export function exitRunPlan (group) {
return request({
url: `/simulation/${group}/planOver`,
method: 'post'
});
}

View File

@ -348,12 +348,9 @@ export default {
return new Promise((resolve, reject) => {
try {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
@ -363,7 +360,6 @@ export default {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
});
resolve(true);
} catch (error) {
reject(error);

View File

@ -361,19 +361,16 @@ export default {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
// runDiagramGetTime(this.group).then(resp => {
// startValue = resp.data - this.PlanConvert.TranslationTime;
// this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
// this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
// this.option.series = series;
// this.myChart = echarts.init(document.getElementById(this.runPlanId));
// if (this.myChart) {
// this.myChart.setOption(this.option);
// this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
// this.myChart.on('click', this.mouseClick);
// }
// });
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
resolve(true);
} catch (error) {
reject(error);

View File

@ -25,7 +25,6 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
@ -361,19 +360,16 @@ export default {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
// runDiagramGetTime(this.group).then(resp => {
// startValue = resp.data - this.PlanConvert.TranslationTime;
// this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
// this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
// this.option.series = series;
// this.myChart = echarts.init(document.getElementById(this.runPlanId));
// if (this.myChart) {
// this.myChart.setOption(this.option);
// this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
// this.myChart.on('click', this.mouseClick);
// }
// });
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
resolve(true);
} catch (error) {
reject(error);

View File

@ -363,9 +363,7 @@ export default {
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
@ -375,7 +373,6 @@ export default {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
});
resolve(true);
} catch (error) {
reject(error);

View File

@ -348,12 +348,9 @@ export default {
return new Promise((resolve, reject) => {
try {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
@ -363,7 +360,6 @@ export default {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
});
resolve(true);
} catch (error) {
reject(error);

View File

@ -3,12 +3,12 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -35,6 +35,29 @@ export function timeFormat(usedTime) {
return getTimeStr(hour) + ':' + getTimeStr(minute) + ':' + getTimeStr(second);
}
// 时分秒转为时间戳
export function toTimeStamp(time) {
let s = 0;
let hour = time.split(':')[0];
let min = time.split(':')[1];
let sec = time.split(':')[2];
s = Number(hour * 3600) + Number(min * 60) + Number(sec);
return s;
}
// 时间戳的只转为时分秒
export function formatDuring(mss) {
let hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
let seconds = (mss % (1000 * 60)) / 1000;
hours = hours < 10 ? ('0' + hours) : hours;
minutes = minutes < 10 ? ('0' + minutes) : minutes;
seconds = seconds < 10 ? ('0' + seconds) : seconds;
return hours + ":" + minutes + ":" + seconds;
}
export function prefixIntrger(num, length) {
return (Array(length).join('0') + num).slice(-length);
}

View File

@ -23,7 +23,7 @@
<script>
import { prefixIntrger } from '@/utils/date';
import { getDesignatedTimeTrainNum } from '@/api/simulation';
import { getLoadTrainNumber } from '@/api/simulation';
//
export default {
@ -85,7 +85,7 @@ export default {
handleChange(initTime) {
this.formModel.loadNum = 0;
if (this.hasNumber) {
getDesignatedTimeTrainNum({ initTime: this.formatTime(initTime) }, this.group).then(resp => {
getLoadTrainNumber({ time: this.formatTime(initTime) }, this.group).then(resp => {
this.maxNumber = parseInt(resp.data);
});
}

View File

@ -71,6 +71,7 @@ import { getSessionStorage } from '@/utils/auth';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import { getToken } from '@/utils/auth';
import { timeFormat } from '@/utils/date';
export default {
name: 'DisplayDraft',
components: {
@ -320,6 +321,7 @@ export default {
if (resp && resp.code == 200) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(resp.data.systemTime)}`));
}
},
//

View File

@ -32,13 +32,10 @@
import SetTime from './demon/setTime';
import { Notification } from 'element-ui';
import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, runDiagramOver, clearSimulation, runDiagramGetTime } from '@/api/simulation';
import { ranAsPlan, exitRunPlan, clearSimulation } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index';
import { runDiagramIsStart, runDiagramQuit, quitScript } from '@/api/simulation';
import { mapGetters } from 'vuex';
// import { timeFormat } from '@/utils/date';
// import { getToken } from '@/utils/auth';
import { quitScript } from '@/api/simulation';
export default {
name: 'MenuDemon',
@ -82,9 +79,6 @@ export default {
};
},
computed: {
...mapGetters('map', [
'trainList'
]),
isShowQuest() {
return this.questId;
},
@ -129,7 +123,6 @@ export default {
this.$store.dispatch('training/over');
}
await this.loadSystemTime();
this.change3dname();
} catch (error) {
console.log(error);
@ -163,9 +156,11 @@ export default {
start(model) {
this.isDisable = true;
const data = {
time: model.initTime,
loadNumber:this.trainList.length
time: model.initTime
};
if (this.$route.query.prdType === '04') {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
@ -183,7 +178,7 @@ export default {
},
end() {
this.isDisable = false;
runDiagramOver(this.group).then(() => {
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
@ -224,12 +219,6 @@ export default {
this.$emit('tryTime', { time: this.tryTime, goodsId: this.goodsId });
}
},
async loadSystemTime() {
// const rest = await runDiagramGetTime(this.group);
// if (rest && rest.code == 200) {
// this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(rest.data)}`));
// }
},
change3dname() {
if (this.$route.query.prdType == '04') {
this.jl3dname = this.$t('display.demon.driverPerspective');

View File

@ -109,17 +109,17 @@ export default {
this.viewDisabled = true;
getStationList(opt.mapId).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
// getEveryDayRunPlanNew(this.group).then(resp => {
// this.$store.dispatch('runPlan/setPlanData', resp.data);
// this.viewDisabled = false;
// }).catch(error => {
// this.$store.dispatch('runPlan/setPlanData', []);
// if (error.code == 30001) {
// this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad'));
// } else {
// this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
// }
// });
getEveryDayRunPlanNew(this.group).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.viewDisabled = false;
}).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []);
if (error.code == 30001) {
this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad'));
} else {
this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
}
});
});
}).catch(() => {

View File

@ -113,7 +113,6 @@ export default {
},
'$store.state.socket.simulationStart': async function (val) {
if (val) {
await this.loadSystemTime();
this.$store.dispatch('training/simulationStart', { start: true });
}
}
@ -137,7 +136,6 @@ export default {
this.$store.dispatch('training/over');
}
await this.loadSystemTime();
} catch (error) {
console.log(error);
}
@ -157,11 +155,6 @@ export default {
}
this.activeName = active;
},
loadSystemTime() {
runDiagramGetTime(this.group).then(response => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(response.data)}`));
});
},
handleMinimality(data) {
if (data == 'min') {
this.minimize = true;