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 * @param id
*/ */
export const delDevicePreset = (id: string | number | Array<string | number>) => { export const delDevicePreset = (data: any) => {
return request({ return request({
url: '/ops/devicePreset/' + id, url: '/ops/devicePreset/delYzd',
method: 'delete' method: 'delete',
data: [data]
}); });
}; };
/** /**

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="system-busPresettingBit-add"> <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> <template #header>
<div <div
v-drag="['.system-busPresettingBit-add .el-dialog', '.system-busPresettingBit-add .el-dialog__header']"> 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 { getToken } from '@/api/securitySurveillance/index.js';
import EZUIKit from 'ezuikit-js'; import EZUIKit from 'ezuikit-js';
import { ca } from 'element-plus/es/locale/index.mjs';
const emit = defineEmits(['update']); const emit = defineEmits(['update']);
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
@ -201,7 +202,12 @@ function handleDelete(row: any) {
deviceSerial: row.deviceSerial, deviceSerial: row.deviceSerial,
ids: id 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) { if (res.code === 200) {
ElMessage.success('删除成功'); ElMessage.success('删除成功');
busPresettingBitList(); busPresettingBitList();
@ -252,6 +258,7 @@ function resetForm() {
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
if (flvPlayer.value) { if (flvPlayer.value) {
flvPlayer.value.destroy().then((data: any) => { flvPlayer.value.destroy().then((data: any) => {
console.log('promise 获取 数据', data); console.log('promise 获取 数据', data);

View File

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

View File

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