feat: 更新 @riwa/api-types 依赖至 0.0.67;新增资产视图及相关路由配置;优化 RWA 产品组件的操作按钮及功能

This commit is contained in:
2025-12-28 02:19:02 +07:00
parent f2f311fdab
commit e4e99f9ee2
12 changed files with 132 additions and 65 deletions

View File

@@ -0,0 +1,5 @@
<script lang="ts" setup></script>
<template>Hello world</template>
<style lang="css" scoped></style>

View File

@@ -22,9 +22,9 @@ const form = ref({
totalSupply: '1',
unitPrice: '1',
dividendRate: '0.01',
launchDate: dayjs().add(1, 'day').valueOf() as number | null,
subscriptionStartDate: null as number | null,
subscriptionEndDate: null as number | null
launchDate: dayjs().valueOf() as number | null,
subscriptionStartDate: dayjs().valueOf() as number | null,
subscriptionEndDate: dayjs().valueOf() as number | null
});
const rules: FormRules = {
@@ -66,11 +66,6 @@ function validateTimes() {
function handleCreateDraft() {
formInst.value?.validate(async errors => {
if (!errors) {
const timeError = validateTimes();
if (timeError) {
window.$message?.error(timeError);
return;
}
await safeClient(
client.api.admin.rwa.issuance.editions.post({
...form.value,

View File

@@ -23,9 +23,9 @@ const form = ref<Body>({
totalSupply: props.data.totalSupply,
unitPrice: props.data.unitPrice,
dividendRate: props.data.dividendRate,
launchDate: dayjs(props.data.launchDate).toDate(),
subscriptionStartDate: props.data.subscriptionStartDate ? dayjs(props.data.subscriptionStartDate).toDate() : null,
subscriptionEndDate: props.data.subscriptionEndDate ? dayjs(props.data.subscriptionEndDate).toDate() : null
launchDate: dayjs().toDate(),
subscriptionStartDate: dayjs().toDate(),
subscriptionEndDate: dayjs().toDate()
});
const rules: FormRules = {
@@ -67,11 +67,6 @@ function validateTimes() {
function handleSubmit() {
formInst.value?.validate(async errors => {
if (!errors) {
const timeError = validateTimes();
if (timeError) {
window.$message?.error(timeError);
return;
}
await safeClient(
client.api.admin.rwa.issuance.editions.post({
...form.value,

View File

@@ -59,7 +59,10 @@ const columns: TableBaseColumns = [
},
{
title: '分红率',
key: 'editionName'
key: 'dividendRate',
render: (row: any) => {
return `${(Number(row.dividendRate) * 100).toFixed(2)}%`;
}
},
{
title: '预热时间',
@@ -93,18 +96,19 @@ const columns: TableBaseColumns = [
title: '操作',
fixed: 'right',
key: 'operation',
width: 'auto',
width: 300,
operations: (row: any) => [
{
contentText: '发布',
contentText: '排期',
type: 'primary',
ghost: true,
size: 'small',
visible: row.status === 'draft' || row.status === 'cancelled',
text: true,
onClick: async () => {
dialog.create({
title: '确认发布该发行期吗?',
content: '发布后该发行期将对投资者可见,且不可修改。',
title: '确认期吗?',
content: '排期后将对投资者可见,且不可修改。',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
@@ -115,15 +119,16 @@ const columns: TableBaseColumns = [
}
},
{
contentText: '取消发布',
contentText: '取消排期',
type: 'primary',
ghost: true,
size: 'small',
text: true,
visible: row.status === 'scheduled',
onClick: async () => {
dialog.create({
title: '确认取消发布该发行期吗?',
content: '取消发布后该发行期将对投资者不可见,且不可修改。',
title: '确认取消发布该期吗?',
content: '取消期将对投资者不可见,且不可修改。',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
@@ -133,11 +138,36 @@ const columns: TableBaseColumns = [
});
}
},
{
contentText: '执行分红',
type: 'primary',
ghost: true,
size: 'small',
text: true,
// visible: row.status === 'scheduled',
onClick: async () => {
dialog.create({
title: '确认执行分红吗?',
content: '执行分红后将按照分红率向持有者分配收益。',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
await safeClient(
client.api.admin.rwa.issuance.dividend.distribute.post({
editionId: row.id as string
})
);
tableInst.value?.reload();
}
});
}
},
{
contentText: '申购记录',
type: 'primary',
ghost: true,
size: 'small',
text: true,
visible: row.status === 'scheduled',
onClick: () => handleAllocations(row)
},
@@ -146,7 +176,8 @@ const columns: TableBaseColumns = [
type: 'primary',
ghost: true,
size: 'small',
visible: row.status === 'draft',
text: true,
// visible: row.status === 'draft',
onClick: () => handleEdit(row)
},
{
@@ -154,11 +185,12 @@ const columns: TableBaseColumns = [
type: 'error',
ghost: true,
size: 'small',
visible: row.status === 'draft' || row.status === 'cancelled',
text: true,
// visible: row.status === 'draft' || row.status === 'cancelled',
onClick: () => {
dialog.create({
title: '确认删除该发行期吗?',
content: '删除后该发行期将不可恢复,请谨慎操作。',
title: '确认删除该期吗?',
content: '删除后该期将不可恢复,请谨慎操作。',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
@@ -174,7 +206,7 @@ const columns: TableBaseColumns = [
function handleAdd() {
const dialogInstance = dialog.create({
title: '添加发行期',
title: '添加阶段',
content: () =>
h(AddEdition, {
productId: props.data.id,
@@ -192,7 +224,7 @@ function handleAdd() {
}
function handleEdit(row: any) {
const dialogInstance = dialog.create({
title: '编辑发行期',
title: '编辑阶段',
content: () =>
h(EditEdition, {
data: row,
@@ -219,7 +251,7 @@ function handleAllocations(row: any) {
</script>
<template>
<TableBase ref="tableInst" title="RWA发行期" :columns="columns" :fetch-data="fetchData" @add="handleAdd" />
<TableBase ref="tableInst" title="RWA阶段" :columns="columns" :fetch-data="fetchData" @add="handleAdd" />
</template>
<style lang="css" scoped></style>

View File

@@ -148,10 +148,10 @@ const columns: TableBaseColumns = [
},
{
contentText: '编辑',
type: 'tertiary',
type: 'primary',
ghost: true,
size: 'small',
visible: row.status === 'draft' || row.status === 'rejected',
// visible: row.status === 'draft' || row.status === 'rejected',
onClick: () => {
handleEdit(row);
}
@@ -161,7 +161,7 @@ const columns: TableBaseColumns = [
type: 'error',
ghost: true,
size: 'small',
visible: row.status === 'draft' || row.status === 'rejected',
// visible: row.status === 'draft' || row.status === 'rejected',
onClick: () => {
dialog.create({
title: '删除产品',
@@ -183,6 +183,15 @@ const columns: TableBaseColumns = [
onClick: () => {
handleViewEditions(row);
}
},
{
contentText: '代币化',
type: 'tertiary',
ghost: true,
size: 'small',
onClick: () => {
handleTokenization(row);
}
}
]
}
@@ -204,6 +213,25 @@ const filterColumns: TableFilterColumns = [
}
];
function handleTokenization(row: any) {
dialog.create({
title: '代币化产品',
content: '确认将该产品代币化吗?',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
await safeClient(() =>
client.api.admin.rwa.tokenization.issue.post({
assetCode: row.code,
productId: row.id,
totalSupply: row.estimatedValue
})
);
tableInst.value?.reload();
}
});
}
function handleAdd() {
const dialogInstance = dialog.create({
title: '添加产品',