forked from drone/command-center-dashboard

张含笑
2025-04-12 bb9b31d8abc6578fa451cc545658115d0da4ff50
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
<!-- 任务详情 -->
<template>
    <el-dialog
        append-to-body
        modal-class="detailsOfHistoricalTasks"
        v-model="isShow"
        title="历史任务详情"
        :width="pxToRem(1500)"
        :close-on-click-modal="false"
        :destroy-on-close="true"
    >
        <div class="content">
            <div class="contentLeft">
                <el-divider content-position="left">详情</el-divider>
                <div class="infoBox">
                    <div class="itemBox" v-for="item in infoList">
                        <div class="itemTitle">{{ item.name }}:</div>
                        <div class="itemValue">{{ item.value }}</div>
                    </div>
                </div>
                <JobRelatedEvents v-if="isShow" />
                <el-divider content-position="left">任务成果 xxx个</el-divider>
                <div class="imgListBox">
                    <el-image
                        class="imgItem"
                        v-for="(item, index) in achievementList"
                        :src="item.url"
                        :preview-src-list="achievementList.map(i => i.url)"
                        show-progress
                        preview-teleported
                        :initial-index="index"
                        fit="cover"
                    />
                </div>
            </div>
            <DeviceJobDetailsMap v-if="isShow" class="contentRight" :detailsData="detailsData"/>
        </div>
    </el-dialog>
</template>
 
<script setup>
import { pxToRem } from '@/utils/rem'
import JobRelatedEvents from './JobRelatedEvents.vue'
import { getJobDetails, getJobInfoFiles } from '@/api/home/task'
import DeviceJobDetailsMap from './DeviceJobDetailsMap.vue'
 
const isShow = defineModel('show')
 
const infoList = ref([
    { name: '任务编号', value: '', field: 'id' },
    { name: '任务所属机巢', value: '', field: 'device_names' },
    { name: '关联算法', value: '', field: 'ai_type_str' },
    { name: '任务名称', value: '', field: 'name' },
    { name: '所属单位', value: '', field: 'dept_name' },
    { name: '任务类型', value: '', field: 'industry_type_str' },
    { name: '飞行事件', value: '', field: 'event_number' },
    { name: '任务周期', value: '', field: 'rep_rule_val' },
    { name: '任务频次', value: '', field: 'rep_fre_val' },
    { name: '任务描述', value: '', field: 'remark' },
])
 
const detailsData = ref({
    id: null,
    remark: null,
    is_monitoring: null,
    industry_type_str: null,
    area_code: null,
    ai_type_str: null,
    begin_time: null,
    end_time: null,
    device_names: null,
    create_time: null,
    name: null,
    event_number: null,
    creator_name: null,
    way_lines: [],
})
 
const achievementList = ref([])
 
const wayLineJodInfoId = inject('wayLineJodInfoId')
const getAchievement = () => {
    getJobInfoFiles({ jobInfoId: wayLineJodInfoId.value }).then(res => {
        achievementList.value = res.data.data
    })
}
const getDetails = () => {
    getJobDetails({ wayLineJobInfoId: wayLineJodInfoId.value }).then(res => {
        detailsData.value = res.data.data
        infoList.value.forEach(item => {
            item.value = detailsData.value?.[item.field] || ''
        })
    })
}
 
watch(isShow, (newValue, oldValue) => {
    if (newValue) {
        getDetails()
        getAchievement()
    }
})
</script>
 
<style lang="scss">
.detailsOfHistoricalTasks {
    .el-dialog {
        --el-dialog-margin-top: 5vh;
    }
 
    .el-pagination {
        justify-content: center;
        padding: 20px;
    }
 
    .el-dialog__body {
        height: 80vh;
    }
}
</style>
 
<style lang="scss" scoped>
.content {
    display: flex;
    height: 100%;
 
    .contentLeft {
        width: 900px;
        overflow: auto;
 
        .infoBox {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px; // 列之间的间距
            padding: 10px;
 
            .itemBox {
                background-color: #fff;
                border: 1px solid #ddd;
                border-radius: 4px;
                padding: 15px;
                box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
                display: flex;
                align-items: center;
            }
 
            .itemTitle {
                font-weight: bold;
                color: #333;
            }
 
            .itemValue {
                color: #666;
            }
        }
 
        .imgListBox {
            display: flex;
            flex-wrap: wrap;
            gap: 0 10px;
 
            .imgItem {
                width: 200px;
                height: 200px;
            }
        }
    }
 
    .contentRight {
        width: 0;
        flex-grow: 1;
        background: #19ad8d;
    }
}
</style>