Newer
Older
KaiFengPC / src / views / document / projectTransfer / tableList.vue
@zhangdeliang zhangdeliang on 23 May 1 KB 初始化项目
<template>
  <div class="tableList">
    <el-table :data="tableData" v-loading="loading" stripe :max-height="600">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column label="文件名称" prop="name" show-overflow-tooltip />
      <el-table-column label="大小" prop="size" show-overflow-tooltip>
        <template #default="{ row }">
          <span>{{ handleFileSize(row?.size) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="格式" prop="extension" show-overflow-tooltip />
      <el-table-column label="上传人" prop="createBy" show-overflow-tooltip />
      <el-table-column label="上传时间" prop="createTime" show-overflow-tooltip />
    </el-table>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { getProjectTransferFileList } from '@/api/document/projectTransfer';
import { handleFileSize } from '@/utils';
const props = defineProps({
  curRow: {
    type: Object,
    default: () => ({}),
  },
});
const { curRow } = props;
const tableData = ref([]);
const loading = ref(false);
const getTableData = async () => {
  loading.value = true;
  try {
    const res = await getProjectTransferFileList({
      projectId: curRow.projectId,
    });
    loading.value = false;
    if (res?.code !== 200) return;
    tableData.value = res.data || [];
  } catch (error) {
    console.log(error);
    loading.value = false;
  }
};
onMounted(() => {
  getTableData();
});
</script>

<style lang="scss" scoped></style>