<template>
  <div>
    <el-form label-position="top" :model="data" v-loading="loading" ref="form ">
      <el-row>
        <el-col :span="12 ">
          <el-form-item label="服务器地址 " prop="svrIp ">
            <el-input v-model="data.svrIp " readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12 ">
          <el-form-item label="服务器名称 " prop="svrName ">
            <el-input v-model="data.svrName " readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12 ">
          <el-form-item label="处理代码 " prop="respCode ">
            <el-input v-model="data.respCode " readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12 ">
          <el-form-item label="处理描述 " prop="respDesc ">
            <el-input v-model="data.respDesc " readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12 ">
          <el-form-item label="协议类型 " prop="acttype ">
            <el-input v-model="acttype " readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12 ">
          <el-form-item label="访问者地址 " prop="reqIp ">
            <el-input v-model="data.reqIp " readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12 ">
          <el-form-item label="操作开始时间 " prop="actSta ">
            <el-input v-model="actSta " readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12 ">
          <el-form-item label="操作结束时间 " prop="actEnd ">
            <el-input v-model="actEnd " readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item label="会话标识 " prop="sesId ">
        <el-input v-model="data.sesId " readonly></el-input>
      </el-form-item>
      <el-form-item label="请求终端类型 " prop="devType ">
        <el-input v-model="data.devType " readonly></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
  import BaseApi from '@/api/base/BaseApi';
  import LogsConstants from "@/module/logs/LogsConstants";

  export default {
    props: {
      uuid: String,
    },
    data() {
      return {
        LogsConstants,
        LogsOperLogApi: BaseApi('/logs/LogsOperLog'),
        loading: false,
        data: Object.assign({}),
        acttype: "",
        actSta: "",
        actEnd: ""
      };
    },
    watch: {
      uuid(val) {
        this.loadData();
      }
    },
    mounted() {
      this.loadData();
    },
    methods: {
      async loadData() {
        if (this.uuid) {
          try {
            this.loading = true;
            this.data = await this.LogsOperLogApi.doGet(this.uuid);
            this.acttype = this.LogsConstants.actTypeSimpleFmt(this.data.actType);
            this.actSta = this.formatterDateTime(
              null,
              null,
              this.data.actSta
            );
            this.actEnd = this.formatterDateTime(
              null,
              null,
              this.data.actEnd
            );
          } finally {
            this.loading = false;
          }
        } else {
          this.$refs.form.resetFields();
        }
      },
    }
  };
</script>
<style lang="scss" scoped>
</style>
