<template>
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" :close="handleClose"
|
style="width: 50%; margin-top: 20px; overflow: auto; z-index: 1">
|
<!-- 列表 -->
|
<el-table v-loading="loading" :data="list">
|
<el-table-column
|
label="截图时间"
|
align="center"
|
prop="createDate"
|
:formatter="dateFormatter"
|
width="200"
|
/>
|
<el-table-column label="图片路径" align="center" prop="imagePath" width="500"
|
:show-overflow-tooltip="true"/>
|
<el-table-column label="图片预览" align="center" prop="imageUrl">
|
<template #default="scope">
|
<el-image style="height: 50px; z-index: 1"
|
:src="getPreviewUrl(scope.row.imageUrl)"
|
:preview-src-list="getPreviewSrcList(scope.row.imageUrl)" fit="cover"
|
preview-teleported/>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" min-width="60" fixed="right">
|
<template #default="scope">
|
<el-button
|
link
|
type="danger"
|
style="z-index: 1"
|
@click="handleDelete(scope.row.id)"
|
v-hasPermi="['video:camera:delete']"
|
>
|
删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- 分页 -->
|
<Pagination
|
:total="total"
|
v-model:page="queryParams.pageNo"
|
v-model:limit="queryParams.pageSize"
|
@pagination="open"
|
/>
|
</el-dialog>
|
</template>
|
<script lang="ts" setup>
|
import * as ImageApi from '@/api/data/video/image'
|
import {getPreviewUrl} from "@/api/data/video/image";
|
import {dateFormatter} from "@/utils/formatTime";
|
|
defineOptions({name: 'CameraImage'})
|
|
const message = useMessage() // 消息弹窗
|
const {t} = useI18n() // 国际化
|
const dialogTitle = ref('截图列表')
|
const loading = ref(true) // 列表的加载中
|
const total = ref(0) // 列表的总页数
|
const list = ref([]) // 列表的数据
|
const queryParams = reactive({
|
pageNo: 1,
|
pageSize: 10,
|
id: undefined,
|
brand: undefined,
|
code: undefined,
|
device: undefined,
|
cameraId: '',
|
imagePath: undefined,
|
imageUrl: undefined,
|
createDate: undefined,
|
})
|
const cameraId = ref('')
|
const dialogVisible = ref(false)
|
|
/** 查询列表 */
|
const open = async (camera_id: string) => {
|
dialogVisible.value = true
|
cameraId.value = camera_id
|
queryParams.cameraId = camera_id
|
loading.value = true
|
try {
|
const data = await ImageApi.getImagePage(queryParams)
|
list.value = data.list
|
total.value = data.total
|
} finally {
|
loading.value = false
|
}
|
}
|
|
defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
|
const handleClose = async () => {
|
dialogVisible.value = false
|
}
|
|
const getPreviewSrcList = (imageUrl: string) => {
|
let previewSrcList: string[] = []
|
previewSrcList.push(getPreviewUrl(imageUrl))
|
return previewSrcList
|
}
|
|
/** 删除按钮操作 */
|
const handleDelete = async (id: number) => {
|
try {
|
// 删除的二次确认
|
await message.delConfirm()
|
// 发起删除
|
await ImageApi.deleteImage(id)
|
message.success(t('common.delSuccess'))
|
// 刷新列表
|
await open(cameraId.value)
|
} catch {
|
}
|
}
|
</script>
|