修改更新主机身份逻辑.
This commit is contained in:
@@ -33,10 +33,11 @@
|
||||
label="用户密码"
|
||||
style="justify-content: space-between;">
|
||||
<a-input-password v-model="formModel.password"
|
||||
:disabled="!formModel.useNewPassword"
|
||||
class="password-input"
|
||||
:disabled="!isAddHandle && !formModel.useNewPassword"
|
||||
:class="[isAddHandle ? 'password-input-full' : 'password-input']"
|
||||
placeholder="请输入用户密码" />
|
||||
<a-switch v-model="formModel.useNewPassword"
|
||||
v-if="!isAddHandle"
|
||||
class="password-switch"
|
||||
type="round"
|
||||
size="large"
|
||||
@@ -124,6 +125,10 @@
|
||||
return false;
|
||||
}
|
||||
if (isAddHandle.value) {
|
||||
if (!formModel.password && !formModel.keyId) {
|
||||
Message.error('创建时密码和秘钥不能同时为空');
|
||||
return false;
|
||||
}
|
||||
// 新增
|
||||
await createHostIdentity(formModel as any);
|
||||
Message.success('创建成功');
|
||||
@@ -161,6 +166,10 @@
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.password-input-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.password-switch {
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
@@ -57,9 +57,31 @@
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(pagination.current, size)"
|
||||
:bordered="false">
|
||||
<!-- 操作 -->
|
||||
<!-- 用户名 -->
|
||||
<template #username="{ record }">
|
||||
<a-tooltip content="点击复制">
|
||||
<span class="pointer span-blue" @click="copy(record.username)">
|
||||
<icon-copy class="mr4" />{{ record.username }}
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<!-- 秘钥名称 -->
|
||||
<template #keyId="{ record }">
|
||||
{{ record.keyName }}
|
||||
<template v-if="record.keyId">
|
||||
<!-- 可查看详情 -->
|
||||
<a-tooltip v-if="hasAnyPermission(['asset:host-key:detail', 'asset:host-key:update'])"
|
||||
content="点击查看详情">
|
||||
<a-tag :checked="true"
|
||||
checkable
|
||||
@click="emits('openKeyView',{id: record.keyId})">
|
||||
{{ record.keyName }}
|
||||
</a-tag>
|
||||
</a-tooltip>
|
||||
<!-- 不可查看详情 -->
|
||||
<a-tag v-else>
|
||||
{{ record.keyName }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #handle="{ record }">
|
||||
@@ -105,10 +127,15 @@
|
||||
import { getHostKeyList } from '@/api/asset/host-key';
|
||||
import { useCacheStore } from '@/store';
|
||||
import HostKeySelector from '@/components/asset/host-key/host-key-selector.vue';
|
||||
import useCopy from '@/hooks/copy';
|
||||
import usePermission from '@/hooks/permission';
|
||||
|
||||
const { copy } = useCopy();
|
||||
const { hasAnyPermission } = usePermission();
|
||||
|
||||
const tableRenderData = ref<HostIdentityQueryResponse[]>();
|
||||
const { loading, setLoading } = useLoading();
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openViewKey']);
|
||||
|
||||
const cacheStore = useCacheStore();
|
||||
const pagination = reactive(defaultPagination());
|
||||
|
||||
Reference in New Issue
Block a user