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', edit = '/iot/tplink/cameraInfo/edit',
rebootDevice = '/iot/tplink/cameraInfo/rebootDevice', rebootDevice = '/iot/tplink/cameraInfo/rebootDevice',
previewUrl = '/iot/tplink/cameraInfo/getPreviewUrl', previewUrl = '/iot/tplink/cameraInfo/getPreviewUrl',
getDeviceDetails = '/iot/tplink/cameraInfo/getDeviceDetails',
getImageCommon = '/iot/tplink/cameraInfo/getImageCommon', getImageCommon = '/iot/tplink/cameraInfo/getImageCommon',
setImageCommon = '/iot/tplink/cameraInfo/setImageCommon', setImageCommon = '/iot/tplink/cameraInfo/setImageCommon',
getImageSwitch = '/iot/tplink/cameraInfo/getImageSwitch',
setImageSwitch = '/iot/tplink/cameraInfo/setImageSwitch',
getOsdCapability = '/iot/tplink/cameraInfo/getOsdCapability', getOsdCapability = '/iot/tplink/cameraInfo/getOsdCapability',
getOsd = '/iot/tplink/cameraInfo/getOsd', getOsd = '/iot/tplink/cameraInfo/getOsd',
setOsd = '/iot/tplink/cameraInfo/setOsd', setOsd = '/iot/tplink/cameraInfo/setOsd',
@ -130,6 +133,12 @@ export const rebootDevice = (params) => {
return defHttp.post({ url: Api.rebootDevice, params }); return defHttp.post({ url: Api.rebootDevice, params });
} }
/**
*
* @param params
*/
export const getDeviceDetails = (params) => defHttp.get({ url: Api.getDeviceDetails, params });
/** /**
* *
* @param 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 }); 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能力集参数 * OSD能力集参数
* @param params * @param params

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</a-col> </a-col>
<!-- <a-col :span="24"> <!-- <a-col :span="24">
@ -110,10 +110,10 @@
import { getValueType } from '/@/utils'; import { getValueType } from '/@/utils';
import { Form } from 'ant-design-vue'; import { Form } from 'ant-design-vue';
import { import {
getImageCommon, getImageSwitch,
setImageSwitch,
getMultitransUrl, getMultitransUrl,
getPreviewUrl, getPreviewUrl,
setImageCommon,
testAudio, testAudio,
motionCtrl motionCtrl
} from "../camera.api"; } from "../camera.api";
@ -284,7 +284,7 @@
if(formData.deviceIndex==null){ if(formData.deviceIndex==null){
return return
} }
getImageCommon({ getImageSwitch({
"deviceIndex": formData.deviceIndex, "deviceIndex": formData.deviceIndex,
"type": "switch" "type": "switch"
}).then(res=>{ }).then(res=>{
@ -298,7 +298,7 @@
function changeSwitch(attr,value){ function changeSwitch(attr,value){
let param = {}; let param = {};
param[attr] = value; param[attr] = value;
setImageCommon({ setImageSwitch({
"deviceIndex": formData.deviceIndex, "deviceIndex": formData.deviceIndex,
"type": "switch", "type": "switch",
"param": param "param": param
@ -499,7 +499,7 @@
.fxjImgRight:hover{ .fxjImgRight:hover{
background: url('../../../../../assets/iot/fxj_blue.png') center/contain no-repeat; background: url('../../../../../assets/iot/fxj_blue.png') center/contain no-repeat;
} }
.selectDiv{ .selectDiv{
text-align: center; text-align: center;
border: 1px solid #f6faff; border: 1px solid #f6faff;

View File

@ -79,12 +79,11 @@ import { useMessage } from '@/hooks/web/useMessage';
import { getValueType } from '@/utils'; import { getValueType } from '@/utils';
import { Form } from 'ant-design-vue'; import { Form } from 'ant-design-vue';
import { import {
getImageCommon, getImageSwitch,
setImageSwitch,
getMultitransUrl, getMultitransUrl,
getPreviewUrl, getPreviewUrl,
setImageCommon, testAudio
testAudio,
motionCtrl
} from "../camera.api"; } from "../camera.api";
const props = defineProps({ const props = defineProps({
@ -299,7 +298,7 @@ function getSwitch() {
if (formData.deviceIndex == null) { if (formData.deviceIndex == null) {
return return
} }
getImageCommon({ getImageSwitch({
"deviceIndex": formData.deviceIndex, "deviceIndex": formData.deviceIndex,
"type": "switch" "type": "switch"
}).then(res => { }).then(res => {
@ -313,7 +312,7 @@ function getSwitch() {
function changeSwitch(attr, value) { function changeSwitch(attr, value) {
let param = {}; let param = {};
param[attr] = value; param[attr] = value;
setImageCommon({ setImageSwitch({
"deviceIndex": formData.deviceIndex, "deviceIndex": formData.deviceIndex,
"type": "switch", "type": "switch",
"param": param "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 { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './camera.data'; 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 { useUserStore } from '/@/store/modules/user';
// import { useDrawer } from "@/components/Drawer"; // import { useDrawer } from "@/components/Drawer";
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -157,9 +157,8 @@ function handlePreview(record: Recordable) {
if (record.deviceIndex == null) { if (record.deviceIndex == null) {
return return
} }
getImageCommon({ getDeviceDetails({
"deviceIndex": record.deviceIndex, "deviceIndex": record.deviceIndex
"type": "switch"
}).then(res => { }).then(res => {
previewModal.value.disableSubmit = true; previewModal.value.disableSubmit = true;
previewModal.value.edit(record); previewModal.value.edit(record);
@ -182,9 +181,8 @@ function handlePicConfig(record) {
if (record.deviceIndex == null) { if (record.deviceIndex == null) {
return return
} }
getImageCommon({ getDeviceDetails({
"deviceIndex": record.deviceIndex, "deviceIndex": record.deviceIndex
"type": "switch"
}).then(res => { }).then(res => {
var params = { var params = {
deviceIndex: record.deviceIndex, deviceIndex: record.deviceIndex,