tplink接口优化

This commit is contained in:
曹磊 2026-03-06 17:54:10 +08:00
parent 0a4cecaa9a
commit e8dd5ae7c4
8 changed files with 84 additions and 61 deletions

View File

@ -14,8 +14,11 @@ enum Api {
edit = '/iot/tplink/cameraInfo/edit',
rebootDevice = '/iot/tplink/cameraInfo/rebootDevice',
previewUrl = '/iot/tplink/cameraInfo/getPreviewUrl',
getDeviceDetails = '/iot/tplink/cameraInfo/getDeviceDetails',
getImageCommon = '/iot/tplink/cameraInfo/getImageCommon',
setImageCommon = '/iot/tplink/cameraInfo/setImageCommon',
getImageSwitch = '/iot/tplink/cameraInfo/getImageSwitch',
setImageSwitch = '/iot/tplink/cameraInfo/setImageSwitch',
getOsdCapability = '/iot/tplink/cameraInfo/getOsdCapability',
getOsd = '/iot/tplink/cameraInfo/getOsd',
setOsd = '/iot/tplink/cameraInfo/setOsd',
@ -130,6 +133,12 @@ export const rebootDevice = (params) => {
return defHttp.post({ url: Api.rebootDevice, params });
}
/**
*
* @param params
*/
export const getDeviceDetails = (params) => defHttp.get({ url: Api.getDeviceDetails, params });
/**
*
* @param params
@ -142,6 +151,18 @@ export const getImageCommon = (params) => defHttp.post({ url: Api.getImageCommon
*/
export const setImageCommon = (params) => defHttp.post({ url: Api.setImageCommon, params });
/**
*
* @param params
*/
export const getImageSwitch = (params) => defHttp.post({ url: Api.getImageSwitch, params });
/**
*
* @param params
*/
export const setImageSwitch = (params) => defHttp.post({ url: Api.setImageSwitch, params });
/**
* OSD能力集参数
* @param params

View File

@ -206,6 +206,7 @@
getVideoParams({
"deviceIndex": deviceIndex
}).then(res=>{
console.log(res);
let mainData = res.mainData;
let minorData = res.minorData;

View File

@ -147,36 +147,36 @@
</a-col>
</a-row>
</a-col>
<a-col :span="20" v-show="formData.night_vision_mode == 'md_night_vision'">
<a-row style="margin-bottom: 14px">
<a-col :span="6" class="labelText">
防红外过曝
</a-col>
<a-col :span="16">
<a-select v-model:value="formData.smartir" @change="(value) => changeCommon('smartir', value)">
<a-select-option value="auto_ir_ae">自动-增强模式</a-select-option>
<a-select-option value="auto_ir">自动-标准模式</a-select-option>
<a-select-option value="manual">手动</a-select-option>
</a-select>
</a-col>
</a-row>
</a-col>
<a-col :span="20" v-show="formData.night_vision_mode == 'md_night_vision' && formData.smartir == 'manual'">
<a-row style="margin-bottom: 14px">
<a-col :span="6" class="labelText">
防过曝等级
</a-col>
<a-col :span="12">
<a-slider v-model:value="formData.smartir_level" :min="1" :max="100"
@afterChange="(value) => changeCommon('smartir_level', value)" />
</a-col>
<a-col :span="4">
<a-input-number v-model:value="formData.smartir_level" :min="1" :max="100" style="margin-left: 12px"
@change="(value) => changeCommon('smartir_level', value)" />
</a-col>
</a-row>
</a-col>
<a-col :span="20">
<!-- <a-col :span="20" v-show="formData.night_vision_mode == 'inf_night_vision'">-->
<!-- <a-row style="margin-bottom: 14px">-->
<!-- <a-col :span="6" class="labelText">-->
<!-- 防红外过曝-->
<!-- </a-col>-->
<!-- <a-col :span="16">-->
<!-- <a-select v-model:value="formData.smartir" @change="(value) => changeCommon('smartir', value)">-->
<!-- <a-select-option value="auto_ir_ae">自动-增强模式</a-select-option>-->
<!-- <a-select-option value="auto_ir">自动-标准模式</a-select-option>-->
<!-- <a-select-option value="manual">手动</a-select-option>-->
<!-- </a-select>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </a-col>-->
<!-- <a-col :span="20" v-show="formData.night_vision_mode == 'inf_night_vision' && formData.smartir == 'manual'">-->
<!-- <a-row style="margin-bottom: 14px">-->
<!-- <a-col :span="6" class="labelText">-->
<!-- 防过曝等级-->
<!-- </a-col>-->
<!-- <a-col :span="12">-->
<!-- <a-slider v-model:value="formData.smartir_level" :min="1" :max="100"-->
<!-- @afterChange="(value) => changeCommon('smartir_level', value)" />-->
<!-- </a-col>-->
<!-- <a-col :span="4">-->
<!-- <a-input-number v-model:value="formData.smartir_level" :min="1" :max="100" style="margin-left: 12px"-->
<!-- @change="(value) => changeCommon('smartir_level', value)" />-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </a-col>-->
<a-col :span="20" v-show="formData.night_vision_mode !== 'inf_night_vision'">
<a-row style="margin-bottom: 14px">
<a-col :span="6" class="labelText">
白光强度
@ -190,7 +190,7 @@
</a-col>
</a-row>
</a-col>
<a-col :span="20" v-show="formData.smartwtl == 'manual'">
<a-col :span="20" v-show="formData.night_vision_mode !== 'inf_night_vision' && formData.smartwtl == 'manual'">
<a-row style="margin-bottom: 14px">
<a-col :span="6" class="labelText">
白光等级
@ -230,6 +230,8 @@ import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'
import {
getImageCommon,
setImageCommon,
getImageSwitch,
setImageSwitch,
configRecovery,
getPreviewUrl,
} from "../camera.api";
@ -349,7 +351,7 @@ function getCommon(deviceIndex) {
"deviceIndex": deviceIndex,
"type": "common"
}).then(res => {
formData.chroma = strToInt(res.chroma); //
// formData.chroma = strToInt(res.chroma); //
formData.luma = strToInt(res.luma); //
formData.sharpness = strToInt(res.sharpness); //
formData.saturation = strToInt(res.saturation); //
@ -378,7 +380,7 @@ function getSwitch(deviceIndex) {
if (deviceIndex == null) {
return
}
getImageCommon({
getImageSwitch({
"deviceIndex": deviceIndex,
"type": "switch"
}).then(res => {
@ -392,11 +394,11 @@ function getSwitch(deviceIndex) {
* @param paramKey
* @param paramValue
*/
function setCommon(paramKey, paramValue) {
function setCommon(paramObj, type) {
setImageCommon({
"deviceIndex": formData.deviceIndex,
"type": formData.deviceIndex,
paramKey: paramValue
"type": type,
"param": paramObj
}).then(res => { });
}
@ -406,7 +408,7 @@ function setCommon(paramKey, paramValue) {
* @param type
*/
function setCommonSwitch(paramObj, type) {
setImageCommon({
setImageSwitch({
"deviceIndex": formData.deviceIndex,
"type": type,
"param": paramObj
@ -421,7 +423,7 @@ function setCommonSwitch(paramObj, type) {
function changeCommon(attr, value) {
let param = {};
param[attr] = value;
setCommonSwitch(param, "common");
setCommon(param, "common");
}
/**

View File

@ -98,7 +98,8 @@
const formData = reactive<Record<string, any>>({
deviceIndex: '', //
parentId: '',
channel: '',
weekData:'',
dateData:'',
timeData:'',
@ -154,6 +155,7 @@
getOsd({
"deviceIndex": deviceIndex
}).then(res=>{
console.log(res);
if(res.date.enabled == "on"){
formData.dateEnabled = true;
}else{

View File

@ -145,6 +145,7 @@
projectId: '' ,//ID
regionId: '' ,//ID
ip: '' ,//IP
channel: ''
});
const cameraData = ref({});
const activeKey = ref('A');
@ -219,6 +220,7 @@ function edit(record) {
formData.multitrans = record.multitrans;
formData.projectId = record.projectId;
formData.regionId = record.regionId;
formData.channel = record.channel;
formData.ip = record.ip;
cameraData.value.deviceIndex = formData.deviceIndex;
@ -228,9 +230,7 @@ function edit(record) {
cameraData.value.multitrans = formData.multitrans;
cameraData.value.scale = formData.scale;
cameraData.value.parentId = formData.parentId;
cameraData.value.channel = formData.channel;
}
function destroyPlayer(){

View File

@ -110,10 +110,10 @@
import { getValueType } from '/@/utils';
import { Form } from 'ant-design-vue';
import {
getImageCommon,
getImageSwitch,
setImageSwitch,
getMultitransUrl,
getPreviewUrl,
setImageCommon,
testAudio,
motionCtrl
} from "../camera.api";
@ -284,7 +284,7 @@
if(formData.deviceIndex==null){
return
}
getImageCommon({
getImageSwitch({
"deviceIndex": formData.deviceIndex,
"type": "switch"
}).then(res=>{
@ -298,7 +298,7 @@
function changeSwitch(attr,value){
let param = {};
param[attr] = value;
setImageCommon({
setImageSwitch({
"deviceIndex": formData.deviceIndex,
"type": "switch",
"param": param

View File

@ -79,12 +79,11 @@ import { useMessage } from '@/hooks/web/useMessage';
import { getValueType } from '@/utils';
import { Form } from 'ant-design-vue';
import {
getImageCommon,
getImageSwitch,
setImageSwitch,
getMultitransUrl,
getPreviewUrl,
setImageCommon,
testAudio,
motionCtrl
testAudio
} from "../camera.api";
const props = defineProps({
@ -299,7 +298,7 @@ function getSwitch() {
if (formData.deviceIndex == null) {
return
}
getImageCommon({
getImageSwitch({
"deviceIndex": formData.deviceIndex,
"type": "switch"
}).then(res => {
@ -313,7 +312,7 @@ function getSwitch() {
function changeSwitch(attr, value) {
let param = {};
param[attr] = value;
setImageCommon({
setImageSwitch({
"deviceIndex": formData.deviceIndex,
"type": "switch",
"param": param

View File

@ -78,7 +78,7 @@ import {ref, reactive, createVNode, h, onMounted, watch, unref,nextTick} from 'v
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './camera.data';
import {getImageCommon, list, syncAllDevices,syncDevicesStatus} from './camera.api';
import {getImageCommon, getDeviceDetails, list, syncAllDevices,syncDevicesStatus} from './camera.api';
import { useUserStore } from '/@/store/modules/user';
// import { useDrawer } from "@/components/Drawer";
import { useRouter } from 'vue-router';
@ -157,9 +157,8 @@ function handlePreview(record: Recordable) {
if (record.deviceIndex == null) {
return
}
getImageCommon({
"deviceIndex": record.deviceIndex,
"type": "switch"
getDeviceDetails({
"deviceIndex": record.deviceIndex
}).then(res => {
previewModal.value.disableSubmit = true;
previewModal.value.edit(record);
@ -182,9 +181,8 @@ function handlePicConfig(record) {
if (record.deviceIndex == null) {
return
}
getImageCommon({
"deviceIndex": record.deviceIndex,
"type": "switch"
getDeviceDetails({
"deviceIndex": record.deviceIndex
}).then(res => {
var params = {
deviceIndex: record.deviceIndex,