<template>
  <div class="detail-wrap">
    <el-form ref="editForm" :model="oplog">
      <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>{{ oplog.typeName }}</td>
              <th>{{ $t1('访问IP') }}</th>
              <td>{{ oplog.ip }}</td>
              <th>{{ $t1('操作对象') }}</th>
              <td>{{ oplog.code }}</td>
              <th>{{ $t1('产生日志时间') }}</th>
              <td>{{ oplog.operDate }}</td>
            </tr>
            <tr>
              <th>{{ $t1('冗余字段1') }}</th>
              <td>{{ oplog.field1 }}</td>
              <th>{{ $t1('冗余字段2') }}</th>
              <td>{{ oplog.field2 }}</td>
              <th>{{ $t1('冗余字段3') }}</th>
              <td>{{ oplog.field3 }}</td>
              <th>{{ $t1('冗余字段4') }}</th>
              <td>{{ oplog.field4 }}</td>
            </tr>
            <tr>
              <th>{{ $t1('冗余字段5') }}</th>
              <td>{{ oplog.field5 }}</td>
              <th>{{ $t1('服务名') }}</th>
              <td>{{ oplog.serverName }}</td>
              <th>{{ $t1('创建人') }}</th>
              <td>{{ oplog.createBy }}</td>
              <th>{{ $t1('创建时间') }}</th>
              <td>{{ oplog.createDate }}</td>
            </tr>
            <tr>
              <th>{{ $t1('内容') }}</th>
              <td colspan="7">{{ oplog.content }}</td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </el-form>
  </div>
</template>

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

<style></style>
