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..e2b7faa --- /dev/null +++ b/apps/web-antd/src/api/product-manage/query-whitelist.ts @@ -0,0 +1,89 @@ +import { requestClient } from '#/api/request'; + +export namespace QueryWhitelistApi { + export interface EntryItem { + id: string; + name: string; + id_card_masked: string; + api_codes: string[]; + status: string; + remark: string; + created_at: string; + updated_at: string; + } + + export interface OpRequest { + name: string; + id_card: string; + api_codes: string[]; + remark?: string; + } + + export interface OpResponse { + tianyuan_code: number; + tianyuan_message: string; + transaction_id?: string; + entry?: EntryItem; + } + + export interface OpLogItem { + id: string; + admin_user_id: string; + 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[]; + } + + export interface OpLogListParams { + page?: number; + page_size?: number; + id_card?: string; + action?: string; + tianyuan_code?: number; + } +} + +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: QueryWhitelistApi.OpLogListParams, +) { + 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..5fcf97d --- /dev/null +++ b/apps/web-antd/src/views/product-manage/query-whitelist/data.ts @@ -0,0 +1,149 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { FeatureApi } from '#/api/product-manage/feature'; + +export const actionOptions = [ + { label: '创建规则', value: 'create' }, + { label: '追加接口', value: 'append' }, +]; + +export type FeatureOption = { label: string; value: string }; + +/** 将模块列表转为下拉选项 */ +export function buildFeatureOptions( + features: FeatureApi.FeatureItem[], +): FeatureOption[] { + return features.map((item) => ({ + label: `${item.api_id}(${item.name})`, + value: item.api_id, + })); +} + +/** 司法类模块:名称含「司法」的 feature */ +export function getJudicialApiCodes(features: FeatureApi.FeatureItem[]): string[] { + return features + .filter((item) => item.name.includes('司法')) + .map((item) => item.api_id); +} + +export function useConfigFormSchema( + featureOptions: FeatureOption[] = [], +): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + rules: 'required', + componentProps: { + maxlength: 18, + placeholder: '18位中国大陆身份证号', + }, + }, + { + component: 'Input', + fieldName: 'name', + label: '姓名', + defaultValue: '*', + help: '填 * 表示仅按身份证匹配,不校验姓名', + componentProps: { + placeholder: '默认 *', + }, + }, + { + component: 'Select', + fieldName: 'api_codes', + label: '产品编码', + defaultValue: [], + rules: 'required', + help: '从模块列表多选;可点击下方快捷按钮一键选中司法类模块', + componentProps: { + mode: 'multiple', + placeholder: '请选择产品编码', + options: featureOptions, + optionFilterProp: 'label', + showSearch: true, + allowClear: true, + maxTagCount: 'responsive', + }, + }, + { + component: 'Input', + fieldName: 'remark', + label: '备注', + componentProps: { + maxlength: 500, + placeholder: '可选,最长500字符', + }, + }, + ]; +} + +export function useLogGridFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + }, + { + component: 'Select', + fieldName: 'action', + label: '操作类型', + componentProps: { + allowClear: true, + options: actionOptions, + }, + }, + { + component: 'Select', + fieldName: 'tianyuan_code', + label: '业务结果', + componentProps: { + allowClear: true, + options: [{ label: '成功', value: 0 }], + }, + }, + ]; +} + +export function useLogColumns(): VxeTableGridOptions['columns'] { + return [ + { field: 'create_time', title: '操作时间', minWidth: 170 }, + { field: 'admin_user_name', title: '操作人', minWidth: 100 }, + { + field: 'action', + title: '操作类型', + minWidth: 100, + formatter: ({ cellValue }: { cellValue: string }) => + cellValue === 'create' ? '创建规则' : '追加接口', + }, + { field: 'id_card', title: '身份证号', minWidth: 180 }, + { field: 'id_card_masked', title: '脱敏身份证', minWidth: 150 }, + { field: 'name', title: '姓名规则', minWidth: 90 }, + { + field: 'api_codes', + title: '提交编码', + minWidth: 200, + formatter: ({ cellValue }: { cellValue: string[] }) => + Array.isArray(cellValue) ? cellValue.join(', ') : cellValue, + }, + { + field: 'tianyuan_code', + title: '天远码', + minWidth: 80, + formatter: ({ cellValue }: { cellValue: number }) => + String(cellValue ?? ''), + }, + { field: 'tianyuan_message', title: '天远描述', minWidth: 160 }, + { field: 'transaction_id', title: '流水号', minWidth: 200 }, + { + field: 'entry_api_codes', + title: '当前编码', + minWidth: 200, + formatter: ({ cellValue }: { cellValue: string[] }) => + Array.isArray(cellValue) ? cellValue.join(', ') : cellValue || '-', + }, + { field: 'remark', title: '备注', minWidth: 120 }, + ]; +} 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..0a48960 --- /dev/null +++ b/apps/web-antd/src/views/product-manage/query-whitelist/list.vue @@ -0,0 +1,244 @@ + + +