<template>
  <div class="detail-wrap">
    <el-form ref="editForm" :model="userLog">
      <div class="d-header clearfix">
        <div class="fl">
          <i class="el-icon-info"/>
          {{ dataId ? $t1('查看访问统计') : $t1('新增访问统计') }}
        </div>
        <div class="fr">
          <el-button type="primary" plain class="button-sty" @click="$baseReload()" icon="el-icon-refresh-right">
            {{ $t1('重置') }}
          </el-button>
        </div>
      </div>
      <div class="d-cont">
        <div class="d-item">
          <div class="title first"><b>{{ $t1('基本信息') }}</b></div>
          <table class="table-detail">
            <tbody>
            <tr>
              <th>{{ $t1('操作类型') }}</th>
              <td>{{ userLog.logTypeName }}</td>
            </tr>
            <tr>
              <th>{{ $t1('操作内容') }}</th>
              <td colspan="7">{{ userLog.content }}</td>
            </tr>
            <tr>
              <th>{{ $t1('请求地址') }}</th>
              <td colspan="7">{{ userLog.path }}</td>
            </tr>
            <tr>
              <th>{{ $t1('客户端') }}</th>
              <td colspan="7">{{ userLog.client }}</td>
            </tr>
            <tr>
              <th>{{ $t1('冗余字段1') }}</th>
              <td>{{ userLog.param1 }}</td>
              <th>{{ $t1('冗余字段2') }}</th>
              <td>{{ userLog.param2 }}</td>
            </tr>
            <tr>
              <th>{{ $t1('操作人') }}</th>
              <td>{{ userLog.nickName }}</td>
              <th>{{ $t1('请求IP') }}</th>
              <td>{{ userLog.ip }}</td>
              <th>{{ $t1('服务名') }}</th>
              <td colspan="3">{{ userLog.serverName }}</td>
            </tr>
            <tr>
              <th>{{ $t1('内部信息数据') }}</th>
              <td colspan="7">{{ userLog.msg }}</td>
            </tr>
            <tr>
              <th>{{ $t1('创建人') }}</th>
              <td>{{ userLog.createBy }}</td>
              <th>{{ $t1('创建时间') }}</th>
              <td>{{ userLog.createDate }}</td>
              <th class="no"></th>
              <td></td>
              <th class="no"></th>
              <td></td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'userLogEdit',
  props: {
    _dataId: [String, Number]
  },
  components: {},
  data() {
    return {
      tabIndex: 0,
      isEdit: false,
      dataId: '',
      userLog: {}
    };
  },
  created() {
    if (this._dataId && !isNaN(this._dataId)) this.dataId = this._dataId;
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      if (this.dataId && !isNaN(this.dataId)) {
        this.isEdit = true;
        this.$commonHttp({
          url: USER_PREFIX + `/user_log/get`,
          method: `post`,
          data: {
            id: this.dataId
          },
          isLoading: true,
          modalStrictly: true,
          success: res => {
            this.userLog = res.objx || {};
          }
        });
      }
    }
  }
};
</script>

<style></style>
