无人机管理后台前端(已迁走)
张含笑
2025-08-05 c832bf2e80ac465e71b7a1c1f7a59d4252030989
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
312
313
314
<template>
    <div class="JobRelatedEvents">
        <div class="machineTableDetailsTitle">
        <p>
            关联事件
            <span>{{ total }}</span>
            件
        </p>
    </div>
    <div class="search">
        <div class="searchBox">
            <div class="item">
                <div class="itemchild">模糊查询:</div>
                <el-input v-model="params.event_name" placeholder="请输入事件名称" clearable></el-input>
            </div>
            <div class="item">
                <div class="itemchild">任务执行日期:</div>
                <el-date-picker
                    popper-class="custom-date-picker"
                    class="tasktimer"
                    v-model="taskData"
                    type="date"
                    placeholder="请选择日期"
                    value-format="YYYY-MM-DD"
                    :disabled-date="disabledDate"
                    @change="changeselect"
                />
            </div>
            <div class="item">
                <div class="itemchild">关联算法:</div>
                <TaskAlgorithmBusiness :setWidth="186" :showAlgorithm="true" @algorithmChange="algorithmChange" />
            </div>
        </div>
        <div class="search-btn">
                <div class="btn search" @click="handleSearch"><img src="@/assets/images/task/search.png"/>搜索</div>
                <div class="btn clear" @click="handleReset"><img src="@/assets/images/task/clear.png"/>清空</div>
            </div>
    </div>
 
    <div class="ztzf-table">
        <el-table
            v-loading="loading"
            :row-class-name="tableRowClassName"
            :data="list"
            style="width: 100%"
            :row-style="{ height: '38px', fontSize: '14px', 'text-align': 'center' }"
            :header-cell-style="{ 'text-align': 'center', height: '36px', fontSize: '14px' }"
        >
            <el-table-column label="序号" type="index" width="60" align="center">
                <template #default="{ $index }">
                    {{ ($index + 1 + (sizeParams.current - 1) * sizeParams.size).toString().padStart(2, '0') }}
                </template>
            </el-table-column>
            <el-table-column prop="event_num" label="事件编号"  align="center"/>
            <el-table-column show-overflow-tooltip prop="event_name" label="事件名称"  align="center"/>
            <el-table-column show-overflow-tooltip prop="remark" label="事件地址"  align="center"/>
            <el-table-column show-overflow-tooltip prop="ai_types" label="关联算法"  align="center"/>
            <el-table-column show-overflow-tooltip prop="job_create_time" label="事件时间"  align="center"/>
            <el-table-column prop="status" label="事件状态" align="center">
                <template #default="scope">
                    <div class="pending" v-if="scope.row.status === 0">待处理</div>
                    <div class="reviewed" v-if="scope.row.status === 2">待审核</div>
                    <div class="processing" v-if="scope.row.status === 3">处理中</div>
                    <div class="done" v-if="scope.row.status === 4">已完成</div>
                    <div class="ended" v-if="scope.row.status === 5">已完结</div>
                </template>
            </el-table-column>
            <el-table-column label="操作" width="90" align="center">
                <template #default="scope">
                    <div class="ztzf-view btnItem" @click="examine(scope.row)">查看</div>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <el-pagination
        class="ztzf-pagination"
        popper-class="custom-pagination-dropdown"
        background
        :page-sizes="[10, 20, 30, 50]"
        v-model:current-page="sizeParams.current"
        v-model:page-size="sizeParams.size"
        layout=" prev, pager, next,sizes, jumper"
        :total="total"
        @change="pageChange"
    />
    </div>
</template>
<script setup>
import { useStore } from 'vuex'
import { getDeviceEventList } from '@/api/job/task'
import { dayjs, ElMessage } from 'element-plus'
import { useRouter } from 'vue-router';
import { pxToRem } from '@/utils/rem'
import TaskAlgorithmBusiness from './TaskAlgorithmBusiness.vue'
const router = useRouter();
const emit = defineEmits(['refresh'])
const props = defineProps({
    jobTimes: Array,
    batchNo: Number,
})
const taskData = ref('')
const algorithmChange = val => {
    params.value.ai_types = val
}
const loading = ref(false)
const list = ref()
const params = ref({
    way_line_jod_info_id: null,
    event_name: '',
    ai_types: [], // 算法类型
    start_date: null,
    end_date: null,
})
const sizeParams = ref({
    current: 1,
    size: 10,
})
// 日期选择
const changeselect = () => {
    params.value.start_date = taskData.value.length ? `${taskData.value} 00:00:00` : null
    params.value.end_date = taskData.value.length ? `${taskData.value} 23:59:59` : null
}
const store = useStore()
const child_sn = computed(() => store.state.home.singleUavHome.child_sn)
const total = ref(0)
const examine = row => {
    const orderNumber = row.event_num
    router.push({
      path: `/tickets/ticket`,
      query: {
        orderNumber,
      },
    });
}
const wayLineJodInfoId = inject('wayLineJodInfoId')
 
const getList = () => {
    if (!wayLineJodInfoId.value) return
    params.value.way_line_jod_info_id = wayLineJodInfoId.value
    params.value.batchNo = props.batchNo
    loading.value = true
    getDeviceEventList(params.value, sizeParams.value).then(res => {
        const resData = res?.data?.data || {}
        list.value = resData.records
        total.value = resData.total
        loading.value = false
    })
}
 
const pageChange = val => {
    sizeParams.value.current = val
    getList()
}
// 表格隔行变色
const tableRowClassName = ({ row, rowIndex }) => {
    if (rowIndex % 2 === 1) {
        return 'warning-row'
    } else {
        return 'success-row'
    }
}
// 禁用当天之前的日期
const disabledDate = time => {
    const curTime = dayjs(time).format('YYYY-MM-DD')
    // console.log(curTime)
    return !(props.jobTimes || []).includes(curTime)
}
const handleReset = () => {
    params.value.ai_types = []
    params.value.event_name = ''
    params.value.end_date = null
    params.value.start_date = null
    taskData.value = ''
    algorithmChange([])
    getList()
}
const handleSearch = () => {
    // console.log('sousuo', params.value)
 
    getList()
}
onMounted(() => {
    getList()
})
</script>
<style lang="scss">
// .custom-date-picker .el-picker-panel__content .el-date-table td.disabled div {
//     background-color: #00193b !important;
//     color: #505050 !important;
//     cursor: not-allowed;
// }
</style>
<style scoped lang="scss">
.JobRelatedEvents {
    .machineTableDetailsTitle {
    margin-bottom: 16px;
    background: url('/src/assets/images/task/detailtitle.png') no-repeat center;
    background-size: 100% 100%;
    p {
        display: inline-block;
        margin-left: 30px;
        font-size: 16px;
        color: #363636;
        line-height: 20px;
        text-align: left;
        margin-bottom: 8px;
        span {
            font-size: 26px;
            color: #0282ff;
            font-weight: bold;
        }
    }
}
 
// 待处理
.pending {
    color: #ff7411;
}
// 待审核
.reviewed {
    color: #ff472f;
}
// 处理中
.processing {
    color: #ffff61;
}
// 已完成
.done {
    color: #06d957;
}
// 已完结
.ended {
    color: #06d957;
}
.search {
    display: flex;
    justify-content: space-between;
    margin-bottom: 19px; // 添加底部间距
    .item {
        position: relative;
        display: flex;
        align-items: center;
        font-size: 14px;
        color: #363636;
        margin-right: 20px;
        .itemchild {
            white-space: nowrap;
            margin-right: 5px;
        }
        :deep(.el-date-editor.el-input__wrapper) {
            width: 200px; // 调整日期选择器宽度
        }
    }
    .item:nth-last-child {
        margin-right: 113px;
    }
}
.searchBox {
    display: flex;
}
 
.search-btn {
            display: flex;
            justify-content: space-between;
            font-size: 14px;
            
            .btn {
                width: 80px;
                height: 32px;
                border-radius: 4px 4px 4px 4px;
                line-height: 32px;
                display: flex;
                justify-content: center;
                align-items: center;
                
                img {
                    width: 14px;
                    height: 14px;
                }
            }
            .search {
                background: #409EFF;
                color: #fff;
                margin-right: 10px;
                cursor: pointer;
            }
            .clear {
                border: 1px solid #D2D1D1;
                color: #676767;
                margin-right: 10px;
                cursor: pointer;
            }
            .add {
                background: #FF9243;
                color: #fff;
            }
        }
        .btnItem {
            height: 27px;
            line-height: 27px;
            border-radius: 0px 0px 0px 0px;
            border: 1px solid #51a8ff;
            font-family: Segoe UI, Segoe UI;
            font-weight: 400;
            font-size: 14px;
            color: #1C5CFF;
            padding: 0 10px;
            display: inline-block;
            margin-right: 10px;
            cursor: pointer;
    }
}
 
</style>