mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-17 23:59:02 +00:00
perf: 修复标签导入和搜索的问题
This commit is contained in:
@@ -5,9 +5,10 @@ import Switcher from '@/components/Form/FormFields/Switcher.vue'
|
||||
import rules from '@/components/Form/DataForm/rules'
|
||||
import BasicTree from '@/components/Form/FormFields/BasicTree.vue'
|
||||
import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
|
||||
import TransferSelect from '@/components/Form/FormFields/TransferSelect.vue'
|
||||
import { assignIfNot } from '@/utils/common'
|
||||
import TagInput from '@/components/Form/FormFields/TagInput.vue'
|
||||
import Select2 from '@/components/Form/FormFields/Select2.vue'
|
||||
import TransferSelect from '@/components/Form/FormFields/TransferSelect.vue'
|
||||
|
||||
export class FormFieldGenerator {
|
||||
constructor(emit) {
|
||||
@@ -45,7 +46,7 @@ export class FormFieldGenerator {
|
||||
break
|
||||
case 'field':
|
||||
type = ''
|
||||
field.component = TransferSelect
|
||||
field.component = Select2
|
||||
if (fieldRemoteMeta.required) {
|
||||
field.el.clearable = false
|
||||
}
|
||||
@@ -76,7 +77,7 @@ export class FormFieldGenerator {
|
||||
field.component = ObjectSelect2
|
||||
break
|
||||
case 'm2m_related_field':
|
||||
field.component = TransferSelect
|
||||
field.component = Select2
|
||||
field.el.label = field.label
|
||||
break
|
||||
case 'nested object':
|
||||
@@ -134,6 +135,9 @@ export class FormFieldGenerator {
|
||||
case 'comment':
|
||||
field.el.type = 'textarea'
|
||||
break
|
||||
case 'users':
|
||||
field.component = TransferSelect
|
||||
field.el.label = field.label
|
||||
}
|
||||
return field
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<el-button v-if="shouldFold" circle class="search-btn" size="mini" @click="handleManualSearch">
|
||||
<svg-icon icon-class="search" />
|
||||
</el-button>
|
||||
<TagSearch v-else :options="iOption" v-bind="$attrs" @tagSearch="handleTagSearch" v-on="$listeners" />
|
||||
<TagSearch v-else :options="iOption" v-bind="$attrs" v-on="$listeners" @tag-search="handleTagSearch" />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
|
@@ -173,12 +173,14 @@ export default {
|
||||
this.dataTable.getList()
|
||||
},
|
||||
search(attrs) {
|
||||
this.$log.debug('ListTable: search table', attrs)
|
||||
this.$emit('TagSearch', attrs)
|
||||
return this.dataTable?.search(attrs, true)
|
||||
this.$refs.dataTable?.$refs.dataTable?.search(attrs, true)
|
||||
},
|
||||
filter(attrs) {
|
||||
this.$emit('TagFilter', attrs)
|
||||
this.$refs.dataTable.$refs.dataTable.search(attrs, true)
|
||||
this.$log.debug('ListTable: found filter change', attrs)
|
||||
this.search(attrs)
|
||||
},
|
||||
hasActionPerm(action) {
|
||||
const permRequired = this.permissions[action]
|
||||
|
@@ -10,14 +10,14 @@
|
||||
<el-tag
|
||||
v-for="(v, k) in filterTags"
|
||||
:key="k"
|
||||
:disable-transitions="true"
|
||||
:name="k"
|
||||
class="filter-tag"
|
||||
closable
|
||||
size="small"
|
||||
class="filter-tag"
|
||||
type="info"
|
||||
:disable-transitions="true"
|
||||
@close="handleTagClose(k)"
|
||||
@click="handleTagClick(v,k)"
|
||||
@close="handleTagClose(k)"
|
||||
>
|
||||
<strong v-if="v.label">{{ v.label + ':' }}</strong>
|
||||
<span v-if="v.valueLabel">{{ v.valueLabel }}</span>
|
||||
@@ -27,14 +27,14 @@
|
||||
<el-input
|
||||
ref="SearchInput"
|
||||
v-model="filterValue"
|
||||
:placeholder="placeholder"
|
||||
class="search-input"
|
||||
:class="options.length < 1 ? 'search-input2': ''"
|
||||
:placeholder="placeholder"
|
||||
:validate-event="false"
|
||||
class="search-input"
|
||||
suffix-icon="el-icon-search"
|
||||
@blur="focus = false"
|
||||
@focus="focus = true"
|
||||
@change="handleConfirm"
|
||||
@focus="focus = true"
|
||||
@keyup.enter.native="handleConfirm"
|
||||
@keyup.delete.native="handleDelete"
|
||||
/>
|
||||
@@ -122,6 +122,12 @@ export default {
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
filterTags: {
|
||||
handler() {
|
||||
this.$emit('tag-search', this.filterMaps)
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
filterValue(newValue, oldValue) {
|
||||
if (newValue === '' && oldValue !== '') {
|
||||
this.emptyCount = 1
|
||||
@@ -210,11 +216,6 @@ export default {
|
||||
...asFilterTags,
|
||||
...routeFilter
|
||||
}
|
||||
if (Object.keys(this.filterTags).length > 0) {
|
||||
setTimeout(() => {
|
||||
return this.$emit('tagSearch', this.filterMaps)
|
||||
}, 400)
|
||||
}
|
||||
},
|
||||
getValueLabel(key, value) {
|
||||
for (const field of this.options) {
|
||||
@@ -252,7 +253,7 @@ export default {
|
||||
if (this.getUrlQuery) {
|
||||
this.checkUrlFields(evt)
|
||||
}
|
||||
this.$emit('tagSearch', this.filterMaps)
|
||||
// this.$emit('tagSearch', this.filterMaps)
|
||||
return true
|
||||
},
|
||||
handleDelete() {
|
||||
@@ -284,7 +285,7 @@ export default {
|
||||
valueLabel: this.valueLabel
|
||||
}
|
||||
this.$set(this.filterTags, this.filterKey, tag)
|
||||
this.$emit('tagSearch', this.filterMaps)
|
||||
// this.$emit('tagSearch', this.filterMaps)
|
||||
|
||||
// 修改查询参数时改变url中保存的参数
|
||||
if (this.getUrlQuery) {
|
||||
|
@@ -121,8 +121,10 @@ export default {
|
||||
}
|
||||
const url = `/api/v1/labels/labels/${this.label.id}/resource-types/${this.select2.value}/resources/`
|
||||
this.$axios.put(url, data).then(res => {
|
||||
this.$message.success(this.$t('common.BindSuccess'))
|
||||
this.$emit('confirm')
|
||||
setTimeout(() => {
|
||||
this.$message.success(this.$tc('common.BindSuccess'))
|
||||
this.$emit('bind-success')
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
async getResourceTypes() {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<GenericListPage ref="GenericListPage" :header-actions="headerActions" :table-config="tableConfig" />
|
||||
<BindDialog v-if="bindVisible" :label="label" :visible.sync="bindVisible" @confirm="handleDialogConfirm" />
|
||||
<BindDialog v-if="bindVisible" :label="label" :visible.sync="bindVisible" @bind-success="handleDialogConfirm" />
|
||||
<LabelResourcesDialog
|
||||
v-if="resDialogVisible"
|
||||
:label="label"
|
||||
|
@@ -31,25 +31,6 @@ export default {
|
||||
default: ['display_name', 'users_amount', 'builtin', 'comment', 'actions']
|
||||
},
|
||||
columnsMeta: {
|
||||
users_amount: {
|
||||
label: this.$t('users.Users'),
|
||||
width: '120px',
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
getRoute({ row }) {
|
||||
return {
|
||||
name: 'RoleDetail',
|
||||
params: {
|
||||
id: row.id
|
||||
},
|
||||
query: {
|
||||
activeTab: 'RoleUsers',
|
||||
scope: vm.scope
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
display_name: {
|
||||
label: this.$t('common.Name'),
|
||||
formatter: DetailFormatter,
|
||||
|
Reference in New Issue
Block a user