feat: 菜单复制 (#214)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
nsnail 2024-11-22 14:04:33 +08:00 committed by GitHub
parent ef2f0de095
commit 81d9b0b3bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,7 @@
<span class="btn">
<el-button-group size="small">
<el-button @click.stop="add(node, data)" icon="el-icon-plus"></el-button>
<el-button @click.stop="copy(data)" icon="el-icon-copy-document"></el-button>
<el-popconfirm
:title="this.$t('确定删除 {item} 吗?', { item: data.meta.title })"
@confirm="del(node, data)"
@ -88,6 +89,18 @@ export default {
const targetText = data.meta.title
return targetText.indexOf(value) !== -1
},
//
async copy(data) {
const newData = Object.assign({}, data, {
id: 0,
meta: Object.assign({}, data.meta, { title: data.meta.title + '-copy' }),
name: data.name + '-copy',
})
this.loading = true
const res = await this.$API.sys_menu.create.post(newData)
this.loading = false
this.reload()
},
//
async add(node, data) {
const newData = {