|
@@ -2,13 +2,13 @@
|
|
|
<el-dialog
|
|
|
v-model="dialogVisible"
|
|
|
class="le-dialog"
|
|
|
- :title="titleMap[type - 1]"
|
|
|
- :width="type == 1 ? 680 : 460"
|
|
|
+ :title="curTitle"
|
|
|
+ :width="type === 1 ? 680 : 460"
|
|
|
destroy-on-close
|
|
|
append-to-body
|
|
|
@closed="$emit('closed')"
|
|
|
>
|
|
|
- <template v-if="type == 1">
|
|
|
+ <template v-if="type === 1">
|
|
|
<div class="sc-user-select">
|
|
|
<div class="sc-user-select__left">
|
|
|
<div class="sc-user-select__search">
|
|
@@ -86,7 +86,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <template v-if="type == 2">
|
|
|
+ <template v-if="type === 3">
|
|
|
<div class="sc-user-select sc-user-select-role">
|
|
|
<div class="sc-user-select__left">
|
|
|
<div class="sc-user-select__select">
|
|
@@ -164,8 +164,6 @@ export default {
|
|
|
label: 'name',
|
|
|
children: 'children'
|
|
|
},
|
|
|
-
|
|
|
- titleMap: ['人员选择', '角色选择'],
|
|
|
dialogVisible: false,
|
|
|
showGrouploading: false,
|
|
|
showUserloading: false,
|
|
@@ -177,7 +175,7 @@ export default {
|
|
|
group: [],
|
|
|
user: [],
|
|
|
role: [],
|
|
|
- type: 1,
|
|
|
+ type: 1, // 1: 用户 3: 角色
|
|
|
selected: [],
|
|
|
value: []
|
|
|
}
|
|
@@ -185,21 +183,28 @@ export default {
|
|
|
computed: {
|
|
|
selectedIds() {
|
|
|
return this.selected.map(t => t.id)
|
|
|
+ },
|
|
|
+ curTitle() {
|
|
|
+ return {
|
|
|
+ 1: '人员选择',
|
|
|
+ 3: '角色选择'
|
|
|
+ }[this.type]
|
|
|
}
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
//打开赋值
|
|
|
open(type, data) {
|
|
|
+ // 1: 用户 3: 角色
|
|
|
this.type = type
|
|
|
this.value = JSON.parse(JSON.stringify(data || []))
|
|
|
this.selected = JSON.parse(JSON.stringify(data || []))
|
|
|
this.dialogVisible = true
|
|
|
|
|
|
- if (this.type == 1) {
|
|
|
+ if (this.type === 1) {
|
|
|
this.getGroup()
|
|
|
this.getUser()
|
|
|
- } else if (this.type == 2) {
|
|
|
+ } else if (this.type === 3) {
|
|
|
this.getRole()
|
|
|
}
|
|
|
},
|
|
@@ -268,9 +273,9 @@ export default {
|
|
|
//删除已选
|
|
|
deleteSelected(index) {
|
|
|
this.selected.splice(index, 1)
|
|
|
- if (this.type == 1) {
|
|
|
+ if (this.type === 1) {
|
|
|
this.$refs.userTree.setCheckedKeys(this.selectedIds)
|
|
|
- } else if (this.type == 2) {
|
|
|
+ } else if (this.type === 3) {
|
|
|
this.$refs.groupTree.setCheckedKeys(this.selectedIds)
|
|
|
}
|
|
|
},
|