web
2 天以前 7885ad510c6246a35ba14faff7cfdbc066e269cd
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<template>
    <div class="item">
        <div class="item-t">{{props.data.name}}</div>
        <div class="item-c">
            <div class="warning-num">
                <div class="title">报警数量</div>
                <div class="num">{{props.data.warnNum}}</div>
            </div>
            <div class="warning-charts" ref="lineChartRef"></div>
            <div class="type-charts" ref="pieChartRef"></div>
            <div class="gongdan">
                <div class="title">待处理工单数量</div>
                <div class="num">{{ props.data.orderNum }}</div>
            </div>
            <div class="status">
                <div class="status-item">
                    <div class="status1">
                        <div class="title">巡检进度</div>
                        <div class="btn btn-org" v-if="props.data.xunjian.status === 0">待保养</div>
                        <div class="btn btn-parmity" v-else-if="props.data.xunjian.status === 1">进行中</div>
                        <div class="btn btn-success" v-else>已完成</div>
                    </div>
                    <div class="status2">
                        <div class="title">上次巡检时间</div>
                        <div class="time">{{props.data.xunjian.time}}</div>
                    </div>
                </div>
                <div class="status-item">
                    <div class="status1">
                        <div class="title">保养进度</div>
                        <div class="btn btn-org" v-if="props.data.baoyang.status === 0">待保养</div>
                        <div class="btn btn-parmity" v-else-if="props.data.baoyang.status === 1">进行中</div>
                        <div class="btn btn-success" v-else>已完成</div>
                    </div>
                    <div class="status2">
                        <div class="title">上次保养时间</div>
                        <div class="time">{{props.data.baoyang.time}}</div>
                    </div>
                </div>
                <div class="status-item">
                    <div class="status1">
                        <div class="title">维修进度</div>
                        <div class="btn btn-org" v-if="props.data.weixiu.status === 0">待保养</div>
                        <div class="btn btn-parmity" v-else-if="props.data.weixiu.status === 1">进行中</div>
                        <div class="btn btn-success" v-else>已完成</div>
                    </div>
                    <div class="status2">
                        <div class="title">上次维修时间</div>
                        <div class="time">{{ props.data.weixiu.time }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
 
<script setup>
import {ref, onMounted} from "vue";
import * as echarts from 'echarts/core';
import { GridComponent, TitleComponent } from 'echarts/components';
import { LineChart, PieChart } from 'echarts/charts';
import { UniversalTransition } from 'echarts/features';
import { CanvasRenderer } from 'echarts/renderers';
 
echarts.use([GridComponent, TitleComponent, LineChart, PieChart, CanvasRenderer, UniversalTransition]);
 
 
const props = defineProps({
    data: {
        type: Object,
        default: () => {}
    }
})
 
const lineChartRef = ref()
const pieChartRef = ref()
let lineCharts = null;
let pieCharts = null;
 
const initLineCharts = () => {
    if(lineChartRef.value) {
        lineCharts = echarts.init(lineChartRef.value);
        const option = {
            title: {
                text:'历史报警数量统计',
                textStyle:{
                    color: '#FFF'
                }
            },
            grid: {
                top: 40,
                bottom: 40,
                left: 40
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: props.data.historyData.xdata,
                axisLabel: {
                    color: '#fff',
                    fontSize: '0.8rem',
                    rotate: 30,
                },
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    color: '#fff',
                    fontSize: '0.8rem',
                }
            },
            tooltip: {
                show: true
            },
            series: [
                {
                    data: props.data.historyData.sdata,
                    type: 'line',
                    smooth: true,
                    areaStyle: {}
                }
            ]
        };
        lineCharts.setOption(option)
    }
}
 
const initPieCharts = () => {
    if(pieChartRef.value) {
        pieCharts = echarts.init(pieChartRef.value);
        const option = {
            title: {
                text: '报警类型占比',
                textStyle:{
                    color: '#FFF'
                }
            },
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    type: 'pie',
                    radius: '60%',
                    data: props.data.warnData,
                }
            ]
        };
        pieCharts.setOption(option)
    }
}
 
onMounted(() => {
    initLineCharts()
    initPieCharts()
})
</script>
 
 
<style scoped lang="scss">
.item{
    width: 100%;
    height: 100%;
    background: url("@/assets/images_lc/H_100_bg.png") no-repeat;
    background-size: 100% 100%;
    .item-t{
        background: url("@/assets/images_lc/title_font.png") no-repeat;
        padding-left: 12%;
        color: #fff;
        font-size: 1.2rem;
    }
    .item-c{
        height: 96%;
        padding: 1rem;
        .warning-num,
        .gongdan{
            height: 5%;
            display: flex;
            justify-content: space-between;
            color: #fff;
            font-size: 1.5rem;
            padding: 0 0 0.5rem 0;
            .num{
                width: 30%;
            }
        }
        .warning-charts{
            height: 30%;
        }
        .type-charts{
            height: 30%;
        }
        .status{
            height: 30%;
            padding-top: 0.5rem;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            color: #fff;
            &-item{
                height: 30%;
            }
            .status1{
                display: flex;
                align-items: center;
                font-size: 1.2rem;
                .title{
                    width: 30%;
                    text-align: right;
                    margin-right: 6rem;
                }
                .btn{
                    width: 7rem;
                    height: 2.3rem;
                    text-align: center;
                    line-height: 2.2rem;
                    border-radius: 0.2rem;
                }
                .btn-parmity{
                    background: #1775E3;
                    box-shadow: 0 0 10px 0 #1775E3;
                }
                .btn-org{
                    background: #E37617;
                    box-shadow: 0 0 10px 0 #E37617;
                }
                .btn-success{
                    background: #17E39B;
                    box-shadow: 0 0 10px 0 #17E39B;
                }
            }
            .status2{
                margin-top: 0.5rem;
                display: flex;
                .title{
                    width: 30%;
                    text-align: right;
                    margin-right: 6rem;
                }
            }
        }
    }
}
</style>