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 6.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div>
  3. <div class="ui container">
  4. <div class="top-container">
  5. <el-checkbox class="check-toggle" v-model="allChecked" @change="allSelectChange">全选/全不选</el-checkbox>
  6. <el-button class="btn-agree">批量同意展示</el-button>
  7. <el-button class="btn-cancel">批量取消展示</el-button>
  8. </div>
  9. <div class="table-container">
  10. <div class="table-title">2030科技项目管理</div>
  11. <div class="table-wrap">
  12. <el-table ref="tableRef" border :data="tableData" style="width:100%;" v-loading="loading" stripe row-key="id">
  13. <el-table-column label="" align="center" header-align="center" width="40" fixed>
  14. <template slot-scope="scope">
  15. <el-checkbox v-model="scope.row.checked" @change="rowSelectChange(scope.row)"></el-checkbox>
  16. </template>
  17. </el-table-column>
  18. <el-table-column prop="name" label="启智项目名称" align="center" header-align="center" fixed></el-table-column>
  19. <el-table-column prop="tech_name" label="科技项目名称" align="center" header-align="center"
  20. fixed></el-table-column>
  21. <el-table-column prop="status" label="展示状态" align="center" header-align="center" fixed></el-table-column>
  22. <el-table-column prop="tech_number" label="项目立项编号" align="center" header-align="center"></el-table-column>
  23. <el-table-column prop="institution" label="项目承担单位" align="center" header-align="center"></el-table-column>
  24. <el-table-column prop="execute_period" label="执行周期" align="center" header-align="center"></el-table-column>
  25. <el-table-column prop="contact" label="联系人" align="center" header-align="center"></el-table-column>
  26. <el-table-column prop="contact_phone" label="电话" align="center" header-align="center"></el-table-column>
  27. <el-table-column prop="apply_user" label="申请账号" align="center" header-align="center"></el-table-column>
  28. <el-table-column prop="" label="操作" align="center" header-align="center" fixed="right"></el-table-column>
  29. </el-table>
  30. </div>
  31. <div class="center">
  32. <el-pagination ref="paginationRef" background @current-change="currentChange" @size-change="sizeChange"
  33. :current-page.sync="page" :page-sizes="pageSizes" :page-size.sync="pageSize"
  34. layout="total, sizes, prev, pager, next, jumper" :total="total">
  35. </el-pagination>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import { getTechAdminList, setTechAdminOperation } from '~/apis/modules/tech';
  43. export default {
  44. data() {
  45. return {
  46. allChecked: false,
  47. loading: false,
  48. tableData: [],
  49. page: 1,
  50. pageSizes: [15, 30, 50, 100],
  51. pageSize: 50,
  52. total: 0,
  53. };
  54. },
  55. components: {},
  56. methods: {
  57. getData() {
  58. this.loading = true;
  59. getTechAdminList({
  60. page: this.page,
  61. pageSize: this.pageSize,
  62. }).then(res => {
  63. this.loading = false;
  64. const { total, data } = res.data;
  65. this.tableData = data.map((item, index) => {
  66. return {
  67. checked: false,
  68. id: 'id' + Math.random(),
  69. ...item,
  70. }
  71. });
  72. this.total = total;
  73. }).catch(err => {
  74. this.loading = false;
  75. console.log(err);
  76. });
  77. },
  78. allSelectChange() {
  79. for (let i = 0, iLen = this.tableData.length; i < iLen; i++) {
  80. this.tableData[i].checked = this.allChecked;
  81. }
  82. this.tableData.splice(1, 0);
  83. },
  84. rowSelectChange(row) {
  85. if (row.checked == false) {
  86. this.allChecked = false;
  87. } else {
  88. if (this.tableData.filter((item) => item.checked).length == this.tableData.length) {
  89. this.allChecked = true;
  90. }
  91. }
  92. this.tableData.splice(1, 0);
  93. },
  94. currentChange(page) {
  95. this.page = page;
  96. this.getData();
  97. },
  98. sizeChange(pageSize) {
  99. this.pageSize = pageSize;
  100. this.getData();
  101. },
  102. },
  103. beforeMount() {
  104. },
  105. mounted() {
  106. this.tableData = new Array(15).fill(0).map((item, index) => {
  107. return {
  108. id: '记录的id-' + index,
  109. name: '启智项目名称-' + index,
  110. owner_name: '启智项目拥有者名称-' + index,
  111. tech_name: '科技项目名称-' + index,
  112. tech_number: '科技项目编号-' + index,
  113. institution: '项目承担单位-' + index,
  114. execute_period: '执行周期-' + index,
  115. contact: '联系人-' + index,
  116. contact_phone: '联系电话-' + index,
  117. contact_email: '联系邮件-' + index,
  118. apply_user: '申请账号-' + index,
  119. status: '状态-' + index,
  120. }
  121. });
  122. this.total = this.tableData.length;
  123. },
  124. beforeDestroy() { },
  125. };
  126. </script>
  127. <style scoped lang="less">
  128. .top-container {
  129. display: flex;
  130. align-items: center;
  131. margin: 15px 0;
  132. .check-toggle {
  133. margin-right: 20px;
  134. }
  135. .btn-agree {
  136. margin-right: 10px;
  137. background: rgb(50, 145, 248);
  138. color: rgb(255, 255, 255);
  139. &:hover {
  140. opacity: 0.9;
  141. }
  142. &:active {
  143. opacity: 0.8;
  144. }
  145. }
  146. .btn-cancel {
  147. margin-right: 10px;
  148. background: rgb(250, 140, 22);
  149. color: rgb(255, 255, 255);
  150. &:hover {
  151. opacity: 0.9;
  152. }
  153. &:active {
  154. opacity: 0.8;
  155. }
  156. }
  157. }
  158. .table-container {
  159. .table-title {
  160. height: 43px;
  161. font-size: 16px;
  162. font-weight: 700;
  163. padding: 15px;
  164. color: rgb(16, 16, 16);
  165. border-color: rgb(212, 212, 213);
  166. border-width: 1px;
  167. border-style: solid;
  168. border-radius: 5px 5px 0px 0px;
  169. background: rgb(240, 240, 240);
  170. display: flex;
  171. align-items: center;
  172. }
  173. .table-wrap {
  174. margin-bottom: 12px;
  175. overflow-x: auto;
  176. /deep/ .el-table__header {
  177. th {
  178. background: rgb(249, 249, 249);
  179. font-size: 12px;
  180. color: rgb(136, 136, 136);
  181. font-weight: normal;
  182. }
  183. }
  184. /deep/ .el-table__body {
  185. td {
  186. font-size: 12px;
  187. }
  188. }
  189. /deep/ .el-radio__label {
  190. display: none;
  191. }
  192. }
  193. }
  194. </style>