🔨 优化代码逻辑.

This commit is contained in:
lijiahangmax
2025-03-31 21:00:31 +08:00
parent 6479694b4b
commit 10624b42c4
8 changed files with 70 additions and 46 deletions

View File

@@ -11,13 +11,13 @@
:options="toRadioOptions(extraSshAuthTypeKey)" />
</a-form-item>
<!-- 用户名 -->
<a-form-item v-if="formModel.authType === ExtraSshAuthType.CUSTOM_KEY"
<a-form-item v-if="formModel.authType === ExtraHostAuthType.CUSTOM_KEY"
field="username"
label="用户名">
<a-input v-model="formModel.username" placeholder="请输入用户名" />
</a-form-item>
<!-- 主机密钥 -->
<a-form-item v-if="formModel.authType === ExtraSshAuthType.CUSTOM_KEY"
<a-form-item v-if="formModel.authType === ExtraHostAuthType.CUSTOM_KEY"
field="keyId"
label="主机密钥"
:rules="{ required: true, message: '请选择主机密钥' }">
@@ -25,7 +25,7 @@
:authorized="true" />
</a-form-item>
<!-- 主机身份 -->
<a-form-item v-if="formModel.authType === ExtraSshAuthType.CUSTOM_IDENTITY"
<a-form-item v-if="formModel.authType === ExtraHostAuthType.CUSTOM_IDENTITY"
field="identityId"
label="主机身份"
:rules="{ required: true, message: '请选择主机身份' }">
@@ -45,7 +45,7 @@
import type { HostSshExtraSettingModel } from '@/api/asset/host-extra';
import { onMounted, ref } from 'vue';
import { getHostExtraItem } from '@/api/asset/host-extra';
import { ExtraSshAuthType, extraSshAuthTypeKey } from '../../../types/const';
import { ExtraHostAuthType, extraSshAuthTypeKey } from '../../../types/const';
import { useDictStore } from '@/store';
import HostKeySelector from '@/components/asset/host-key/selector/index.vue';
import HostIdentitySelector from '@/components/asset/host-identity/selector/index.vue';
@@ -59,7 +59,7 @@
const formRef = ref();
const formModel = ref<Partial<HostSshExtraSettingModel>>({
authType: ExtraSshAuthType.DEFAULT,
authType: ExtraHostAuthType.DEFAULT,
});
// 渲染表单

View File

@@ -63,8 +63,8 @@ export const ExtraSettingItems = {
LABEL: 'LABEL',
};
// 主机额外配置 ssh 认证方式
export const ExtraSshAuthType = {
// 主机额外配置认证方式
export const ExtraHostAuthType = {
// 使用默认认证方式
DEFAULT: 'DEFAULT',
// 自定义密钥