fix(devicePreset): 修改删除预置位接口参数及调用方式

refactor(securitySurveillance): 添加项目ID参数到监控列表请求
style(camera): 注释掉未使用的设备操作按钮代码
This commit is contained in:
tcy
2025-09-24 17:52:51 +08:00
parent 64c538775f
commit b7c716509d
4 changed files with 65 additions and 53 deletions

View File

@ -55,10 +55,11 @@ export const updateDevicePreset = (data: DevicePresetForm) => {
* 删除摄像头预置位
* @param id
*/
export const delDevicePreset = (id: string | number | Array<string | number>) => {
export const delDevicePreset = (data: any) => {
return request({
url: '/ops/devicePreset/' + id,
method: 'delete'
url: '/ops/devicePreset/delYzd',
method: 'delete',
data: [data]
});
};
/**

View File

@ -1,6 +1,7 @@
<template>
<div class="system-busPresettingBit-add">
<el-dialog v-model="isShowDialog" width="1250px" :close-on-click-modal="false" :destroy-on-close="true">
<el-dialog v-model="isShowDialog" width="1250px" :close-on-click-modal="false" :destroy-on-close="true"
@close="closeDialog">
<template #header>
<div
v-drag="['.system-busPresettingBit-add .el-dialog', '.system-busPresettingBit-add .el-dialog__header']">
@ -58,7 +59,7 @@ import { listDevicePreset, addDevicePreset, updateDevicePreset, delDevicePreset,
import { getToken } from '@/api/securitySurveillance/index.js';
import EZUIKit from 'ezuikit-js';
import { ca } from 'element-plus/es/locale/index.mjs';
const emit = defineEmits(['update']);
const { proxy } = getCurrentInstance() as any;
@ -201,7 +202,12 @@ function handleDelete(row: any) {
deviceSerial: row.deviceSerial,
ids: id
};
delDevicePreset(id).then((res: any) => {
delDevicePreset({
id: row.id,
deviceSerial: row.deviceSerial,
channelNo: "1",
presetIndex: row.presetIndex
}).then((res: any) => {
if (res.code === 200) {
ElMessage.success('删除成功');
busPresettingBitList();
@ -252,6 +258,7 @@ function resetForm() {
}
onBeforeUnmount(() => {
if (flvPlayer.value) {
flvPlayer.value.destroy().then((data: any) => {
console.log('promise 获取 数据', data);

View File

@ -91,7 +91,7 @@
><el-icon><Plus /></el-icon>新增</el-button
>
</el-col> -->
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button type="success" :disabled="single" @click="handleUpdate(null)"
v-auth="'api/v1/system/ys7Devices/edit'"><el-icon>
<Edit />
@ -102,13 +102,13 @@
v-auth="'api/v1/system/ys7Devices/delete'"><el-icon>
<Delete />
</el-icon>删除</el-button>
</el-col>
</el-col>
<el-col :span="1.5">
<el-button type="warning" :disabled="multiple" @click="onLinkProject(null)"
v-auth="'api/v1/system/ys7Devices/add'"><el-icon>
<Link />
</el-icon>设备分配</el-button>
</el-col>
</el-col>-->
</el-row>
</div>
<el-table v-loading="loading" :data="tableData.data" @selection-change="handleSelectionChange">
@ -245,6 +245,7 @@ const ys7DevicesList = () => {
getMonitoringList({
pageStart: state.tableData.param.pageNum,
pageSize: state.tableData.param.pageSize,
isflow: false
}).then((res: any) => {
let list = res.data.object ?? [];
state.tableData.data = list.map((item) => {
@ -285,40 +286,40 @@ const handleSelectionChange = (selection: any[]) => {
// };
// 删除
const handleDelete = (row?: Ys7DeviceVO) => {
let msg = row ? `此操作将永久删除数据,是否继续?` : '你确定要删除所选数据?';
let id = row ? [row.id] : state.ids;
// const handleDelete = (row?: any) => {
// let msg = row ? `此操作将永久删除数据,是否继续?` : '你确定要删除所选数据?';
// let id = row ? [row.id] : state.ids;
if (id.length === 0) {
ElMessage.error('请选择要删除的数据。');
return;
}
// if (id.length === 0) {
// ElMessage.error('请选择要删除的数据。');
// return;
// }
ElMessageBox.confirm(msg, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
delYs7Device(id).then(() => {
ElMessage.success('删除成功');
ys7DevicesList();
});
})
.catch(() => { });
};
// ElMessageBox.confirm(msg, '提示', {
// confirmButtonText: '确认',
// cancelButtonText: '取消',
// type: 'warning'
// })
// .then(() => {
// delYs7Device(id).then(() => {
// ElMessage.success('删除成功');
// ys7DevicesList();
// });
// })
// .catch(() => { });
// };
// 绑定项目
const onLinkProject = (row?: Ys7DeviceVO) => {
let serials = row ? [row.deviceSerial] : state.ids;
// const onLinkProject = (row?: Ys7DeviceVO) => {
// let serials = row ? [row.deviceSerial] : state.ids;
if (serials.length === 0) {
ElMessage.error('请选择要绑定项目的设备');
return;
}
let info = { serials, row };
bindProRef.value.openDialog(toRaw(info));
};
// if (serials.length === 0) {
// ElMessage.error('请选择要绑定项目的设备');
// return;
// }
// let info = { serials, row };
// bindProRef.value.openDialog(toRaw(info));
// };
// 添加预置位
const addPreset = (row: any) => {
@ -326,20 +327,20 @@ const addPreset = (row: any) => {
};
// 开关加密
const encryptChange = (row: Ys7DeviceVO | any) => {
row.enctyptLoading = true;
// const action = row.videoEncrypted === 0 ? 1 : 0;
console.log(row.videoEncrypted);
// const encryptChange = (row: any) => {
// row.enctyptLoading = true;
// // const action = row.videoEncrypted === 0 ? 1 : 0;
// console.log(row.videoEncrypted);
toggleEncrypt({ videoEncrypted: row.videoEncrypted, id: row.id })
.then(() => {
proxy?.$modal.msgSuccess(row.videoEncrypted === 0 ? '关闭成功' : '开启成功');
})
.finally(() => {
row.enctyptLoading = false;
ys7DevicesList();
});
};
// toggleEncrypt({ videoEncrypted: row.videoEncrypted, id: row.id })
// .then(() => {
// proxy?.$modal.msgSuccess(row.videoEncrypted === 0 ? '关闭成功' : '开启成功');
// })
// .finally(() => {
// row.enctyptLoading = false;
// ys7DevicesList();
// });
// };
//监听项目id刷新数据
// const listeningProject = watch(

View File

@ -101,7 +101,7 @@ import EZUIKit from 'ezuikit-js';
// import TitleComponent from '@/components/TitleComponent';
import { getToken, getMonitoringList } from '@/api/securitySurveillance/index.js';
import { ref, onMounted, watch, nextTick, onUnmounted } from 'vue';
import { useUserStore } from '@/store/modules/user';
const activeIndex = ref(0); // 初始选中第一个视频
const isExpanded = ref(true); // 初始为扩展
const accessToken = ref('')
@ -111,6 +111,7 @@ const totalRecords = ref(0);
const activeTab = ref('live');
const bigVideoRef = ref<HTMLDivElement>(null);
const smallVideoRefs = ref<Array<HTMLDivElement | null>>([]); // 使用数组存储多个视频容器引用
const currentProject = computed(() => useUserStore().selectedProject);
const videoList = ref([]);
// 存储第二页的数据,用于处理扩展视图右边视频不足的情况
@ -178,7 +179,9 @@ const getMonitoringListData = async () => {
const currentPageSize = isExpanded.value ? 4 : 9;
const { data: { object, sum }, } = await getMonitoringList({
pageStart: pageStart.value,
pageSize: currentPageSize
pageSize: currentPageSize,
isflow: true,
projectId: currentProject.value?.id,
})
totalRecords.value = Number(sum)
// 确保object是数组如果不是则使用空数组