diff --git a/vue/src/api/iot/device.js b/vue/src/api/iot/device.js index 8a242723..b3dad975 100644 --- a/vue/src/api/iot/device.js +++ b/vue/src/api/iot/device.js @@ -2,38 +2,38 @@ import request from '@/utils/request'; // 查询设备列表 export function listDevice(query) { - return request({ - url: '/iot/device/list', - method: 'get', - params: query, - }); + return request({ + url: '/iot/device/list', + method: 'get', + params: query, + }); } // 查询未授权设备列表 export function listUnAuthDevice(query) { - return request({ - url: '/iot/device/unAuthlist', - method: 'get', - params: query, - }); + return request({ + url: '/iot/device/unAuthlist', + method: 'get', + params: query, + }); } // 查询分组可添加设备分页列表 export function listDeviceByGroup(query) { - return request({ - url: '/iot/device/listByGroup', - method: 'get', - params: query, - }); + return request({ + url: '/iot/device/listByGroup', + method: 'get', + params: query, + }); } // 查询设备简短列表 export function listDeviceShort(query) { - return request({ - url: '/iot/device/shortList', - method: 'get', - params: query, - }); + return request({ + url: '/iot/device/shortList', + method: 'get', + params: query, + }); } // 查询设备变量概况 @@ -47,109 +47,117 @@ export function listThingsModel(query) { // 查询所有设备简短列表 export function listAllDeviceShort() { - return request({ - url: '/iot/device/all', - method: 'get', - }); + return request({ + url: '/iot/device/all', + method: 'get', + }); } // 查询设备详细 export function getDevice(deviceId) { - return request({ - url: '/iot/device/' + deviceId, - method: 'get', - }); + return request({ + url: '/iot/device/' + deviceId, + method: 'get', + }); } // 设备数据同步 export function deviceSynchronization(serialNumber) { - return request({ - url: '/iot/device/synchronization/' + serialNumber, - method: 'get', - }); + return request({ + url: '/iot/device/synchronization/' + serialNumber, + method: 'get', + }); } // 根据设备编号查询设备详细 export function getDeviceBySerialNumber(serialNumber) { - return request({ - url: '/iot/device/getDeviceBySerialNumber/' + serialNumber, - method: 'get', - }); + return request({ + url: '/iot/device/getDeviceBySerialNumber/' + serialNumber, + method: 'get', + }); } // 查询设备统计信息 export function getDeviceStatistic() { - return request({ - url: '/iot/device/statistic', - method: 'get', - }); + return request({ + url: '/iot/device/statistic', + method: 'get', + }); } // 查询设备运行状态详细 export function getDeviceRunningStatus(params) { - return request({ - url: '/iot/device/runningStatus', - method: 'get', - params: params, - }); + return request({ + url: '/iot/device/runningStatus', + method: 'get', + params: params, + }); } // 查询设备物模型的值 export function getDeviceThingsModelValue(deviceId) { - return request({ - url: '/iot/device/thingsModelValue/' + deviceId, - method: 'get', - }); + return request({ + url: '/iot/device/thingsModelValue/' + deviceId, + method: 'get', + }); } // 新增设备 export function addDevice(data) { - return request({ - url: '/iot/device', - method: 'post', - data: data, - }); + return request({ + url: '/iot/device', + method: 'post', + data: data, + }); } // 修改设备 export function updateDevice(data) { - return request({ - url: '/iot/device', - method: 'put', - data: data, - }); + return request({ + url: '/iot/device', + method: 'put', + data: data, + }); } // 删除设备 export function delDevice(deviceId) { - return request({ - url: '/iot/device/' + deviceId, - method: 'delete', - }); + return request({ + url: '/iot/device/' + deviceId, + method: 'delete', + }); } // 生成设备编号 export function generatorDeviceNum(params) { - return request({ - url: '/iot/device/generator', - method: 'get', - params: params, - }); + return request({ + url: '/iot/device/generator', + method: 'get', + params: params, + }); } export function getGwDevCode(params) { - return request({ - url: '/iot/device/gwDevCount', - method: 'get', - params: params, - }); + return request({ + url: '/iot/device/gwDevCount', + method: 'get', + params: params, + }); } //mqtt连接参数查看 export function getMqttConnect(params) { - return request({ - url: '/iot/device/getMqttConnectData', - method: 'get', - params: params, - }); + return request({ + url: '/iot/device/getMqttConnectData', + method: 'get', + params: params, + }); +} + +//获取国标配置信息 +export function getSipConfig(deviceSipId) { + return request({ + url: '/sip/sipconfig/auth/' + deviceSipId, + method: 'get', + }); } diff --git a/vue/src/views/iot/device/device-edit.vue b/vue/src/views/iot/device/device-edit.vue index be60a6fd..597f1756 100644 --- a/vue/src/views/iot/device/device-edit.vue +++ b/vue/src/views/iot/device/device-edit.vue @@ -1,6 +1,7 @@ - - {{ $t('device.device-edit.148398-6') }} + + {{ + $t('device.device-edit.148398-6') + }} @@ -25,81 +30,109 @@ * {{ $t('device.device-edit.148398-7') }} - - {{ $t('device.device-edit.148398-9') }} - {{ $t('device.device-edit.148398-9') }} + + {{ $t('device.device-edit.148398-9') + }} + {{ + $t('device.device-edit.148398-9') }} - + - + - + - + - - + + - - {{ $t('device.device-edit.148398-23') }} + + {{ $t('device.device-edit.148398-23') + }} - - {{ $t('device.device-edit.148398-23') }} + + {{ $t('device.device-edit.148398-23') + }} - + - + - + - + - - - {{ $t('device.device-edit.148398-35') }} - {{ $t('device.device-edit.148398-36') }} + + + {{ $t('device.device-edit.148398-35') + }} + {{ $t('device.device-edit.148398-36') + }} -
-
{{ $t('device.device-edit.148398-37') }}
+
+
{{ $t('device.device-edit.148398-37') + }}
@@ -107,8 +140,12 @@ - {{ $t('device.device-timer.433369-33') }} - {{ $t('device.device-timer.433369-32') }} + {{ + $t('device.device-timer.433369-33') }} + {{ + $t('device.device-timer.433369-32') }} @@ -118,31 +155,34 @@ - + {{ $t('device.device-edit.148398-42') }} - - - + + + {{ $t('device.device-edit.148398-45') }} - + {{ $t('device.device-edit.148398-47') }} - + {{ $t('device.device-user.037521-12') }} - + {{ $t('device.device-edit.148398-49') }} - + {{ $t('device.device-edit.148398-50') }} @@ -156,7 +196,8 @@ - {{ $t('device.device-edit.148398-53') }} + {{ $t('device.device-edit.148398-53') + }} @@ -165,14 +206,16 @@ -
+
-
+
{{ $t('device.device-edit.148398-56') }}
@@ -189,29 +232,82 @@
{{ $t('device.device-edit.148398-56') }}
- - - - + + + + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -230,7 +326,7 @@ import deviceTimer from './device-timer'; import DeviceFunc from './device-functionlog'; import vueQr from 'vue-qr'; import { loadBMap } from '@/utils/map.js'; -import { deviceSynchronization, getDevice, addDevice, updateDevice, generatorDeviceNum, getMqttConnect } from '@/api/iot/device'; +import { deviceSynchronization, getDevice, addDevice, updateDevice, generatorDeviceNum, getMqttConnect, getSipConfig } from '@/api/iot/device'; import { getDeviceRunningStatus } from '@/api/iot/device'; import { cacheJsonThingsModel } from '@/api/iot/model'; import deviceLiveStream from '@/views/components/player/deviceLiveStream'; @@ -320,8 +416,19 @@ export default { clientId: 0, username: '', passwd: '', - subscribeTopic: '', - reportTopic: '', + port: '', + }, + GBform: { + domainAlias: '', + serverSipid: '', + password: '', + port: '', + }, + httpForm: { + type: '', + username: '', + password: '', + clientId: '', port: '', }, openTip: false, @@ -486,7 +593,7 @@ export default { //获取子组件订阅的设备状态 getDeviceStatusData(status) { - this.form.status = status; + this.form.status = status; }, getPlayerData(data) { this.activeName = data.tabName; @@ -881,7 +988,7 @@ export default { this.form.serialNumber = devsipid; }, // 获取选中的用户 - getUserData(user) {}, + getUserData(user) { }, /**关闭物模型 */ openSummaryDialog() { let json = { @@ -898,9 +1005,9 @@ export default { this.openSummary = false; this.openViewMqtt = false; }, - doCopy(type) { - if (type == 2) { - const input = document.createElement('input'); + doCopy() { + const input = document.createElement('input'); + if (this.form.transport == 'MQTT' || this.form.transport == 'COAP') { input.value = '{"clientId":"' + this.listQuery.clientId + @@ -915,12 +1022,39 @@ export default { '","port":"' + this.listQuery.port + '"}'; - document.body.appendChild(input); - input.select(); //选中输入框 - document.execCommand('Copy'); //复制当前选中文本到前切板 - document.body.removeChild(input); - this.$message.success('复制成功'); + } else if (this.form.transport == 'TCP') { + input.value = '{enrollPackage:' + this.listQuery.enrollPackage + ',port:' + this.listQuery.port + '}'; + } else if (this.form.transport == 'HTTP') { + input.value = + '{clientId:' + + this.httpForm.clientId + + ',type:' + + this.httpForm.type + + ',username:' + + this.httpForm.username + + ',password:' + + this.httpForm.password + + '","port":"' + + this.httpForm.port + + '"}'; } + if (this.form.transport == 'GB28181') { + input.value = + '{domainAlias:' + + this.GBform.domainAlias + + ',serverSipid:' + + this.GBform.serverSipid + + ',password:' + + this.GBform.password + + ',port:' + + this.GBform.port + + '}'; + } + document.body.appendChild(input); + input.select(); //选中输入框 + document.execCommand('Copy'); //复制当前选中文本到剪切板 + document.body.removeChild(input); + this.$message.success(this.$t('device.device-edit.148398-71')); }, openCodeDialog() { let json = { @@ -967,15 +1101,35 @@ export default { handleViewMqtt() { this.openViewMqtt = true; this.loading = true; - const params = { - deviceId: this.form.deviceId, - }; - getMqttConnect(params).then((response) => { - if (response.code == 200) { - this.listQuery = response.data; - this.loading = false; - } - }); + if (this.form.transport === 'MQTT' || this.form.transport === 'TCP' || this.form.transport === 'COAP') { + const params = { + deviceId: this.form.deviceId, + }; + getMqttConnect(params).then((response) => { + if (response.code == 200) { + this.listQuery = response.data; + this.loading = false; + } + }); + } else if (this.form.transport === 'GB28181') { + const deviceSipId = this.form.deviceId; + getSipConfig(deviceSipId).then((response) => { + if (response.code == 200) { + this.GBform = response.data; + this.loading = false; + } + }); + } else if (this.form.transport === 'HTTP') { + const params = { + deviceId: this.form.deviceId, + }; + getHttpConfig(params).then((response) => { + if (response.code == 200) { + this.httpForm = response.data; + this.loading = false; + } + }); + } }, }, }; diff --git a/vue/src/views/iot/sip/sipidGen.vue b/vue/src/views/iot/sip/sipidGen.vue index 1861301e..473d2ff7 100644 --- a/vue/src/views/iot/sip/sipidGen.vue +++ b/vue/src/views/iot/sip/sipidGen.vue @@ -1,21 +1,27 @@