You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
5.8 KiB

2 years ago
<template>
<div id="big-screen" ref="appRef">
<topBackground></topBackground>
2 years ago
<Title @show-done="$refs['done'].show()"></Title>
<toDo ref="toDo"
@step-click="stepClick"
@callback="e => {
$refs['callback'].setId(e.id)
$refs['callback'].setType('add')
$refs['callback'].show()
}"></toDo>
<doing ref="doing"
@step-click="stepClick"
@callback="e => {
$refs['callback'].setId(e.id)
$refs['callback'].setType('add')
$refs['callback'].show()
}"></doing>
<done ref="done" @step-click="stepClick"></done>
<detailTransfer ref="detailTransfer"
@start="start"
@pause="pause"
@refresh="getTransfer(true)"></detailTransfer>
<callback ref="callback"></callback>
2 years ago
</div>
</template>
<script>
2 years ago
import callback from "@/views/bigScreen1/component/callback.vue";
2 years ago
import topBackground from "@/views/bigScreen1/component/topBackground.vue";
import Title from "@/views/bigScreen1/component/title.vue";
import toDo from "@/views/bigScreen1/component/toDo.vue";
import doing from "@/views/bigScreen1/component/doing.vue";
2 years ago
import done from "@/views/bigScreen1/component/done.vue";
import detailTransfer from "@/views/bigScreen1/component/detailTransfer.vue";
2 years ago
import { index } from "@/api/system/baseForm";
import { refreshTransferTime } from "@/settings";
export default {
components: {
2 years ago
callback,
2 years ago
topBackground,
Title,
toDo,
2 years ago
doing,
done,
detailTransfer
2 years ago
},
provide() {
return {
transfers: (status="toDo") => {
switch (status) {
case "toDo":
return this.transfers1;
case "doing":
return this.transfers2;
case "done":
return this.transfers3;
default:
return [];
}
},
nowTime: () => this.time,
}
},
data() {
return {
forwardRefreshTime: '',
transfers1: [],
transfers2: [],
transfers3: [],
time: this.$moment(),
timer: null,
transferTimer: null,
}
},
methods: {
2 years ago
start () {
this.$refs['toDo'].isPaused = false;
this.$refs['doing'].isPaused = false;
console.log('start',this.$refs['toDo'].isPaused)
},
pause () {
this.$refs['toDo'].isPaused = true;
this.$refs['doing'].isPaused = true;
console.log('pause',this.$refs['toDo'].isPaused)
},
stepClick ({ data, isDetail }) {
this.$refs['detailTransfer'].setData(data);
this.$refs['detailTransfer'].readonly = isDetail;
this.$refs['detailTransfer'].show();
},
2 years ago
startTime () {
this.timer = setInterval(() => {
this.time = this.$moment()
},1000)
},
setRem () {
const baseSize = 15;
const scale = document.documentElement.clientWidth / 1920;
document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + "px";
window.requestAnimationFrame(this.setRem)
},
async getTransfer(isFirst = false) {
if (isFirst) {
this.forwardRefreshTime = this.$moment();
2 years ago
let transfers1 = [];
let transfers2 = [];
let transfers3 = [];
2 years ago
const res = (
await index({
table_name: "transfers",
page: 1,
page_size: 9999,
2 years ago
sort_name: "start_time",
sort_type: "asc",
2 years ago
filter: [
{
key: 'start_time',
op: 'range',
value: `${this.$moment().startOf('days').format('YYYY-MM-DD HH:mm:ss')},${this.$moment().endOf('days').format('YYYY-MM-DD HH:mm:ss')}`
},
{
key: 'status',
op: 'neq',
value: 1
}
]
},false)
).data;
res.forEach(i => {
2 years ago
if (i.status === 2 || i.status === 3 || i.status === 4) {
transfers1.push(i)
2 years ago
}
2 years ago
if (i.status === 5 || i.status === 6) {
transfers2.push(i)
2 years ago
}
2 years ago
if (i.status === 7) {
transfers3.push(i)
2 years ago
}
})
2 years ago
this.transfers1 = transfers1;
this.transfers2 = transfers2;
this.transfers3 = transfers3;
2 years ago
} else {
const res = (
(await index({
table_name: "transfers",
page: 1,
page_size: 9999,
filter: [
{
key: "created_at",
op: "range",
value: `${this.forwardRefreshTime.format('YYYY-MM-DD HH:mm:ss')},${this.$moment().format('YYYY-MM-DD HH:mm:ss')}`
},
{
key: "status",
2 years ago
op: "eq",
value: "2"
2 years ago
}
]
},false)
).data);
if (res.length > 0) {
this.transfers1.push(...res)
}
this.forwardRefreshTime = this.$moment()
}
}
},
computed: {},
created() {
this.setRem();
window.onresize = this.setRem;
this.getTransfer(true);
this.transferTimer = setInterval(() => {
this.getTransfer()
},refreshTransferTime)
},
mounted() {
this.startTime()
},
destroyed() {
window.onscroll = null;
document.documentElement.style.fontSize = "15px";
clearInterval(this.timer);
clearInterval(this.transferTimer);
}
}
</script>
<style scoped lang="scss">
#big-screen {
2 years ago
overflow: hidden;
2 years ago
width: 100vw;
height: 100vh;
z-index: 2;
position: relative;
}
</style>
<style lang="scss">
#app:has(#big-screen) {
.app-main {
padding: 0;
}
.app-wrapper {
overflow: hidden!important;
}
.main-container {
margin: 0;
}
.sidebar-container,.fixed-header {
display: none;
}
}
</style>