仿真调整

This commit is contained in:
joylink_fanyuhong 2020-02-25 10:36:18 +08:00
parent 03843cf217
commit 3197641b97
6 changed files with 21 additions and 19 deletions

View File

@ -25,7 +25,7 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import {toTimeStamp, formatDuring} from '@/utils/date';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
@ -350,7 +350,8 @@ export default {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = 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;

View File

@ -27,6 +27,7 @@ import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
import {toTimeStamp, formatDuring} from '@/utils/date';
export default {
name: 'PlanSchedule',
@ -360,7 +361,8 @@ export default {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = 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;

View File

@ -25,7 +25,7 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import {toTimeStamp, formatDuring} from '@/utils/date';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
@ -360,10 +360,10 @@ export default {
return new Promise((resolve, reject) => {
try {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = 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;

View File

@ -25,7 +25,7 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import {toTimeStamp, formatDuring} from '@/utils/date';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
@ -350,7 +350,8 @@ export default {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
startValue = this.$store.state.training.initTime - this.PlanConvert.TranslationTime;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = 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;

View File

@ -2,7 +2,7 @@ import store from '@/store';
import { Notification } from 'element-ui';
function handle(state, data) {
console.log(data, 'socket订阅');
// console.log(data, 'socket订阅');
const msg = data.body;
const path = window.location.href;
switch (data.type) {

View File

@ -39,9 +39,9 @@ export function timeFormat(usedTime) {
export function toTimeStamp(time) {
let s = 0;
let hour = time.split(':')[0];
let min = time.split(':')[1];
let sec = time.split(':')[2];
const hour = time.split(':')[0];
const min = time.split(':')[1];
const sec = time.split(':')[2];
s = Number(hour * 3600) + Number(min * 60) + Number(sec);
return s;
}
@ -49,13 +49,11 @@ export function toTimeStamp(time) {
// 时间戳的只转为时分秒
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;
const now = new Date(mss);
const hour = now.getHours(); // 返回日期中的小时数0到23
const minute = now.getMinutes(); // 返回日期中的分钟数0到59
const second = now.getSeconds(); // 返回日期中的秒数0到59
return hour + ':' + minute + ':' + second;
}
export function prefixIntrger(num, length) {