mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +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) {
|
||||
|
||||
Reference in New Issue
Block a user