forked from drone/command-center-dashboard

张含笑
2025-04-08 cbec4308b61d0147cd60abfcbbb90db24c4a8e7f
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<template>
    <div class="right">
        <div>工单列表</div>
 
        <div>
            <el-date-picker
                v-model="timeArr"
                type="daterange"
                value-format="YYYY-MM-DD"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                @change="change"
                disabled
            />
            <el-select v-model="params.device_sn" placeholder="请选择" size="large" filterable clearable>
                <el-option
                    v-for="item in deviceList"
                    :label="item.nickname"
                    :value="item.device_sn"
                    :key="item.device_sn"
                />
            </el-select>
 
            <el-select
                v-model="params.word_order_type"
                placeholder="请选择"
                size="large"
                filterable
                clearable
            >
                <el-option
                    v-for="item in workOrderType"
                    :label="item.dictValue"
                    :value="item.dictKey"
                    :key="item.dictKey"
                />
            </el-select>
            <div>
                <div v-for="item in statusList">
                    <div>{{ item.name }}</div>
                    <div>{{ item.num || 0 }}</div>
                </div>
            </div>
 
            <el-checkbox-group v-model="params.SFType">
                <el-checkbox v-for="item in SFDictList" :label="item.dictValue":value="item.dictKey"  :key="item.dictKey"/>
            </el-checkbox-group>
 
        </div>
    </div>
</template>
<script setup>
import dayjs from 'dayjs'
import { selectDevicePage } from '@/api/home/machineNest'
import { getMultipleDictionary } from '@/api/system/dictbiz'
import { getEventStatusNum } from '@/api/home/event'
 
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const today = dayjs().format(timeFormat)
const oneWeekAgo = dayjs().subtract(7, 'day').format(timeFormat)
const timeArr = ref([oneWeekAgo, today])
const deviceList = ref([])
 
const params = ref({
    device_sn: '',
    word_order_type: '',
    SFType:[]
})
 
const getDeviceList = async () => {
    const res = await selectDevicePage({ current: 1, size: 99999, type: 1 })
    deviceList.value = res.data?.data?.records || []
}
 
const workOrderType = ref([])
const SFDictList = ref([])
const getDictList = () => {
    getMultipleDictionary('WORK_ORDER_TYPE,SF').then(res => {
        workOrderType.value = res.data.data?.['WORK_ORDER_TYPE'] || []
        SFDictList.value = res.data.data?.['SF'] || []
    })
}
 
const statusList = ref([])
const getEventStatusNumFun = () => {
    const [start_date, end_date] = timeArr.value
    getEventStatusNum({ start_date, end_date }).then(res => {
        statusList.value = res.data?.data || []
    })
}
 
const change = value => {}
 
onMounted(() => {
    getDeviceList()
    getDictList()
    getEventStatusNumFun()
})
</script>
<style scoped lang="scss">
.right {
    position: absolute;
    right: 0;
    top: 88px;
    color: black;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 900px;
    width: 400px;
    background: white;
}
</style>