<template>
<div>
  <el-dialog :title="logTitle" width="30%" :visible.sync="isDialogShow" @open="loadSQLLog">
    <el-row>
      <el-col :span="6">
        <div class="cellprop zvingalin">时间：</div>
        <div class="cellprop zvingalin">用户名：</div>
        <div class="cellprop zvingalin">IP地址：</div>
        <div class="cellprop zvingalin">原始消息：</div>
      </el-col>
      <el-col :span="18">
        <div class="cellprop" v-bind:text-content.prop="SQLLog.addTime"></div>
        <div class="cellprop" v-bind:text-content.prop="SQLLog.userName"></div>
        <div class="cellprop" v-bind:text-content.prop="SQLLog.IP"></div>
        <div class="cellprop" v-bind:text-content.prop="SQLLog.logMessage"></div>
      </el-col>
    </el-row>
    <div slot="footer">
      <el-button type="primary" @click="isDialogShow = false">确 定</el-button>
    </div>
  </el-dialog>
  </div>
</template>
<script>
import util from '@src/common/util.js'
export default {
  props: ['logUserName', 'logID', 'logShow', 'logTitle'],
  data() {
    return {
      SQLLog: []
    }
  },
  computed: {
    isDialogShow: {
      get() {
        return this.logShow
      },
      set(val) {
        this.$emit('update:logShow', val)
      }
    }
  },
  methods: {
    async loadSQLLog() {
      let SQLLogData = await axios.get('/ui/logs/initsqllog', {
        params: {
          userName: this.logUserName,
          logID: this.logID
        }
      })
      this.SQLLog = SQLLogData.data.data
      this.SQLLog.addTime = util.formatDate(this.SQLLog.addTime, 'yyyy-MM-dd HH:mm:ss')
    }
  },
  created() {}
}
</script>
<style>
  .cellprop {
    min-height: 24px;
  }
  .zvingalin{
    text-align: right;
  }
</style>
