gaoshp
2024-04-23 7243d05010bde40a8c82b7cbbf904eeb35168cdd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!--
 * @Date: 2024-04-09 22:11:21
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-23 21:40:53
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/processParam/index.vue
 实时看板
-->
<template>
    <el-main>
        <el-card shadow="never">
            <el-container style="height: 100%;">
                <el-aside width="300px" style="height: 100%;">
                    <el-container>
                        <el-main class="nopadding">
                            <el-row style="margin-top: 14px;">
                                工位
                            </el-row>
                            <MYTree v-model="treeChecked" @loaded="query"></MYTree>
                        </el-main>
                    </el-container>
                </el-aside>
                <el-container>
                    <el-main>
                        <el-row>
                            <el-col style='text-align: right;'>
                                <el-date-picker :max-range="3" :clearable="false" value-format="YYYY-MM-DD"
                                    style="width: 250px" v-model="time" type="daterange" range-separator="-"
                                    start-placeholder="" end-placeholder="" :disabled-date="disabledDate"
                                    @calendar-change="change" />
                            </el-col>
                        </el-row>
                        <TimeLine ref="timeLine"></TimeLine>
                    </el-main>
                </el-container>
            </el-container>
        </el-card>
    </el-main>
</template>
 
<script>
import moment from 'moment'
import TimeLine from './TimeLine.vue'
import MYTree from '../MYTree.vue'
export default {
    components: {
        TimeLine,
        MYTree
    },
    watch: {
        treeChecked() {
            this.query()
        },
        time() {
            this.query()
        }
    },
    data() {
        return {
            treeChecked: [],
            timeStart: moment().format('YYYY-MM-DD'),
            time: [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
            disabledDate: Date => {
                let max = moment(this.timeStart, 'YYYY-MM-DD').add(3, 'd').format('YYYY-MM-DD')
                let min = moment(this.timeStart, 'YYYY-MM-DD').subtract(3, 'd').format('YYYY-MM-DD')
                return !moment(Date).isBetween(min, max);
            }
        }
    },
    methods: {
        query() {
            this.$refs.timeLine.init({
                dates: this.time,
                workstationId: this.treeChecked.toString()
            })
        },
        change(e) {
            this.timeStart = e[0] || moment().format('YYYY-MM-DD')
        }
    },
}
</script>
 
<style lang="scss" scoped></style>