diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue index bc99f1390..dea69fbe4 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue @@ -20,6 +20,7 @@ :height="mainTableHeight" :table-data="tableData" @del="del" + @copy="copy" @edit="edit" @orderBy="tableDataSort" @reload="getTableData" diff --git a/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue b/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue index e29ac3ee1..07a9991e2 100644 --- a/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue @@ -57,7 +57,8 @@ export default { obj: { type: Object }, - detail: Boolean + detail: Boolean, + copyFlag: Boolean }, mixins: [editRigthBox], data () { @@ -94,6 +95,10 @@ export default { }, mounted () { this.getMenus().then(() => { + console.log(this.copyFlag) + if (this.copyFlag) { + this.editRole.id = '' + } if (this.$refs.menuTree && this.selectedIds && this.selectedIds.length > 0) { this.$refs.menuTree.setCheckedKeys(this.selectedIds, true) } diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index 6b3c7de87..499213081 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'),