History.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <v-card elevation="1">
  3. <!-- 顶部组件 -->
  4. <Top :query='query' :page='page' :table='table'></Top>
  5. <!-- 中间表格组件 -->
  6. <Table :query='query' :page='page' :table='table'></Table>
  7. </v-card>
  8. </template>
  9. <script>
  10. import Top from '@/components/viewer/Top'
  11. import Table from '@/components/viewer/Table'
  12. import EthMev from '@/plugins/model/EthMev'
  13. export default {
  14. name: 'History',
  15. components: {Top, Table},
  16. data: () => ({
  17. query: {
  18. block: '',
  19. hash: '',
  20. dataVague: '',
  21. autoFlushTime: 0
  22. },
  23. page: {
  24. name: 'History Page'
  25. },
  26. table: {
  27. search: '',
  28. loading: false,
  29. groupBy: 'block',
  30. groupDesc: true,
  31. sortBy: ['block', 'index'],
  32. sortDesc: [true, false],
  33. pageSize: 200,
  34. pageNum: 1,
  35. data: [],
  36. headers: [
  37. { text: "Option", value: 'option', width: '7%' },
  38. { text: 'Block', value: 'block' },
  39. { text: 'Hash', value: 'hash', width: '7%' },
  40. { text: 'From', value: 'from', width: '7%' },
  41. { text: 'To', value: 'to', width: '7%' },
  42. { text: 'GasPrice', value: 'gasPrice', width: '6%' },
  43. { text: 'Type', value: 'type', width: '3%' },
  44. { text: 'Index', value: 'index', width: '3%' },
  45. { text: 'State', value: 'state', width: '3%' },
  46. { text: 'Mev', value: 'mev', width: '3%' },
  47. { text: 'Pending', value: 'pending', width: '7%' },
  48. { text: 'TradeInfo', value: 'tradeInfo'},
  49. { text: 'memo', value: 'memo', width: '10%'}
  50. ]
  51. },
  52. }),
  53. methods: {
  54. // 获取数据
  55. async generateTableData() {
  56. this.table.loading = true
  57. this.table.data.length = 0
  58. const rst = await EthMev.getEthMevData(this.query.block, this.query.hash, this.query.dataVague,
  59. this.table.pageNum, this.table.pageSize)
  60. if (rst.state) {
  61. EthMev.generateTableDataByDbData(rst.data)
  62. this.table.data = rst.data
  63. this.$msgkit.success(rst.msg)
  64. } else {
  65. this.$msgkit.error(rst.msg)
  66. }
  67. this.table.loading = false
  68. }
  69. },
  70. provide() {
  71. return {
  72. generateTableData: this.generateTableData
  73. }
  74. },
  75. async mounted () {
  76. await this.generateTableData()
  77. }
  78. }
  79. </script>