|
@@ -0,0 +1,310 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="table-container">
|
|
|
|
|
+ <v-card elevation="0">
|
|
|
|
|
+ <!-- 表格上功能区 -->
|
|
|
|
|
+ <v-card-title>
|
|
|
|
|
+ <v-container id="dataTableHeader">
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="4">
|
|
|
|
|
+ {{ page.name }}
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ <v-col cols="8">
|
|
|
|
|
+ <v-text-field hide-details single-line label="Local Search" append-icon="mdi-magnify"
|
|
|
|
|
+ v-model="table.search"/>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ </v-container>
|
|
|
|
|
+ </v-card-title>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 顶部分页 -->
|
|
|
|
|
+ <div class="mt-2">
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="2"></v-col>
|
|
|
|
|
+ <v-col cols="2">
|
|
|
|
|
+ <v-text-field required type="number" label="page" v-model="tempPage" @change="inputPageNum"/>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ <v-col cols="4">
|
|
|
|
|
+ <v-pagination color="teal" :disabled="table.loading" :length="table.pageLength" v-model="table.pageNum"
|
|
|
|
|
+ @input="generateTableDataAgain"></v-pagination>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 表格主体 -->
|
|
|
|
|
+ <v-data-table calculate-widths multi-sort hide-default-footer
|
|
|
|
|
+ :headers="table.headers" :items="table.data" :search="table.search" :loading="table.loading"
|
|
|
|
|
+ :items-per-page="table.pageSize"
|
|
|
|
|
+ :sort-by="table.sortBy" :sort-desc="table.sortDesc">
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 操作区 -->
|
|
|
|
|
+ <template v-slot:item.option="{ item }">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="5">
|
|
|
|
|
+ <v-btn large icon elevation="0" color="primary" @click="editItem(item)">
|
|
|
|
|
+ <v-icon>mdi-table-edit</v-icon>
|
|
|
|
|
+ </v-btn>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.networkName="{ item }">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ {{ item.networkName }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.ws="{ item }">
|
|
|
|
|
+ <div v-if="item.ws !== undefined && item.ws !== '' && item.ws !== null">
|
|
|
|
|
+ {{ item.ws }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [ws]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <template v-slot:item.v3ToolAddress="{ item }">
|
|
|
|
|
+ <div v-if="item.v3ToolAddress !== undefined && item.v3ToolAddress !== '' && item.v3ToolAddress !== null">
|
|
|
|
|
+ {{ item.v3ToolAddress }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [v3ToolAddress]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.v2ToolAddress="{ item }">
|
|
|
|
|
+ <div v-if="item.v2ToolAddress !== undefined && item.v2ToolAddress !== '' && item.v2ToolAddress !== null">
|
|
|
|
|
+ {{ item.v2ToolAddress }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [v2ToolAddress]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.tokenSymbol="{ item }">
|
|
|
|
|
+ <div v-if="item.tokenSymbol !== undefined && item.tokenSymbol !== '' && item.tokenSymbol !== null">
|
|
|
|
|
+ {{ item.tokenSymbol }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [tokenSymbol]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template v-slot:item.ipc="{ item }">
|
|
|
|
|
+ <div v-if="item.ipc !== undefined && item.ipc !== '' && item.ipc !== null">
|
|
|
|
|
+ {{ item.ipc }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [ipc]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.id="{ item }">
|
|
|
|
|
+ <div v-if="item.id !== undefined && item.id !== '' && item.id !== null">
|
|
|
|
|
+ {{ item.id }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [id]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.http="{ item }">
|
|
|
|
|
+ <div v-if="item.http !== undefined && item.http !== '' && item.http !== null">
|
|
|
|
|
+ {{ item.http }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [http]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.explorer="{ item }">
|
|
|
|
|
+ <div v-if="item.explorer !== undefined && item.explorer !== '' && item.explorer !== null">
|
|
|
|
|
+ {{ item.explorer }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [explorer]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:item.chain="{ item }">
|
|
|
|
|
+ <div v-if="item.chain !== undefined && item.chain !== '' && item.chain !== null">
|
|
|
|
|
+ {{ item.chain }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ [chain]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </v-data-table>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 底部分页 -->
|
|
|
|
|
+ <div class="mt-2">
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="2"></v-col>
|
|
|
|
|
+ <v-col cols="2">
|
|
|
|
|
+ <v-text-field type="number" required label="page" v-model="tempPage" @change="inputPageNum"/>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ <v-col cols="4">
|
|
|
|
|
+ <v-pagination :disabled="table.loading" :length="table.pageLength" v-model="table.pageNum"
|
|
|
|
|
+ @input="generateTableDataAgain"></v-pagination>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </v-card>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 新增Address -->
|
|
|
|
|
+ <v-dialog v-model="editDialog.visible" max-width="1200">
|
|
|
|
|
+ <v-card elevation="0">
|
|
|
|
|
+ <v-card-title>{{ editDialog.addOrUpdate ? '新增' : '编辑' }} Address</v-card-title>
|
|
|
|
|
+ <v-card-text>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="id" v-model="editDialog.item.id"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="chain" v-model="editDialog.item.chain"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="tokenSymbol" v-model="editDialog.item.tokenSymbol"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="networkName" v-model="editDialog.item.networkName"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="http" v-model="editDialog.item.http"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="explorer" v-model="editDialog.item.explorer"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col cols="12">
|
|
|
|
|
+ <v-text-field label="other" v-model="editDialog.item.other"></v-text-field>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ </v-card-text>
|
|
|
|
|
+ <v-card-actions>
|
|
|
|
|
+ <v-spacer></v-spacer>
|
|
|
|
|
+ <v-btn text color="primary" @click="addOrUpdateChain">提交</v-btn>
|
|
|
|
|
+ </v-card-actions>
|
|
|
|
|
+ </v-card>
|
|
|
|
|
+ </v-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import TradeInfo from '@/components/viewer/Chain/table/TradeInfoDetails'
|
|
|
|
|
+import BooleanViewer from '@/components/viewer/Chain/table/BooleanViewer'
|
|
|
|
|
+import HashKit from '@/plugins/kit/HashKit'
|
|
|
|
|
+import HttpKit from '@/plugins/kit/HttpKit'
|
|
|
|
|
+import TimeKit from '@/plugins/kit/TimeKit'
|
|
|
|
|
+
|
|
|
|
|
+import jquery from 'jquery'
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+import Chain from '@/plugins/model/Chain.js'
|
|
|
|
|
+import AddressModel from "@/plugins/model/AddressModel";
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: 'Table',
|
|
|
|
|
+ components: {BooleanViewer, TradeInfo},
|
|
|
|
|
+ props: ['query', 'page', 'table', 'chainModel', 'explorer', 'editDialog'],
|
|
|
|
|
+ inject: ['packQuery', 'showVisible'],
|
|
|
|
|
+ data: () => ({
|
|
|
|
|
+ hashKit: HashKit,
|
|
|
|
|
+ httpKit: HttpKit,
|
|
|
|
|
+ timeKit: TimeKit,
|
|
|
|
|
+ transferDetailsDialog: {
|
|
|
|
|
+ data: [],
|
|
|
|
|
+ visible: false
|
|
|
|
|
+ },
|
|
|
|
|
+ tempPage: 1,
|
|
|
|
|
+ dblclickRowUrl: "https://tools.blocksec.com/tx/eth/",
|
|
|
|
|
+ }),
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ async addOrUpdateChain() {
|
|
|
|
|
+
|
|
|
|
|
+ const {id, chain, tokenSymbol, networkName, http, explorer, other} = this.editDialog.item
|
|
|
|
|
+ console.log("???", this.editDialog.item)
|
|
|
|
|
+ const updateOrAdd = {
|
|
|
|
|
+ id, chain, tokenSymbol, networkName, http, explorer,other
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const rst1 = await this.chainModel.appendOrUpdateChain(updateOrAdd)
|
|
|
|
|
+ if (rst1.state) {
|
|
|
|
|
+ this.$msgkit.success((this.editDialog.addOrUpdate ? '添加' : '更新') + '成功')
|
|
|
|
|
+
|
|
|
|
|
+ this.editDialog.visible = false
|
|
|
|
|
+ await this.packQuery()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$msgkit.error(`rst1: ${rst1.msg}`)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ async inputPageNum() {
|
|
|
|
|
+ this.table.pageNum = parseInt(this.tempPage)
|
|
|
|
|
+ await this.generateTableDataAgain()
|
|
|
|
|
+ },
|
|
|
|
|
+ async generateTableDataAgain() {
|
|
|
|
|
+ this.tempPage = this.table.pageNum
|
|
|
|
|
+ this.table.data = []
|
|
|
|
|
+
|
|
|
|
|
+ await this.packQuery()
|
|
|
|
|
+ },
|
|
|
|
|
+ formatTimeBySixBitTimestamp(sixBitTimestamp) {
|
|
|
|
|
+ let lastThreeBit = (sixBitTimestamp + '').slice(-3)
|
|
|
|
|
+ return this.timeKit.getTime(sixBitTimestamp) + lastThreeBit
|
|
|
|
|
+ },
|
|
|
|
|
+ editItem(item) {
|
|
|
|
|
+ this.editDialog.item = item
|
|
|
|
|
+ this.editDialog.visible = true
|
|
|
|
|
+ this.editDialog.addOrUpdate = false
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ remButClick() {
|
|
|
|
|
+ jquery(".v-row-group__header td.text-start").unbind('click')
|
|
|
|
|
+ console.log("移除点击事件:remButClick")
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ async mounted() {
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.table-container {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#dataTableHeader {
|
|
|
|
|
+ max-width: none;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.tokenChip {
|
|
|
|
|
+ margin-top: 5px;
|
|
|
|
|
+ margin-left: 5px;
|
|
|
|
|
+ margin-bottom: 5px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.tradeInfoBtn {
|
|
|
|
|
+ padding: 15px !important;
|
|
|
|
|
+ border: grey 2px solid;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.tradeInfoBtn:hover {
|
|
|
|
|
+ background: beige;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.memo-span {
|
|
|
|
|
+ width: 200px;
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ padding: 10px;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|