修改看板工位登陆状态弹窗弹出时间

This commit is contained in:
XingCheng3
2026-05-22 13:16:38 +08:00
parent fffe77ec31
commit f0b9e3317a
3 changed files with 15 additions and 14 deletions

View File

@@ -37,6 +37,12 @@
<script> <script>
export default { export default {
name: 'OpLoginStatusOverlay', name: 'OpLoginStatusOverlay',
props: {
currentTimeTick: {
type: Number,
default: 0
}
},
data() { data() {
return { return {
opLoginBoxShowStartTime: '', opLoginBoxShowStartTime: '',
@@ -46,9 +52,7 @@ export default {
stationRows: [], stationRows: [],
refreshTimer: null, refreshTimer: null,
configTimer: null, configTimer: null,
clockTimer: null, refreshing: false
refreshing: false,
nowTick: Date.now()
} }
}, },
computed: { computed: {
@@ -82,10 +86,10 @@ export default {
isInShowWindow() { isInShowWindow() {
const start = this.parseTimeToSeconds(this.opLoginBoxShowStartTime) const start = this.parseTimeToSeconds(this.opLoginBoxShowStartTime)
const end = this.parseTimeToSeconds(this.opLoginBoxShowEndTime) const end = this.parseTimeToSeconds(this.opLoginBoxShowEndTime)
if (start === null || end === null) { if (start === null || end === null || !this.currentTimeTick) {
return false return false
} }
const now = new Date(this.nowTick) const now = new Date(this.currentTimeTick)
const nowSec = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds() const nowSec = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds()
if (start <= end) { if (start <= end) {
return nowSec >= start && nowSec <= end return nowSec >= start && nowSec <= end
@@ -105,9 +109,6 @@ export default {
this.configTimer = setInterval(() => { this.configTimer = setInterval(() => {
this.loadOverlayTimeWindow() this.loadOverlayTimeWindow()
}, 2 * 60 * 1000) }, 2 * 60 * 1000)
this.clockTimer = setInterval(() => {
this.nowTick = Date.now()
}, 1000)
}, },
beforeDestroy() { beforeDestroy() {
if (this.refreshTimer) { if (this.refreshTimer) {
@@ -118,10 +119,6 @@ export default {
clearInterval(this.configTimer) clearInterval(this.configTimer)
this.configTimer = null this.configTimer = null
} }
if (this.clockTimer) {
clearInterval(this.clockTimer)
this.clockTimer = null
}
}, },
methods: { methods: {
displayStationStatus(item) { displayStationStatus(item) {

View File

@@ -211,7 +211,7 @@
<div class="bottom"> <div class="bottom">
<div class="slogan">{{ slogan }}</div> <div class="slogan">{{ slogan }}</div>
</div> </div>
<OpLoginStatusOverlay /> <OpLoginStatusOverlay :current-time-tick="currentTimeTick" />
<div <div
v-if="machineStopCall.length > 0" v-if="machineStopCall.length > 0"
class="machineStop" class="machineStop"
@@ -331,6 +331,7 @@ export default {
timer2: '', timer2: '',
dbTimeBase: null, dbTimeBase: null,
dbTimeBaseTick: 0, dbTimeBaseTick: 0,
currentTimeTick: 0,
year: '', year: '',
time: '', time: '',
week: '', week: '',
@@ -635,6 +636,7 @@ export default {
const date = this.dbTimeBase const date = this.dbTimeBase
? new Date(this.dbTimeBase.getTime() + Date.now() - this.dbTimeBaseTick) ? new Date(this.dbTimeBase.getTime() + Date.now() - this.dbTimeBaseTick)
: new Date() : new Date()
this.currentTimeTick = date.getTime()
const month = this.zeroFill(date.getMonth() + 1) const month = this.zeroFill(date.getMonth() + 1)
const day = this.zeroFill(date.getDate()) const day = this.zeroFill(date.getDate())
const hour = this.zeroFill(date.getHours()) const hour = this.zeroFill(date.getHours())

View File

@@ -145,7 +145,7 @@
<div class="bottom"> <div class="bottom">
<div class="slogan">{{ slogan }}</div> <div class="slogan">{{ slogan }}</div>
</div> </div>
<OpLoginStatusOverlay /> <OpLoginStatusOverlay :current-time-tick="currentTimeTick" />
<div v-if="machineStopCall.length > 0" class="machineStop" :style="getMachineStopCallColor()"> <div v-if="machineStopCall.length > 0" class="machineStop" :style="getMachineStopCallColor()">
<!-- 只有一条数据时铺满显示字体放大 --> <!-- 只有一条数据时铺满显示字体放大 -->
<div v-if="machineStopCall.length === 1" class="machineStop-single"> <div v-if="machineStopCall.length === 1" class="machineStop-single">
@@ -242,6 +242,7 @@ export default {
timer2: '', timer2: '',
dbTimeBase: null, dbTimeBase: null,
dbTimeBaseTick: 0, dbTimeBaseTick: 0,
currentTimeTick: 0,
year: '', year: '',
time: '', time: '',
week: '', week: '',
@@ -481,6 +482,7 @@ export default {
getNowTime() { getNowTime() {
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
const date = this.dbTimeBase ? new Date(this.dbTimeBase.getTime() + Date.now() - this.dbTimeBaseTick) : new Date() const date = this.dbTimeBase ? new Date(this.dbTimeBase.getTime() + Date.now() - this.dbTimeBaseTick) : new Date()
this.currentTimeTick = date.getTime()
const month = this.zeroFill(date.getMonth() + 1) const month = this.zeroFill(date.getMonth() + 1)
const day = this.zeroFill(date.getDate()) const day = this.zeroFill(date.getDate())
const hour = this.zeroFill(date.getHours()) const hour = this.zeroFill(date.getHours())