custom-page-select.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div class="product-select">
  3. <el-form :inline="true" :model="formData" class="demo-form-inline">
  4. <el-form-item label="">
  5. <el-input v-model="formData.keyword" maxlength="20" placeholder="页面名称"></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="primary" @click="onSubmit">查询</el-button>
  9. </el-form-item>
  10. </el-form>
  11. <el-table
  12. :data="tableData"
  13. max-height="500"
  14. border
  15. style="width: 100%">
  16. <el-table-column label="" width="35" align="center">
  17. <template slot-scope="scope">
  18. <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
  19. </template>
  20. </el-table-column>
  21. <el-table-column
  22. prop="name"
  23. label="页面名称">
  24. </el-table-column>
  25. <el-table-column
  26. prop="updateTime"
  27. label="更新时间">
  28. </el-table-column>
  29. </el-table>
  30. <el-pagination
  31. @size-change="handleSizeChange"
  32. @current-change="handleCurrentChange"
  33. :current-page="currentPage"
  34. :page-sizes="[10, 20, 50, 100]"
  35. :page-size="pageSize"
  36. layout="total, sizes, prev, pager, next, jumper"
  37. :total="total">
  38. </el-pagination>
  39. </div>
  40. </template>
  41. <script>
  42. import api from '@@/components/canvasShow/config/api'
  43. import {sendReqMixin} from '@@/components/canvasShow/config/mixin'
  44. export default {
  45. name: 'custom-page-select',
  46. mixins: [sendReqMixin],
  47. data () {
  48. return {
  49. tableRadio: '',
  50. currentPage: 1,
  51. total: 0,
  52. pageSize: 10,
  53. formData: {
  54. keyword: ''
  55. },
  56. tableData: []
  57. }
  58. },
  59. mounted () {
  60. this.getTableData()
  61. },
  62. methods: {
  63. // 获取自定义列表
  64. getTableData () {
  65. var _this = this
  66. var paramsData = {
  67. page: this.currentPage,
  68. pageSize: this.pageSize
  69. }
  70. if (this.formData.keyword) {
  71. paramsData.search = this.formData.keyword
  72. }
  73. let params = {
  74. url: api.selectCanvasCustomList,
  75. method: 'POST',
  76. data: paramsData
  77. }
  78. this.sendReq(params, (res) => {
  79. _this.tableData = res.data.list
  80. _this.total = res.data.total
  81. })
  82. },
  83. // 搜索
  84. onSubmit () {
  85. this.getTableData()
  86. },
  87. // 每页条数改变
  88. handleSizeChange (val) {
  89. this.pageSize = val
  90. this.getTableData()
  91. },
  92. // 当前页改变
  93. handleCurrentChange (val) {
  94. this.currentPage = val
  95. this.getTableData()
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .product-select{
  102. .el-pagination{
  103. padding: 0px;
  104. margin-top: 30px;
  105. }
  106. }
  107. </style>