|
@@ -34,32 +34,17 @@ const ETH_TX_BASE_URL = 'https://etherscan.io/tx/'
|
|
|
const TRON_TX_BASE_URL = 'https://tronscan.org/#/transaction/'
|
|
const TRON_TX_BASE_URL = 'https://tronscan.org/#/transaction/'
|
|
|
|
|
|
|
|
const filters = reactive<{
|
|
const filters = reactive<{
|
|
|
- status: string | null
|
|
|
|
|
- // senderIsVaultAddress: string | null
|
|
|
|
|
- // recipientIsVaultAddress: string | null
|
|
|
|
|
|
|
+ senderLabel: string | null
|
|
|
|
|
+ recipientLabel: string | null
|
|
|
|
|
+ senderAddress: string | null
|
|
|
|
|
+ recipientAddress: string | null
|
|
|
}>({
|
|
}>({
|
|
|
- status: null,
|
|
|
|
|
- // senderIsVaultAddress: null,
|
|
|
|
|
- // recipientIsVaultAddress: null,
|
|
|
|
|
|
|
+ senderLabel: null,
|
|
|
|
|
+ recipientLabel: null,
|
|
|
|
|
+ senderAddress: null,
|
|
|
|
|
+ recipientAddress: null,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const statusOptions = computed(() => [
|
|
|
|
|
- { label: t('vaultTx.filterAll'), value: null },
|
|
|
|
|
- { label: t('vaultTx.status_unconfirmed'), value: 'unconfirmed' },
|
|
|
|
|
- { label: t('vaultTx.status_confirming'), value: 'confirming' },
|
|
|
|
|
- { label: t('vaultTx.status_confirmed'), value: 'confirmed' },
|
|
|
|
|
- { label: t('vaultTx.status_finalized'), value: 'finalized' },
|
|
|
|
|
- { label: t('vaultTx.status_dropped'), value: 'dropped' },
|
|
|
|
|
- { label: t('vaultTx.status_replaced'), value: 'replaced' },
|
|
|
|
|
- { label: t('vaultTx.status_failed'), value: 'failed' },
|
|
|
|
|
-])
|
|
|
|
|
-
|
|
|
|
|
-// const boolFilterOptions = computed(() => [
|
|
|
|
|
-// { label: t('vaultTx.filterAll'), value: null },
|
|
|
|
|
-// { label: t('vaultTx.boolYes'), value: 'true' },
|
|
|
|
|
-// { label: t('vaultTx.boolNo'), value: 'false' },
|
|
|
|
|
-// ])
|
|
|
|
|
-
|
|
|
|
|
function formatDash(v: unknown): string {
|
|
function formatDash(v: unknown): string {
|
|
|
if (v == null || v === '') return '—'
|
|
if (v == null || v === '') return '—'
|
|
|
return String(v)
|
|
return String(v)
|
|
@@ -91,11 +76,11 @@ function formatTimestamp(v: string | number | undefined): string {
|
|
|
return Number.isNaN(d.getTime()) ? String(v) : format(d)
|
|
return Number.isNaN(d.getTime()) ? String(v) : format(d)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function boolText(v: boolean | undefined): string {
|
|
|
|
|
- if (v === true) return t('vaultTx.boolYes')
|
|
|
|
|
- if (v === false) return t('vaultTx.boolNo')
|
|
|
|
|
- return '—'
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// function boolText(v: boolean | undefined): string {
|
|
|
|
|
+// if (v === true) return t('vaultTx.boolYes')
|
|
|
|
|
+// if (v === false) return t('vaultTx.boolNo')
|
|
|
|
|
+// return '—'
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
/** 各列 width 之和,供 scroll-x 使用,保证超出视口时可横向滚动看全列 */
|
|
/** 各列 width 之和,供 scroll-x 使用,保证超出视口时可横向滚动看全列 */
|
|
|
const VAULT_TX_COL_WIDTHS = [
|
|
const VAULT_TX_COL_WIDTHS = [
|
|
@@ -229,15 +214,15 @@ const columns = computed<DataTableColumns<VaultTransactionItem>>(() => [
|
|
|
render: (row) =>
|
|
render: (row) =>
|
|
|
h('span', { class: 'vault-tx__cell-text' }, formatDash(row.blockchain)),
|
|
h('span', { class: 'vault-tx__cell-text' }, formatDash(row.blockchain)),
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- title: () => t('vaultTx.colBlockHeight'),
|
|
|
|
|
- key: 'minedInBlockHeight',
|
|
|
|
|
- width: 112,
|
|
|
|
|
- titleAlign: 'center',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- render: (row) =>
|
|
|
|
|
- h('span', { class: 'vault-tx__cell-num' }, formatDash(row.minedInBlockHeight)),
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: () => t('vaultTx.colBlockHeight'),
|
|
|
|
|
+ // key: 'minedInBlockHeight',
|
|
|
|
|
+ // width: 112,
|
|
|
|
|
+ // titleAlign: 'center',
|
|
|
|
|
+ // align: 'center',
|
|
|
|
|
+ // render: (row) =>
|
|
|
|
|
+ // h('span', { class: 'vault-tx__cell-num' }, formatDash(row.minedInBlockHeight)),
|
|
|
|
|
+ // },
|
|
|
{
|
|
{
|
|
|
title: () => t('vaultTx.colFee'),
|
|
title: () => t('vaultTx.colFee'),
|
|
|
key: 'feeAmount',
|
|
key: 'feeAmount',
|
|
@@ -293,7 +278,10 @@ async function load(): Promise<void> {
|
|
|
try {
|
|
try {
|
|
|
const res = await fetchVaultTransactions({
|
|
const res = await fetchVaultTransactions({
|
|
|
vaultId: vault.currentVaultId,
|
|
vaultId: vault.currentVaultId,
|
|
|
- status: filters.status,
|
|
|
|
|
|
|
+ senderLabel: filters.senderLabel,
|
|
|
|
|
+ recipientLabel: filters.recipientLabel,
|
|
|
|
|
+ senderAddress: filters.senderAddress,
|
|
|
|
|
+ recipientAddress: filters.recipientAddress,
|
|
|
// senderIsVaultAddress: filters.senderIsVaultAddress,
|
|
// senderIsVaultAddress: filters.senderIsVaultAddress,
|
|
|
// recipientIsVaultAddress: filters.recipientIsVaultAddress,
|
|
// recipientIsVaultAddress: filters.recipientIsVaultAddress,
|
|
|
page: {
|
|
page: {
|
|
@@ -305,7 +293,7 @@ async function load(): Promise<void> {
|
|
|
})
|
|
})
|
|
|
if (res.code === ApiCode.StatusOK && Array.isArray(res.data)) {
|
|
if (res.code === ApiCode.StatusOK && Array.isArray(res.data)) {
|
|
|
rows.value = res.data
|
|
rows.value = res.data
|
|
|
- const total = res.page.pageTotal
|
|
|
|
|
|
|
+ const total = res.page?.rowTotal
|
|
|
pagination.itemCount =
|
|
pagination.itemCount =
|
|
|
typeof total === 'number' && Number.isFinite(total) ? total : res.data.length
|
|
typeof total === 'number' && Number.isFinite(total) ? total : res.data.length
|
|
|
} else {
|
|
} else {
|
|
@@ -327,7 +315,7 @@ watch(
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
watch(
|
|
watch(
|
|
|
- () => [filters.status],
|
|
|
|
|
|
|
+ () => [filters.senderLabel, filters.recipientLabel, filters.senderAddress, filters.recipientAddress],
|
|
|
() => {
|
|
() => {
|
|
|
pagination.page = 1
|
|
pagination.page = 1
|
|
|
void load()
|
|
void load()
|
|
@@ -354,11 +342,16 @@ async function onExport(): Promise<void> {
|
|
|
try {
|
|
try {
|
|
|
const res = await exportVaultTransactions({
|
|
const res = await exportVaultTransactions({
|
|
|
vaultId: vault.currentVaultId,
|
|
vaultId: vault.currentVaultId,
|
|
|
- status: filters.status,
|
|
|
|
|
|
|
+ senderLabel: filters.senderLabel,
|
|
|
|
|
+ recipientLabel: filters.recipientLabel,
|
|
|
|
|
+ senderAddress: filters.senderAddress,
|
|
|
|
|
+ recipientAddress: filters.recipientAddress,
|
|
|
// senderIsVaultAddress: filters.senderIsVaultAddress,
|
|
// senderIsVaultAddress: filters.senderIsVaultAddress,
|
|
|
// recipientIsVaultAddress: filters.recipientIsVaultAddress,
|
|
// recipientIsVaultAddress: filters.recipientIsVaultAddress,
|
|
|
- page: pagination.page,
|
|
|
|
|
- pageSize: pagination.pageSize,
|
|
|
|
|
|
|
+ page: {
|
|
|
|
|
+ current: pagination.page,
|
|
|
|
|
+ row: pagination.pageSize,
|
|
|
|
|
+ },
|
|
|
})
|
|
})
|
|
|
if ('error' in res) {
|
|
if ('error' in res) {
|
|
|
message.error(res.error || t('vaultTx.exportFail'))
|
|
message.error(res.error || t('vaultTx.exportFail'))
|
|
@@ -375,7 +368,10 @@ async function onExport(): Promise<void> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function onResetFilters(): void {
|
|
function onResetFilters(): void {
|
|
|
- filters.status = null
|
|
|
|
|
|
|
+ filters.senderLabel = null
|
|
|
|
|
+ filters.recipientLabel = null
|
|
|
|
|
+ filters.senderAddress = null
|
|
|
|
|
+ filters.recipientAddress = null
|
|
|
// filters.senderIsVaultAddress = null
|
|
// filters.senderIsVaultAddress = null
|
|
|
// filters.recipientIsVaultAddress = null
|
|
// filters.recipientIsVaultAddress = null
|
|
|
}
|
|
}
|
|
@@ -404,12 +400,29 @@ function onResetFilters(): void {
|
|
|
<div v-else class="vault-panel__body">
|
|
<div v-else class="vault-panel__body">
|
|
|
<div class="vault-panel__toolbar">
|
|
<div class="vault-panel__toolbar">
|
|
|
<div class="vault-panel__filters">
|
|
<div class="vault-panel__filters">
|
|
|
- <n-select
|
|
|
|
|
- v-model:value="filters.status"
|
|
|
|
|
- :options="statusOptions"
|
|
|
|
|
- :placeholder="t('vaultTx.colStatus')"
|
|
|
|
|
|
|
+ <n-input
|
|
|
|
|
+ v-model:value="filters.senderLabel"
|
|
|
|
|
+ :placeholder="t('vaultTx.colSenderLabel')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ style="width: 200px"
|
|
|
|
|
+ />
|
|
|
|
|
+ <n-input
|
|
|
|
|
+ v-model:value="filters.senderAddress"
|
|
|
|
|
+ :placeholder="t('vaultTx.colSenderAddr')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ style="width: 260px"
|
|
|
|
|
+ />
|
|
|
|
|
+ <n-input
|
|
|
|
|
+ v-model:value="filters.recipientLabel"
|
|
|
|
|
+ :placeholder="t('vaultTx.colRecipientLabel')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ style="width: 200px"
|
|
|
|
|
+ />
|
|
|
|
|
+ <n-input
|
|
|
|
|
+ v-model:value="filters.recipientAddress"
|
|
|
|
|
+ :placeholder="t('vaultTx.colRecipientAddr')"
|
|
|
clearable
|
|
clearable
|
|
|
- style="width: 180px"
|
|
|
|
|
|
|
+ style="width: 260px"
|
|
|
/>
|
|
/>
|
|
|
<!-- <n-select-->
|
|
<!-- <n-select-->
|
|
|
<!-- v-model:value="filters.senderIsVaultAddress"-->
|
|
<!-- v-model:value="filters.senderIsVaultAddress"-->
|