| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <v-card elevation="1">
- <!-- 顶部组件 -->
- <Top :query='query' :page='page' :table='table'></Top>
- <!-- 中间表格组件 -->
- <Table :query='query' :page='page' :table='table'></Table>
- </v-card>
- </template>
- <script>
- import Top from '@/components/viewer/Top'
- import Table from '@/components/viewer/Table'
- import EthMev from "@/plugins/model/EthMev";
- import NumKit from "@/plugins/kit/NumKit";
- export default {
- name: 'Pending',
- components: {Top, Table},
- data: () => ({
- query: {
- block: '',
- hash: '',
- dataVague: ''
- },
- page: {
- name: 'Pending Page'
- },
- table: {
- search: '',
- loading: false,
- groupBy: 'block',
- sortBy: ['block', 'gasPrice', 'pending'],
- sortDesc: [false, true, false],
- pageSize: 200,
- data: [],
- headers: [
- {text: "Option", value: 'option'},
- {text: 'Block', value: 'block'},
- {text: 'Hash', value: 'hash'},
- {text: 'From', value: 'from'},
- {text: 'To', value: 'to'},
- {text: 'GasPrice', value: 'gasPrice'},
- {text: 'Type', value: 'type'},
- {text: 'Index', value: 'index'},
- {text: 'State', value: 'state'},
- {text: 'Mev', value: 'mev'},
- {text: 'Pending', value: 'pending'},
- {text: 'TradeInfo', value: 'tradeInfo'}
- ]
- }
- }),
- methods: {
- // 获取数据
- async generateTableData() {
- this.table.data.length = 0
- this.table.loading = true
- const rst = await EthMev.getEthMevPendingData(this.query.block, this.query.hash, this.query.dataVague)
- this.table.loading = false
- if (!rst.data.state) {
- this.$msgkit.error(rst.data.msg)
- return
- }
- this.$msgkit.success(rst.data.msg)
- this.table.data = rst.data.data
- this.table.data.map(function (one) {
- try {
- let dataObj = one.dataObj
- one.tradeInfo = dataObj.tradeInfo
- one.from = dataObj.fromAdd
- one.to = dataObj.toAdd
- one.gasPrice = NumKit._N(parseInt(dataObj.gasPrice) / (1E9), 2)
- one.index = dataObj.index
- one.type = dataObj.type
- one.state = dataObj.status
- one.pending = dataObj.pending
- } catch (e) {
- one.tradeInfo = []
- }
- })
- }
- },
- provide() {
- return {
- generateTableData: this.generateTableData
- }
- },
- async mounted () {
- await this.generateTableData()
- }
- }
- </script>
- <style>
- #dataTable {
- height: 410px;
- }
- #dataTableHeader {
- max-width: none;
- }
- .tradeLabel {
- width: 250px;
- }
- thead.v-data-table-header {
- position: fixed !important;
- bottom: 0 !important;
- z-index: 999;
- background-color: rgba(255, 255, 255, 255);
- width: 96.35%;
- border-top: grey 1px solid;
- }
- div.tokenName {
- text-align: left;
- width: 100%;
- }
- div.tokenAmount {
- text-align: right;
- width: 100%;
- }
- span.v-chip__content {
- width: 100%;
- }
- </style>
|