perf: 修改 accounts

This commit is contained in:
ibuler
2024-06-07 10:34:31 +08:00
parent a3a58040a0
commit 0f013cd7a0
2 changed files with 26 additions and 11 deletions

View File

@@ -2,8 +2,8 @@
<el-tree <el-tree
:data="iTree" :data="iTree"
:default-checked-keys="iValue" :default-checked-keys="iValue"
:default-expand-all="true" :default-expand-all="expandAll"
:default-expanded-keys="iValue" :default-expanded-keys="defaultExpanded"
:props="defaultProps" :props="defaultProps"
:render-content="renderContent" :render-content="renderContent"
class="el-tree-custom" class="el-tree-custom"
@@ -27,6 +27,14 @@ export default {
readonly: { readonly: {
type: Boolean, type: Boolean,
default: false default: false
},
expandAll: {
type: Boolean,
default: true
},
defaultExpanded: {
type: Array,
default: () => []
} }
}, },
data() { data() {
@@ -95,7 +103,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.el-tree-custom > > > { .el-tree-custom ::v-deep {
.help-tips { .help-tips {
margin-left: 10px; margin-left: 10px;
font-size: 12px; font-size: 12px;
@@ -105,6 +113,16 @@ export default {
.el-tree-node__content:hover { .el-tree-node__content:hover {
background-color: transparent; background-color: transparent;
} }
> .el-tree-node > {
.el-tree-node__content > .el-tree-node__expand-icon {
display: none;
}
.el-tree-node__children {
margin-left: -25px;
}
}
} }
</style> </style>

View File

@@ -244,24 +244,21 @@ export default {
}, },
methods: { methods: {
initDefaultChoice() { initDefaultChoice() {
const choicesSelected = this.value.filter(i => i.startsWith('@')) const choicesSelected = this.value.filter(i => {
return i.startsWith('@') && i !== this.SPEC && i !== this.VIRTUAL
})
// 是否添加特定账号选择 // 是否添加特定账号选择
const specAccountsInput = this.value.filter(i => !i.startsWith('@')) const specAccountsInput = this.value.filter(i => !i.startsWith('@') && i !== this.SPEC)
if (specAccountsInput.length > 0 && !choicesSelected.includes(this.ALL)) { if (specAccountsInput.length > 0 && !choicesSelected.includes(this.ALL)) {
choicesSelected.push(this.SPEC) choicesSelected.push(this.SPEC)
this.showSpecAccounts = true this.showSpecAccounts = true
} }
if (this.value.indexOf(this.SPEC) > -1) {
this.showSpecAccounts = true
}
// 是否添加虚拟账号选择 // 是否添加虚拟账号选择
const hasVirtual = this.value.filter(i => { const hasVirtual = this.value.filter(i => {
return i && i.startsWith('@') && i !== '@ALL' && i !== '@SPEC' return i && i.startsWith('@') && i !== '@ALL' && i !== '@SPEC'
}) })
if (hasVirtual.length > 0 && !choicesSelected.includes(this.VIRTUAL)) { if (hasVirtual.length > 0 && !choicesSelected.includes(this.VIRTUAL)) {
this.choicesSelected = [...choicesSelected, this.VIRTUAL] choicesSelected.push(this.VIRTUAL)
} }
// 如果没有就设置 ALL // 如果没有就设置 ALL