<template>
    <div class="wrapper">
        <el-timeline>
            <el-timeline-item
                :timestamp="ele.time"
                placement="top"
                v-for="(ele, i) in subTimelineData"
                icon="iconfont iconriqi"
                :key="i"
            >
                <div
                    v-for="(item, index) in ele.info"
                    :key="index"
                    class="time-line-box"
                >
                    <p>
                        <span class="time-lime-title">
                            <i
                                class="iconfont"
                                :class="getCategoryClass(item.category)"
                            ></i>
                            <span class="sub-title">
                                {{ item.title ? item.title : "" }}</span
                            >
                        </span>
                        <span
                            v-if="item.type && item.type === '外院'"
                            class="start-type"
                            >{{ item.type }}</span
                        >
                        <span v-else class="start-time">{{
                            item.start_time
                        }}</span>
                    </p>
                    <div class="time-line-desc">
                        <div class="">
                            <span v-if="item.description">
                                {{ item.description }}
                            </span>
                        </div>
                    </div>
                </div>
            </el-timeline-item>
            <el-timeline-item
                timestamp="last"
                placement="top"
                icon="iconfont iconriqi"
            ></el-timeline-item>
        </el-timeline>
    </div>
</template>

<script>
export default {
    props:['subTimelineData', 'tableModal'],
    data(){
        return{

        }
    },
    methods:{
        getCategoryClass(category) {
            let name = '';
            let iconVal = ''
            this.tableModal.forEach(item => {
                if (item.list.indexOf(category) >= 0) {
                    name = item.value
                }
            })
            if (name === "outpatients_hospital_record") {
                iconVal = 'iconicon1'
            } else if (name === "operationf" || name === "treatment") {
                iconVal = 'iconshengmingtizheng'
            } else if (name === "other_check_report") {
                iconVal = "iconicon2"
            } else if (name === "pathology_report" || name === "image_report") {
                iconVal = "iconicon3"
            }
            return iconVal
        },
    }
}
</script>

<style lang="less" scoped>
.wrapper{
   margin-left: 50%;
}
</style>