2019-12-30 09:00:16 +08:00
|
|
|
<template>
|
2020-05-25 10:32:14 +08:00
|
|
|
<div v-if="isShowSystemTime" class="display-card" :style="{top: top+'px', right: newRight+'px'}">
|
2019-12-30 09:00:16 +08:00
|
|
|
<template v-if="pause">
|
|
|
|
<span class="display-pause">{{ $t('display.systemTime.timePause') }}</span>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<system-time
|
|
|
|
class="display-time"
|
|
|
|
:time="time"
|
|
|
|
/>
|
2020-05-25 10:32:14 +08:00
|
|
|
<div v-if="isShowDate" style="width: 80px;height: 58px;float: right;box-shadow: 0 0 5px #eee;">
|
|
|
|
<div class="display-date-box">{{ dateString }}</div>
|
|
|
|
<div class="display-date-box">{{ dayString }}</div>
|
|
|
|
</div>
|
2019-12-30 09:00:16 +08:00
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { prefixIntrger } from '@/utils/date';
|
|
|
|
import SystemTime from '@/views/components/systemTime/index';
|
|
|
|
|
|
|
|
// 顶部时间栏显示
|
|
|
|
export default {
|
|
|
|
name: 'MenuSystemTime',
|
|
|
|
components: {
|
|
|
|
SystemTime
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
right: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2020-05-22 20:32:19 +08:00
|
|
|
time: '00:0000',
|
2020-05-25 10:32:14 +08:00
|
|
|
dateString: '00/00/00',
|
|
|
|
dayString: ''
|
2019-12-30 09:00:16 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isShowSystemTime() {
|
|
|
|
return this.$route.params.mode == 'demon' ||
|
|
|
|
this.$route.params.mode == 'dp' ||
|
|
|
|
this.$route.params.mode == 'plan' ||
|
2020-05-27 14:45:32 +08:00
|
|
|
this.$route.params.mode == 'script' ||
|
|
|
|
this.$route.params.mode == 'practice' ||
|
2019-12-30 09:00:16 +08:00
|
|
|
!this.$route.params.mode;
|
|
|
|
},
|
|
|
|
pause() {
|
|
|
|
return this.$store.state.scriptRecord.simulationPause;
|
2020-05-25 10:32:14 +08:00
|
|
|
},
|
|
|
|
isShowDate() {
|
|
|
|
return (this.$route.query.lineCode == 10 || this.$route.query.lineCode == 11) && this.$route.path.includes('displayNew');
|
|
|
|
},
|
|
|
|
top() {
|
|
|
|
return (this.$route.query.lineCode == 10 || this.$route.query.lineCode == 11) && this.$route.path.includes('displayNew') ? 35 : this.offset;
|
|
|
|
},
|
|
|
|
newRight() {
|
|
|
|
return (this.$route.query.lineCode == 10 || this.$route.query.lineCode == 11) && this.$route.path.includes('displayNew') ? this.$store.state.config.width - 340 - 80 : this.right;
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.training.initTime': function (initTime) {
|
|
|
|
const date = new Date(initTime);
|
2020-05-25 10:32:14 +08:00
|
|
|
this.initDate(date);
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
2020-05-18 11:04:39 +08:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
const initTime = this.$store.state.training.initTime;
|
|
|
|
if (initTime > 0) {
|
|
|
|
const date = new Date(initTime);
|
2020-05-25 10:32:14 +08:00
|
|
|
this.initDate(date);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
initDate(date) {
|
2020-05-18 11:04:39 +08:00
|
|
|
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
|
2020-05-25 10:32:14 +08:00
|
|
|
const years = date.getFullYear() + '';
|
|
|
|
let months = date.getMonth() + 1 + '';
|
|
|
|
let dates = date.getDate() + '';
|
|
|
|
if (months.length < 2) { months = '0' + months; }
|
|
|
|
if (dates.length < 2) { dates = '0' + dates; }
|
|
|
|
this.dateString = dates + '/' + months + '/' + years.slice(2);
|
|
|
|
const day = date.getDay();
|
|
|
|
switch (day) {
|
|
|
|
case 0:
|
|
|
|
this.dayString = '星 期 一';
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
this.dayString = '星 期 二';
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
this.dayString = '星 期 三';
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
this.dayString = '星 期 四';
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
this.dayString = '星 期 五';
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
this.dayString = '星 期 六';
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
this.dayString = '星 期 日';
|
|
|
|
}
|
2020-05-18 11:04:39 +08:00
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
.display-card {
|
|
|
|
z-index: 9;
|
|
|
|
display: inline;
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
|
|
|
|
.display-pause {
|
|
|
|
font-size: 21px;
|
|
|
|
font-weight: bold;
|
|
|
|
color: yellow;
|
|
|
|
}
|
|
|
|
|
|
|
|
.display-time{
|
|
|
|
padding: 3px 5px;
|
|
|
|
box-shadow: 0px 0px 5px #eee;
|
|
|
|
border-radius: 3px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.display-card .el-row {
|
|
|
|
line-height: 32px !important;
|
|
|
|
}
|
2020-05-25 10:32:14 +08:00
|
|
|
.display-date-box{
|
|
|
|
height: 29px;
|
|
|
|
line-height: 29px;
|
|
|
|
background: #404040;
|
|
|
|
color: #1DEA1E;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
|
|
|
|
</style>
|