<template>
  <div class="detail-wrap">
    <el-form ref="editForm" :model="formImportLog">
      <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>
                {{ formImportLog.version }}
              </td>
              <th>
                {{ $t1('表单分类路径') }}
              </th>
              <td colspan="5">
                {{ formImportLog.treePathName }}
              </td>
            </tr>
            <tr>
              <th>
                {{ $t1('日志类型') }}
              </th>
              <td>
                {{ formImportLog.logType }}
              </td>
              <th>
                {{ $t1('日志对象') }}
              </th>
              <td colspan="3">
                [{{ formImportLog.abc }}] {{ formImportLog.logObj }}
              </td>
            </tr>
            <tr>
              <th>
                {{ $t1('导入时间') }}
              </th>
              <td>
                {{ formImportLog.impDate }}
              </td>
              <th>
                {{ $t1('结果') }}
              </th>
              <td>
                {{ impReturnTypeMap[formImportLog.impReturnType] }}
              </td>
            </tr>
            <tr>
              <th>{{ $t1('失败描述') }}</th>
              <td colspan="7">{{ formImportLog.impReturnMsg }}</td>
            </tr>
            <tr>
              <th>{{ $t1('创建人') }}</th>
              <td>{{ formImportLog.createBy }}</td>
              <th>{{ $t1('创建时间') }}</th>
              <td>{{ formImportLog.createDate }}</td>
              <th>{{ $t1('更新人') }}</th>
              <td>{{ formImportLog.modifyBy }}</td>
              <th>{{ $t1('更新时间') }}</th>
              <td>{{ formImportLog.modifyDate }}</td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'formImportLogEdit',
  props: {
    _dataId: [String, Number]
  },
  components: {},
  data() {
    return {
      isEdit: false,
      tabIndex: 'first',
      dataId: '',
      formImportLog: {},
      impReturnTypeMap: {
        success: this.$t1('成功'),
        fail: this.$t1('失败')
      }
    };
  },
  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({
          aes: true,
          url: USER_PREFIX + `/form_import_log/get`,
          method: `post`,
          data: {
            id: this.dataId
          },
          isLoading: true,
          modalStrictly: true,
          success: res => {
            this.formImportLog = res.objx || {};
          }
        });
      }
    }
  }
};
</script>
