吉安感知网项目-前端
chenyao
4 days ago c567cbca3b78a7e06a827acbab56a46657e31aa1
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<template>
    <div class="drone-card">
        <div class="header">
            <div class="title">
                <el-tooltip class="title-tooltip" :content="data.droneName || '-'" placement="top" effect="dark"
                    :show-after="200">
                    <span class="name">{{ data.droneName }}</span>
                </el-tooltip>
                <span class="status">
                    <span :class="getStatusType(data)">
 
                    </span>
 
                    <span>
                        {{ getStatusText(data) }}
                    </span>
                </span>
            </div>
 
            <div class="actions">
                <img
                    class="favorite-icon"
                    :src="favoriteIcon"
                    alt="收藏"
                    @click="emit('favorite')"
                />
            </div>
        </div>
 
        <div class="content">
            <div>
                <span class="label">序列号</span>
                {{ data.droneSerialNo }}
            </div>
            <div>
                <span class="label">数据源</span>
                {{ getDataSource(data) }}
            </div>
            <div>
                <span class="label">经纬度</span>
                {{ data.longitude }}, {{ data.latitude }}
            </div>
            <div class="row">
                <div class="col">
                    <span class="label">信号频段</span>
                    {{ formatFrequency(data.signalFreqMhz) }}
                </div>
                <div class="col">
                    <span class="label">发现时间</span>
                    {{ getAlarmTime(data.alarmTime) }}
                </div>
            </div>
            <div class="row">
                <div class="col">
                    <span class="label">飞行高度</span>
                    {{ formatHeight(data.flightHeightM) }}
                </div>
                <div class="col">
                    <span class="label">飞行速度</span>
                    {{ formatSpeed(data.flightSpeedMs) }}
                </div>
            </div>
        </div>
 
        <div class="footer">
            <el-button class="general" color="#2B2B4C" @click="handleSignal">信号干扰</el-button>
            <el-button color="#284FE3" type="primary" @click="handleCounter">诱导驱离</el-button>
        </div>
    </div>
</template>
 
<script setup>
import { computed } from 'vue'
import { saveOperationLog } from '@ztzf/apis'
import { useRoute } from 'vue-router'
import favoriteNo from '@/assets/images/dataCockpit/favorite-n.png'
import favoriteYes from '@/assets/images/dataCockpit/favorite-y.png'
 
const props = defineProps({
    data: {
        type: Object,
        required: true,
        default: () => ({})
    }
})
 
const route = useRoute()
const emit = defineEmits(['signal', 'counter', 'favorite'])
const favoriteIcon = computed(() => (props.data?.isFavorite ? favoriteYes : favoriteNo))
 
// 信号干扰操作
const handleSignal = () => {
    saveOperationLog({
        requestUri: route.path,
        title: `${route.name || '数据驾驶舱'}-信号干扰`,
        type: 1
    })
    emit('signal')
}
 
const handleCounter = () => {
    saveOperationLog({
        requestUri: route.path,
        title: `${route.name || '数据驾驶舱'}-诱导驱离`,
        type: 1
    })
    emit('counter')
}
 
const getStatusText = (item) => {
    const status = item?.flightStatus
    if (status === 1 || status === '1') return '侦测中'
    if (status === 2 || status === '2') return '反制中'
    return status || '侦测中'
}
 
const getStatusType = (item) => {
    const statusText = getStatusText(item)
    const counterWay = item?.counterWay
    if (statusText.includes('反制') || counterWay === 2 || counterWay === '2' || counterWay === '诱导驱离') {
        return 'countering'
    }
    return 'detecting'
}
 
const normalizeCounterWay = (value) => {
    if (value == null) return ''
    return String(value).trim()
}
 
const showSignalBtn = (item) => {
    const counterWay = normalizeCounterWay(item?.counterWay)
    return counterWay !== '1'
}
 
const showCounterBtn = (item) => {
    const counterWay = normalizeCounterWay(item?.counterWay)
    return counterWay !== '2'
}
 
const getDataSource = (item) => {
    return item?.deviceName || item?.areaName || '-'
}
 
const formatFrequency = (value) => {
    if (value == null || value === '') return '-'
    return `${value}MHz`
}
 
const getAlarmTime = (value) => {
    if (!value) return '-'
    const parts = value.replace('T', ' ').split(' ')
    return parts[1] || value
}
 
const formatHeight = (value) => {
    if (value == null || value === '') return '-'
    return `${value}m`
}
 
const formatSpeed = (value) => {
    if (value == null || value === '') return '-'
    return `${value}m/s`
}
</script>
 
<style scoped lang="scss">
.drone-card {
    margin-top: 10px;
    padding: 10px;
    color: #fff;
    background: #191933;
    border-radius: 6px 6px 6px 6px;
 
    &:hover {
        background: #29294D;
        ;
    }
 
    &:first-child {
        margin-top: 0;
    }
 
    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
 
        .title {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
 
            .title-tooltip {
                flex: 1;
                min-width: 0;
                display: block;
            }
 
            .name {
                display: inline-block;
                max-width: 100%;
                font-family: Source Han Sans CN, Source Han Sans CN;
                font-weight: bold;
                font-size: 14px;
                color: #FFFFFF;
                text-align: left;
                font-style: normal;
                text-transform: none;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
 
            .status {
                flex-shrink: 0;
                padding: 0 10px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                height: 21px;
 
                background: #303041;
                border-radius: 10px;
                gap: 6px;
 
                span {
                    font-family: Source Han Sans CN, Source Han Sans CN;
                    font-weight: 400;
                    font-size: 10px;
                    color: #FFFFFF;
                    text-align: center;
                    font-style: normal;
                    text-transform: none;
                }
 
 
                span.detecting {
                    width: 4px;
                    height: 4px;
                    background: #18FF4A;
                    border-radius: 50%;
                }
 
                span.countering {
                    width: 4px;
                    height: 4px;
                    background: #FF4444;
                    border-radius: 50%;
                }
            }
        }
 
        .actions {
            display: flex;
            gap: 8px;
            font-size: 16px;
            cursor: pointer;
 
            .favorite-icon {
                width: 16px;
                height: 16px;
            }
        }
    }
 
    .content {
        font-family: Source Han Sans CN, Source Han Sans CN;
        font-weight: 400;
        font-size: 12px;
        color: #9E9EBA;
        text-align: left;
        font-style: normal;
        text-transform: none;
 
        &>div {
            margin-top: 10px;
            line-height: 22px;
 
            span.label {
                margin-right: 10px;
                color: #D4D5D7;
            }
        }
 
        .row {
            display: flex;
            justify-content: space-between;
        }
    }
 
    .footer {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
 
        ::v-deep(.el-button) {
            width: 96px;
            height: 36px;
 
            &.general.el-button {
                border-radius: 4px 4px 4px 4px;
                border: 1px solid rgba(255, 255, 255, 0.5);
            }
        }
    }
}
</style>