perf: json many to many

This commit is contained in:
ibuler
2024-06-25 17:16:13 +08:00
committed by 老广
parent 564b04850a
commit ea9f067f35
5 changed files with 19 additions and 7 deletions

View File

@@ -68,8 +68,12 @@ export default {
const url = setUrlParam(this.attr.el.url, 'ids', this.cellValue.join(','))
const data = await this.$axios.get(url) || []
if (data.length > 0) {
const displayField = this.attr.el.displayField || 'name'
this.value = data.map(item => item[displayField]).join(', ')
if (this.attr.name === 'labels') {
this.value = data.map(item => `${item.name}:${item.value}`).join(', ')
} else {
const displayField = this.attr.el.displayField || 'name'
this.value = data.map(item => item[displayField]).join(', ')
}
}
} else if (this.attr.type === 'select') {
const options = this.attr.el.options || []

View File

@@ -77,7 +77,7 @@ export default {
this.showLabelSearch = true
return
}
this.labelValue = [[label.name, label.value]]
this.labelValue = [...this.labelValue, [label.name, label.value]]
this.getLabelOptions()
setTimeout(() => {
this.showLabelSearch = true

View File

@@ -1,6 +1,6 @@
<template>
<DataActions
v-if="hasLeftActions"
v-if="hasLeftActions && iActions.length > 0"
:actions="iActions"
class="header-action"
v-bind="$attrs"
@@ -188,6 +188,9 @@ export default {
return this.selectedRows.length > 0
}
},
mounted() {
this.$emit('init-actions-done', this.iActions)
},
methods: {
handleCreate() {
let route

View File

@@ -8,6 +8,7 @@
class="left-side"
v-bind="$attrs"
v-on="$listeners"
@init-actions-done="handleActionsDone"
/>
<RightSide
v-if="hasRightActions"
@@ -99,7 +100,8 @@ export default {
data() {
return {
keyword: '',
foldSearch: false
foldSearch: false,
iHasLeftActions: this.hasLeftActions
}
},
computed: {
@@ -119,7 +121,7 @@ export default {
return ''
},
searchClass() {
return this.hasLeftActions ? 'right' : 'left'
return this.iHasLeftActions ? 'right' : 'left'
}
},
methods: {
@@ -138,6 +140,9 @@ export default {
},
handleLabelSearchShowChange(val) {
this.foldSearch = val
},
handleActionsDone(actions) {
this.iHasLeftActions = actions.filter(i => i && i.has !== false).length > 0
}
}
}

View File

@@ -208,7 +208,7 @@ export default {
this.selectedRows = val
},
reloadTable() {
this.dataTable.getList()
this.dataTable?.getList()
},
search(attrs) {
this.$log.debug('ListTable: search table', attrs)