<template>
  <div class="comp-data-info">
    <div class="content">
      <TableForm ref="tableFormRef" :data="data" tableName="DATA_OVERVIEW_DIR_INFO" showDisabled>
        <template #form-originalName="{ row }">
          {{ row.originalName || '--' }}
        </template>
        <template #form-ownProjectName="{ row }">
          {{ row.ownProjectName || '--' }}
        </template>
        <template #form-ownPhaseName="{ row }">
          {{ row.ownPhaseName || '--' }}
        </template>
        <template #form-ownDisciplineName="{ row }">
          {{ row.ownDisciplineName || '--' }}
        </template>
        <template #form-ownMachineName="{ row }">
          {{ row.ownMachineName || '--' }}
        </template>
        <template #form-ownWorkspaceName="{ row }">
          {{ row.ownWorkspaceName || '--' }}
        </template>
        <template #form-owntaskName="{ row }">
          {{ row.owntaskName || '--' }}
        </template>
        <template #form-ownRunName="{ row }">
          {{ row.ownRunName || '--' }}
        </template>
        <template #form-dataType="{ row }">
          {{ DATA_TYPE.O[row.dataType] || '--' }}
        </template>
        <template #form-creatorName="{ row }">
          {{ row.creatorName || '--' }}
        </template>
        <template #form-createTime="{ row }">
          {{ row.createTime || '--' }}
        </template>
        <template #form-updateTime="{ row }">
          {{ row.updateTime || '--' }}
        </template>
        <template #form-fileType="{ row }">
          {{ DATA_SEARCH_FILE_TYPE.O[row.fileType] || '--' }}
        </template>
        <template #form-fileSize="{ row }">
          {{ formatFileSize(row.fileSize) || '--' }}
        </template>
      </TableForm>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import TableForm from '@/components/common/table/tableForm.vue';
import { formatFileSize } from '@/utils/file';
import { useDict } from '@/utils/useDict';

const { DATA_TYPE, DATA_SEARCH_FILE_TYPE } = useDict('DATA_TYPE', 'DATA_SEARCH_FILE_TYPE');
const tableFormRef = ref();

interface Props {
  data: any;
}

withDefaults(defineProps<Props>(), {
  data: {},
});
</script>

<style lang="scss" scoped>
.comp-data-info {
  width: 100%;
  height: 100%;
  padding: 10px;
  border: solid 1px var(--el-border-color);
  border-radius: 4px;
  margin-left: 10px;
  overflow-y: auto;
}
</style>
