update V3.0.0

This commit is contained in:
hupeng committed 2024-06-02 10:52:34 +08:00
1 parent 3b4e0ca614
commit b16dd30f0b
1227 files changed
+337804 -4

No files matched your search

@@ -0,0 +1,3 @@
import OperateLogV2 from './src/OperateLogV2.vue'
export { OperateLogV2 }
@@ -0,0 +1,105 @@
<!-- 某个记录的操作日志列表,目前主要用于 CRM 客户、商机等详情界面 -->
<template>
<div class="pt-20px">
<el-timeline>
<el-timeline-item
v-for="(log, index) in logList"
:key="index"
:timestamp="formatDate(log.createTime)"
placement="top"
>
<div class="el-timeline-right-content">
<el-tag class="mr-10px" type="success">{{ log.userName }}</el-tag>
{{ log.action }}
</div>
<template #dot>
<span :style="{ backgroundColor: getUserTypeColor(log.userType) }" class="dot-node-style">
{{ getDictLabel(DICT_TYPE.USER_TYPE, log.userType)[0] }}
</span>
</template>
</el-timeline-item>
</el-timeline>
</div>
</template>
<script lang="ts" setup>
import { OperateLogVO } from '@/api/system/operatelog'
import { formatDate } from '@/utils/formatTime'
import { DICT_TYPE, getDictLabel, getDictObj } from '@/utils/dict'
import { ElTag } from 'element-plus'
defineOptions({ name: 'OperateLogV2' })
interface Props {
logList: OperateLogVO[] // 操作日志列表
}
withDefaults(defineProps<Props>(), {
logList: () => []
})
/** 获得 userType 颜色 */
const getUserTypeColor = (type: number) => {
const dict = getDictObj(DICT_TYPE.USER_TYPE, type)
switch (dict?.colorType) {
case 'success':
return '#67C23A'
case 'info':
return '#909399'
case 'warning':
return '#E6A23C'
case 'danger':
return '#F56C6C'
}
return '#409EFF'
}
</script>
<style lang="scss" scoped>
// 时间线样式调整
:deep(.el-timeline) {
margin: 10px 0 0 110px;
.el-timeline-item__wrapper {
position: relative;
top: -20px;
.el-timeline-item__timestamp {
position: absolute !important;
top: 10px;
left: -150px;
}
}
.el-timeline-right-content {
display: flex;
align-items: center;
min-height: 30px;
padding: 10px;
background-color: #fff;
&::before {
position: absolute;
top: 10px;
left: 13px; /* 将伪元素水平居中 */
border-color: transparent #fff transparent transparent; /* 尖角颜色,左侧朝向 */
border-style: solid;
border-width: 8px; /* 调整尖角大小 */
content: ''; /* 必须设置 content 属性 */
}
}
}
.dot-node-style {
position: absolute;
left: -5px;
display: flex;
width: 20px;
height: 20px;
font-size: 10px;
color: #fff;
border-radius: 50%;
justify-content: center;
align-items: center;
}
</style>