refactor(module): 重构格式化,并添加菜单一键复制功能
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<slot />
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="permission.edit"
|
v-permission="permission.edit"
|
||||||
:loading="crud.status.cu === 2"
|
:loading="crud.status.cu === 2"
|
||||||
:disabled="disabledEdit"
|
:disabled="disabledEdit"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="primary"
|
type="text"
|
||||||
icon="el-icon-edit"
|
|
||||||
@click.stop="crud.toEdit(data)"
|
@click.stop="crud.toEdit(data)"
|
||||||
/>
|
>编辑</el-button>
|
||||||
<el-popover
|
<el-popover
|
||||||
v-model="pop"
|
v-model="pop"
|
||||||
v-permission="permission.del"
|
v-permission="permission.del"
|
||||||
@@ -32,11 +32,10 @@
|
|||||||
<el-button
|
<el-button
|
||||||
slot="reference"
|
slot="reference"
|
||||||
:disabled="disabledDle"
|
:disabled="disabledDle"
|
||||||
type="danger"
|
type="text"
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
size="mini"
|
||||||
@click.stop="toDelete"
|
@click.stop="toDelete"
|
||||||
/>
|
>删除</el-button>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -181,7 +181,7 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
v-if="checkPer(['admin','menu:edit','menu:del'])"
|
v-if="checkPer(['admin','menu:edit','menu:del'])"
|
||||||
label="操作"
|
label="操作"
|
||||||
width="130px"
|
width="150px"
|
||||||
align="center"
|
align="center"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
@@ -190,7 +190,15 @@
|
|||||||
:data="scope.row"
|
:data="scope.row"
|
||||||
:permission="permission"
|
:permission="permission"
|
||||||
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
|
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
|
||||||
/>
|
>
|
||||||
|
<el-button
|
||||||
|
v-permission="permission.edit"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click.stop="onCopyClick(scope.row)"
|
||||||
|
>复制
|
||||||
|
</el-button>
|
||||||
|
</udOperation>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -207,6 +215,7 @@ import rrOperation from '@crud/RR.operation'
|
|||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import DateRangePicker from '@/components/DateRangePicker'
|
import DateRangePicker from '@/components/DateRangePicker'
|
||||||
|
import CsMessage from '@/utils/elementui/CsMessage'
|
||||||
|
|
||||||
// crud交由presenter持有
|
// crud交由presenter持有
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
@@ -304,6 +313,71 @@ export default {
|
|||||||
// 选中图标
|
// 选中图标
|
||||||
selected(name) {
|
selected(name) {
|
||||||
this.form.icon = name
|
this.form.icon = name
|
||||||
|
},
|
||||||
|
onCopyClick(row) {
|
||||||
|
let data = {}
|
||||||
|
if (row.type === 0) {
|
||||||
|
// 目录
|
||||||
|
data = {
|
||||||
|
id: null,
|
||||||
|
title: row.title + 'Copy',
|
||||||
|
menuSort: 1,
|
||||||
|
path: row.path + 'Copy',
|
||||||
|
component: null,
|
||||||
|
componentName: null,
|
||||||
|
iFrame: row.IFrame,
|
||||||
|
roles: [],
|
||||||
|
pid: 0,
|
||||||
|
icon: row.icon,
|
||||||
|
cache: row.cache,
|
||||||
|
hidden: row.hidden,
|
||||||
|
type: row.type,
|
||||||
|
permission: null
|
||||||
|
}
|
||||||
|
} else if (row.type === 1) {
|
||||||
|
// 菜单
|
||||||
|
data = {
|
||||||
|
id: null,
|
||||||
|
title: row.title + 'Copy',
|
||||||
|
menuSort: row.menuSort,
|
||||||
|
path: row.path + 'Copy',
|
||||||
|
component: row.component,
|
||||||
|
componentName: row.componentName + 'Copy',
|
||||||
|
iFrame: row.IFrame,
|
||||||
|
roles: [],
|
||||||
|
pid: row.pid,
|
||||||
|
icon: row.icon,
|
||||||
|
cache: row.cache,
|
||||||
|
hidden: row.hidden,
|
||||||
|
type: row.type,
|
||||||
|
permission: row.permission
|
||||||
|
}
|
||||||
|
} else if (row.type === 2) {
|
||||||
|
// 按钮
|
||||||
|
data = {
|
||||||
|
id: null,
|
||||||
|
title: row.title + 'Copy',
|
||||||
|
menuSort: row.menuSort,
|
||||||
|
path: null,
|
||||||
|
component: null,
|
||||||
|
componentName: null,
|
||||||
|
iFrame: row.IFrame,
|
||||||
|
roles: [],
|
||||||
|
pid: row.pid,
|
||||||
|
icon: null,
|
||||||
|
cache: row.cache,
|
||||||
|
hidden: row.hidden,
|
||||||
|
type: row.type,
|
||||||
|
permission: row.permission
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const that = this
|
||||||
|
crudMenu.add(data).then(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
CsMessage.Success('复制成功')
|
||||||
|
that.crud.toQuery()
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user