2021-03-17 11:22:18 +08:00
|
|
|
<template>
|
2021-03-17 18:50:29 +08:00
|
|
|
<div>
|
|
|
|
<el-button v-show="!showSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showSearchWidget" />
|
|
|
|
<div v-show="showSearchInput" class="de-input">
|
|
|
|
<el-input v-model="key">
|
|
|
|
<el-button slot="append" icon="el-icon-close" @click="closeSearchWidget" />
|
|
|
|
</el-input>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<el-tabs v-model="activeName" :class="{'de-search-header': showSearchInput}" @tab-click="handleClick">
|
2021-03-18 16:55:31 +08:00
|
|
|
<el-tab-pane :lazy="true" class="de-tab" label="部门" :name="tabNames[0]"><grant-dept :ref="tabNames[0]" :resource-id="resourceId" :key-word="key" /></el-tab-pane>
|
|
|
|
<el-tab-pane :lazy="true" class="de-tab" label="角色" :name="tabNames[1]"><grant-role :ref="tabNames[1]" :resource-id="resourceId" :key-word="key" /></el-tab-pane>
|
|
|
|
<el-tab-pane :lazy="true" class="de-tab" label="用户" :name="tabNames[2]"><grant-user :ref="tabNames[2]" :resource-id="resourceId" :key-word="key" /></el-tab-pane>
|
2021-03-17 18:50:29 +08:00
|
|
|
</el-tabs>
|
2021-03-18 16:55:31 +08:00
|
|
|
<div class="auth-root-class">
|
|
|
|
<span slot="footer">
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
<el-button type="primary" @click="save">确 定</el-button>
|
|
|
|
</span>
|
|
|
|
</div>
|
2021-03-17 18:50:29 +08:00
|
|
|
</div>
|
|
|
|
|
2021-03-17 11:22:18 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-03-17 18:50:29 +08:00
|
|
|
import GrantDept from './dept'
|
|
|
|
import GrantRole from './role'
|
|
|
|
import GrantUser from './user'
|
2021-03-17 11:22:18 +08:00
|
|
|
export default {
|
|
|
|
name: 'GrantAuth',
|
2021-03-17 18:50:29 +08:00
|
|
|
components: { GrantDept, GrantRole, GrantUser },
|
2021-03-17 11:22:18 +08:00
|
|
|
props: {
|
|
|
|
resourceId: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-03-18 16:55:31 +08:00
|
|
|
tabNames: ['grantDept', 'grantRole', 'grantUser'],
|
|
|
|
activeName: null,
|
2021-03-17 18:50:29 +08:00
|
|
|
showSearchInput: false,
|
2021-03-18 16:55:31 +08:00
|
|
|
key: ''
|
2021-03-17 11:22:18 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-18 16:55:31 +08:00
|
|
|
created() {
|
|
|
|
this.activeName = this.tabNames[0]
|
|
|
|
},
|
2021-03-17 11:22:18 +08:00
|
|
|
|
|
|
|
methods: {
|
|
|
|
handleClick(tab, event) {
|
|
|
|
console.log(tab, event)
|
2021-03-17 18:50:29 +08:00
|
|
|
},
|
|
|
|
showSearchWidget() {
|
|
|
|
this.showSearchInput = true
|
|
|
|
},
|
|
|
|
closeSearchWidget() {
|
2021-03-18 16:55:31 +08:00
|
|
|
this.key = ''
|
2021-03-17 18:50:29 +08:00
|
|
|
this.showSearchInput = false
|
2021-03-18 16:55:31 +08:00
|
|
|
},
|
|
|
|
save() {
|
|
|
|
this.$refs[this.activeName].save()
|
|
|
|
this.$emit('close-grant', 0)
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.$refs[this.activeName].cancel()
|
|
|
|
this.$emit('close-grant', 0)
|
2021-03-17 11:22:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2021-03-17 18:50:29 +08:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.de-tab {
|
|
|
|
border:1px solid #E6E6E6;
|
|
|
|
min-height:200px !important;
|
|
|
|
max-height:300px !important;
|
|
|
|
overflow:auto;
|
|
|
|
}
|
|
|
|
.de-icon {
|
|
|
|
position: absolute;
|
|
|
|
right: 20px;
|
|
|
|
top: 50px;
|
|
|
|
z-index: 99;
|
|
|
|
}
|
|
|
|
.el-input-group__append{
|
|
|
|
background-color: #ffffff;
|
|
|
|
}
|
|
|
|
.el-input__inner{
|
|
|
|
border-right: none;
|
|
|
|
}
|
|
|
|
|
2021-03-18 16:55:31 +08:00
|
|
|
.auth-root-class {
|
|
|
|
margin: 15px 0px 5px;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
|
2021-03-17 18:50:29 +08:00
|
|
|
// ::-webkit-scrollbar {
|
|
|
|
|
|
|
|
// }
|
|
|
|
</style>
|