perf: updat asset list and account list action

This commit is contained in:
ibuler
2024-10-11 19:22:39 +08:00
parent a23a0d0197
commit 7ff1da71d4
5 changed files with 78 additions and 11 deletions

View File

@@ -185,6 +185,7 @@ export default {
},
connect: {
label: this.$t('Connect'),
width: '80px',
formatter: () => {
return (
<span class='connect'>
@@ -286,7 +287,7 @@ export default {
},
{
name: 'Test',
title: this.$t('Test'),
title: this.$t('验证密码'),
can: ({ row }) =>
!this.$store.getters.currentOrgIsRoot &&
this.$hasPerm('accounts.verify_account') &&
@@ -314,6 +315,21 @@ export default {
this.$message.success(this.$tc('ClearSuccessMsg'))
})
}
},
{
name: 'SecretHistory',
title: '密文历史'
},
{
name: 'CopyToOther',
title: '复制到其他资产',
type: 'primary',
divided: true
},
{
name: 'MoveToOther',
title: '移动到其他资产',
type: 'primary'
}
]
}

View File

@@ -5,7 +5,9 @@
v-bind="iAttrs"
@input="handleInput"
v-on="$listeners"
/>
>
hello
</Password>
</template>
<script>

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div class="update-token">
<el-button v-show="!isShow" icon="el-icon-edit" type="text" @click="isShow=true">
{{ text }}
</el-button>
@@ -8,14 +8,19 @@
v-model.trim="curValue"
:placeholder="placeholder"
:type="type"
autocomplete="new-password"
class="password-input"
show-password
@change="onChange"
/>
<el-button size="small" type="text" @click="randomPassword">
<i class="fa fa-retweet" />
</el-button>
</div>
</template>
<script>
import { randomString } from '@/utils/string'
export default {
props: {
value: {
@@ -55,7 +60,24 @@ export default {
methods: {
onChange(e) {
this.$emit('input', this.curValue)
},
randomPassword() {
this.curValue = randomString(24, true)
this.$emit('input', this.curValue)
}
}
}
</script>
<style lang='scss' scoped>
.password-input {
width: calc(100% - 50px);
}
.update-token {
i {
color: var(--color-text-secondary);
font-size: 14px;
}
}
</style>

View File

@@ -1,9 +1,32 @@
export function randomString(length) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
let result = ''
const charactersLength = characters.length
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength))
export function randomString(length, includeSymbols = false) {
const upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
const lowerCase = 'abcdefghijklmnopqrstuvwxyz'
const numbers = '0123456789'
const symbols = '!@#$%^&*()-_=+[]{}|;:,.<>?'
// 根据是否包含特殊字符来决定字符集
let allCharacters = upperCase + lowerCase + numbers
if (includeSymbols) {
allCharacters += symbols
}
return result
let result = ''
// 如果包含特殊字符,确保至少包含一个大写字母、一个小写字母、一个数字、一个符号
if (includeSymbols) {
result += upperCase.charAt(Math.floor(Math.random() * upperCase.length))
result += lowerCase.charAt(Math.floor(Math.random() * lowerCase.length))
result += numbers.charAt(Math.floor(Math.random() * numbers.length))
result += symbols.charAt(Math.floor(Math.random() * symbols.length))
}
const allCharactersLength = allCharacters.length
// 填充剩余的字符
for (let i = result.length; i < length; i++) {
result += allCharacters.charAt(Math.floor(Math.random() * allCharactersLength))
}
// 随机打乱结果
return result.split('').sort(() => 0.5 - Math.random()).join('')
}

View File

@@ -211,6 +211,10 @@ export default {
}
}
},
{
name: 'AddAccount',
title: '添加账号'
},
...this.addExtraMoreColActions
]
}