[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

@@ -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 {
add,
addChannel, controlPlayback, deleteDevice, factoryReset,
addChannel, connection, controlPlayback, deleteDevice, factoryReset,
fillLight, getRecordTempUrl, linkDetection,
play, ptz, queryAttribute,
queryChannels, queryConfig,
@@ -290,6 +290,16 @@ const actions = {
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 command="factoryReset" v-bind:disabled="!scope.row.status" >
恢复出厂</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>
<el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status" >
@@ -149,6 +151,7 @@
<textMsg ref="textMsg" />
<telephoneCallback ref="telephoneCallback" />
<driverInfo ref="driverInfo" />
<connectionServer ref="connectionServer" />
</div>
</template>
@@ -160,11 +163,12 @@ import position from './dialog/position.vue'
import textMsg from './dialog/textMsg.vue'
import telephoneCallback from './dialog/telephoneCallback.vue'
import driverInfo from './dialog/driverInfo.vue'
import connectionServer from './dialog/connectionServer.vue'
export default {
name: 'App',
components: {
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer
},
data() {
return {
@@ -263,8 +267,6 @@ export default {
moreClick: function(command, itemData) {
if (command === 'params') {
this.showParam(itemData)
} else if (command === 'connection') {
// this.queryCloudRecords(itemData)
} else if (command === 'attribute') {
this.queryAttribute(itemData)
} else if (command === 'linkDetection') {
@@ -281,6 +283,8 @@ export default {
this.factoryReset(itemData)
} else if (command === 'reset') {
this.reset(itemData)
} else if (command === 'connection') {
this.connection(itemData)
} else {
this.$message.info('尚不支持')
}
@@ -352,6 +356,9 @@ export default {
})
},
connection: function(itemData) {
this.$refs.connectionServer.openDialog(itemData.phoneNumber)
},
linkDetection: function(itemData) {
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
.then((data) => {