<template>
  <div class="bi-disk-manage-detail" v-if="data">
    <div class="bi-disk-manage-detail__profile">
      <ui-file-portray
        :type="data.fileType === 2 ? 'folder' : 'file'"
        :label="data.fileType === 2 ? data.filePath : data.fileName"
        :name="data.fileName"
        dir="vertical"
        size="large"
      ></ui-file-portray>
    </div>
    <div class="bi-disk-manage-detail__dataset">
      <ui-panel
        title="文件属性"
        size="small"
      >
        <ui-dataset>
          <ui-dataset-item
            label="文件类型"
          >{{ data.fileExtension }}文件</ui-dataset-item>
          <ui-dataset-item
            label="文件大小"
          >{{ handleFormatFileSize(data.fileSize) }}</ui-dataset-item>
          <ui-dataset-item
            label="创建人"
          >{{ data.createName }}</ui-dataset-item>
          <ui-dataset-item
            label="最后更新"
          >{{ data.updateTime }}</ui-dataset-item>
        </ui-dataset>
      </ui-panel>
    </div>
  </div>
</template>
<script>
import { formatFileSize } from '../util'

export default {
  name: 'BiDiskManageDetail',
  props: {
    data: {
      type: Object
    }
  },
  methods: {
    handleFormatFileSize(fileSize) {
      return formatFileSize(fileSize)
    }
  }
}
</script>
<style lang="less">
.bi-disk-manage-detail{
  padding: 24px;
}
.bi-disk-manage-detail__profile{
  padding: 24px 0 36px;
}
.bi-disk-manage-detail__dataset{
  border-top: 1px solid #D5D8DC;
  padding-top: 12px;
}
</style>
