You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 5.2 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div>
  3. <TopHeader :menu="'my_view'"></TopHeader>
  4. <div class="ui container">
  5. <div class="table-container">
  6. <div class="table-title">2030科技项目</div>
  7. <div class="table-wrap">
  8. <el-table ref="tableRef" border :data="tableData" style="width:100%;" v-loading="loading" stripe row-key="id">
  9. <el-table-column label="序号" type="index" align="center" header-align="center" width="50"
  10. fixed></el-table-column>
  11. <el-table-column label="启智项目名称" align="center" header-align="center" fixed min-width="140">
  12. <template slot-scope="scope">
  13. <span v-if="scope.row.status == 5">
  14. {{ `${scope.row.url.split('/')[3]}/${scope.row.url.split('/')[4]}` }}
  15. </span>
  16. <a v-else target="_blank" :href="`/${scope.row.repo_owner_name}/${scope.row.repo_name}`">
  17. {{ `${scope.row.repo_owner_name}/${scope.row.repo_name}` }}
  18. </a>
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="name" label="科技项目名称" align="center" header-align="center" fixed
  22. min-width="200"></el-table-column>
  23. <el-table-column prop="status" label="展示状态" align="center" header-align="center" fixed>
  24. <template slot-scope="scope">
  25. <span style="color:rgb(255, 37, 37)"
  26. :style="scope.row.status == 1 ? { color: 'rgb(56, 158, 13)' } : ''">{{
  27. statusMap[scope.row.status] }}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column prop="no" label="项目立项编号" align="center" header-align="center"
  31. min-width="120"></el-table-column>
  32. <el-table-column prop="institution" label="项目承担单位" align="center" header-align="center"
  33. min-width="120"></el-table-column>
  34. <el-table-column prop="all_institution" label="所有参与单位" align="center" header-align="center"
  35. min-width="280"></el-table-column>
  36. <el-table-column prop="contribution_institution" label="成果贡献单位" align="center" header-align="center"
  37. min-width="280"></el-table-column>
  38. <el-table-column prop="contribution_institution" label="申请时间" align="center" header-align="center"
  39. min-width="120">
  40. <template slot-scope="scope">
  41. <span>{{ dateFormat(scope.row.created_unix) }}</span>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. </div>
  46. <div class="center">
  47. <el-pagination ref="paginationRef" background @current-change="currentChange" @size-change="sizeChange"
  48. :current-page.sync="page" :page-sizes="pageSizes" :page-size.sync="pageSize"
  49. layout="total, sizes, prev, pager, next, jumper" :total="total">
  50. </el-pagination>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import dayjs from 'dayjs';
  58. import TopHeader from '../components/TopHeader.vue';
  59. import { getTechMyList } from '~/apis/modules/tech';
  60. export default {
  61. data() {
  62. return {
  63. loading: false,
  64. tableData: [],
  65. page: 1,
  66. pageSizes: [15, 30, 50],
  67. pageSize: 15,
  68. total: 0,
  69. statusMap: {
  70. '1': '已展示',
  71. '2': '未展示',
  72. '3': '项目迁移中',
  73. '4': '项目迁移失败',
  74. '5': '项目不存在',
  75. },
  76. };
  77. },
  78. components: { TopHeader },
  79. methods: {
  80. getData() {
  81. this.loading = true;
  82. getTechMyList({
  83. page: this.page,
  84. pageSize: this.pageSize,
  85. }).then(res => {
  86. this.loading = false;
  87. const { total, data } = res.data;
  88. this.tableData = data.map((item, index) => {
  89. return { ...item, }
  90. });
  91. this.total = total;
  92. }).catch(err => {
  93. this.loading = false;
  94. console.log(err);
  95. });
  96. },
  97. currentChange(page) {
  98. this.page = page;
  99. this.getData();
  100. },
  101. sizeChange(pageSize) {
  102. this.pageSize = pageSize;
  103. this.getData();
  104. },
  105. dateFormat(unix) {
  106. return dayjs(unix * 1000).format('YYYY-MM-DD HH:mm');
  107. }
  108. },
  109. beforeMount() {
  110. this.getData();
  111. },
  112. mounted() { },
  113. beforeDestroy() { },
  114. };
  115. </script>
  116. <style scoped lang="less">
  117. .table-container {
  118. margin-top: 30px;
  119. .table-title {
  120. height: 43px;
  121. font-size: 16px;
  122. font-weight: 700;
  123. padding: 15px;
  124. color: rgb(16, 16, 16);
  125. border-color: rgb(212, 212, 213);
  126. border-width: 1px;
  127. border-style: solid;
  128. border-radius: 5px 5px 0px 0px;
  129. background: rgb(240, 240, 240);
  130. display: flex;
  131. align-items: center;
  132. }
  133. .table-wrap {
  134. overflow-x: auto;
  135. margin-bottom: 20px;
  136. /deep/ .el-table__header {
  137. th {
  138. background: rgb(249, 249, 249);
  139. font-size: 12px;
  140. color: rgb(136, 136, 136);
  141. font-weight: normal;
  142. }
  143. }
  144. /deep/ .el-table__body {
  145. td {
  146. font-size: 12px;
  147. }
  148. }
  149. /deep/ .el-radio__label {
  150. display: none;
  151. }
  152. }
  153. }
  154. </style>