From 517d834876f01283abd1729ca696e744555701c6 Mon Sep 17 00:00:00 2001 From: Alexey Vorobev Date: Thu, 16 Jun 2022 04:20:02 +0400 Subject: [PATCH] fix my own fault (previous version of bindings did not work) --- .../components/StdDataDisplay/StdTable.vue | 140 ++++++++---------- 1 file changed, 62 insertions(+), 78 deletions(-) diff --git a/frontend/src/components/StdDataDisplay/StdTable.vue b/frontend/src/components/StdDataDisplay/StdTable.vue index 649fe6d7..dfafd029 100644 --- a/frontend/src/components/StdDataDisplay/StdTable.vue +++ b/frontend/src/components/StdDataDisplay/StdTable.vue @@ -68,19 +68,19 @@ - {{restore.action_text}} + :cancelText="cancel_text" + :okText="ok_text" + :title="restore_title_text" + @confirm="restore(record[rowKey])"> + {{restore_action_text}} - {{destroy.action_text}} + :cancelText="cancel_text" + :okText="ok_text" + :title="destroy_title_text" + @confirm="destroy(record[rowKey])"> + {{destroy_action_text}} @@ -129,75 +129,41 @@ export default { return this.$gettext('Edit') } }, - restore: { - title_text: { - type: String, - default() { - return this.$gettext('Are you sure you want to restore?') - } - }, - action_text: { - type: String, - default() { - return this.$gettext('Restore') - } - }, - ok_text: { - type: String, - default() { - return this.$gettext('Yes, I\'m sure') - } - }, - cancel_text: { - type: String, - default() { - return this.$gettext('No, I\'m rethink') - } - }, - exec(id) { - this.api.restore(id).then(() => { - this.get_list() - this.$message.success('反删除 ID: ' + id + ' 成功') - }).catch(e => { - console.log(e) - this.$message.error(e?.message ?? '系统错误') - }) - }, + restore_title_text: { + type: String, + default() { + return this.$gettext('Are you sure you want to restore?') + } }, - destroy: { - title_text: { - type: String, - default() { - return this.$gettext('Are you sure you want to destroy?') - } - }, - action_text: { - type: String, - default() { - return this.$gettext('Destroy') - } - }, - ok_text: { - type: String, - default() { - return this.$gettext('Yes, I\'m sure') - } - }, - cancel_text: { - type: String, - default() { - return this.$gettext('No, I\'m rethink') - } - }, - exec(id) { - this.api.destroy(id).then(() => { - this.get_list() - this.$message.success('删除 ID: ' + id + ' 成功') - }).catch(e => { - console.log(e) - this.$message.error(e?.message ?? '系统错误') - }) - }, + restore_action_text: { + type: String, + default() { + return this.$gettext('Restore') + } + }, + ok_text: { + type: String, + default() { + return this.$gettext('Yes, I\'m sure') + } + }, + cancel_text: { + type: String, + default() { + return this.$gettext('No, I\'m rethink') + } + }, + destroy_title_text: { + type: String, + default() { + return this.$gettext('Are you sure you want to destroy?') + } + }, + destroy_action_text: { + type: String, + default() { + return this.$gettext('Destroy') + } }, deletable: { type: Boolean, @@ -252,6 +218,24 @@ export default { this.get_list() }, methods: { + restore(id) { + this.api.restore(id).then(() => { + this.get_list() + this.$message.success('反删除 ID: ' + id + ' 成功') + }).catch(e => { + console.log(e) + this.$message.error(e?.message ?? '系统错误') + }) + }, + destroy(id) { + this.api.destroy(id).then(() => { + this.get_list() + this.$message.success('删除 ID: ' + id + ' 成功') + }).catch(e => { + console.log(e) + this.$message.error(e?.message ?? '系统错误') + }) + }, get_list(page_num = null) { this.loading = true if (page_num) {