From 83e57eec1f2757bfce70abb937eae7c499d8a2e9 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 26 Aug 2021 17:10:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=20=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=20asset=20Double=20=E7=B2=BE=E5=BA=A6=E6=9C=AA?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=EF=BC=8C=E6=97=B6=E9=97=B4=E4=B8=8D=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8C=BA=E9=97=B4=EF=BC=8C=E4=BB=A5=E5=8F=8AcheckBox?= =?UTF-8?q?=20value=E5=80=BC=E7=9A=84=E9=A1=BA=E5=BA=8F=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rightBox/asset/assetBox.vue | 23 +++++++++++++++---- .../common/rightBox/assetMetaBox.vue | 4 ++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index 2734e8376..33094af64 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue @@ -115,11 +115,11 @@ - + @@ -64,6 +65,7 @@ export default { blankObject: { // 空白对象 name: '' }, + copyFlag: false, searchMsg: { // 给搜索框子组件传递的信息 zheze_none: true, searchLabelList: [{ @@ -77,9 +79,22 @@ export default { } }, methods: { - edit (row) { + edit (row, copyFlag) { this.object = { ...row } + if (copyFlag) { + this.object.name = this.object.name + '-copy' + if (this.object.name.length > 64) { + const length = this.object.name.length - 64 + console.log(length, this.object.name.length, row.name.length) + this.object.name = row.name.substring(0, row.name.length - length) + '-copy' + } + } this.rightBox.show = true + }, + copy (u) { + this.edit(u, true) + this.copyFlag = true + console.log(this.copyFlag) } } } diff --git a/nezha-fronted/src/components/page/config/user.vue b/nezha-fronted/src/components/page/config/user.vue index 202604867..b71a2e80d 100644 --- a/nezha-fronted/src/components/page/config/user.vue +++ b/nezha-fronted/src/components/page/config/user.vue @@ -25,6 +25,7 @@ :height="mainTableHeight" :table-data="tableData" @del="del" + @copy="copy" @reset_mfa="resetMfa" @edit="edit" @orderBy="tableDataSort" @@ -105,7 +106,7 @@ export default { this.getTableData() }) }, - edit (u) { + edit (u, copyFlag) { this.$get(`${this.url}/${u.id}`).then(response => { const user = response.user if (response.code === 200) { @@ -119,10 +120,22 @@ export default { if (!this.object.mfaLevel) { this.object.mfaLevel = 0 } + if (copyFlag) { + this.object.id = '' + this.object.name = this.object.name + '-copy' + if (this.object.name.length > 64) { + const length = this.object.name.length - 64 + console.log(length, this.object.name.length, u.name.length) + this.object.name = u.name.substring(0, u.name.length - length) + '-copy' + } + } this.rightBox.show = true } }) }, + copy (u) { + this.edit(u, true) + }, resetMfa (row) { MessageBox.confirm(i18n.t('tip.resetMfa'), { confirmButtonText: i18n.t('tip.yes'),