Commit 93e24cac by cwq0219

role-详细组件

1 parent 19b4c56e
<!-- createRoleComponent -->
<template>
<gl-dialog title="新增角色" :visible.sync="createVisible" :before-close="handleCreateCancel">
<gl-dialog :title="title" :visible.sync="createVisible" :before-close="handleCreateCancel">
<gl-form :model="createRuleForm" :rules="createRules" ref="createRuleForm" label-width="105px">
<gl-form-item label="角色名称:" prop="roleName">
<gl-input v-model="createRuleForm.roleName" clearable></gl-input>
......@@ -31,14 +31,15 @@ import { roleCreateStructure } from '@/common/roleCommon'
export default {
name: 'RoleCreate',
props: {
title: String,
createVisible: Boolean,
editParam: Object
roleParam: Object
},
watch: {
createVisible(val) {
!val && this.$refs['createRuleForm'].resetFields()
},
editParam(val) {
roleParam(val) {
if (val !== this.createRuleForm) {
this.createRuleForm = this.$deep_clone(val)
}
......
import RoleDetail from './src/main.vue'
RoleDetail.install = Vue => {
Vue.component(RoleDetail.name, RoleDetail)
}
export default RoleDetail
<!-- RoleDetail -->
<template>
<gl-dialog title="角色列表" :visible.sync="detailVisible" :before-close="handleDetailCancel">
<gl-form label-width="105px">
<gl-form-item label="角色名称:">
<span>{{roleParam.roleName}}</span>
</gl-form-item>
<gl-form-item label="角色描述:">
<span style="word-wrap: break-word;">{{roleParam.description}}</span>
</gl-form-item>
<gl-form-item label="菜单选项:"></gl-form-item>
</gl-form>
</gl-dialog>
</template>
<script>
export default {
name: 'RoleDetail',
props: {
detailVisible: Boolean,
roleParam: Object
},
data() {
return {
}
},
methods: {
handleDetailCancel() {
this.$emit('detailClose')
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
import UserCreate from './UserCreate'
import RoleCreate from './RoleCreate'
import RoleDetail from './RoleDetail'
import Tree from './Tree'
export {
UserCreate,
RoleCreate,
RoleDetail,
Tree
}
......@@ -7,8 +7,9 @@
</div>
<hr>
<div class="default p-t15">
<gl-button class="control-tabledata-button" size="small" @click="handleCreateOrEdit(editParam)">创建</gl-button>
<role-create :createVisible="createVisible" :editParam="editParam" @createClose="handleCreateClose"></role-create>
<gl-button class="control-tabledata-button" size="small" @click="handleCreateOrEdit(roleParam, '新增角色')">创建</gl-button>
<role-create :createVisible="createVisible" :roleParam="roleParam" :title="title" @createClose="handleCreateClose"></role-create>
<role-detail :detailVisible="detailVisible" :roleParam="roleParam" @detailClose="handleDetailClose"></role-detail>
<div class="m-b8">
<gl-table :table="roleData" :pagination="pagination"></gl-table>
</div>
......@@ -17,19 +18,22 @@
</template>
<script>
import { RoleCreate } from '@/components/index'
import { RoleCreate, RoleDetail } from '@/components/index'
import { roleTest } from '@/api/roleApi'
import { roleCreateStructure } from '@/common/roleCommon'
export default {
name: 'role',
components: {
RoleCreate
RoleCreate,
RoleDetail
},
data() {
return {
roleName: '',
createVisible: false,
editParam: roleCreateStructure,
detailVisible: false,
roleParam: roleCreateStructure,
title: '新增角色',
roleData: {
border: true,
height: 400,
......@@ -57,13 +61,13 @@ export default {
label: '编辑',
type: 'text',
callback: (index, rows) => {
this.handleCreateOrEdit(rows[index])
this.handleCreateOrEdit(rows[index], '角色列表')
}
}, {
label: '详细',
type: 'text',
callback: (index, rows) => {
this.$alert(rows[index])
this.handleGetRoleDetail(rows[index])
}
}, {
label: '删除',
......@@ -129,17 +133,29 @@ export default {
createDialogVisible() {
this.createVisible = !this.createVisible
},
DetaleDialogVisible() {
this.detailVisible = !this.detailVisible
},
handleSearchRoleName() {
this.roleName = ''
},
handleCreateOrEdit(params) {
handleGetRoleDetail(params) {
this.roleParam = params
this.DetaleDialogVisible()
},
handleDetailClose() {
this.DetaleDialogVisible()
this.roleParam = roleCreateStructure
},
handleCreateOrEdit(params, title) {
this.createDialogVisible()
this.editParam = params
this.title = title
this.roleParam = params
},
// 关闭新增用户组件
handleCreateClose(flagEOrC, data) {
this.createDialogVisible()
this.editParam = roleCreateStructure
this.roleParam = roleCreateStructure
!data && this.message('取消创建角色')
// 将数据提交给后台,根据返回结果做判断
data && !flagEOrC && this.addRole(data)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!