<template>
  <div>
    <el-container class="visual-project-list-drawer">
          <el-header class="visual-project-list-header" v-if=" $permission('/workspace/project/add') && !show">
            <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增专利挖掘</el-button>
          </el-header>
          <el-main v-loading="loading" style="padding:0">
            <el-table
                class="file-table"
                :data="reportList"
                stripe
                header-row-class-name="custom-table-header"
                >
                <el-table-column
                    type="index"
                    label="序号"
                    align="center"
                    width="50px"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column label="名称" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                    <span class="report-name" @click="handleDownload(scope.row)">{{
                        scope.row.name
                    }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="文件大小" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                    <span>{{ renderSize(scope.row.size) }}</span>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="createName"
                    label="创建人"
                    align="center"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column label="创建时间" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                    <span>{{ $d(scope.row.createTime, "YYYY.MM.DD") }}</span>
                    </template>
                </el-table-column>
                </el-table>
          </el-main>
          <el-footer v-if="!show">
            <el-pagination :current-page.sync="queryParams.current" :page-size="queryParams.size" :total="total" @current-change="handleCurrentChange" layout="prev, pager, next, jumper" background></el-pagination>
          </el-footer>
        </el-container>
    
  </div>
</template>

<script>
import { downLoad2, renderSize } from '@/utils'
export default {
  components: {},
  props: {
    show:{},
  },
  data() {
    return {
        reportList:[],
        loading:false,
        queryParams:{
            current:1,
            size:10,
        },
        total:0
    };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {
    this.getList()
  },
  methods: {
    getList(){

    },
    handleAdd(){

    },
    handleCurrentChange(){
        this.queryParams.current = val;
        this.getList();
    },
    handleDownload(row) {
        var FileUrl =  `http://${this.$c.hostname}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$p + row.url))
        const router = this.$router.resolve({
                path: '/checkFile',
                query: {
                  row: JSON.stringify(row),
                  FileUrl: FileUrl,
                  isPicture:0
              }
          })
          window.open(router.href, '_blank');
      },
  },
};
</script>
<style lang="scss" scoped>
</style>