From 9d64bffd121caef013535fdd2971dcc05038482d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B5=A9=E7=8E=AE?= Date: Thu, 1 Jul 2021 16:39:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/action_button/index.vue | 24 +++++- src/components/popconfirm_delete/index.vue | 22 ++++- src/components/table/index.vue | 4 +- .../view/organization/usermanagement/User.vue | 84 ++++++++++++++++--- 4 files changed, 112 insertions(+), 22 deletions(-) diff --git a/src/components/action_button/index.vue b/src/components/action_button/index.vue index be2be56..818e4ca 100644 --- a/src/components/action_button/index.vue +++ b/src/components/action_button/index.vue @@ -50,20 +50,38 @@ export default { }, row: Object, }, + watch: { + row() { + this.init(); + }, + }, + data() { + return { + buttonsArr: [], + }; + }, + created() { + this.init(); + }, computed: { basicBtns() { - return this.buttons.length > 3 ? this.buttons.slice(0, 3) : this.buttons; + return this.buttonsArr.length > 3 ? this.buttonsArr.slice(0, 3) : this.buttonsArr; }, moreBtns() { - return this.buttons.length > 3 ? this.buttons.slice(3) : []; + return this.buttonsArr.length > 3 ? this.buttonsArr.slice(3) : []; }, }, - methods: { getDelUrl(url, row) { if (isFunction(url)) return url(row); return url; }, + init() { + this.buttons.map((i) => { + i.__hidden__ = i.isHidden && i.isHidden(this.row); + }); + this.buttonsArr = this.buttons.filter((i) => !i.__hidden__); + }, }, }; diff --git a/src/components/popconfirm_delete/index.vue b/src/components/popconfirm_delete/index.vue index 89b6993..b478ee4 100644 --- a/src/components/popconfirm_delete/index.vue +++ b/src/components/popconfirm_delete/index.vue @@ -6,11 +6,11 @@ -- GitLab