Files
mosr-web/src/components/NameCircle.vue
2024-05-19 15:27:22 +08:00

127 lines
2.6 KiB
Vue

<template>
<div>
<slot name="pre"></slot>
<div class="user-audit">
<div class="circle-user">
<Tooltip :content="user.name" placement="bottom-start" width="45"/>
<div v-if="user.icon"
class="el-timeline-item__node" :style="{
backgroundColor: user.color
}">
<el-icon v-if="user.icon" size="15" :class="user.class">
<component :is="user.icon"/>
</el-icon>
</div>
</div>
<div class="username" v-if="user.auditOpinion">
<div style="margin-bottom: 10px;color: #909399">{{user.operationTime}}</div>
<Tooltip :content="user.auditOpinion" placement="bottom-start" width="150" :lines="true"/>
</div>
</div>
</div>
</template>
<script setup>
import {Loading, Close, CircleCheckFilled, MoreFilled} from '@element-plus/icons-vue'
import {defineProps} from "vue";
const props = defineProps({
row: {
type: Number,
default: 1
},
hoverTip: {
type: Boolean,
default: false
},
user: {
type: Object,
default: {}
},
mode: {
type: String,
default: 'design'
}
})
const init = () => {
// for (let user of props.userInfo) {
initUser(props.user)
// }
}
const initUser = (user) => {
let state = user.state
//创建节点
if (state === 'CREATE') {
user["icon"] = CircleCheckFilled
user["color"] = "#0bbd87"
}
//审批通过
if (state === 'AGREE' || state === 'AUTO_PASS') {
user["icon"] = CircleCheckFilled
user["color"] = "#0bbd87"
}
//审批处理中
if (state === 'RUNNING') {
user["icon"] = Loading
user["color"] = "#f78f5f"
user["class"] = 'is-loading'
}
//拒绝后评论
if (state === 'REFUSE') {
user["icon"] = Close
user["color"] = "#f56c6c"
}
if (state === 'PASS') {
user["icon"] = MoreFilled
user["color"] = "#c0c4cc"
}
return user;
}
init()
</script>
<style scoped lang="scss">
.user-audit {
display: flex;
flex-direction: column;
align-items: center;
.circle-user {
width: 50px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
border: 1px solid #ACACAC;
position: relative;
.el-timeline-item__node {
position: absolute;
bottom: 0;
right: 1px;
}
}
.username {
//width: 90px;
margin-top: 10px;
background: #f5f5f5;
padding: 5px;
.el-tooltip__trigger {
width: 90px;
text-align: center;
//padding-top: 2px;
//text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden
}
}
}
</style>