<template>
  <div class="project-manage">
    <ProjectMenu cur-key="project" />

    <div class="project-manage-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="create_date" label="创建日期" width="180" header-align="center" />
        <el-table-column prop="content_count_SJ" label="教材内容数" width="100" header-align="center" />
        <el-table-column prop="status_name" label="状态" width="120" header-align="center" />
        <el-table-column prop="request_status_name" label="申请状态" width="120" header-align="center" />
        <el-table-column prop="version" label="教材版本" width="120" header-align="center" />
        <el-table-column prop="version_desc_YSJ" label="已上架教材版本" 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="queryMyProjectList_Leader" />
    </div>
  </div>
</template>

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

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

export default {
  name: 'ProjectManage',
  components: {
    PaginationPage,
    ProjectMenu,
  },
  data() {
    return {
      list: [],
      total: 0,
      cur_page_begin_index: 0,
    };
  },
  methods: {
    queryMyProjectList_Leader(data) {
      PageQueryMyProjectList_Leader(data).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/project/preview/${projectId}` });
    },
  },
};
</script>

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

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