forked from drone/command-center-dashboard

张含笑
2025-04-19 86dfd09e0939f3d07c78434a88e416630094e0bf
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
<template>
    <div class="machineTableDetailsTitle"><span>关联事件</span></div>
    <div class="ztzf-table">
        <el-table
            :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 prop="id" label="事件编号" />
            <el-table-column show-overflow-tooltip prop="event_name" label="事件名称" />
            <el-table-column show-overflow-tooltip prop="create_user" label="所属单位" />
            <el-table-column show-overflow-tooltip prop="remark" label="事件内容" />
            <el-table-column show-overflow-tooltip prop="ai_types" label="关联算法" />
            <el-table-column prop="status" label="工单状态">
                <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="80">
                <template #default="scope">
                    <div class="ztzf-view" @click="examine(scope.row)">查看</div>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <el-pagination
        class="ztzf-pagination"
        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"
    />
</template>
<script setup>
import { useStore } from 'vuex'
import { getDeviceEventList } from '@/api/home/machineNest'
import { ElMessage } from 'element-plus'
import { pxToRem } from '@/utils/rem'
 
const list = ref()
const params = ref({
    wayLineJodInfoId: null,
})
const sizeParams = ref({
    current: 1,
    size: 10,
})
const store = useStore()
const child_sn = computed(() => store.state.home.singleUavHome.child_sn)
const total = ref(10)
const examine = row => {
    const orderNumber = row.event_num
    const primaryUrl = `${import.meta.env.VITE_APP_TICKET_BASE_URL}/manage/tickets/ticket?orderNumber=${orderNumber}`
    const backupUrl = `${import.meta.env.VITE_APP_TICKET_BACKUP_URL}/manage/tickets/ticket?orderNumber=${orderNumber}`
    const win = window.open(primaryUrl, '_blank')
    if (!win || win.closed) {
        window.open(backupUrl, '_blank')
    }
}
const wayLineJodInfoId = inject('wayLineJodInfoId')
 
const getList = () => {
    params.value.wayLineJodInfoId = wayLineJodInfoId.value
    getDeviceEventList(params.value, sizeParams.value).then(res => {
        const resData = res?.data?.data || {}
        list.value = resData.records
        total.value = resData.total
    })
}
 
const pageChange = val => {
    sizeParams.value.current = val
    getList()
}
// 表格隔行变色
const tableRowClassName = ({ row, rowIndex }) => {
    if (rowIndex % 2 === 1) {
        return 'warning-row'
    } else {
        return 'success-row'
    }
}
onMounted(() => {
    getList()
})
</script>
<style scoped lang="scss">
.machineTableDetailsTitle {
    margin-bottom: 16px;
    background: url('/src/assets/images/signMachineNest/machineRight/detailtitle.png') no-repeat center;
    background-size: 100% 100%;
    span {
        display: inline-block;
        margin-left: 30px;
        font-size: 16px;
        color: #ddf0ff;
        line-height: 20px;
        text-align: left;
        margin-bottom: 8px;
    }
}
 
// 待处理
.pending {
    color: #ff7411;
}
// 待审核
.reviewed {
    color: #8cfea7;
}
// 处理中
.processing {
    color: #ffc398;
}
// 已完成
.done {
    color: #afd9fb;
}
// 已完结
.ended {
    color: #11c4ff;
}
</style>