list.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <basic-container class="list">
  3. <div class="flexBetween">
  4. <el-button
  5. type="primary"
  6. size="mini"
  7. class="el-icon-plus"
  8. @click="pushRouter()"
  9. >新增</el-button>
  10. <el-select
  11. v-model="value"
  12. filterable
  13. placeholder="请选择"
  14. @change="projectChange"
  15. >
  16. <el-option
  17. v-for="item in options"
  18. :key="item.value"
  19. :label="item.projectName"
  20. :value="item.id"
  21. >
  22. </el-option>
  23. </el-select>
  24. </div>
  25. <el-table
  26. class="martop20"
  27. :data="tableData"
  28. header-color='red'
  29. style="width: 100%"
  30. >
  31. <el-table-column
  32. type="index"
  33. label="序号"
  34. width="180"
  35. >
  36. </el-table-column>
  37. <el-table-column
  38. prop="name"
  39. label="证书所有者"
  40. width="180"
  41. >
  42. </el-table-column>
  43. <el-table-column
  44. prop="address"
  45. label="证书ID"
  46. >
  47. </el-table-column>
  48. <el-table-column
  49. prop="address"
  50. label="证书类型"
  51. >
  52. </el-table-column>
  53. <el-table-column
  54. prop="address"
  55. label="注册"
  56. >
  57. <template slot-scope="scope">
  58. <el-button
  59. type="text"
  60. @click="register(scope.row)"
  61. >注册</el-button>
  62. <el-button
  63. type="text"
  64. disabled
  65. >已注册</el-button>
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. prop="address"
  70. label="操作"
  71. >
  72. <template slot-scope="scope">
  73. <el-button type="text">编辑</el-button>
  74. <el-button
  75. type="text"
  76. @click="deleteList(scope.row)"
  77. style="color:rgba(240, 99, 10, 1);"
  78. >删除</el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <el-pagination
  83. style="float:right"
  84. background
  85. class="martop20 marbottom20"
  86. layout="prev, pager, next"
  87. :total="total"
  88. @size-change="handleSizeChange"
  89. @current-change="handleCurrentChange"
  90. :current-page.sync="pageindex"
  91. :page-size="pagesize"
  92. >
  93. </el-pagination>
  94. </basic-container>
  95. </template>
  96. <script>
  97. import { queryProjectList, listpage, goRegister } from "@/api/certificate/list";
  98. export default {
  99. data () {
  100. return {
  101. value: '',
  102. options: [],
  103. tableData: [{}],
  104. total: 0,
  105. pageindex: 1,
  106. pagesize: 20,
  107. }
  108. },
  109. methods: {
  110. //#region 页码
  111. handleSizeChange (val) {
  112. this.pagesize = val
  113. this.listpage()
  114. },
  115. handleCurrentChange (val) {
  116. this.pageindex = val
  117. this.listpage()
  118. },
  119. //#endregion
  120. //#region 列表接口
  121. projectChange () {
  122. this.listpage()
  123. },
  124. register () {//注册按钮
  125. },
  126. deleteList () {//删除按钮
  127. },
  128. async queryProjectList () {//获取所有项目
  129. const { data: res } = await queryProjectList()
  130. console.log(res);
  131. if (res.code == 200) {
  132. this.options = res.data
  133. }
  134. },
  135. async listpage () {//分页获取证书列表数据
  136. const { data: res } = await listpage({
  137. current: this.pageindex,
  138. size: this.pagesize,
  139. projectId: this.value,
  140. })
  141. console.log(res);
  142. if (res.code == 200) {
  143. this.tableData = res.data.records
  144. this.total = res.data.total
  145. }
  146. },
  147. async goRegister () {//注册
  148. const { data: res } = await goRegister({ id: '' })
  149. },
  150. //#endregion
  151. },
  152. created () {
  153. // this.queryProjectList()
  154. this.listpage()
  155. },
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. </style>