|
@@ -3,25 +3,27 @@
|
|
|
<div class="ml">工作经验 <span v-if="total > queryParams.pageSize">{{ '最多展示' + queryParams.pageSize + '条数据' }}</span></div>
|
|
|
<el-timeline>
|
|
|
<template v-for="(val, index) in list" :key="index">
|
|
|
- <template v-if="retract || index < displayIndex">
|
|
|
+ <template v-if="expandAll || index < foldNum">
|
|
|
<el-timeline-item center placement="top" color="#0bbd87">
|
|
|
<div class="timeline-item">
|
|
|
- <div style="width: 20%;">
|
|
|
+ <div class="timeline-item-time">
|
|
|
<span>{{ val?.startTime ? timesTampChange(val.startTime, 'Y-M') : '未填写工作时间' }}</span>
|
|
|
<span v-if="val?.startTime"> - {{ val.startTime ? val.endTime ? timesTampChange(val.endTime, 'Y-M') : '至今' : '' }}</span>
|
|
|
<span v-if="val?.startTime"> ({{ val.startTime ? getTimeDifferenceInChinese(val.startTime, val.endTime) : '' }})</span>
|
|
|
</div>
|
|
|
- <div class="timeline-item-name mx-3">{{ formatName(val.enterpriseName) || '' }}</div>
|
|
|
- <div class="timeline-item-name">{{ formatName(val.positionName) || '' }}</div>
|
|
|
+ <div class="timeline-item-content">
|
|
|
+ <div class="timeline-item-name">{{ formatName(val.enterpriseName) || '' }}</div>
|
|
|
+ <div class="timeline-item-name">{{ formatName(val.positionName) || '' }}</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-timeline-item>
|
|
|
</template>
|
|
|
</template>
|
|
|
<!-- 允许折叠情况下数据大于displayIndex 展示折叠按钮 -->
|
|
|
- <div v-if="list.length > displayIndex && !displayAll" class="showBtn color-primary" @click.stop="retract = Boolean(!retract)">
|
|
|
- <span>{{ retract ? '折叠' : '展开全部' }}</span>
|
|
|
+ <div v-if="list.length > foldNum && !defaultShowAll" class="showBtn color-primary" @click.stop="expandAll = Boolean(!expandAll)">
|
|
|
+ <span>{{ expandAll ? '折叠' : '展开全部' }}</span>
|
|
|
<!-- <div class="icons">
|
|
|
- <i :class="retract ? 'up' : 'down'"></i>
|
|
|
+ <i :class="expandAll ? 'up' : 'down'"></i>
|
|
|
<i class="el-icon-down"></i>
|
|
|
</div> -->
|
|
|
</div>
|
|
@@ -40,7 +42,7 @@ import { formatName } from '@/utils'
|
|
|
const props = defineProps({
|
|
|
userId: [String, Number],
|
|
|
data: Array,
|
|
|
- displayAll: Boolean
|
|
|
+ defaultShowAll: Boolean // 展示所有工作经验
|
|
|
})
|
|
|
|
|
|
const queryParams = reactive({
|
|
@@ -48,8 +50,8 @@ const queryParams = reactive({
|
|
|
pageSize: 100,
|
|
|
userId: props.userId
|
|
|
})
|
|
|
-const retract = ref(!props.displayAll) // 是否默认折叠
|
|
|
-const displayIndex = ref(2) // 默认展示个数-1
|
|
|
+const expandAll = ref(props.defaultShowAll) // 展开/折叠
|
|
|
+const foldNum = ref(2) // 折叠时展示个数-1
|
|
|
|
|
|
const list = ref(props.data || [])
|
|
|
const total = ref(props.data?.length || 0)
|
|
@@ -59,12 +61,13 @@ const getList = async () => {
|
|
|
loading.value = true
|
|
|
try {
|
|
|
const data = await PersonInfoApi.getPersonExpPage(queryParams)
|
|
|
- list.value = data.list ? data.list.map(exp => {
|
|
|
+ list.value = data.list?.length ? data.list.map(exp => {
|
|
|
exp.startTimeStr = exp.startTime ? timesTampChange(exp.startTime, 'Y-M') : '未填写工作时间'
|
|
|
exp.endTimeStr = exp.startTime ? exp.endTime ? timesTampChange(exp.endTime, 'Y-M') : '至今' : ''
|
|
|
exp.year = exp.endTimeStr ? getTimeDifferenceInChinese(exp.startTime, exp.endTime) : ''
|
|
|
// 未填写工作经验内容,不展示
|
|
|
exp.show = Boolean(exp.year) || Boolean(exp.enterpriseName) || Boolean(exp.positionName)
|
|
|
+ return exp
|
|
|
}) : []
|
|
|
total.value = data.total
|
|
|
} finally {
|
|
@@ -84,15 +87,37 @@ getList()
|
|
|
width: 100%;
|
|
|
color: var(--color-666);
|
|
|
font-size: 13px;
|
|
|
- .timeline-item-name {
|
|
|
- width: 40%;
|
|
|
+ .timeline-item-time {
|
|
|
+ width: 20%;
|
|
|
+ min-width: 200px;
|
|
|
}
|
|
|
- .mx-3 {
|
|
|
- margin: 0 12px;
|
|
|
+ .timeline-item-content {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .timeline-item-name {
|
|
|
+ width: 50%;
|
|
|
+ padding-left: 12px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.el-timeline-item {
|
|
|
padding-bottom: 0;
|
|
|
}
|
|
|
+ .showBtn {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ color: #00b760;
|
|
|
+ cursor: pointer;
|
|
|
+ .icons {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ margin-left: 5px;
|
|
|
+ .icon {
|
|
|
+ line-height: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|