无人机管理后台前端(已迁走)
张含笑
2025-12-09 5808f76456ca0d40de5074f132b73a5a488e3e13
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
<template>
  <el-dialog
    v-model="dialogVisible"
    title="工单复核"
    width="30%"
    append-to-body
    class="ztzf-dialog-mange"
    @close="handleClose"
  >
    <div class="dialog-footer">
      <el-button type="primary" @click="handleConfirm(1)">人工复核</el-button>
      <el-button type="primary" @click="handleConfirm(2)">无人机复核</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
import { ElMessageBox, ElLoading } from 'element-plus';
import { getReviewById, getCreateEventJob } from '@/api/tickets/ticket';
 
export default {
  name: 'RecheckDialog',
  props: {
    modelValue: {
      type: Boolean,
      default: false
    },
    recheckData: {
      type: Object,
      default: () => ({})
    }
  },
  emits: ['update:modelValue', 'recheck-success'],
  computed: {
    dialogVisible: {
      get() {
        return this.modelValue;
      },
      set(value) {
        this.$emit('update:modelValue', value);
      }
    }
  },
  methods: {
    handleClose() {
      this.dialogVisible = false;
    },
    
    handleConfirm(key) {
      if (key === 1) {
        this.handleManualRecheck();
      } else {
        this.handleUAVRecheck();
      }
    },
    
    async handleManualRecheck() {
      try {
        await getReviewById(this.recheckData.id);
        this.$message.success('人工复核成功');
        this.$emit('recheck-success');
        this.dialogVisible = false;
      } catch (error) {
        this.$message.error('人工复核失败');
        console.error('人工复核失败:', error);
      }
    },
    
    async handleUAVRecheck() {
      const loading = ElLoading.service({
        lock: true,
        text: '复核任务创建中……',
        background: 'rgba(0, 0, 0, 0.7)',
      });
 
      try {
        const response = await getCreateEventJob(this.recheckData.id);
        const estimatedTime = response.data.data;
        
        loading.close();
        
        await ElMessageBox.confirm(
          `预计复核执行时间为${estimatedTime}`,
          '提示',
          {
            confirmButtonText: '确定',
            showCancelButton: false,
            closeOnClickModal: false,
            closeOnPressEscape: false,
            type: 'warning',
          }
        );
        
        this.$message.success('无人机复核任务创建成功');
        this.$emit('recheck-success');
        this.dialogVisible = false;
      } catch (error) {
        loading.close();
        if (error !== 'cancel') {
          this.$message.error('无人机复核任务创建失败');
          console.error('无人机复核失败:', error);
        }
        this.dialogVisible = false;
      }
    }
  }
};
</script>
 
<style scoped>
.dialog-footer {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 20px 0;
}
</style>