Commit e97bff0e by cwq0219

role-用户组件

1 parent 93e24cac
<!-- createRoleComponent --> <!-- createRoleComponent -->
<template> <template>
<gl-dialog :title="title" :visible.sync="createVisible" :before-close="handleCreateCancel"> <gl-dialog :title="createOrEditTitle" :visible.sync="createVisible" :before-close="handleCreateCancel">
<gl-form :model="createRuleForm" :rules="createRules" ref="createRuleForm" label-width="105px"> <gl-form :model="createRuleForm" :rules="createRules" ref="createRuleForm" label-width="105px">
<gl-form-item label="角色名称:" prop="roleName"> <gl-form-item label="角色名称:" prop="roleName">
<gl-input v-model="createRuleForm.roleName" clearable></gl-input> <gl-input v-model="createRuleForm.roleName" clearable></gl-input>
...@@ -31,7 +31,7 @@ import { roleCreateStructure } from '@/common/roleCommon' ...@@ -31,7 +31,7 @@ import { roleCreateStructure } from '@/common/roleCommon'
export default { export default {
name: 'RoleCreate', name: 'RoleCreate',
props: { props: {
title: String, createOrEditTitle: String,
createVisible: Boolean, createVisible: Boolean,
roleParam: Object roleParam: Object
}, },
......
import UserDetail from './src/main.vue'
UserDetail.install = Vue => {
Vue.component(UserDetail.name, UserDetail)
}
export default UserDetail
<!-- -->
<template>
<div>
<gl-dialog :title="userDetailTitle" :visible.sync="userDetailVisible" :before-close="handleClose">
<gl-table :table="tableParam"></gl-table>
</gl-dialog>
</div>
</template>
<script>
export default {
name: 'UserDetail',
props: {
userDetailTitle: String,
userDetailVisible: Boolean,
dataParam: Object,
columnParam: Object
},
data() {
return {
tableParam: {
border: true,
data: [{
id: '1006',
username: 'text11',
realname: '陈婉清',
state: '启动'
}],
column: [{
label: '序号',
prop: 'id'
}, {
label: '账号',
prop: 'username'
}, {
label: '用户名称',
prop: 'realname'
}, {
label: '状态',
prop: 'state'
}],
console: {
label: '操作',
prop: 'option',
button: [{
label: '删除',
type: 'text',
callback: (index, rows) => {
this.$alert(rows[index])
}
}]
}
}
}
},
methods: {
handleClose() {
this.$emit('userDetailClose')
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file \ No newline at end of file
import UserCreate from './UserCreate' import UserCreate from './UserCreate'
import UserDetail from './UserDetail'
import RoleCreate from './RoleCreate' import RoleCreate from './RoleCreate'
import RoleDetail from './RoleDetail' import RoleDetail from './RoleDetail'
import Tree from './Tree' import Tree from './Tree'
export { export {
UserCreate, UserCreate,
UserDetail,
RoleCreate, RoleCreate,
RoleDetail, RoleDetail,
Tree Tree
......
...@@ -8,32 +8,36 @@ ...@@ -8,32 +8,36 @@
<hr> <hr>
<div class="default p-t15"> <div class="default p-t15">
<gl-button class="control-tabledata-button" size="small" @click="handleCreateOrEdit(roleParam, '新增角色')">创建</gl-button> <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-create :createVisible="createVisible" :roleParam="roleParam" :createOrEditTitle="createOrEditTitle" @createClose="handleCreateClose"></role-create>
<role-detail :detailVisible="detailVisible" :roleParam="roleParam" @detailClose="handleDetailClose"></role-detail> <role-detail :detailVisible="detailVisible" :roleParam="roleParam" @detailClose="handleDetailClose"></role-detail>
<user-detail :userDetailVisible="userDetailVisible" :userDetailTitle="userDetailTitle" @userDetailClose="userDetailDialogVisible"></user-detail>
<div class="m-b8"> <div class="m-b8">
<gl-table :table="roleData" :pagination="pagination"></gl-table> <gl-table :table="roleData" :pagination="pagination" :dataParam="[]" :columnParam="[]"></gl-table>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { RoleCreate, RoleDetail } from '@/components/index' import { RoleCreate, RoleDetail, UserDetail } from '@/components/index'
import { roleTest } from '@/api/roleApi' import { roleTest } from '@/api/roleApi'
import { roleCreateStructure } from '@/common/roleCommon' import { roleCreateStructure } from '@/common/roleCommon'
export default { export default {
name: 'role', name: 'role',
components: { components: {
RoleCreate, RoleCreate,
RoleDetail RoleDetail,
UserDetail
}, },
data() { data() {
return { return {
roleName: '', roleName: '',
createVisible: false, createVisible: false,
detailVisible: false, detailVisible: false,
userDetailVisible: false,
roleParam: roleCreateStructure, roleParam: roleCreateStructure,
title: '新增角色', createOrEditTitle: '新增角色',
userDetailTitle: '用户列表',
roleData: { roleData: {
border: true, border: true,
height: 400, height: 400,
...@@ -79,7 +83,7 @@ export default { ...@@ -79,7 +83,7 @@ export default {
label: '用户', label: '用户',
type: 'text', type: 'text',
callback: (index, rows) => { callback: (index, rows) => {
this.$alert(rows[index]) this.handleGetUserDetail(rows[index])
} }
}] }]
} }
...@@ -133,23 +137,29 @@ export default { ...@@ -133,23 +137,29 @@ export default {
createDialogVisible() { createDialogVisible() {
this.createVisible = !this.createVisible this.createVisible = !this.createVisible
}, },
DetaleDialogVisible() { detaleDialogVisible() {
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
}, },
userDetailDialogVisible() {
this.userDetailVisible = !this.userDetailVisible
},
handleSearchRoleName() { handleSearchRoleName() {
this.roleName = '' this.roleName = ''
}, },
handleGetRoleDetail(params) { handleGetRoleDetail(params) {
this.roleParam = params this.roleParam = params
this.DetaleDialogVisible() this.detaleDialogVisible()
}, },
handleDetailClose() { handleDetailClose() {
this.DetaleDialogVisible() this.detaleDialogVisible()
this.roleParam = roleCreateStructure this.roleParam = roleCreateStructure
}, },
handleGetUserDetail(params) {
this.userDetailDialogVisible()
},
handleCreateOrEdit(params, title) { handleCreateOrEdit(params, title) {
this.createDialogVisible() this.createDialogVisible()
this.title = title this.createOrEditTitle = title
this.roleParam = params this.roleParam = params
}, },
// 关闭新增用户组件 // 关闭新增用户组件
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!