diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index edae135ec..d6f65a7b4 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue @@ -218,27 +218,37 @@ - TELNET - - - - - - - - - - - - - - - + TELNET + + + + + + + + + + + + + + + + + + + + + - SNMP - + SNMP + + + + + @@ -450,6 +460,16 @@ export default { } else { editAsset.showSSH = false } + if (!editAsset.authType && this.editAsset.authUsername) { + editAsset.showTelnet = true + } else if (!editAsset.authType && !this.editAsset.authUsername) { + editAsset.showTelnet = false + } + if (editAsset.type.snmpEnable === 1 && editAsset.snmpCredentialId) { + editAsset.showSnmp = true + } else { + editAsset.showSnmp = false + } this.editAsset = editAsset this.editAsset.brandAndModel = [this.editAsset.brand.id, this.editAsset.model.id] this.editAsset.stateId = n.state ? n.state.id : 2 @@ -677,6 +697,7 @@ export default { this.editAsset.snmpCredentialId = '' this.editAsset.authProtocolPort = '' this.editAsset.pid = '' + this.$refs.form.clearValidate() this.getModelData() }, addLabel ([groupId, metaId]) { @@ -733,12 +754,28 @@ export default { if (params.purchaseDate) { params.purchaseDate = bus.timeFormate(new Date(params.purchaseDate), 'YYYY-MM-DD') } - if (!params.showSSH) { + // 判断是 ssh 还是 telnet + if (params.type.authProtocol === assetConstants.authProtocolData.telnet && !params.showTelnet) { // telnet params.authType = '' params.authUsername = '' params.authPriKey = '' params.authPin = '' } + if (params.type.authProtocol === assetConstants.authProtocolData.ssh && !params.showSSH) { // ssh + params.authType = '' + params.authUsername = '' + params.authPriKey = '' + params.authPin = '' + } + if (!params.showSSH && !params.showTelnet) { + params.authType = '' + params.authUsername = '' + params.authPriKey = '' + params.authPin = '' + } + if (!params.showSnmp) { + params.snmpCredentialId = '' + } if (params.type.vm !== 1) { params.parent = {} params.pid = '-1'