diff --git a/package.json b/package.json index c0737c2..e0eac3a 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@better-scroll/core": "2.5.1", "@elysiajs/eden": "^1.4.5", "@iconify/vue": "5.0.0", - "@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.56.tgz", + "@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz", "@sa/axios": "workspace:*", "@sa/color": "workspace:*", "@sa/hooks": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 223ad2f..f741668 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: 5.0.0 version: 5.0.0(vue@3.5.25(typescript@5.9.3)) '@riwa/api-types': - specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.56.tgz - version: http://192.168.1.27:9527/api/riwa-api-types-0.0.56.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))) + specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz + version: http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))) '@sa/axios': specifier: workspace:* version: link:packages/axios @@ -1068,9 +1068,9 @@ packages: '@quansync/fs@0.1.6': resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==} - '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.56.tgz': - resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.56.tgz} - version: 0.0.56 + '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz': + resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz} + version: 0.0.59 peerDependencies: '@elysiajs/eden': ^1.4.5 @@ -5057,7 +5057,7 @@ snapshots: dependencies: quansync: 0.3.0 - '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.56.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))': + '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))': dependencies: '@elysiajs/eden': 1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)) diff --git a/src/views/rwa/product/components/add-edition.vue b/src/views/rwa/product/components/add-edition.vue index 40e0497..4c46c28 100644 --- a/src/views/rwa/product/components/add-edition.vue +++ b/src/views/rwa/product/components/add-edition.vue @@ -184,7 +184,7 @@ function handleCreateDraftAndSubmit() { - 创建并发布 + 创建并提交审核 创建 diff --git a/src/views/rwa/product/components/add.vue b/src/views/rwa/product/components/add.vue index 5b4dd03..956fb02 100644 --- a/src/views/rwa/product/components/add.vue +++ b/src/views/rwa/product/components/add.vue @@ -25,14 +25,33 @@ const form = ref({ code: '', categoryId: '', description: '', - estimatedValue: '', - totalSupplyLimit: '', + estimatedValue: '1', + totalSupplyLimit: '100', proofDocuments: '' }); const rules: FormRules = { name: [{ required: true, message: '请输入产品名称', trigger: ['blur', 'input'] }], - code: [{ required: true, message: '请输入产品编号', trigger: ['blur', 'input'] }], + code: [ + { required: true, message: '请输入产品编号', trigger: ['blur', 'input'] }, + { + trigger: ['blur'], + asyncValidator: async (rule, value, callback) => { + if (!value) return; + const { data: check } = await safeClient(() => + client.api.admin.rwa.issuance.products.check_code.get({ + query: { + code: value + } + }) + ); + if (check.value?.exists) { + callback(new Error('产品编号已存在')); + } + callback(); + } + } + ], categoryId: [{ required: true, message: '请输入产品类型', trigger: ['blur', 'input'] }], estimatedValue: [{ required: true, message: '请输入产品估值', trigger: ['blur', 'input'] }], totalSupplyLimit: [{ required: true, message: '请输入总发行量', trigger: ['blur', 'input'] }] @@ -89,10 +108,20 @@ function handleCreateDraftAndSubmit() { /> - + - + diff --git a/src/views/rwa/product/components/edit.vue b/src/views/rwa/product/components/edit.vue index ffd1e9d..4a7a973 100644 --- a/src/views/rwa/product/components/edit.vue +++ b/src/views/rwa/product/components/edit.vue @@ -38,7 +38,27 @@ const form = ref({ const rules: FormRules = { name: [{ required: true, message: '请输入产品名称', trigger: ['blur', 'input'] }], - code: [{ required: true, message: '请输入产品编号', trigger: ['blur', 'input'] }], + code: [ + { required: true, message: '请输入产品编号', trigger: ['blur', 'input'] }, + { + trigger: ['blur'], + asyncValidator: async (rule, value, callback) => { + if (!value) return; + const { data: check } = await safeClient(() => + client.api.admin.rwa.issuance.products.check_code.get({ + query: { + code: value, + excludeId: props.data.id + } + }) + ); + if (check.value?.exists) { + callback(new Error('产品编号已存在')); + } + callback(); + } + } + ], categoryId: [{ required: true, message: '请输入产品类型', trigger: ['blur', 'input'] }], estimatedValue: [{ required: true, message: '请输入产品估值', trigger: ['blur', 'input'] }], totalSupplyLimit: [{ required: true, message: '请输入总发行量', trigger: ['blur', 'input'] }] diff --git a/src/views/rwa/product/components/editions.vue b/src/views/rwa/product/components/editions.vue index 861bfb2..75b52ee 100644 --- a/src/views/rwa/product/components/editions.vue +++ b/src/views/rwa/product/components/editions.vue @@ -145,9 +145,18 @@ const columns: TableBaseColumns = [ type: 'error', ghost: true, size: 'small', - visible: row.status === 'draft', + visible: row.status === 'draft' || row.status === 'cancelled', onClick: () => { - tableInst.value?.reload(); + dialog.create({ + title: '确认删除该发行期吗?', + content: '删除后该发行期将不可恢复,请谨慎操作。', + positiveText: '确认', + negativeText: '取消', + onPositiveClick: async () => { + await safeClient(client.api.admin.rwa.issuance.editions({ id: row.id }).delete()); + tableInst.value?.reload(); + } + }); } } ] diff --git a/src/views/rwa/product/index.vue b/src/views/rwa/product/index.vue index 0a6666d..901d9e5 100644 --- a/src/views/rwa/product/index.vue +++ b/src/views/rwa/product/index.vue @@ -79,18 +79,25 @@ const columns: TableBaseColumns = [ width: 300, operations: (row: any) => [ { - contentText: '提交到流程', + contentText: '提交到审核', ghost: true, visible: row.status === 'draft', size: 'small', onClick: async () => { - // await safeClient(() => - // client.api.admin.rwa.issuance.approve.post({ - // productId: row.id as string, - // publishFirstEdition: true - // }) - // ); - tableInst.value?.reload(); + dialog.create({ + title: '提交到审核流程', + content: '确认将该产品提交到审核流程吗?', + positiveText: '确认', + negativeText: '取消', + onPositiveClick: async () => { + await safeClient(() => + client.api.admin.rwa.issuance.products({ id: row.id }).submit.post({ + submissionNote: '提交审核' + }) + ); + tableInst.value?.reload(); + } + }); } }, { @@ -99,13 +106,21 @@ const columns: TableBaseColumns = [ visible: row.status === 'under_review', size: 'small', onClick: async () => { - await safeClient(() => - client.api.admin.rwa.issuance.approve.post({ - productId: row.id as string, - publishFirstEdition: true - }) - ); - tableInst.value?.reload(); + dialog.create({ + title: '批准产品', + content: '确认批准该产品吗?', + positiveText: '确认', + negativeText: '取消', + onPositiveClick: async () => { + await safeClient(() => + client.api.admin.rwa.issuance.approve.post({ + productId: row.id as string, + publishFirstEdition: true + }) + ); + tableInst.value?.reload(); + } + }); } }, { @@ -114,13 +129,21 @@ const columns: TableBaseColumns = [ visible: row.status === 'under_review', size: 'small', onClick: async () => { - await safeClient(() => - client.api.admin.rwa.issuance.reject.post({ - productId: row.id as string, - rejectionReason: '不符合要求' - }) - ); - tableInst.value?.reload(); + dialog.create({ + title: '批准产品', + content: '确认批准该产品吗?', + positiveText: '确认', + negativeText: '取消', + onPositiveClick: async () => { + await safeClient(() => + client.api.admin.rwa.issuance.reject.post({ + productId: row.id as string, + rejectionReason: '不符合要求' + }) + ); + tableInst.value?.reload(); + } + }); } }, { @@ -133,6 +156,25 @@ const columns: TableBaseColumns = [ handleEdit(row); } }, + { + contentText: '删除', + type: 'error', + ghost: true, + size: 'small', + visible: row.status === 'draft' || row.status === 'rejected', + onClick: () => { + dialog.create({ + title: '删除产品', + content: '确认删除该产品吗,删除后不可恢复。', + positiveText: '确认', + negativeText: '取消', + onPositiveClick: async () => { + await safeClient(() => client.api.admin.rwa.issuance.products({ id: row.id }).delete()); + tableInst.value?.reload(); + } + }); + } + }, { contentText: '发行期', type: 'tertiary',