feat(video): 添加报警记录管理功能- 新增报警记录实体类 AlarmRecord 及相关字段定义
- 实现报警记录的增删改查接口与 Mapper 层逻辑 - 添加报警记录前端页面,支持列表展示、搜索、处理与忽略操作 - 支持批量处理报警记录及导出功能 - 增加报警记录详情查看弹窗,展示图片与视频信息- 配置定时任务白名单,允许访问 ruoyi.video 包 - 引入 JavaCV 依赖以支持视频处理功能 - 添加 testng 依赖用于测试支持
This commit is contained in:
28
rtsp-vue/src/api/video/alarm.js
Normal file
28
rtsp-vue/src/api/video/alarm.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询报警记录列表
|
||||
export function listAlarm(query) {
|
||||
return request({
|
||||
url: '/video/alarm/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 处理报警记录
|
||||
export function handleAlarm(data) {
|
||||
return request({
|
||||
url: '/video/alarm/handle',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 批量处理报警记录
|
||||
export function batchHandleAlarm(data) {
|
||||
return request({
|
||||
url: '/video/alarm/batchHandle',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
68
rtsp-vue/src/api/video/inspection.js
Normal file
68
rtsp-vue/src/api/video/inspection.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询巡检任务列表
|
||||
export function listInspection(query) {
|
||||
return request({
|
||||
url: '/video/inspection/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询巡检任务详细
|
||||
export function getInspection(taskId) {
|
||||
return request({
|
||||
url: '/video/inspection/' + taskId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增巡检任务
|
||||
export function addInspection(data) {
|
||||
return request({
|
||||
url: '/video/inspection',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改巡检任务
|
||||
export function updateInspection(data) {
|
||||
return request({
|
||||
url: '/video/inspection',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除巡检任务
|
||||
export function delInspection(taskId) {
|
||||
return request({
|
||||
url: '/video/inspection/' + taskId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 启动巡检任务
|
||||
export function startTask(taskId) {
|
||||
return request({
|
||||
url: '/video/inspection/start/' + taskId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
// 停止巡检任务
|
||||
export function stopTask(taskId) {
|
||||
return request({
|
||||
url: '/video/inspection/stop/' + taskId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
// 执行巡检任务
|
||||
export function executeTask(taskId) {
|
||||
return request({
|
||||
url: '/video/inspection/execute/' + taskId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
349
rtsp-vue/src/views/video/alarm/index.vue
Normal file
349
rtsp-vue/src/views/video/alarm/index.vue
Normal file
@@ -0,0 +1,349 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input
|
||||
v-model="queryParams.taskName"
|
||||
placeholder="请输入任务名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警类型" prop="alarmType">
|
||||
<el-input
|
||||
v-model="queryParams.alarmType"
|
||||
placeholder="请输入报警类型"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理状态" prop="handleStatus">
|
||||
<el-select v-model="queryParams.handleStatus" placeholder="请选择处理状态" clearable>
|
||||
<el-option label="未处理" value="0" />
|
||||
<el-option label="已处理" value="1" />
|
||||
<el-option label="已忽略" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警时间">
|
||||
<el-date-picker
|
||||
v-model="daterangeAlarmTime"
|
||||
style="width: 240px"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Check"
|
||||
:disabled="multiple"
|
||||
@click="handleBatchProcess('1')"
|
||||
v-hasPermi="['video:alarm:handle']"
|
||||
>批量处理</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="Close"
|
||||
:disabled="multiple"
|
||||
@click="handleBatchProcess('2')"
|
||||
v-hasPermi="['video:alarm:handle']"
|
||||
>批量忽略</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['video:alarm:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="alarmList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="报警ID" align="center" prop="alarmId" />
|
||||
<el-table-column label="任务名称" align="center" prop="taskName" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="报警类型" align="center" prop="alarmType" />
|
||||
<el-table-column label="报警级别" align="center" prop="alarmLevel">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.alarmLevel === '1'" type="info">低</el-tag>
|
||||
<el-tag v-else-if="scope.row.alarmLevel === '2'" type="warning">中</el-tag>
|
||||
<el-tag v-else-if="scope.row.alarmLevel === '3'" type="danger">高</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报警描述" align="center" prop="alarmDesc" />
|
||||
<el-table-column label="置信度" align="center" prop="confidence">
|
||||
<template #default="scope">
|
||||
{{ (scope.row.confidence * 100).toFixed(1) }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报警图片" align="center" prop="imagePath">
|
||||
<template #default="scope">
|
||||
<el-image
|
||||
v-if="scope.row.imagePath"
|
||||
style="width: 60px; height: 40px"
|
||||
:src="scope.row.imagePath"
|
||||
:preview-src-list="[scope.row.imagePath]"
|
||||
fit="cover"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报警时间" align="center" prop="alarmTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理状态" align="center" prop="handleStatus">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.handleStatus === '0'" type="danger">未处理</el-tag>
|
||||
<el-tag v-else-if="scope.row.handleStatus === '1'" type="success">已处理</el-tag>
|
||||
<el-tag v-else-if="scope.row.handleStatus === '2'" type="info">已忽略</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理人" align="center" prop="handleBy" />
|
||||
<el-table-column label="处理时间" align="center" prop="handleTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.handleTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
icon="Check"
|
||||
@click="handleProcess(scope.row, '1')"
|
||||
v-hasPermi="['video:alarm:handle']"
|
||||
v-if="scope.row.handleStatus === '0'"
|
||||
>处理</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="info"
|
||||
icon="Close"
|
||||
@click="handleProcess(scope.row, '2')"
|
||||
v-hasPermi="['video:alarm:handle']"
|
||||
v-if="scope.row.handleStatus === '0'"
|
||||
>忽略</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="View"
|
||||
@click="handleView(scope.row)"
|
||||
>查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 处理报警对话框 -->
|
||||
<el-dialog :title="processTitle" v-model="processOpen" width="500px" append-to-body>
|
||||
<el-form ref="processRef" :model="processForm" label-width="80px">
|
||||
<el-form-item label="处理状态">
|
||||
<el-tag v-if="processForm.handleStatus === '1'" type="success">已处理</el-tag>
|
||||
<el-tag v-else-if="processForm.handleStatus === '2'" type="info">已忽略</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理备注">
|
||||
<el-input
|
||||
v-model="processForm.handleRemark"
|
||||
type="textarea"
|
||||
placeholder="请输入处理备注"
|
||||
:rows="4"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitProcess">确 定</el-button>
|
||||
<el-button @click="processOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看报警详情对话框 -->
|
||||
<el-dialog title="报警详情" v-model="viewOpen" width="800px" append-to-body>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="报警ID">{{ viewForm.alarmId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务名称">{{ viewForm.taskName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="设备名称">{{ viewForm.deviceName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="报警类型">{{ viewForm.alarmType }}</el-descriptions-item>
|
||||
<el-descriptions-item label="报警级别">
|
||||
<el-tag v-if="viewForm.alarmLevel === '1'" type="info">低</el-tag>
|
||||
<el-tag v-else-if="viewForm.alarmLevel === '2'" type="warning">中</el-tag>
|
||||
<el-tag v-else-if="viewForm.alarmLevel === '3'" type="danger">高</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="置信度">{{ (viewForm.confidence * 100).toFixed(1) }}%</el-descriptions-item>
|
||||
<el-descriptions-item label="报警时间" :span="2">{{ parseTime(viewForm.alarmTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</el-descriptions-item>
|
||||
<el-descriptions-item label="报警描述" :span="2">{{ viewForm.alarmDesc }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理状态">
|
||||
<el-tag v-if="viewForm.handleStatus === '0'" type="danger">未处理</el-tag>
|
||||
<el-tag v-else-if="viewForm.handleStatus === '1'" type="success">已处理</el-tag>
|
||||
<el-tag v-else-if="viewForm.handleStatus === '2'" type="info">已忽略</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="处理人">{{ viewForm.handleBy || '无' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理时间" :span="2">{{ parseTime(viewForm.handleTime, '{y}-{m}-{d} {h}:{i}:{s}') || '无' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理备注" :span="2">{{ viewForm.handleRemark || '无' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<div v-if="viewForm.imagePath" style="margin-top: 20px;">
|
||||
<h4>报警图片:</h4>
|
||||
<el-image
|
||||
style="width: 100%; max-height: 400px"
|
||||
:src="viewForm.imagePath"
|
||||
:preview-src-list="[viewForm.imagePath]"
|
||||
fit="contain"
|
||||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Alarm">
|
||||
import { listAlarm, handleAlarm, batchHandleAlarm } from "@/api/video/alarm";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const alarmList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const daterangeAlarmTime = ref([]);
|
||||
|
||||
const processOpen = ref(false);
|
||||
const processTitle = ref("");
|
||||
const processForm = ref({});
|
||||
|
||||
const viewOpen = ref(false);
|
||||
const viewForm = ref({});
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskName: null,
|
||||
deviceName: null,
|
||||
alarmType: null,
|
||||
handleStatus: null,
|
||||
beginAlarmTime: null,
|
||||
endAlarmTime: null
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams } = toRefs(data);
|
||||
|
||||
/** 查询报警记录列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
queryParams.value.beginAlarmTime = daterangeAlarmTime.value ? daterangeAlarmTime.value[0] : null;
|
||||
queryParams.value.endAlarmTime = daterangeAlarmTime.value ? daterangeAlarmTime.value[1] : null;
|
||||
listAlarm(queryParams.value).then(response => {
|
||||
alarmList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
daterangeAlarmTime.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.alarmId);
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 处理报警 */
|
||||
function handleProcess(row, status) {
|
||||
processForm.value = {
|
||||
alarmId: row.alarmId,
|
||||
handleStatus: status,
|
||||
handleRemark: ''
|
||||
};
|
||||
processTitle.value = status === '1' ? '处理报警' : '忽略报警';
|
||||
processOpen.value = true;
|
||||
}
|
||||
|
||||
/** 提交处理 */
|
||||
function submitProcess() {
|
||||
handleAlarm(processForm.value).then(response => {
|
||||
proxy.$modal.msgSuccess("操作成功");
|
||||
processOpen.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量处理 */
|
||||
function handleBatchProcess(status) {
|
||||
const alarmIds = ids.value;
|
||||
const statusText = status === '1' ? '处理' : '忽略';
|
||||
proxy.$modal.confirm('是否确认批量' + statusText + '选中的报警记录?').then(function() {
|
||||
return batchHandleAlarm({
|
||||
alarmIds: alarmIds,
|
||||
handleStatus: status,
|
||||
handleRemark: '批量' + statusText
|
||||
});
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("操作成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
function handleView(row) {
|
||||
viewForm.value = { ...row };
|
||||
viewOpen.value = true;
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('video/alarm/export', {
|
||||
...queryParams.value
|
||||
}, `alarm_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
365
rtsp-vue/src/views/video/inspection/index.vue
Normal file
365
rtsp-vue/src/views/video/inspection/index.vue
Normal file
@@ -0,0 +1,365 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input
|
||||
v-model="queryParams.taskName"
|
||||
placeholder="请输入任务名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable>
|
||||
<el-option label="启用" value="0" />
|
||||
<el-option label="停用" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['video:inspection:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['video:inspection:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['video:inspection:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['video:inspection:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="inspectionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="任务ID" align="center" prop="taskId" />
|
||||
<el-table-column label="任务名称" align="center" prop="taskName" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="Cron表达式" align="center" prop="cronExpression" />
|
||||
<el-table-column label="巡检时长(秒)" align="center" prop="duration" />
|
||||
<el-table-column label="任务状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_normal_disable" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="启用检测" align="center" prop="enableDetection">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_normal_disable" :value="scope.row.enableDetection"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检测阈值" align="center" prop="threshold" />
|
||||
<el-table-column label="执行次数" align="center" prop="executeCount" />
|
||||
<el-table-column label="报警次数" align="center" prop="alarmCount" />
|
||||
<el-table-column label="最后执行时间" align="center" prop="lastExecuteTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.lastExecuteTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['video:inspection:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="VideoPlay" @click="handleStart(scope.row)" v-hasPermi="['video:inspection:start']" v-if="scope.row.status === '1'">启动</el-button>
|
||||
<el-button link type="warning" icon="VideoPause" @click="handleStop(scope.row)" v-hasPermi="['video:inspection:stop']" v-if="scope.row.status === '0'">停止</el-button>
|
||||
<el-button link type="success" icon="CaretRight" @click="handleExecute(scope.row)" v-hasPermi="['video:inspection:execute']">执行</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['video:inspection:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改巡检任务对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="inspectionRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input v-model="form.taskName" placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备" prop="deviceId">
|
||||
<el-select v-model="form.deviceId" placeholder="请选择设备" style="width: 100%">
|
||||
<el-option
|
||||
v-for="device in deviceList"
|
||||
:key="device.deviceId"
|
||||
:label="device.ip"
|
||||
:value="device.deviceId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="Cron表达式" prop="cronExpression">
|
||||
<el-input v-model="form.cronExpression" placeholder="请输入Cron表达式" />
|
||||
<div class="el-form-item__tip">
|
||||
例如:0 0 8 * * ? 表示每天8点执行<br/>
|
||||
0 0/30 * * * ? 表示每30分钟执行一次
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检时长" prop="duration">
|
||||
<el-input-number v-model="form.duration" :min="10" :max="3600" placeholder="巡检时长(秒)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="0">启用</el-radio>
|
||||
<el-radio label="1">停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用检测" prop="enableDetection">
|
||||
<el-radio-group v-model="form.enableDetection">
|
||||
<el-radio label="0">启用</el-radio>
|
||||
<el-radio label="1">停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测阈值" prop="threshold">
|
||||
<el-input-number v-model="form.threshold" :min="0.1" :max="1.0" :step="0.1" placeholder="检测阈值" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Inspection">
|
||||
import { listInspection, getInspection, delInspection, addInspection, updateInspection, startTask, stopTask, executeTask } from "@/api/video/inspection";
|
||||
import { listDevice } from "@/api/video/device";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict('sys_normal_disable');
|
||||
|
||||
const inspectionList = ref([]);
|
||||
const deviceList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskName: null,
|
||||
deviceName: null,
|
||||
status: null
|
||||
},
|
||||
rules: {
|
||||
taskName: [
|
||||
{ required: true, message: "任务名称不能为空", trigger: "blur" }
|
||||
],
|
||||
deviceId: [
|
||||
{ required: true, message: "设备不能为空", trigger: "change" }
|
||||
],
|
||||
cronExpression: [
|
||||
{ required: true, message: "Cron表达式不能为空", trigger: "blur" }
|
||||
],
|
||||
duration: [
|
||||
{ required: true, message: "巡检时长不能为空", trigger: "blur" }
|
||||
],
|
||||
threshold: [
|
||||
{ required: true, message: "检测阈值不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询巡检任务列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listInspection(queryParams.value).then(response => {
|
||||
inspectionList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询设备列表 */
|
||||
function getDeviceList() {
|
||||
listDevice({}).then(response => {
|
||||
deviceList.value = response.rows;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
taskId: null,
|
||||
taskName: null,
|
||||
deviceId: null,
|
||||
cronExpression: null,
|
||||
duration: 300,
|
||||
status: "0",
|
||||
enableDetection: "0",
|
||||
threshold: 0.7
|
||||
};
|
||||
proxy.resetForm("inspectionRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.taskId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加巡检任务";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const taskId = row.taskId || ids.value;
|
||||
getInspection(taskId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改巡检任务";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["inspectionRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.taskId != null) {
|
||||
updateInspection(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addInspection(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const taskIds = row.taskId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除巡检任务编号为"' + taskIds + '"的数据项?').then(function() {
|
||||
return delInspection(taskIds);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 启动任务 */
|
||||
function handleStart(row) {
|
||||
proxy.$modal.confirm('是否确认启动任务"' + row.taskName + '"?').then(function() {
|
||||
return startTask(row.taskId);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("启动成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 停止任务 */
|
||||
function handleStop(row) {
|
||||
proxy.$modal.confirm('是否确认停止任务"' + row.taskName + '"?').then(function() {
|
||||
return stopTask(row.taskId);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("停止成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 执行任务 */
|
||||
function handleExecute(row) {
|
||||
proxy.$modal.confirm('是否确认立即执行任务"' + row.taskName + '"?').then(function() {
|
||||
return executeTask(row.taskId);
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess("任务已提交执行");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('video/inspection/export', {
|
||||
...queryParams.value
|
||||
}, `inspection_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getDeviceList();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user