From 70affacfde9cd32c40d30f41d0663785f175bd37 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 26 Nov 2020 10:13:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(list):=20=E4=BF=AE=E5=A4=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=85=8B=E9=9A=86=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ListTable/index.vue | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/components/ListTable/index.vue b/src/components/ListTable/index.vue index b6c46c8ce..354b5dd6e 100644 --- a/src/components/ListTable/index.vue +++ b/src/components/ListTable/index.vue @@ -44,11 +44,31 @@ export default { dataTable() { return this.$refs.dataTable.$refs.dataTable }, + hasCreateAction() { + const hasLeftAction = this.headerActions.hasLeftActions + if (hasLeftAction === false) { + return false + } + const hasCreate = this.headerActions.hasCreate + if (hasCreate === false) { + return false + } + return true + }, + hasCloneAction() { + const hasClone = _.get(this.tableConfig, 'columnsMeta.actions.formatterArgs.hasClone', null) + if (hasClone) { + return true + } + if (this.hasCreateAction && hasClone == null) { + return true + } + return false + }, iTableConfig() { const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery }) - let hasClone = _.get(config, 'columnsMeta.actions.formatterArgs.hasClone', null) - hasClone = !!(this.headerActions.hasCreate && hasClone == null) - _.set(config, 'columnsMeta.actions.formatterArgs.hasClone', hasClone) + this.$log.debug('Header actions', this.headerActions) + _.set(config, 'columnsMeta.actions.formatterArgs.hasClone', this.hasCloneAction) this.$log.debug('ListTable: iTableConfig change', config) return config }