Merge branch 'main' of http://192.168.1.35:6888/Riwa/riwa-admin
This commit is contained in:
@@ -6,8 +6,13 @@ import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
||||
import type { safeClient } from '@/service/api';
|
||||
import type TableBase from './table-base.vue';
|
||||
|
||||
export type TableActionButtonProps = Partial<ButtonProps> & {
|
||||
contentText: string;
|
||||
visible?: boolean;
|
||||
};
|
||||
|
||||
export type TableBaseExpandColumn<T = InternalRowData> = {
|
||||
operations?: (row: T) => Array<Partial<ButtonProps> & { contentText: string }>;
|
||||
operations?: (row: T) => Array<TableActionButtonProps>;
|
||||
key: string;
|
||||
title: string;
|
||||
};
|
||||
@@ -49,7 +54,10 @@ export function transformColumns<T = InternalRowData>(columns: TableBaseColumns<
|
||||
render: col.operations
|
||||
? (row: T) =>
|
||||
h(NSpace, null, {
|
||||
default: () => col.operations!(row).map(item => h(NButton, item, { default: () => item.contentText }))
|
||||
default: () =>
|
||||
col.operations!(row)
|
||||
.filter(item => item.visible !== false)
|
||||
.map(item => h(NButton, item, { default: () => item.contentText }))
|
||||
})
|
||||
: (col as any).render
|
||||
} as TableBaseColumn<T>;
|
||||
|
||||
@@ -56,6 +56,7 @@ const columns: TableBaseColumns = [
|
||||
strong: true,
|
||||
secondary: true,
|
||||
size: 'small',
|
||||
visible: row.status !== 'approved',
|
||||
onClick: async () => {
|
||||
const amount = ref<string>(row.amount);
|
||||
dialog.create({
|
||||
|
||||
@@ -63,15 +63,17 @@ const columns: TableBaseColumns = [
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
key: 'operation',
|
||||
width: 230,
|
||||
width: 140,
|
||||
operations: (row: any) => [
|
||||
{
|
||||
contentText: '批准',
|
||||
size: 'small',
|
||||
visible: row.status === 'under_review',
|
||||
onClick: async () => {
|
||||
safeClient(() =>
|
||||
await safeClient(() =>
|
||||
client.api.admin.rwa.issuance.approve.post({
|
||||
productId: row.id as string
|
||||
productId: row.id as string,
|
||||
publishFirstEdition: true
|
||||
})
|
||||
);
|
||||
tableInst.value?.reload();
|
||||
@@ -80,8 +82,9 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
contentText: '拒绝',
|
||||
size: 'small',
|
||||
visible: row.status === 'under_review',
|
||||
onClick: async () => {
|
||||
safeClient(() =>
|
||||
await safeClient(() =>
|
||||
client.api.admin.rwa.issuance.reject.post({
|
||||
productId: row.id as string,
|
||||
rejectionReason: '不符合要求'
|
||||
@@ -89,14 +92,14 @@ const columns: TableBaseColumns = [
|
||||
);
|
||||
tableInst.value?.reload();
|
||||
}
|
||||
},
|
||||
{
|
||||
contentText: '编辑',
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
tableInst.value?.reload();
|
||||
}
|
||||
}
|
||||
// {
|
||||
// contentText: '编辑',
|
||||
// size: 'small',
|
||||
// onClick: () => {
|
||||
// tableInst.value?.reload();
|
||||
// }
|
||||
// }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user