fix:asset编辑新增 添加ssh开关
This commit is contained in:
@@ -182,7 +182,12 @@
|
||||
</div>
|
||||
<!-- SSH -->
|
||||
<template v-if="editAsset.type && editAsset.type.authProtocol === assetConstants.authProtocolData.ssh">
|
||||
<div class="form__sub-title">SSH</div>
|
||||
<div class="form__sub-title">SSH
|
||||
<div>
|
||||
<el-switch v-model="editAsset.showSSH" :active-value="true" :inactive-value="false" size="small"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="editAsset.showSSH">
|
||||
<el-form-item :label="$t('asset.authType')" prop="authType">
|
||||
<el-select v-model="editAsset.authType" class="right-box__select" :placeholder="$t('el.select.placeholder')" popper-class="right-box-select-top prevent-clickoutside" size="small" value-key="value" clearable>
|
||||
<el-option v-for="type in assetConstants.authTypeOptions" :key="type.value" :label="type.label" :value="type.value"/>
|
||||
@@ -203,6 +208,7 @@
|
||||
<el-form-item :label="$t('asset.port')" prop="authProtocolPort">
|
||||
<el-input v-model="editAsset.authProtocolPort" size="small"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
<!-- TELNET -->
|
||||
<template v-if="editAsset.type && editAsset.type.authProtocol === assetConstants.authProtocolData.telnet">
|
||||
@@ -430,7 +436,13 @@ export default {
|
||||
immediate: true,
|
||||
handler (n) {
|
||||
this.isEdit = true
|
||||
this.editAsset = JSON.parse(JSON.stringify(n))
|
||||
const editAsset = JSON.parse(JSON.stringify(n))
|
||||
if (editAsset.authType) {
|
||||
editAsset.showSSH = true
|
||||
} else {
|
||||
editAsset.showSSH = false
|
||||
}
|
||||
this.editAsset = editAsset
|
||||
this.editAsset.brandAndModel = [this.editAsset.brand.id, this.editAsset.model.id]
|
||||
this.editAsset.stateId = n.state ? n.state.id : 2
|
||||
this.editAsset.typeId = n.type ? n.type.id : ''
|
||||
@@ -680,6 +692,12 @@ export default {
|
||||
if (params.purchaseDate) {
|
||||
params.purchaseDate = bus.timeFormate(new Date(params.purchaseDate), 'YYYY-MM-DD')
|
||||
}
|
||||
if (!params.showSSH) {
|
||||
params.authType = ''
|
||||
params.authUsername = ''
|
||||
params.authPriKey = ''
|
||||
params.authPin = ''
|
||||
}
|
||||
if (params.type.vm !== 1) {
|
||||
params.parent = {}
|
||||
params.pid = '-1'
|
||||
|
||||
Reference in New Issue
Block a user