Specification.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div>
  3. <el-card>
  4. <div slot="header" class="clearfix">
  5. <span>标准规范</span>
  6. <el-button class="header-more-btn" type="text" @click="showMore">更多<i class="el-icon-arrow-right" /></el-button>
  7. </div>
  8. <el-scrollbar class="spec-content">
  9. <el-table v-loading="loading" :data="tableData" :show-header="false">
  10. <el-table-column show-overflow-tooltip>
  11. <template slot-scope="scope">
  12. <el-link :underline="false" @click="showDetail(scope.row.id)">{{ scope.row.title }}</el-link>
  13. </template>
  14. </el-table-column>
  15. <el-table-column prop="createOrgName" width="300" show-overflow-tooltip />
  16. <el-table-column prop="createTime" width="150" />
  17. </el-table>
  18. </el-scrollbar>
  19. </el-card>
  20. <info-view ref="infoView" :type-data="typeData" is-home />
  21. </div>
  22. </template>
  23. <script>
  24. import { fetchTableList } from '@/api/info'
  25. import { hasValidRecords } from '@/utils/convert'
  26. import InfoView from '@/views/info/InfoView'
  27. export default {
  28. name: 'HomeSpec',
  29. components: {
  30. InfoView
  31. },
  32. data() {
  33. return {
  34. tableData: [],
  35. typeData: [{ 'id': 1, 'label': '通知通告' }, { 'id': 2, 'label': '信息交流' }, { 'id': 3, 'label': '标准规范' }],
  36. // others
  37. loading: false
  38. }
  39. },
  40. created() {
  41. this.getSpecData()
  42. },
  43. methods: {
  44. getSpecData() {
  45. this.loading = true
  46. const params = {
  47. current: 1,
  48. size: 50,
  49. delFlag: 0,
  50. messageType: 3
  51. }
  52. fetchTableList(params).then(response => {
  53. this.loading = false
  54. if (hasValidRecords(response)) {
  55. this.tableData = response.data.records
  56. this.total = response.data.total
  57. } else {
  58. this.tableData = []
  59. this.total = 0
  60. }
  61. }).catch(error => {
  62. console.log(error)
  63. this.loading = false
  64. this.$message({
  65. type: 'error',
  66. duration: 0,
  67. showClose: true,
  68. message: '获取标准规范列表出错: ' + error.message
  69. })
  70. })
  71. },
  72. showMore() {
  73. this.$router.push('/info')
  74. },
  75. showDetail(id) {
  76. this.$refs['infoView'].open(id)
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .spec-content{
  83. ::v-deep {
  84. .el-table {
  85. &::before {
  86. background-color: transparent !important;
  87. }
  88. td {
  89. border-bottom: none;
  90. }
  91. }
  92. }
  93. }
  94. </style>