{{ opt.label }}
+
+
+
diff --git a/src/components/ListTable/formatters/index.js b/src/components/ListTable/formatters/index.js
index a2235da5b..66ca66727 100644
--- a/src/components/ListTable/formatters/index.js
+++ b/src/components/ListTable/formatters/index.js
@@ -8,6 +8,7 @@ import RouterFormatter from './RouterFormatter'
import OutputExpandFormatter from './OutputExpandFormatter'
import ExpandAssetPermissionFormatter from './ExpandAssetPermissionFormatter'
import CustomActionsFormatter from './CustomActionsFormatter'
+import DeleteActionFormatter from './DeleteActionFormatter'
export default {
DetailFormatter,
@@ -19,7 +20,8 @@ export default {
RouterFormatter,
OutputExpandFormatter,
ExpandAssetPermissionFormatter,
- CustomActionsFormatter
+ CustomActionsFormatter,
+ DeleteActionFormatter
}
export {
@@ -32,5 +34,6 @@ export {
RouterFormatter,
OutputExpandFormatter,
ExpandAssetPermissionFormatter,
- CustomActionsFormatter
+ CustomActionsFormatter,
+ DeleteActionFormatter
}
diff --git a/src/components/RelationCard/index.vue b/src/components/RelationCard/index.vue
index 825686586..583f06990 100644
--- a/src/components/RelationCard/index.vue
+++ b/src/components/RelationCard/index.vue
@@ -24,6 +24,14 @@
+
+
+
+
+ {{ $tc('More') }} ( {{ hasObjectLeftLength }} )
+
+ |
+
@@ -73,6 +81,7 @@ export default {
data() {
return {
iHasObjects: this.hasObjects || [],
+ totalHasObjectsLength: 0,
params: {
page: 1,
hasMore: false,
@@ -88,22 +97,25 @@ export default {
},
computed: {
iAjax() {
- this.$log.debug('iAjax', this.$refs.select2)
return this.$refs.select2.iAjax
+ },
+ safeMakeParams() {
+ return this.$refs.select2.safeMakeParams
+ },
+ hasObjectLeftLength() {
+ this.$log.debug('Total', this.totalHasObjectsLength)
+ this.$log.debug(this.iHasObjects.length)
+ return this.totalHasObjectsLength - this.iHasObjects.length
}
},
mounted() {
if (this.hasObjectsId.length !== 0) {
setTimeout(() => {
this.getHasObjectsByIds()
- }, 500)
+ }, 50)
}
},
methods: {
- safeMakeParams(params) {
- this.$log.debug('safeMakeParams', this.$refs.select2)
- return this.$refs.select2.safeMakeParams(params)
- },
async loadMore() {
if (this.loading) {
return
@@ -125,14 +137,18 @@ export default {
let data = await this.$axios.get(this.iAjax.url, { params: params })
data = this.iAjax.processResults.bind(this)(data)
data.results.forEach((v) => {
- this.hasObjects.push(v)
+ if (!this.hasObjects.find((item) => item.value === v.value)) {
+ this.hasObjects.push(v)
+ }
})
// 如果还有其它页,继续获取, 如果没有就停止
- if (!data.pagination) {
- this.params.hasMore = false
- }
+ this.params.hasMore = !!data.pagination
+ this.totalHasObjectsLength = data.total
},
async getHasObjectsByIds() {
+ if (!this.$refs.select2 || !this.iAjax || !this.safeMakeParams) {
+ return
+ }
const resp = await createSourceIdCache(this.hasObjectsId)
this.params.spm = resp.spm
await this.loadHasObjects()
diff --git a/src/components/Select2/index.vue b/src/components/Select2/index.vue
index 39fb8b359..d96cc64c6 100644
--- a/src/components/Select2/index.vue
+++ b/src/components/Select2/index.vue
@@ -7,9 +7,12 @@
:multiple="multiple"
filterable
remote
+ :reserve-keyword="true"
popper-append-to-body
class="select2"
v-bind="$attrs"
+ @change="onChange"
+ @visible-change="onVisibleChange"
v-on="$listeners"
>