木子李·De 3 years ago
parent 90c26b95b9
commit 3726ce16f5

@ -248,7 +248,6 @@ export default {
} else {
this.hasRowCustomButton = false
}
console.log(`是否有自定义行按钮: ${this.hasRowCustomButton}`)
},
methods: {
queryFormFieldSpan(item) {

@ -1,6 +1,5 @@
<template>
<anji-crud ref="listPage"
:option="crudOption">
<anji-crud ref="listPage" :option="crudOption">
<template v-slot:buttonLeftOnTable>
</template>
@ -18,10 +17,16 @@
</anji-crud>
</template>
<script>
import { accessAuthorityList, accessAuthorityAdd, accessAuthorityDeleteBatch, accessAuthorityUpdate, accessAuthorityDetail } from '@/api/accessAuthority'
import {
accessAuthorityList,
accessAuthorityAdd,
accessAuthorityDeleteBatch,
accessAuthorityUpdate,
accessAuthorityDetail,
} from '@/api/accessAuthority'
export default {
name: 'AccessAuthority',
data () {
data() {
return {
crudOption: {
// 使
@ -46,7 +51,7 @@ export default {
dictCode: 'ENABLE_FLAG',
},
label: '启用状态',
field: 'enableFlag'
field: 'enableFlag',
},
{
inputType: 'input',
@ -73,23 +78,23 @@ export default {
buttons: {
query: {
api: accessAuthorityList,
permission: 'authorityManage:query'
permission: 'authorityManage:query',
},
queryByPrimarykey: {
api: accessAuthorityDetail,
permission: 'authorityManage:query'
permission: 'authorityManage:query',
},
add: {
api: accessAuthorityAdd,
permission: 'authorityManage:insert'
permission: 'authorityManage:insert',
},
delete: {
api: accessAuthorityDeleteBatch,
permission: 'authorityManage:delete'
permission: 'authorityManage:delete',
},
edit: {
api: accessAuthorityUpdate,
permission: 'authorityManage:update'
permission: 'authorityManage:update',
},
},
//
@ -102,7 +107,7 @@ export default {
editHide: true, //
},
{
label: '菜单代码',//
label: '菜单代码', //
placeholder: '',
field: 'target',
editField: 'target',
@ -110,12 +115,12 @@ export default {
inputType: 'input',
rules: [
{ required: true, message: '目标菜单必填', trigger: 'blur' },
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' },
],
disabled: false,
},
{
label: '菜单名称',//
label: '菜单名称', //
placeholder: '',
field: 'targetName',
sortable: true,
@ -127,12 +132,12 @@ export default {
inputType: 'input',
rules: [
{ required: true, message: '目标菜单名称必填', trigger: 'blur' },
{ min: 1, max: 128, message: '不超过128个字符', trigger: 'blur' }
{ min: 1, max: 128, message: '不超过128个字符', trigger: 'blur' },
],
disabled: false,
},
{
label: '按钮代码',//
label: '按钮代码', //
placeholder: '',
field: 'action',
tableHide: true, //
@ -141,12 +146,12 @@ export default {
inputType: 'input',
rules: [
{ required: true, message: '目标必填', trigger: 'blur' },
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' },
],
disabled: false,
},
{
label: '按钮名称',//
label: '按钮名称', //
placeholder: '',
field: 'actionName',
fieldTableRowRenderer: (row) => {
@ -158,12 +163,12 @@ export default {
inputType: 'input',
rules: [
{ required: true, message: '目标按钮名称必填', trigger: 'blur' },
{ min: 1, max: 128, message: '不超过128个字符', trigger: 'blur' }
{ min: 1, max: 128, message: '不超过128个字符', trigger: 'blur' },
],
disabled: false,
},
{
label: '启用状态',//0-- 1-- DIC_NAME=ENABLE_FLAG
label: '启用状态', //0-- 1-- DIC_NAME=ENABLE_FLAG
placeholder: '',
field: 'enableFlag',
fieldTableRowRenderer: (row) => {
@ -176,7 +181,7 @@ export default {
},
colorStyle: {
0: 'table-danger', //keyeditField'': 'danger','': 'primary','绿': 'success','': 'warning','': 'info',''''
1: 'table-success'
1: 'table-success',
},
rules: [
{ required: true, message: '启用状态必填', trigger: 'blur' },
@ -184,13 +189,12 @@ export default {
disabled: false,
},
{
label: '排序',//
label: '排序', //
placeholder: '',
field: 'sort',
editField: 'sort',
inputType: 'input',
rules: [
],
rules: [],
disabled: false,
},
@ -239,9 +243,8 @@ export default {
}
},
created () { },
methods: {
}
created() {},
methods: {},
}
</script>

@ -1,25 +1,9 @@
<template>
<el-dialog class="tree_dialog"
title="设置权限项"
width="60%"
:close-on-click-modal="false"
center
:visible.sync="visib"
:before-close="closeDialog">
<el-tree ref="roleTree"
:data="treeData"
show-checkbox
node-key="id"
default-expand-all
:default-checked-keys="checkedKeys" />
<div slot="footer"
style="text-align: center">
<el-button type="primary"
plain
@click="saveTreeData">保存</el-button>
<el-button type="danger"
plain
@click="closeDialog">取消</el-button>
<el-dialog class="tree_dialog" title="为角色分配权限" width="60%" :close-on-click-modal="false" center :visible.sync="visib" :before-close="closeDialog">
<el-tree ref="roleTree" :data="treeData" show-checkbox node-key="id" default-expand-all :default-checked-keys="checkedKeys" />
<div slot="footer" style="text-align: center">
<el-button type="primary" plain @click="saveTreeData"></el-button>
<el-button type="danger" plain @click="closeDialog"></el-button>
</div>
</el-dialog>
</template>
@ -40,14 +24,14 @@ export default {
},
},
},
data () {
data() {
return {
checkedKeys: [], // keys
treeData: [], //
}
},
watch: {
visib (val) {
visib(val) {
if (val) {
//
console.log(1)
@ -55,17 +39,17 @@ export default {
}
},
},
created () { },
created() {},
methods: {
//
async getTreeData () {
async getTreeData() {
const { code, data } = await accessRoleAuthorityTree(this.roleCode)
if (code != '200') return
this.treeData = data.treeData
this.checkedKeys = data.checkedKeys
},
async saveTreeData () {
async saveTreeData() {
var params = {
roleCode: this.roleCode,
authorityList: this.$refs.roleTree.getCheckedKeys(true),
@ -76,7 +60,7 @@ export default {
},
//
closeDialog () {
closeDialog() {
this.treeData = []
this.checkedKeys = []
this.$emit('handleClose')

@ -1,31 +1,32 @@
<template>
<anji-crud ref="listPage"
:option="crudOption">
<anji-crud ref="listPage" :option="crudOption">
<template v-slot:buttonLeftOnTable>
</template>
<template slot="rowButton"
slot-scope="props">
<el-button type="text"
@click="handleOpenDialogSetAuthorityForRole(props)">设定权限</el-button>
<template slot="rowButton" slot-scope="props">
<el-button type="text" @click="handleOpenDialogSetAuthorityForRole(props)" v-permission="'roleManage:grantAuthority'"></el-button>
</template>
<!--自定义的卡片插槽将在编辑详情页面出现在底部新卡片-->
<template v-slot:pageSection>
<RoleAuthority :role-code="roleCode"
:visib="dialogVisibleSetAuthorityForRole"
@handleClose="dialogVisibleSetAuthorityForRole = false" />
<RoleAuthority :role-code="roleCode" :visib="dialogVisibleSetAuthorityForRole" @handleClose="dialogVisibleSetAuthorityForRole = false" />
</template>
</anji-crud>
</template>
<script>
import { accessRoleList, accessRoleAdd, accessRoleDeleteBatch, accessRoleUpdate, accessRoleDetail } from '@/api/accessRole'
import {
accessRoleList,
accessRoleAdd,
accessRoleDeleteBatch,
accessRoleUpdate,
accessRoleDetail,
} from '@/api/accessRole'
import RoleAuthority from '@/views/accessRole/components/RoleAuthority'
export default {
name: 'AccessRole',
components: {
RoleAuthority: RoleAuthority,
},
data () {
data() {
return {
//
dialogVisibleSetAuthorityForRole: false,
@ -42,12 +43,12 @@ export default {
{
inputType: 'input',
label: '角色编码',
field: 'roleCode'
field: 'roleCode',
},
{
inputType: 'input',
label: '角色名称',
field: 'roleName'
field: 'roleName',
},
{
inputType: 'anji-select', //form input|input-number|anji-select(urldictCode)|anji-tree()|date|datetime|datetimerange
@ -62,23 +63,23 @@ export default {
buttons: {
query: {
api: accessRoleList,
permission: 'roleManage:query'
permission: 'roleManage:query',
},
queryByPrimarykey: {
api: accessRoleDetail,
permission: 'roleManage:query'
permission: 'roleManage:query',
},
add: {
api: accessRoleAdd,
permission: 'roleManage:insert'
permission: 'roleManage:insert',
},
delete: {
api: accessRoleDeleteBatch,
permission: 'roleManage:delete'
permission: 'roleManage:delete',
},
edit: {
api: accessRoleUpdate,
permission: 'roleManage:update'
permission: 'roleManage:update',
},
},
//
@ -99,7 +100,7 @@ export default {
inputType: 'input',
rules: [
{ required: true, message: '角色编码必填', trigger: 'blur' },
{ min: 1, max: 32, message: '不超过32个字符', trigger: 'blur' }
{ min: 1, max: 32, message: '不超过32个字符', trigger: 'blur' },
],
disabled: false,
},
@ -114,12 +115,12 @@ export default {
inputType: 'input',
rules: [
{ required: true, message: '角色名称必填', trigger: 'blur' },
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' },
],
disabled: false,
},
{
label: '启用状态',//0-- 1-- DIC_NAME=ENABLE_FLAG
label: '启用状态', //0-- 1-- DIC_NAME=ENABLE_FLAG
placeholder: '',
field: 'enableFlag',
fieldTableRowRenderer: (row) => {
@ -132,7 +133,7 @@ export default {
},
colorStyle: {
0: 'table-danger', //keyeditField'': 'danger','': 'primary','绿': 'success','': 'warning','': 'info',''''
1: 'table-success'
1: 'table-success',
},
rules: [
{ required: true, message: '启用状态必填', trigger: 'blur' },
@ -180,13 +181,13 @@ export default {
},
}
},
created () { },
created() {},
methods: {
handleOpenDialogSetAuthorityForRole (props) {
handleOpenDialogSetAuthorityForRole(props) {
this.roleCode = props.msg.roleCode
this.dialogVisibleSetAuthorityForRole = true
},
}
},
}
</script>

@ -1,25 +1,9 @@
<template>
<el-dialog class="tree_dialog"
title="授权角色"
width="60%"
:close-on-click-modal="false"
center
:visible.sync="visib"
:before-close="closeDialog">
<el-tree ref="roleTree"
:data="treeData"
show-checkbox
node-key="id"
default-expand-all
:default-checked-keys="checkedKeys" />
<div slot="footer"
style="text-align: center">
<el-button type="primary"
plain
@click="saveTreeData">保存</el-button>
<el-button type="danger"
plain
@click="closeDialog">取消</el-button>
<el-dialog class="tree_dialog" title="为用户分配角色" width="60%" :close-on-click-modal="false" center :visible.sync="visib" :before-close="closeDialog">
<el-tree ref="roleTree" :data="treeData" show-checkbox node-key="id" default-expand-all :default-checked-keys="checkedKeys" />
<div slot="footer" style="text-align: center">
<el-button type="primary" plain @click="saveTreeData"></el-button>
<el-button type="danger" plain @click="closeDialog"></el-button>
</div>
</el-dialog>
</template>
@ -40,14 +24,14 @@ export default {
},
},
},
data () {
data() {
return {
checkedKeys: [], // keys
treeData: [], //
}
},
watch: {
visib (val) {
visib(val) {
if (val) {
//
console.log(1)
@ -55,17 +39,17 @@ export default {
}
},
},
created () { },
created() {},
methods: {
//
async getTreeData () {
async getTreeData() {
const { code, data } = await getRoleTree(this.loginName)
if (code != '200') return
this.treeData = data.treeData
this.checkedKeys = data.checkedKeys
},
async saveTreeData () {
async saveTreeData() {
var params = {
loginName: this.loginName,
roleCodeList: this.$refs.roleTree.getCheckedKeys(true),
@ -76,7 +60,7 @@ export default {
},
//
closeDialog () {
closeDialog() {
this.treeData = []
this.checkedKeys = []
this.$emit('handleClose')

@ -4,7 +4,8 @@
</template>
<template slot="rowButton" slot-scope="props">
<el-button type="text" @click="handleOpenDialogSetRoleForUser(props)"></el-button>
<el-button type="text" @click="handleOpenDialogSetRoleForUser(props)" v-permission="'userManage:grantRole'"></el-button>
<!--<el-button type="text" @click="handleOpenDialogSetRoleForUser(props)" v-permission="'userManage:resetPassword'"></el-button>-->
</template>
<!--自定义的卡片插槽将在编辑详情页面出现在底部新卡片-->
<template v-slot:pageSection>

Loading…
Cancel
Save