messageInfo.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div id="messageInfo">
  3. <el-row>
  4. <el-col :span="24" class="info">
  5. <el-col :span="24" class="top">
  6. <el-col :span="12" class="topTitle">
  7. <span>信息列表</span>
  8. </el-col>
  9. <el-col :span="12" class="topAdd">
  10. <el-button type="primary" size="mini" @click="addData()"><i class="el-icon-plus"></i></el-button>
  11. </el-col>
  12. </el-col>
  13. <el-col :span="24" class="list">
  14. <template>
  15. <el-table :data="message" style="width: 100%">
  16. <el-table-column prop="title" label="标题" align="center"> </el-table-column>
  17. <el-table-column prop="column_name" label="所属栏目" align="center"> </el-table-column>
  18. <el-table-column label="操作" align="center">
  19. <template slot-scope="scope">
  20. <el-button type="text" size="small" @click="$router.push({ path: '/record/messageInfoDetail', query: { id: scope.row.id } })"
  21. ><i class="el-icon-edit"></i
  22. ></el-button>
  23. <el-button type="text" size="small" @click="handleDelete(scope.row)"><i class="el-icon-delete"></i></el-button>
  24. </template>
  25. </el-table-column>
  26. </el-table>
  27. <el-col :span="24" class="page">
  28. <el-pagination
  29. @size-change="handleSizeChange"
  30. @current-change="handleCurrentChange"
  31. :current-page="currentPage"
  32. layout="total, prev, pager, next, jumper"
  33. :total="total"
  34. >
  35. </el-pagination>
  36. </el-col>
  37. </template>
  38. </el-col>
  39. </el-col>
  40. </el-row>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. name: 'messageInfo',
  46. props: {
  47. message: null,
  48. total: null,
  49. },
  50. components: {},
  51. data: () => ({
  52. currentPage: 1,
  53. }),
  54. created() {},
  55. computed: {},
  56. methods: {
  57. handleSizeChange(val) {
  58. console.log(`每页 ${val} 条`);
  59. },
  60. handleCurrentChange(val) {
  61. console.log(`当前页: ${val}`);
  62. },
  63. addData() {
  64. this.$router.push({ path: '/record/messageInfoDetail' });
  65. },
  66. handleDelete(item) {
  67. this.$emit('delete', item);
  68. },
  69. },
  70. };
  71. </script>
  72. <style lang="less" scoped>
  73. .top {
  74. padding: 15px 0;
  75. border-bottom: 1px solid #cccc;
  76. }
  77. .top .topTitle {
  78. padding: 0 10px;
  79. }
  80. .top .topAdd {
  81. padding: 0 10px 0 0;
  82. text-align: right;
  83. }
  84. .page {
  85. padding: 20px 0;
  86. text-align: center;
  87. }
  88. </style>