messageInfo.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 prop="state" label="状态" align="center"> </el-table-column> -->
  19. <el-table-column label="操作" align="center">
  20. <template slot-scope="scope">
  21. <el-button type="text" size="small" @click="$router.push({ path: '/government/messageInfoDetail', query: { id: scope.row.id } })"
  22. ><i class="el-icon-edit"></i
  23. ></el-button>
  24. <el-button type="text" size="small" @click="handleDelete(scope.row)"><i class="el-icon-delete"></i></el-button>
  25. </template>
  26. </el-table-column>
  27. </el-table>
  28. <el-col :span="24" class="page">
  29. <el-pagination
  30. @size-change="handleSizeChange"
  31. @current-change="handleCurrentChange"
  32. :current-page="currentPage"
  33. layout="total, prev, pager, next, jumper"
  34. :total="total"
  35. >
  36. </el-pagination>
  37. </el-col>
  38. </template>
  39. </el-col>
  40. </el-col>
  41. </el-row>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. name: 'messageInfo',
  47. props: {
  48. message: null,
  49. total: null,
  50. },
  51. components: {},
  52. data: () => ({
  53. currentPage: 1,
  54. }),
  55. created() {},
  56. computed: {},
  57. methods: {
  58. handleSizeChange(val) {
  59. console.log(`每页 ${val} 条`);
  60. },
  61. handleCurrentChange(val) {
  62. console.log(`当前页: ${val}`);
  63. },
  64. addData() {
  65. this.$router.push({ path: '/government/messageInfoDetail' });
  66. },
  67. handleDelete(item) {
  68. this.$emit('delete', item);
  69. },
  70. },
  71. };
  72. </script>
  73. <style lang="less" scoped>
  74. .top {
  75. padding: 15px 0;
  76. border-bottom: 1px solid #cccc;
  77. }
  78. .top .topTitle {
  79. padding: 0 10px;
  80. }
  81. .top .topAdd {
  82. padding: 0 10px 0 0;
  83. text-align: right;
  84. }
  85. .page {
  86. padding: 20px 0;
  87. text-align: center;
  88. }
  89. </style>