<template>
  <m-dialog
    :show.sync="isShow"
    width="750px"
    :title="$t('ManualEntryPage.opera_logs')"
    @close="closeDialog"
  >
    <div>
      <el-table
        :data="tableData"
        style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);margin-top: 20px"
        border
        ref="table"
      >
        <el-table-column
          v-for="item in tableColums"
          :key="item.key"
          :label="item.label"
          :width="item.widthsty"
          :min-width="item.minwidthsty"
          align="center"
        >
          <template slot-scope="{row}">
            <span>{{row[item.key]}}</span>
          </template>
        </el-table-column>

      </el-table>
      <div style="height:35px;margin: 20px 0;">
        <m-page
          :page_no="page_no"
          :pageSize="pageSize"
          :total="total"
          @handleCurrentChange="pageChange"
        />
      </div>
    </div>
  </m-dialog>
</template>
<script>
import { dataInterence } from '@/api/api.js';
import mDialog from '@/components/mDialog.vue';
import mPage from '@/components/mPage.vue';
export default {
  components: { mDialog,mPage },
  props: {
    isShow: {
      type: Boolean
    },
    edbCode: {
      type: String
    }
  },
  watch: {
    isShow(nval) {
      if(!nval) return 
      this.getTableData()
    }
  },
  computed: {
    tableColums() {
      return [
        {  label: /* '操作时间' */this.$t('ManualEntryPage.opera_time'),key: 'CreateTime' },
        {  label: /* '操作内容' */this.$t('ManualEntryPage.opera_msg'),key: 'Remark',minwidthsty:'150px' },
        {  label: /* '操作人' */this.$t('ManualEntryPage.opera_user'),key: 'UserName'},
      ]
    }
  },
  data() {
    return {
      tableData: [],
      page_no:1,
      pageSize: 8,
      total: 0
    }
  },
  mounted(){

  },
  methods:{
    async getTableData() {
      const res = await dataInterence.getOperaLogsList({
        PageSize: this.pageSize,
        CurrentIndex: this.page_no,
        TradeCode: this.edbCode
      })

      if(res.Ret !== 200) return 

      this.tableData = res.Data.List || [];
      this.total = res.Data.Paging.Totals;

    },

    pageChange(page) {
      this.page_no = page;
      this.getTableData()
    },

    closeDialog() {
      this.$emit('update:isShow',false)
    }
  },
}
</script>
<style scoped lang='scss'>

</style>
