无人机管理后台前端(已迁走)
张含笑
2025-09-01 2ca94de8ede18ac07ccfd8dec7b6f6a707adde9b
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
<template>
    <el-dialog
        v-model="dialogVisible"
        :width="400"
        :close-on-click-modal="false"
        :destroy-on-close="true"
        class="cancel-task-dialogs"
    >
        <div class="dialog-headers">
            <img @click="closeClick" src="@/assets/images/task/close.png" alt="" />
        </div>
        <div class="dialog-contents">
            <div class="dialog-text">您确定取消任务?</div>
            <div class="dialog-btns">
                <img src="@/assets/images/task/cancel-one.png" @click="handleCancel" alt="" />
                <img src="@/assets/images/task/cancel-all.png" @click="handleCancelAll" alt="" />
            </div>
        </div>
    </el-dialog>
</template>
<script setup>
import { cancelJobs } from '@/api/job/task'
import { ElMessage } from 'element-plus'
 
const props = defineProps({
    isShowCancelTask: {
        type: Boolean,
        default: false,
    },
    rowData: {
        type: Object,
        required: true,
    },
})
 
const emit = defineEmits(['update:isShowCancelTask', 'refresh'])
 
const dialogVisible = computed({
    get: () => props.isShowCancelTask,
    set: val => emit('update:isShowCancelTask', val),
})
 
// 取消本次
const handleCancel = () => {
    submitCancelTask(props.rowData, 1)
    dialogVisible.value = false
}
// 取消所有
const handleCancelAll = () => {
    submitCancelTask(props.rowData, 0)
    dialogVisible.value = false
}
// 提交取消任务请求
const submitCancelTask = (row, isSingle) => {
    if (!row.wayline_job_info_id) {
        ElMessage.warning('该任务无法取消,数据未兼容!')
        return
    }
    cancelJobs({
        jobInfoId: row.wayline_job_info_id,
        batchNo: row.batch_no,
        isSingle: isSingle,
    }).then(res => {
        if (res.data.code !== 0) return
        ElMessage.success('取消任务成功')
        emit('refresh')
    })
}
const closeClick = () => {
    dialogVisible.value = false
}
 
defineExpose({
    submitCancelTask,
})
</script>
<style lang="scss">
.cancel-task-dialogs {
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    // width: 398px;
    // height: 181px;
    background: #0f1d33;
    box-shadow: inset 0px -50px 50px 0px rgba(27, 148, 255, 0.13);
    border-radius: 50px 0px 0px 0px;
    border: 2px solid;
    border-image: linear-gradient(
            180deg,
            rgba(81, 168, 255, 0),
            rgba(48, 111, 202, 1),
            rgba(255, 255, 255, 1),
            rgba(27, 148, 255, 1)
        )
        2 2;
    .el-dialog__header {
        display: none;
    }
    .dialog-headers {
        width: 100%;
        height: 60px;
        background: url('@/assets/images/task/header.png') center no-repeat;
        background-size: 100% 100%;
        color: #fff;
        font-size: 16px;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        img {
            position: absolute;
            top: 24px;
            right: 20px;
            cursor: pointer;
        }
    }
 
    .dialog-contents {
        padding: 40px 20px 20px 20px;
        .dialog-text {
            color: #fff;
            font-size: 14px;
            margin-bottom: 60px;
            text-align: center;
        }
 
        .dialog-btns {
            display: flex;
            justify-content: center;
            gap: 46px;
            img {
                width: 96px;
                height: 32px;
                cursor: pointer;
            }
            // .el-button {
            //     width: 120px;
            //     height: 32px;
            //     border-radius: 2px;
 
            //     &.el-button--primary {
            //         background: #026ad6;
            //         border-color: #026ad6;
            //     }
            // }
        }
    }
}
</style>