<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>
|