[1078] 增加连接到指定服务器

This commit is contained in:
lin 2025-07-17 15:12:23 +08:00
parent f7b35e8e14
commit 47e4f2343b
6 changed files with 155 additions and 77 deletions

View File

@ -1,10 +1,12 @@
package com.genersoft.iot.vmp.jt1078.bean; package com.genersoft.iot.vmp.jt1078.bean;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/** /**
* JT 终端控制 * JT 终端控制
*/ */
@Data
@Schema(description = "终端控制") @Schema(description = "终端控制")
public class JTDeviceConnectionControl { public class JTDeviceConnectionControl {
@ -52,78 +54,6 @@ public class JTDeviceConnectionControl {
*/ */
private Long timeLimit; private Long timeLimit;
public Boolean getSwitchOn() {
return switchOn;
}
public void setSwitchOn(Boolean switchOn) {
this.switchOn = switchOn;
}
public String getAuthentication() {
return authentication;
}
public void setAuthentication(String authentication) {
this.authentication = authentication;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getTcpPort() {
return tcpPort;
}
public void setTcpPort(Integer tcpPort) {
this.tcpPort = tcpPort;
}
public Integer getUdpPort() {
return udpPort;
}
public void setUdpPort(Integer udpPort) {
this.udpPort = udpPort;
}
public Long getTimeLimit() {
return timeLimit;
}
public void setTimeLimit(Long timeLimit) {
this.timeLimit = timeLimit;
}
@Override @Override
public String toString() { public String toString() {
return "JTDeviceConnectionControl{" + return "JTDeviceConnectionControl{" +

View File

@ -436,7 +436,7 @@ public class JT1078Controller {
service.setConfig(config.getPhoneNumber(), config.getConfig()); service.setConfig(config.getPhoneNumber(), config.getConfig());
} }
@Operation(summary = "终端控制-连接", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "终端控制-连接指定的服务器", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "control", description = "终端控制参数", required = true) @Parameter(name = "control", description = "终端控制参数", required = true)
@PostMapping("/control/connection") @PostMapping("/control/connection")
public void connectionControl(@RequestBody ConnectionControlParam control){ public void connectionControl(@RequestBody ConnectionControlParam control){

View File

@ -300,5 +300,12 @@ export function reset(phoneNumber) {
} }
}) })
} }
export function connection(data) {
return request({
method: 'post',
url: '/api/jt1078/control/connection',
data: data
})
}

View File

@ -1,6 +1,6 @@
import { import {
add, add,
addChannel, controlPlayback, deleteDevice, factoryReset, addChannel, connection, controlPlayback, deleteDevice, factoryReset,
fillLight, getRecordTempUrl, linkDetection, fillLight, getRecordTempUrl, linkDetection,
play, ptz, queryAttribute, play, ptz, queryAttribute,
queryChannels, queryConfig, queryChannels, queryConfig,
@ -290,6 +290,16 @@ const actions = {
reject(error) reject(error)
}) })
}) })
},
connection({ commit }, data) {
return new Promise((resolve, reject) => {
connection(data).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
} }
} }

View File

@ -0,0 +1,124 @@
<template>
<div id="configInfo">
<el-dialog
v-el-drag-dialog
title="连接到指定的服务器"
width="=80%"
top="2rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<div style="padding: 0 20px 0 10px">
<el-form label-width="110px">
<el-form-item label="服务类型">
<el-radio-group v-model="form.switchOn">
<el-radio :label="false" border>指定监管平台服务器</el-radio>
<el-radio :label="true" border>原缺省监控平台服务器</el-radio>
</el-radio-group>
</el-form-item>
<div v-if="form.switchOn != null && !form.switchOn">
<el-form-item label="平台鉴权码">
<el-input type="input" v-model="form.authentication" ></el-input>
</el-form-item>
<el-form-item label="拨号点名称">
<el-input type="input" v-model="form.name" ></el-input>
</el-form-item>
<el-form-item label="拨号用户名">
<el-input type="input" v-model="form.username" ></el-input>
</el-form-item>
<el-form-item label="拨号密码">
<el-input type="input" v-model="form.password" ></el-input>
</el-form-item>
<el-form-item label="IP地址">
<el-input type="input" v-model="form.address" ></el-input>
</el-form-item>
<el-form-item label="TCP端口">
<el-input type="input" v-model="form.tcpPort" ></el-input>
</el-form-item>
<el-form-item label="UDP端口">
<el-input type="input" v-model="form.udpPort" ></el-input>
</el-form-item>
<el-form-item label="时限">
<el-input type="input" v-model="form.timeLimit" ></el-input>
</el-form-item>
</div>
<el-form-item style="text-align: right">
<el-button type="primary" @click="onSubmit">确认</el-button>
<el-button @click="close" >取消</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
export default {
name: 'ConnectionServer',
directives: { elDragDialog },
props: {},
data() {
return {
showDialog: false,
phoneNumber: null,
form: {
switchOn: null,
authentication: null,
name: null,
username: null,
password: null,
address: null,
tcpPort: null,
udpPort: null,
timeLimit: null,
sign: 0, // : 0:,1:
destPhoneNumber: null //
}
}
},
computed: {},
created() {},
methods: {
openDialog: function(data) {
this.showDialog = true
this.phoneNumber = data
this.form = {
switchOn: null,
authentication: null,
name: null,
username: null,
password: null,
address: null,
tcpPort: null,
udpPort: null,
timeLimit: null,
sign: 0, // : 0:,1:
destPhoneNumber: null //
}
},
close: function() {
this.showDialog = false
},
onSubmit: function() {
this.$store.dispatch('jtDevice/connection', {
phoneNumber: this.phoneNumber,
control: this.form
})
.then(data => {
this.$message.success({
showClose: true,
message: '发送成功'
})
this.close()
})
}
}
}
</script>

View File

@ -123,6 +123,8 @@
终端复位</el-dropdown-item> 终端复位</el-dropdown-item>
<el-dropdown-item command="factoryReset" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="factoryReset" v-bind:disabled="!scope.row.status" >
恢复出厂</el-dropdown-item> 恢复出厂</el-dropdown-item>
<el-dropdown-item command="connection" v-bind:disabled="!scope.row.status" >
连接指定服务器</el-dropdown-item>
<el-dropdown-item command="door" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="door" v-bind:disabled="!scope.row.status" >
车门控制</el-dropdown-item> 车门控制</el-dropdown-item>
<el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status" >
@ -149,6 +151,7 @@
<textMsg ref="textMsg" /> <textMsg ref="textMsg" />
<telephoneCallback ref="telephoneCallback" /> <telephoneCallback ref="telephoneCallback" />
<driverInfo ref="driverInfo" /> <driverInfo ref="driverInfo" />
<connectionServer ref="connectionServer" />
</div> </div>
</template> </template>
@ -160,11 +163,12 @@ import position from './dialog/position.vue'
import textMsg from './dialog/textMsg.vue' import textMsg from './dialog/textMsg.vue'
import telephoneCallback from './dialog/telephoneCallback.vue' import telephoneCallback from './dialog/telephoneCallback.vue'
import driverInfo from './dialog/driverInfo.vue' import driverInfo from './dialog/driverInfo.vue'
import connectionServer from './dialog/connectionServer.vue'
export default { export default {
name: 'App', name: 'App',
components: { components: {
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer
}, },
data() { data() {
return { return {
@ -263,8 +267,6 @@ export default {
moreClick: function(command, itemData) { moreClick: function(command, itemData) {
if (command === 'params') { if (command === 'params') {
this.showParam(itemData) this.showParam(itemData)
} else if (command === 'connection') {
// this.queryCloudRecords(itemData)
} else if (command === 'attribute') { } else if (command === 'attribute') {
this.queryAttribute(itemData) this.queryAttribute(itemData)
} else if (command === 'linkDetection') { } else if (command === 'linkDetection') {
@ -281,6 +283,8 @@ export default {
this.factoryReset(itemData) this.factoryReset(itemData)
} else if (command === 'reset') { } else if (command === 'reset') {
this.reset(itemData) this.reset(itemData)
} else if (command === 'connection') {
this.connection(itemData)
} else { } else {
this.$message.info('尚不支持') this.$message.info('尚不支持')
} }
@ -352,6 +356,9 @@ export default {
}) })
}, },
connection: function(itemData) {
this.$refs.connectionServer.openDialog(itemData.phoneNumber)
},
linkDetection: function(itemData) { linkDetection: function(itemData) {
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber) this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
.then((data) => { .then((data) => {