<template>
  <div>
    <q-timeline color="secondary" v-if="logList.length>0">
      <q-timeline-entry v-for="(item,index) in logList" :key="index" >
        <template #subtitle>
          <div class="flex justify-between">
            <div>
                <span>{{item.DayStr}}</span><span class="q-ml-md">{{item.TimeStr}}</span>
            </div>
            <div>{{item.CreateByName}}</div>
          </div>
        </template>
        <div>
          {{item.LogContent}}
        </div>
      </q-timeline-entry>
    </q-timeline>
    <div class="flex justify-center q-mt-md text-gray-4" v-if="logList.length==0">
        暂无操作记录
    </div>
    <div class="flex justify-end q-mt-md">
        <q-pagination v-model="logMsg.pageIndex" :max="pageCount" input color="primary" @input="changePage" v-if="logList.length>0"/>
    </div>
  </div>
</template>

<script>
  import {
    getLogList
  } from '../../../api/sale/peemanagement'
  export default {
    components: {

    },
    props: {
      Id: {
        type: Number,
        default: 0
      }
    },
    data() {
      return {
        logMsg: {
          pageIndex: 1,
          pageSize: 10,
          Type: 4,
          SourceId: 0
        },
        logList: [],
        pageCount:1,
      }
    },
    methods: {
      getLog() {
        this.logMsg.SourceId = this.Id
        getLogList(this.logMsg).then(res => {
          this.logList = res.Data.PageData
          this.pageCount=res.Data.PageCount
        })
      },
      changePage(val){
          this.logMsg.pageIndex=val
          this.getLog()
      },
      updatePage(){
         this.logMsg.pageIndex=1
         this.getLog() 
      }
    },
    mounted() {
      this.getLog()
    },
  }

</script>
