tplink摄像头变焦

This commit is contained in:
曹磊 2025-06-30 14:23:13 +08:00
parent 304fa86fbb
commit 686fe4edca
4 changed files with 102 additions and 30 deletions

View File

@ -6,6 +6,7 @@ enum Api {
syncProject = '/iot/tplink/projectInfo/sync',
syncRegion = '/iot/tplink/regionInfo/sync',
list = '/iot/tplink/cameraInfo/list',
syncProjectIpcDevice = '/iot/tplink/cameraInfo/syncProjectIpcDevice',
ipcCapability = '/iot/tplink/cameraInfo/getIpcCapability',
nuList = '/iot/tplink/cameraInfo/nuList',
edit = '/iot/tplink/cameraInfo/edit',
@ -38,6 +39,7 @@ enum Api {
uploadToServer = '/iot/tplink/cameraInfo/uploadToServer',
stopUploadToServer = '/iot/tplink/cameraInfo/stopUploadToServer',
getUploadToServerProcess = '/iot/tplink/cameraInfo/getUploadToServerProcess',
motionCtrl = '/iot/tplink/cameraInfo/motionCtrl',
}
@ -72,6 +74,12 @@ export const syncRegion = (params?) => defHttp.get({ url: Api.syncRegion, params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
* IPC设备
* @param params
*/
export const syncProjectIpcDevice = (params) => defHttp.get({ url: Api.syncProjectIpcDevice, params });
/**
* IPC能力集
* @param params
@ -266,3 +274,9 @@ export const stopUploadToServer = (params) => defHttp.get({ url: Api.stopUploadT
*/
export const getUploadToServerProcess = (params) => defHttp.get({ url: Api.getUploadToServerProcess, params });
/**
*
* @param params
*/
export const motionCtrl = (params) => defHttp.get({ url: Api.motionCtrl, params });

View File

@ -3,10 +3,7 @@
<a-spin :spinning="syncoading">
<div class="j-table-operator" style="width: 100%">
<a-button preIcon="ant-design:sync-outlined" @click="loadRootTreeData">刷新</a-button>
<!-- <a-button type="primary" preIcon="ant-design:sync-outlined" @click="syncProjectInfo">同步项目</a-button>-->
<!-- <template v-if="currentRegion !=null">-->
<!-- <a-button preIcon="ant-design:sync-outlined" @click="syncRegionInfo">同步区域</a-button>-->
<!-- </template>-->
<a-button type="primary" preIcon="ant-design:sync-outlined" @click="getProjectIpcDevice">同步设备</a-button>
</div>
<a-spin :spinning="loading">
<!--区域树-->
@ -35,8 +32,9 @@
import { useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useMethods } from '/@/hooks/system/useMethods';
import { syncProjectIpcDevice,queryProjectTreeSync, queryRegionTreeSync, syncProject, syncRegion } from '../camera.api';
const { createMessage } = useMessage();
import { queryProjectTreeSync, queryRegionTreeSync, syncProject, syncRegion } from '../camera.api';
const emit = defineEmits(['select', 'rootTreeData']);
const syncoading = ref<boolean>(false);
@ -172,31 +170,21 @@
}
/**
* 同步项目
* 同步设备
*/
// async function syncProjectInfo(){
// syncoading.value = true;
// await syncProject();
// await loadRootTreeData();
// }
/**
* 同步区域
*/
// async function syncRegionInfo(){
// let data = currentRegion.value;
// if (data == null) {
// createMessage.warning('');
// return;
// }
// const record = {
// projectId: data.projectId,
// regionId: data.regionId
// };
// syncoading.value = true;
// await syncRegion(record);
// await loadRootTreeData();
// }
async function getProjectIpcDevice(){
let data = currentRegion.value;
if (data == null) {
createMessage.warning('请先选择一个区域');
return;
}
const record = {
projectId: data.projectId
};
await syncProjectIpcDevice(record);
currentRegion.value["timestamp"] = new Date().getTime();
emit('select', currentRegion.value);
}
defineExpose({
loadRootTreeData,

View File

@ -61,6 +61,17 @@
<a-button preIcon="ant-design:alert-outlined" @click="manualAlarm">报警</a-button>
</span>
</a-col>
<a-col :span="24" style="padding: 5px;">
<span style="margin-left: 5px;">
变焦
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-out-outlined" @click="zoomInOut('out')" title="缩小"></a-button>
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-in-outlined" @click="zoomInOut('in')" title="放大"></a-button>
</span>
</a-col>
</a-row>
</a-spin>
</template>
@ -76,7 +87,8 @@
getMultitransUrl,
getPreviewUrl,
setImageCommon,
testAudio
testAudio,
motionCtrl
} from "../camera.api";
const props = defineProps({
@ -328,6 +340,59 @@
izPhone.value = false;
}
/**
* 缩放
*/
function zoomInOut(type){
let delayTime = 6000;
if(type == 'in'){
formData.zoom = formData.zoom+0.4;
if(formData.zoom > 4){
formData.zoom = 4;
}
formData.sliderValue = formData.zoom;
moveCtrl(10,1,1);
if(formData.sliderValue<=2){
delayTime = 0.4*6000;
}else{
delayTime = 0.2*6000;
}
delayExecute(moveCtrl,[10,0,1],delayTime);
}else{
formData.zoom = formData.zoom-0.4;
if(formData.zoom < 1){
formData.zoom = 1;
}
formData.sliderValue = formData.zoom;
moveCtrl(9,1,1);
if(formData.sliderValue<=2){
delayTime = 0.4*6000;
}else{
delayTime = 0.2*6000;
}
delayExecute(moveCtrl,[9,0,1],delayTime);
}
}
/**
* 控制球机
*/
function moveCtrl(direction,startOrNot,speed){
let params = {
"deviceIndex": formData.deviceIndex,
"direction": direction,
"startOrNot": startOrNot,
"speed": speed,
};
motionCtrl(params);
}
function delayExecute(fn, args, delay) {
setTimeout(() => {
fn.apply(this,args) // 使apply
}, delay)
}
/**
* 销毁
*/

View File

@ -63,5 +63,10 @@
.jee-hidden {
display: none !important;
}
.ant-modal-body {
height: auto !important;
overflow: hidden !important;
}
</style>
<style lang="less" scoped></style>