2023-11-10 20:34:36 +08:00
|
|
|
<template>
|
2024-02-01 18:45:13 +08:00
|
|
|
<div v-if="!params.data.folder" class="flex items-center gap-1 cursor-pointer h-9" @click="openAccessModal">
|
2023-11-10 20:34:36 +08:00
|
|
|
<div v-for="(user, i) in visibleUsers" :key="i" :title="user.full_name">
|
2024-03-04 18:07:15 +08:00
|
|
|
<img :src="user.avatar" class="w-7 h-7 rounded-full" />
|
2023-11-10 20:34:36 +08:00
|
|
|
</div>
|
2023-12-11 16:18:22 +08:00
|
|
|
<div v-if="hiddenUsers.length > 0" :title="hiddenUsersTitle"
|
|
|
|
class="flex shrink-0 items-center justify-center w-7 h-7 text-xs rounded-full bg-sn-dark-grey text-sn-white">
|
2023-11-10 20:34:36 +08:00
|
|
|
+{{ hiddenUsers.length }}
|
|
|
|
</div>
|
2024-03-14 20:47:12 +08:00
|
|
|
<div v-if="params.data.permissions['manage_users_assignments']"
|
2024-04-23 17:16:10 +08:00
|
|
|
class="flex items-center shrink-0 justify-center w-7 h-7 rounded-full border-dashed bg-sn-white text-sn-sleepy-grey border-sn-sleepy-grey">
|
2023-11-10 20:34:36 +08:00
|
|
|
<i class="sn-icon sn-icon-new-task"></i>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'UsersRenderer',
|
|
|
|
props: {
|
|
|
|
params: {
|
2023-12-11 16:18:22 +08:00
|
|
|
required: true,
|
2023-12-05 03:59:16 +08:00
|
|
|
},
|
2023-11-10 20:34:36 +08:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
users() {
|
2023-12-11 16:18:22 +08:00
|
|
|
return this.params.value || [];
|
2023-11-10 20:34:36 +08:00
|
|
|
},
|
|
|
|
visibleUsers() {
|
2023-12-11 16:18:22 +08:00
|
|
|
return this.users.slice(0, 4);
|
2023-11-10 20:34:36 +08:00
|
|
|
},
|
|
|
|
hiddenUsers() {
|
2023-12-11 16:18:22 +08:00
|
|
|
return this.users.slice(4);
|
2023-11-10 20:34:36 +08:00
|
|
|
},
|
|
|
|
hiddenUsersTitle() {
|
2023-12-11 16:18:22 +08:00
|
|
|
return this.hiddenUsers.map((user) => user.full_name).join('\u000d');
|
2023-12-12 19:17:38 +08:00
|
|
|
}
|
2023-12-05 03:59:16 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
openAccessModal() {
|
2023-12-11 16:18:22 +08:00
|
|
|
this.params.dtComponent.$emit('access', {}, [this.params.data]);
|
2023-12-12 19:17:38 +08:00
|
|
|
}
|
|
|
|
}
|
2023-12-11 16:18:22 +08:00
|
|
|
};
|
|
|
|
</script>
|