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

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

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

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

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

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

@ -4,7 +4,8 @@
</template> </template>
<template slot="rowButton" slot-scope="props"> <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>
<!--自定义的卡片插槽将在编辑详情页面出现在底部新卡片--> <!--自定义的卡片插槽将在编辑详情页面出现在底部新卡片-->
<template v-slot:pageSection> <template v-slot:pageSection>

Loading…
Cancel
Save