142 lines
2.8 KiB
Vue
142 lines
2.8 KiB
Vue
|
<template>
|
||
|
<div class="role">
|
||
|
<div class="role__head">
|
||
|
<div class="role__head--title">
|
||
|
{{ $t(titleI18n) }}
|
||
|
</div>
|
||
|
<div class="role__head--add">
|
||
|
<el-button v-if="userId == room.creatorId" icon="el-icon-plus" circle plain @click="handleAddUser()" />
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="role__container">
|
||
|
<ul class="role__container--list">
|
||
|
<li v-for="(node, index) in options" :key="index">
|
||
|
<span>{{ node.nickName }}</span>
|
||
|
<i v-if="userId == room.creatorId" class="el-icon-close delete" @click="handleDelUser(node, index)" />
|
||
|
<div v-if="hasDevice" style="float: right; margin-right: 15px;">
|
||
|
<el-cascader
|
||
|
v-model="node.deviceCode"
|
||
|
size="mini"
|
||
|
:placeholder="$t('global.choose')"
|
||
|
:disabled="userId != room.creatorId"
|
||
|
:options="deviceList"
|
||
|
@change="handleSetUser(node, index)"
|
||
|
/>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
|
titleI18n: {
|
||
|
type: String,
|
||
|
required: true
|
||
|
},
|
||
|
userId: {
|
||
|
type: String,
|
||
|
required: true
|
||
|
},
|
||
|
room: {
|
||
|
type:Object,
|
||
|
required: true
|
||
|
},
|
||
|
options: {
|
||
|
type: Array,
|
||
|
required: true
|
||
|
},
|
||
|
roleType: {
|
||
|
type: String,
|
||
|
default: ''
|
||
|
},
|
||
|
deviceList: {
|
||
|
type: Array,
|
||
|
default() {
|
||
|
return [];
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
};
|
||
|
},
|
||
|
computed: {
|
||
|
hasDevice() {
|
||
|
return ['Driver', 'Attendant', 'IBP'].includes(this.roleType);
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
handleAddUser() {
|
||
|
this.$emit('addUser', this.roleType);
|
||
|
},
|
||
|
handleSetUser(node, index) {
|
||
|
},
|
||
|
handleDelUser(node, index) {
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
ul,
|
||
|
li {
|
||
|
list-style: none;
|
||
|
padding: 0;
|
||
|
margin: 0;
|
||
|
}
|
||
|
|
||
|
.role {
|
||
|
border: 1px solid #ccc;
|
||
|
height: 200px;
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
justify-content: space-between;
|
||
|
position: relative;
|
||
|
|
||
|
&__head {
|
||
|
border-bottom: 1px solid #ccc;
|
||
|
background: #f0f0f0;
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
|
padding: 3px;
|
||
|
&--title {
|
||
|
font-size: 14px;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
|
||
|
&--add {
|
||
|
/deep/ .el-button.is-circle {
|
||
|
padding: 5px;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
&__container {
|
||
|
flex-grow: 1;
|
||
|
&--list {
|
||
|
li {
|
||
|
height: 30px;
|
||
|
line-height: 30px;
|
||
|
padding-left: 10px;
|
||
|
|
||
|
&:hover {
|
||
|
background: #D6E0F2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.delete {
|
||
|
float: right;
|
||
|
margin-right: 10px;
|
||
|
margin-top: 7px;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|