<template>
  <div class="final">
    <ProjectMenu cur-key="org/final" />

    <div class="final-list">
      <el-table :data="list">
        <el-table-column label="序号" width="60" align="center" header-align="center" class-name="index-column">
          <template slot-scope="{ $index }">
            {{ cur_page_begin_index + $index }}
          </template>
        </el-table-column>
        <el-table-column prop="sn" label="编号" width="140" header-align="center" />
        <el-table-column prop="name" label="名称" width="240" header-align="center" />
        <el-table-column prop="org_name" label="所属机构" width="120" header-align="center" />
        <el-table-column prop="leader_name_desc" label="项目组长" width="120" header-align="center" />
        <el-table-column prop="create_time" label="创建时间" width="180" header-align="center" />
        <el-table-column prop="content_count_SJ" label="教材页面数" width="100" header-align="center" />
        <el-table-column prop="request_status_name" label="申请状态" width="100" align="center" />
        <el-table-column prop="version" label="教材版本" width="80" align="center" header-align="center" />

        <el-table-column label="操作" fixed="right" width="240" align="center" header-align="center">
          <template slot-scope="{ row }">
            <span class="link">查看信息</span>
            <span class="link" @click="previewProject(row.id)">预览项目</span>
            <span class="link">预览历史版本</span>
          </template>
        </el-table-column>
      </el-table>

      <PaginationPage :total="total" @getList="pageQueryProjectList_OrgManager" />
    </div>
  </div>
</template>

<script>
import PaginationPage from '@/components/PaginationPage.vue';
import ProjectMenu from '@/views/project_manage/common/ProjectMenu.vue';

import { PageQueryProjectList_OrgManager } from '@/api/list';

export default {
  name: 'OrgFinalPage',
  components: {
    PaginationPage,
    ProjectMenu,
  },
  data() {
    return {
      list: [],
      total: 0,
      cur_page_begin_index: 0,
    };
  },
  methods: {
    pageQueryProjectList_OrgManager(data) {
      PageQueryProjectList_OrgManager({ ...data, status: 1 }).then(
        ({ total_count, cur_page_begin_index, project_list }) => {
          this.total = total_count;
          this.cur_page_begin_index = cur_page_begin_index;
          this.list = project_list;
        },
      );
    },
    previewProject(projectId) {
      this.$router.push({ path: `/project_manage/org/final/preview/${projectId}` });
    },
  },
};
</script>

<style lang="scss" scoped>
@use '@/styles/mixin.scss' as *;

.final {
  @include page-base;
  @include table-list;
}
</style>
