20260418
This commit is contained in:
parent
1eeca994ab
commit
34a9cadc02
@ -109,7 +109,7 @@
|
|||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "lint-staged"
|
"pre-commit": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@ -193,7 +193,9 @@ export default {
|
|||||||
httpPort: 'HTTP Port',
|
httpPort: 'HTTP Port',
|
||||||
webPort: 'Web Port',
|
webPort: 'Web Port',
|
||||||
rtspPort: 'RTSP Port',
|
rtspPort: 'RTSP Port',
|
||||||
rtpPort: 'RTP Port'
|
rtpPort: 'RTP Port',
|
||||||
|
portConflict: ' Conflict',
|
||||||
|
PortNumbersCannotBeTheSame: 'The ports cannot be the same'
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
change: 'Change Theme',
|
change: 'Change Theme',
|
||||||
|
|||||||
@ -193,7 +193,9 @@ export default {
|
|||||||
httpPort: 'Porta HTTP',
|
httpPort: 'Porta HTTP',
|
||||||
webPort: 'Porta WEB',
|
webPort: 'Porta WEB',
|
||||||
rtspPort: 'Porta RTSP',
|
rtspPort: 'Porta RTSP',
|
||||||
rtpPort: 'Porta RTP'
|
rtpPort: 'Porta RTP',
|
||||||
|
portConflict: ' Conflito',
|
||||||
|
PortNumbersCannotBeTheSame: 'As portas não podem ser iguais'
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
change: 'Mudar Tema',
|
change: 'Mudar Tema',
|
||||||
|
|||||||
@ -185,7 +185,9 @@ export default {
|
|||||||
httpPort: 'http端口',
|
httpPort: 'http端口',
|
||||||
webPort: 'Web端口',
|
webPort: 'Web端口',
|
||||||
rtspPort: 'RTSP端口',
|
rtspPort: 'RTSP端口',
|
||||||
rtpPort: 'RTP端口'
|
rtpPort: 'RTP端口',
|
||||||
|
portConflict: ' 冲突',
|
||||||
|
PortNumbersCannotBeTheSame: '端口号不能相同'
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
change: '换肤',
|
change: '换肤',
|
||||||
|
|||||||
@ -423,6 +423,53 @@ export default {
|
|||||||
const portRegex = /^(1\d{4}|[2-4]\d{4}|49999)$/
|
const portRegex = /^(1\d{4}|[2-4]\d{4}|49999)$/
|
||||||
const portRegex2 = /^(?:[2-9]\d{0,3}|1\d{0,3}|9999)$/
|
const portRegex2 = /^(?:[2-9]\d{0,3}|1\d{0,3}|9999)$/
|
||||||
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
||||||
|
const ports = [
|
||||||
|
this.formHTTPData.webPort,
|
||||||
|
this.formHTTPData.httpPort,
|
||||||
|
this.formONVIFData.onvifPort,
|
||||||
|
this.formONVIFData.rtspPort,
|
||||||
|
this.formONVIFData.rtpPort
|
||||||
|
]
|
||||||
|
console.log('ports', ports)
|
||||||
|
|
||||||
|
// 使用 HashMap 检测端口冲突 - O(n) 时间复杂度
|
||||||
|
const portNames = ['webPort', 'httpPort', 'onvifPort', 'rtspPort', 'rtpPort']
|
||||||
|
const portMap = new Map()
|
||||||
|
const conflicts = []
|
||||||
|
|
||||||
|
for (let i = 0; i < ports.length; i++) {
|
||||||
|
const portValue = Number(ports[i])
|
||||||
|
|
||||||
|
// 跳过空值
|
||||||
|
if (ports[i] === '' || ports[i] === null || ports[i] === undefined || isNaN(portValue)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查该端口值是否已存在
|
||||||
|
if (portMap.has(portValue)) {
|
||||||
|
const existingPort = portMap.get(portValue)
|
||||||
|
conflicts.push({
|
||||||
|
port1: { name: existingPort.name, value: existingPort.value, index: existingPort.index },
|
||||||
|
port2: { name: portNames[i], value: ports[i], index: i }
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 将端口值和对应的索引存入 Map
|
||||||
|
portMap.set(portValue, { name: portNames[i], value: ports[i], index: i })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果有冲突,显示错误信息
|
||||||
|
if (conflicts.length > 0) {
|
||||||
|
const conflictMessages = conflicts.map(item =>
|
||||||
|
`${item.port1.name}(${item.port1.value}) & ${item.port2.name}(${item.port2.value})`
|
||||||
|
)
|
||||||
|
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: this.$i18n.t('table.PortNumbersCannotBeTheSame') + ' : ' + conflictMessages.join(', ')
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.selectIndex === '0') {
|
if (this.selectIndex === '0') {
|
||||||
param = {
|
param = {
|
||||||
...this.formUDPData
|
...this.formUDPData
|
||||||
|
|||||||
@ -87,7 +87,7 @@ module.exports = {
|
|||||||
// before: require('./mock/mock-server.js'),
|
// before: require('./mock/mock-server.js'),
|
||||||
proxy: {
|
proxy: {
|
||||||
'/dev-api': {
|
'/dev-api': {
|
||||||
target: 'http://127.0.0.1:8080', // http://127.0.0.1:8080
|
target: 'http://192.168.1.190:8080', // http://127.0.0.1:8080
|
||||||
secure: true, // 如果是https接口,需要配置这个参数
|
secure: true, // 如果是https接口,需要配置这个参数
|
||||||
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
|
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
|
||||||
pathRewrite: { '^/dev-api': '' }
|
pathRewrite: { '^/dev-api': '' }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user