diff --git a/src/views/iot/tplink/camera/camera.api.ts b/src/views/iot/tplink/camera/camera.api.ts index d49b2f3..31ab793 100644 --- a/src/views/iot/tplink/camera/camera.api.ts +++ b/src/views/iot/tplink/camera/camera.api.ts @@ -38,6 +38,7 @@ enum Api { getPlaybackUrlList = '/iot/tplink/cameraInfo/getPlaybackUrlList', deletePlaybackChn = '/iot/tplink/cameraInfo/deletePlaybackChn', getMultitransUrl = '/iot/tplink/cameraInfo/getMultitransUrl', + requestBidirectionStream = '/iot/tplink/cameraInfo/requestBidirectionStream', getRecordCfgs = '/iot/tplink/cameraInfo/getRecordCfgs', setRecordCfgs = '/iot/tplink/cameraInfo/setRecordCfgs', getBatchProgress = '/iot/tplink/cameraInfo/getBatchProgress', @@ -277,6 +278,12 @@ export const deletePlaybackChn = (params) => defHttp.get({ url: Api.deletePlayba */ export const getMultitransUrl = (params) => defHttp.get({ url: Api.getMultitransUrl, params }); +/** + * 获取对讲通信URL + * @param params + */ +export const requestBidirectionStream = (params) => defHttp.get({ url: Api.requestBidirectionStream, params }); + /** * 获取录像配置--暂无用 * @param params diff --git a/src/views/iot/tplink/camera/components/CameraPreviewModal.vue b/src/views/iot/tplink/camera/components/CameraPreviewModal.vue index 30e3f86..926444f 100644 --- a/src/views/iot/tplink/camera/components/CameraPreviewModal.vue +++ b/src/views/iot/tplink/camera/components/CameraPreviewModal.vue @@ -82,6 +82,7 @@ import { getImageSwitch, setImageSwitch, getMultitransUrl, + requestBidirectionStream, getPreviewUrl, testAudio } from "../camera.api"; @@ -188,12 +189,17 @@ function handleCancel() { * 开始电话 */ function startPhone() { - getMultitransUrl({ + // getMultitransUrl({ + requestBidirectionStream({ "videoDevId": formData.deviceIndex }).then(res => { + console.log("url:"+res.url); + console.log("wssUrl:"+res.wssUrl); + console.log("slpData:"+res.slpData); player.value.startVoiceIntercom({ "url": res.url, // 该url为一次性 需要通过接口实时获取 "wssUrl": res.wssUrl, + "slpData": res.slpData,//requestBidirectionStream接口响应的result数据(使用getMultitransUrl接口获取url时不需要传此参数) "mode": "half_duplex" }); izPhone.value = true; @@ -233,7 +239,7 @@ async function createPreview() { socket: formData.wssUrl, // websocket地址, getPreviewUrl接口获取 pluginPath: '/static', // 当sdk资源不在根路径下时,需配置pluginPath talkEnable: true, - useMultitrans: true, + useMultitrans: false, }); let isPlaying = player.value.isPlaying(); diff --git a/src/views/iotManager/components/DeviceUpdateForm.vue b/src/views/iotManager/components/DeviceUpdateForm.vue new file mode 100644 index 0000000..1fd3deb --- /dev/null +++ b/src/views/iotManager/components/DeviceUpdateForm.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/src/views/iotManager/components/DeviceUpdateModal.vue b/src/views/iotManager/components/DeviceUpdateModal.vue new file mode 100644 index 0000000..564d3d9 --- /dev/null +++ b/src/views/iotManager/components/DeviceUpdateModal.vue @@ -0,0 +1,83 @@ + + + + + + diff --git a/src/views/iotManager/components/PreviewList.vue b/src/views/iotManager/components/PreviewList.vue index 72997f3..5020df3 100644 --- a/src/views/iotManager/components/PreviewList.vue +++ b/src/views/iotManager/components/PreviewList.vue @@ -70,6 +70,19 @@ + + + + + @@ -78,20 +91,24 @@ import {ref, reactive, defineExpose, nextTick, createVNode} from 'vue'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { useListPage } from '/@/hooks/system/useListPage'; import { orgDeviceColumns } from '../manager.data'; -import {previewList, releaseDevice, unbindDevice} from '../manager.api'; +import {previewList, releaseDevice, unbindDevice, unbindOrg} from '../manager.api'; import { useUserStore } from '/@/store/modules/user'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import {Modal} from "ant-design-vue"; import {ExclamationCircleOutlined} from "@ant-design/icons-vue"; +import DeviceUpdateModal from './DeviceUpdateModal.vue'; const formRef = ref(); const confirmLoading = ref(false); const queryParam = reactive({}); +const deviceUpdateModal = ref(); const departId = ref(''); const nuId = ref(''); const orgCode = ref(''); const remarks = ref(''); const visible = ref(); +const optType = ref(); +const params = ref(); const userStore = useUserStore(); //注册table数据 const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ @@ -159,40 +176,57 @@ function getTableAction(record) { //换绑 function deviceUpBindManager(record: Recordable){ - + deviceUpdateModal.value.disableSubmit = false; + deviceUpdateModal.value.edit(record); } //释放 function deviceReleaseManager(record: Recordable){ - Modal.confirm({ - title: '设备释放', - width: '500px', - icon: createVNode(ExclamationCircleOutlined), - content: createVNode('div', { style: 'color:red;' }, '确定要释放该设备吗?'), - okText: '确定', - onOk() { - releaseDevice(record).then((res) => {}).catch(() =>{}).finally(() => {reload();}); - }, - onCancel() { - }, - class: 'test', - }); + optType.value = '释放'; + visible.value = true; + params.value = record; + // Modal.confirm({ + // title: '设备释放', + // width: '500px', + // icon: createVNode(ExclamationCircleOutlined), + // content: createVNode('div', { style: 'color:red;' }, '确定要释放该设备吗?'), + // okText: '确定', + // onOk() { + // releaseDevice(record).then((res) => {}).catch(() =>{}).finally(() => {reload();}); + // }, + // onCancel() { + // }, + // class: 'test', + // }); } function deviceUnBindManager(record: Recordable){ - Modal.confirm({ - title: '设备解绑', - width: '500px', - icon: createVNode(ExclamationCircleOutlined), - content: createVNode('div', { style: 'color:red;' }, '确定要解绑该设备吗?'), - okText: '确定', - onOk() { - unbindDevice(record).then((res) => {}).catch(() =>{}).finally(() => {reload();}); - }, - onCancel() { - }, - class: 'test', - }); + optType.value = '解绑'; + visible.value = true; + params.value = record; + // Modal.confirm({ + // title: '设备解绑', + // width: '500px', + // icon: createVNode(ExclamationCircleOutlined), + // content: createVNode('div', { style: 'color:red;' }, '确定要解绑该设备吗?'), + // okText: '确定', + // onOk() { + // unbindDevice(record).then((res) => {}).catch(() =>{}).finally(() => {reload();}); + // }, + // onCancel() { + // }, + // class: 'test', + // }); +} + +function handleOk(){ + let param = params.value; + param["remarks"] = remarks.value; + if(optType.value == '释放'){ + releaseDevice(param).then((res) => {}).catch(() =>{}).finally(() => {visible.value = false;remarks.value='';reload();}); + }else{ + unbindDevice(param).then((res) => {}).catch(() =>{}).finally(() => {visible.value = false;remarks.value='';reload();}); + } } /** diff --git a/src/views/iotManager/index.vue b/src/views/iotManager/index.vue index a128767..a8cc8f7 100644 --- a/src/views/iotManager/index.vue +++ b/src/views/iotManager/index.vue @@ -52,6 +52,18 @@ + + + + @@ -60,7 +72,7 @@ import {ref, reactive, createVNode} from 'vue'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { useListPage } from '/@/hooks/system/useListPage'; import { columns } from './manager.data'; -import {orgList, unbindOrg} from './manager.api'; +import {addBatch, orgList, unbindOrg} from './manager.api'; import { useUserStore } from '/@/store/modules/user'; import OrgDeviceAddModal from './components/OrgDeviceAddModal.vue'; import AreaModal from './components/AreaModal.vue'; @@ -73,7 +85,10 @@ const formRef = ref(); const queryParam = reactive({}); const orgModal = ref(); const areaModal = ref(); +const visible = ref(); const previewModal = ref(); +const orgCode = ref(); +const remarks = ref(''); const userStore = useUserStore(); //注册table数据 const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ @@ -151,7 +166,6 @@ function deviceManager(record: Recordable){ } function handleOrgUnbind(record: Recordable){ - let param = {"orgCode":record.orgCode}; Modal.confirm({ title: '机构解绑', width: '500px', @@ -159,7 +173,7 @@ function handleOrgUnbind(record: Recordable){ content: createVNode('div', { style: 'color:red;' }, '解除当前机构已绑定的所有设备,确定要解绑该机构吗?'), okText: '确定', onOk() { - unbindOrg(param).then((res) => {}).catch(() =>{}).finally(() => {}); + unbindAll(record); }, onCancel() { }, @@ -167,6 +181,19 @@ function handleOrgUnbind(record: Recordable){ }); } +function unbindAll(record: Recordable){ + visible.value = true; + orgCode.value = record.orgCode; +} + +function handleOk(){ + let param = { + "remarks": remarks.value, + "orgCode": orgCode.value, + } + unbindOrg(param).then((res) => {}).catch(() =>{}).finally(() => {visible.value = false;}); +} + /** * 设备预览 */ diff --git a/src/views/iotManager/manager.api.ts b/src/views/iotManager/manager.api.ts index 4bde360..7d22c0d 100644 --- a/src/views/iotManager/manager.api.ts +++ b/src/views/iotManager/manager.api.ts @@ -11,7 +11,9 @@ enum Api { unbindOrg = '/iot/manager/device/unbindOrg', releaseDevice = '/iot/manager/device/releaseDevice', unbindDevice = '/iot/manager/device/unbindDevice', + updateBindDevice = '/iot/manager/device/updateBindDevice', logList = '/iot/manager/log/list', + nulist = '/iot/manager/device/queryNuList', } /** @@ -50,6 +52,11 @@ export const addOrgBatch = (params) => defHttp.post({ url: Api.addOrgBatch, para * 机构解绑 */ export const unbindOrg = (params) => defHttp.post({ url: Api.unbindOrg, params }); +/** + * 换绑 + * @param params + */ +export const updateBindDevice = (params) => defHttp.post({ url: Api.updateBindDevice, params }); /** * 列表接口 * @param params @@ -63,3 +70,8 @@ export const releaseDevice = (params) => defHttp.post({ url: Api.releaseDevice, * 解绑设备 */ export const unbindDevice = (params) => defHttp.post({ url: Api.unbindDevice, params }); +/** + * 接口 + * @param params + */ +export const nulist = (params) => defHttp.get({ url: Api.nulist, params }); diff --git a/src/views/iotManager/manager.data.ts b/src/views/iotManager/manager.data.ts index e44bfd0..959a19b 100644 --- a/src/views/iotManager/manager.data.ts +++ b/src/views/iotManager/manager.data.ts @@ -100,7 +100,7 @@ export const orgDeviceColumns: BasicColumn[] = [ width: 100 }, { - title: '报修状态', + title: '设备状态', align: "center", dataIndex: 'maintainStatus', customRender:({record})=>{