<style>
  .EmployeeLog {
    margin: 20px;
    font-size: 13px;
  }

  .Employee_TimeLine {
    display: flex;
    align-items: center;
    font-size: 13px;
  }

</style>
<template>
  <div class="EmployeeLog">
    <div v-for="(item,index) in LogList">
      <span style="font-weight:bold;">{{item.NewTime}} {{item.WeekStr}}</span>
      <q-timeline>
        <template v-for="(subItem,subIndex) in item.LogList">
          <q-timeline-entry>
            <template v-slot:title>
              <div class="Employee_TimeLine">
                {{subItem.TimeStr}}
                <q-avatar size="sm" v-if="subItem.UserIcon" style="margin:0 5px 0 10px">
                  <img :src="subItem.UserIcon" />
                </q-avatar>
                <q-avatar size="sm" color="teal-10" text-color="white" style="margin:0 5px 0 10px"
                  v-if="!subItem.UserIcon">
                  <template v-if="setingObj.CreateName&&setingObj.CreateName!=''">
                    {{setingObj.CreateName.substring(0,1)}}
                  </template>
                </q-avatar>
                {{subItem.CreateName}}
              </div>
            </template>
            <div>
              {{subItem.LogContent}}
            </div>
          </q-timeline-entry>
        </template>
      </q-timeline>
    </div>
  </div>
</template>

<script>
  import {
    queryEmpChangeLog
  } from '../../../api/school/index'
  export default {
    props: {
      saveObj: {
        type: Object,
        default: null
      }
    },
    name: "EmployeeLog",
    data() {
      return {
        qMsg: {
          AccountId: 0, //账号表中的AccountId
          AccountType: 0, //账号表中的AccountType
        },
        LogList: [], //日志列表
      }
    },
    created() {
      if (this.saveObj) {
        this.qMsg.AccountId = this.saveObj.AccountId;
        this.qMsg.AccountType = this.saveObj.AccountType;
      }
    },
    mounted() {
      this.getEmpLog();
    },
    methods: {
      //获取员工修改日志
      getEmpLog() {
        queryEmpChangeLog(this.qMsg).then(res => {
          if (res.Code == 1) {
            this.LogList = res.Data;
          }
        });
      }
    },
    watch: {
      saveObj: function (val, oldval) {
        this.qMsg.AccountId = this.saveObj.AccountId;
        this.qMsg.AccountType = this.saveObj.AccountType;
        this.getEmpLog();
      }
    }
  }

</script>
