From ac6f223eb2db38777f59d98043d39a2f90c95c69 Mon Sep 17 00:00:00 2001 From: Mrxs <18278715334@163.com> Date: Fri, 19 Jun 2026 12:53:39 +0800 Subject: [PATCH] f --- apps/web-antd/src/api/product-manage/index.ts | 1 + .../src/api/product-manage/query-whitelist.ts | 74 +++++++ .../product-manage/query-whitelist/data.ts | 162 +++++++++++++++ .../product-manage/query-whitelist/list.vue | 184 ++++++++++++++++++ 4 files changed, 421 insertions(+) create mode 100644 apps/web-antd/src/api/product-manage/query-whitelist.ts create mode 100644 apps/web-antd/src/views/product-manage/query-whitelist/data.ts create mode 100644 apps/web-antd/src/views/product-manage/query-whitelist/list.vue diff --git a/apps/web-antd/src/api/product-manage/index.ts b/apps/web-antd/src/api/product-manage/index.ts index 3a2f69d..17798bf 100644 --- a/apps/web-antd/src/api/product-manage/index.ts +++ b/apps/web-antd/src/api/product-manage/index.ts @@ -1,2 +1,3 @@ export * from './feature'; export * from './product'; +export * from './query-whitelist'; diff --git a/apps/web-antd/src/api/product-manage/query-whitelist.ts b/apps/web-antd/src/api/product-manage/query-whitelist.ts new file mode 100644 index 0000000..ed8ba88 --- /dev/null +++ b/apps/web-antd/src/api/product-manage/query-whitelist.ts @@ -0,0 +1,74 @@ +import type { Recordable } from '@vben/types'; + +import { requestClient } from '#/api/request'; + +export namespace QueryWhitelistApi { + export interface OpRequest { + name: string; + id_card: string; + api_codes: string[]; + remark?: string; + } + + export interface OpResponse { + success: boolean; + tianyuan_code: number; + tianyuan_message: string; + transaction_id?: string; + entry_id?: string; + id_card_masked?: string; + entry_api_codes?: string[]; + entry_status?: string; + } + + export interface OpLogItem { + id: number; + admin_user_id: number; + admin_user_name: string; + action: string; + name: string; + id_card: string; + id_card_masked: string; + api_codes: string[]; + remark: string; + tianyuan_code: number; + tianyuan_message: string; + transaction_id: string; + entry_id: string; + entry_status: string; + entry_api_codes: string[]; + create_time: string; + } + + export interface OpLogList { + total: number; + items: OpLogItem[]; + } +} + +async function createQueryWhitelist(data: QueryWhitelistApi.OpRequest) { + return requestClient.post( + '/query-whitelist/create', + data, + ); +} + +async function appendQueryWhitelist(data: QueryWhitelistApi.OpRequest) { + return requestClient.post( + '/query-whitelist/append', + data, + ); +} + +async function getQueryWhitelistOpLogList(params: Recordable) { + return requestClient.get( + '/query-whitelist/op-log/list', + { params }, + ); +} + +export { + appendQueryWhitelist, + createQueryWhitelist, + getQueryWhitelistOpLogList, +}; diff --git a/apps/web-antd/src/views/product-manage/query-whitelist/data.ts b/apps/web-antd/src/views/product-manage/query-whitelist/data.ts new file mode 100644 index 0000000..080e58d --- /dev/null +++ b/apps/web-antd/src/views/product-manage/query-whitelist/data.ts @@ -0,0 +1,162 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { QueryWhitelistApi } from '#/api/product-manage/query-whitelist'; + +export function useConfigFormSchema( + featureOptions: Array<{ label: string; value: string }>, +): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + rules: 'required', + componentProps: { + maxlength: 18, + placeholder: '18位中国大陆身份证号', + }, + }, + { + component: 'Input', + fieldName: 'name', + label: '姓名', + defaultValue: '*', + rules: 'required', + componentProps: { + placeholder: '填 * 表示只按身份证匹配', + }, + }, + { + component: 'Select', + fieldName: 'api_codes', + label: '产品编码', + rules: 'required', + componentProps: { + mode: 'multiple', + allowClear: true, + showSearch: true, + optionFilterProp: 'label', + options: featureOptions, + placeholder: '请选择产品编码', + }, + }, + { + component: 'Textarea', + fieldName: 'remark', + label: '备注', + componentProps: { + maxlength: 500, + rows: 2, + showCount: true, + placeholder: '可选备注', + }, + }, + ]; +} + +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + }, + { + component: 'Select', + fieldName: 'action', + label: '操作类型', + componentProps: { + allowClear: true, + options: [ + { label: '创建规则', value: 'create' }, + { label: '追加接口', value: 'append' }, + ], + }, + }, + { + component: 'InputNumber', + fieldName: 'tianyuan_code', + label: '天远返回码', + componentProps: { + class: 'w-full', + }, + }, + ]; +} + +export function useColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'create_time', + title: '操作时间', + minWidth: 170, + }, + { + field: 'admin_user_name', + title: '操作人', + minWidth: 100, + }, + { + field: 'action', + title: '操作类型', + minWidth: 100, + formatter: ({ cellValue }) => (cellValue === 'append' ? '追加接口' : '创建规则'), + }, + { + field: 'id_card', + title: '身份证号', + minWidth: 180, + }, + { + field: 'name', + title: '姓名规则', + minWidth: 90, + }, + { + field: 'api_codes', + title: '提交编码', + minWidth: 220, + formatter: ({ cellValue }) => + Array.isArray(cellValue) ? cellValue.join(', ') : '', + }, + { + field: 'tianyuan_code', + title: '天远码', + minWidth: 80, + }, + { + field: 'tianyuan_message', + title: '天远描述', + minWidth: 180, + }, + { + field: 'entry_api_codes', + title: '规则编码', + minWidth: 220, + formatter: ({ cellValue }) => + Array.isArray(cellValue) ? cellValue.join(', ') : '', + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + ]; +} + +export function formatOpResult(result: QueryWhitelistApi.OpResponse | null) { + if (!result) { + return '暂无调用结果'; + } + const lines = [ + `业务结果:${result.success ? '成功' : '失败'}`, + `天远码:${result.tianyuan_code}`, + `描述:${result.tianyuan_message || '-'}`, + `流水号:${result.transaction_id || '-'}`, + `规则ID:${result.entry_id || '-'}`, + `脱敏身份证:${result.id_card_masked || '-'}`, + `规则状态:${result.entry_status || '-'}`, + `规则编码:${result.entry_api_codes?.join(', ') || '-'}`, + ]; + return lines.join('\n'); +} diff --git a/apps/web-antd/src/views/product-manage/query-whitelist/list.vue b/apps/web-antd/src/views/product-manage/query-whitelist/list.vue new file mode 100644 index 0000000..43d1de2 --- /dev/null +++ b/apps/web-antd/src/views/product-manage/query-whitelist/list.vue @@ -0,0 +1,184 @@ + + +