mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-07 17:55:14 +00:00
Merge pull request #3199 from jumpserver/pr@dev@perf_select2_componenet
perf: 优化 select2 组件
This commit is contained in:
commit
9c7818313e
@ -2,10 +2,11 @@
|
|||||||
<el-select
|
<el-select
|
||||||
ref="select"
|
ref="select"
|
||||||
v-model="iValue"
|
v-model="iValue"
|
||||||
v-loading="!initialized"
|
|
||||||
v-loadmore="loadMore"
|
v-loadmore="loadMore"
|
||||||
:clearable="clearable"
|
:clearable="clearable"
|
||||||
:disabled="selectDisabled"
|
:collapse-tags="collapseTags"
|
||||||
|
:disabled="!!selectDisabled"
|
||||||
|
:loading="!initialized"
|
||||||
:multiple="multiple"
|
:multiple="multiple"
|
||||||
:options="iOptions"
|
:options="iOptions"
|
||||||
:remote="remote"
|
:remote="remote"
|
||||||
@ -90,6 +91,10 @@ export default {
|
|||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
collapseTagsCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -128,6 +133,9 @@ export default {
|
|||||||
selectRef() {
|
selectRef() {
|
||||||
return this.$refs.select
|
return this.$refs.select
|
||||||
},
|
},
|
||||||
|
collapseTags() {
|
||||||
|
return this.multiple && this.collapseTagsCount > 0 && this.value.length > this.collapseTagsCount
|
||||||
|
},
|
||||||
optionsValues() {
|
optionsValues() {
|
||||||
return this.iOptions.map((v) => v.value)
|
return this.iOptions.map((v) => v.value)
|
||||||
},
|
},
|
||||||
@ -216,7 +224,7 @@ export default {
|
|||||||
this.$log.debug('Value is : ', this.value)
|
this.$log.debug('Value is : ', this.value)
|
||||||
this.iValue = this.value
|
this.iValue = this.value
|
||||||
this.initialized = true
|
this.initialized = true
|
||||||
}, 10)
|
}, 100)
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// 因为elform存在问题,这个来清楚验证
|
// 因为elform存在问题,这个来清楚验证
|
||||||
@ -318,7 +326,6 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.remote = false
|
this.remote = false
|
||||||
}
|
}
|
||||||
this.iValue = this.value
|
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.resetParams()
|
this.resetParams()
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import IBox from '@/components/IBox'
|
import IBox from '@/components/IBox'
|
||||||
import Page from '@/layout/components/Page'
|
import Page from '@/layout/components/Page'
|
||||||
import GenericCreateUpdateForm from '../GenericCreateUpdateForm'
|
import GenericCreateUpdateForm from '../GenericCreateUpdateForm'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'GenericCreateUpdatePage',
|
name: 'GenericCreateUpdatePage',
|
||||||
components: {
|
components: {
|
||||||
@ -17,5 +18,8 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
|
>>> .ibox .el-card__body {
|
||||||
|
padding-top: 30px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -63,7 +63,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.page {
|
.page {
|
||||||
height: calc(100vh - 50px);
|
height: calc(100vh - 50px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
@ -189,7 +189,6 @@ export default [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: 'connect-method-acls',
|
path: 'connect-method-acls',
|
||||||
component: globalSubmenu,
|
component: globalSubmenu,
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ListTable } from '@/components'
|
import { ListTable } from '@/components'
|
||||||
import { DetailFormatter } from '@/components/TableFormatters'
|
import { DetailFormatter } from '@/components/TableFormatters'
|
||||||
|
import AmountFormatter from '@/components/TableFormatters/AmountFormatter.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -27,7 +28,7 @@ export default {
|
|||||||
columnsShow: {
|
columnsShow: {
|
||||||
min: ['name', 'actions'],
|
min: ['name', 'actions'],
|
||||||
default: [
|
default: [
|
||||||
'name', 'command_groups_amount', 'priority',
|
'name', 'command_groups', 'priority',
|
||||||
'is_active', 'comment', 'actions'
|
'is_active', 'comment', 'actions'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -37,6 +38,16 @@ export default {
|
|||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
route: 'CommandFilterAclDetail'
|
route: 'CommandFilterAclDetail'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
command_groups: {
|
||||||
|
label: this.$t('acl.CommandGroup'),
|
||||||
|
width: '160px',
|
||||||
|
formatter: AmountFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
routeQuery: {
|
||||||
|
activeTab: 'GroupUser'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
import { DetailFormatter } from '@/components/TableFormatters'
|
import { DetailFormatter } from '@/components/TableFormatters'
|
||||||
|
import AmountFormatter from '@/components/TableFormatters/AmountFormatter.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -14,17 +15,21 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/assets/domains/',
|
url: '/api/v1/assets/domains/',
|
||||||
columnsExclude: ['assets', 'gateway'],
|
columnsExclude: ['gateway'],
|
||||||
columnsExtra: ['asset_count', 'gateway_count'],
|
columnsExtra: ['gateway_count'],
|
||||||
columnsShow: {
|
columnsShow: {
|
||||||
min: ['name', 'actions'],
|
min: ['name', 'actions'],
|
||||||
default: ['name', 'asset_count', 'gateway_count', 'comment', 'actions']
|
default: ['name', 'assets', 'gateway_count', 'comment', 'actions']
|
||||||
},
|
},
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
asset_count: {
|
assets: {
|
||||||
label: this.$t('assets.Assets'),
|
label: this.$t('assets.Assets'),
|
||||||
formatter: function(row) {
|
width: '160px',
|
||||||
return <span> {row.assets.length} </span>
|
formatter: AmountFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
routeQuery: {
|
||||||
|
activeTab: 'GroupUser'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
gateway_count: {
|
gateway_count: {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
|
import AmountFormatter from '@/components/TableFormatters/AmountFormatter.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -17,13 +18,23 @@ export default {
|
|||||||
columnsShow: {
|
columnsShow: {
|
||||||
min: ['name', 'actions'],
|
min: ['name', 'actions'],
|
||||||
default: [
|
default: [
|
||||||
'name', 'value', 'asset_count', 'date_created',
|
'name', 'value', 'assets', 'date_created',
|
||||||
'comment', 'org_name', 'actions'
|
'comment', 'org_name', 'actions'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
name: {
|
name: {
|
||||||
formatter: null
|
formatter: null
|
||||||
|
},
|
||||||
|
assets: {
|
||||||
|
label: this.$t('assets.Assets'),
|
||||||
|
width: '160px',
|
||||||
|
formatter: AmountFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
routeQuery: {
|
||||||
|
activeTab: 'GroupUser'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -92,7 +92,6 @@ export default {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
label: this.$t('perms.Account'),
|
label: this.$t('perms.Account'),
|
||||||
component: AccountFormatter,
|
component: AccountFormatter,
|
||||||
// helpText: this.$t('perms.AccountsHelp'),
|
|
||||||
el: {
|
el: {
|
||||||
assets: [],
|
assets: [],
|
||||||
nodes: []
|
nodes: []
|
||||||
@ -134,6 +133,7 @@ export default {
|
|||||||
>>> .el-tree {
|
>>> .el-tree {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
border: solid 1px #EBEEF5;
|
border: solid 1px #EBEEF5;
|
||||||
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListPage :header-actions="headerActions" :table-config="tableConfig" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
|
import AmountFormatter from '@/components/TableFormatters/AmountFormatter.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -13,15 +14,24 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/users/groups/',
|
url: '/api/v1/users/groups/',
|
||||||
columnsExclude: ['users'],
|
|
||||||
columnsShow: {
|
columnsShow: {
|
||||||
default: ['name', 'users_amount', 'comment', 'actions'],
|
default: ['name', 'users', 'comment', 'actions'],
|
||||||
min: ['name', 'action']
|
min: ['name', 'action']
|
||||||
},
|
},
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
users_amount: {
|
users_amount: {
|
||||||
label: this.$t('users.Users'),
|
label: this.$t('users.Users'),
|
||||||
width: '120px'
|
width: '120px'
|
||||||
|
},
|
||||||
|
users: {
|
||||||
|
label: this.$t('perms.User'),
|
||||||
|
width: '160px',
|
||||||
|
formatter: AmountFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
routeQuery: {
|
||||||
|
activeTab: 'GroupUser'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
permissions: {
|
permissions: {
|
||||||
|
Loading…
Reference in New Issue
Block a user