<template>
  <div class="EmployeeLog">
    <div v-for="(item,index) in LogList">
      <span>{{item.NewTime}} {{item.WeekStr}}</span>
      <q-timeline>
        <template v-for="(subItem,subIndex) in item.LogList">
          <q-timeline-entry>
            <template v-slot:title>
              {{subItem.TimeStr}}
              <q-avatar rounded size="sm" v-if="subItem.UserIcon">
                <img :src="subItem.UserIcon" />
              </q-avatar>
              {{subItem.CreateName}}
            </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;
          }
        });
      }
    },
  }

</script>
