From b0ee15d8c100d5ac60f41fcd5163cef819e77c2f Mon Sep 17 00:00:00 2001 From: Mrxs <18278715334@163.com> Date: Thu, 18 Jun 2026 17:49:54 +0800 Subject: [PATCH] f --- apps/web-antd/src/api/product-manage/index.ts | 1 + .../src/api/product-manage/whitelist.ts | 101 +++++++++ .../views/product-manage/whitelist/data.ts | 207 ++++++++++++++++++ .../views/product-manage/whitelist/list.vue | 114 ++++++++++ .../product-manage/whitelist/modules/form.vue | 186 ++++++++++++++++ 5 files changed, 609 insertions(+) create mode 100644 apps/web-antd/src/api/product-manage/whitelist.ts create mode 100644 apps/web-antd/src/views/product-manage/whitelist/data.ts create mode 100644 apps/web-antd/src/views/product-manage/whitelist/list.vue create mode 100644 apps/web-antd/src/views/product-manage/whitelist/modules/form.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..3b71bfa 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 './whitelist'; diff --git a/apps/web-antd/src/api/product-manage/whitelist.ts b/apps/web-antd/src/api/product-manage/whitelist.ts new file mode 100644 index 0000000..4ae8ad2 --- /dev/null +++ b/apps/web-antd/src/api/product-manage/whitelist.ts @@ -0,0 +1,101 @@ +import type { Recordable } from '@vben/types'; + +import { requestClient } from '#/api/request'; + +export namespace WhitelistApi { + export interface WhitelistItem { + id: string; + id_card: string; + feature_id: string; + feature_api_id: string; + feature_name: string; + user_id: string; + amount: number; + status: number; + status_text: string; + create_time: string; + update_time: string; + } + + export interface WhitelistList { + total: number; + items: WhitelistItem[]; + } + + export interface CreateWhitelistRequest { + id_card: string; + feature_id: string; + amount?: number; + status?: number; + } + + export interface BatchCreateWhitelistRequest { + id_card: string; + feature_ids: string[]; + amount?: number; + status?: number; + } + + export interface BatchCreateWhitelistResultItem { + feature_id: string; + feature_api_id: string; + feature_name: string; + action: string; + message?: string; + } + + export interface BatchCreateWhitelistResponse { + success_count: number; + skip_count: number; + fail_count: number; + items: BatchCreateWhitelistResultItem[]; + } + + export interface UpdateWhitelistRequest { + status?: number; + amount?: number; + } +} + +async function getWhitelistList(params: Recordable) { + return requestClient.get('/whitelist/list', { + params, + }); +} + +async function createWhitelist(data: WhitelistApi.CreateWhitelistRequest) { + return requestClient.post<{ id: string }>('/whitelist/create', data); +} + +async function batchCreateWhitelist( + data: WhitelistApi.BatchCreateWhitelistRequest, +) { + return requestClient.post( + '/whitelist/batch-create', + data, + ); +} + +async function updateWhitelist( + id: string, + data: WhitelistApi.UpdateWhitelistRequest, +) { + return requestClient.put<{ success: boolean }>( + `/whitelist/update/${id}`, + data, + ); +} + +async function deleteWhitelist(id: string) { + return requestClient.delete<{ success: boolean }>( + `/whitelist/delete/${id}`, + ); +} + +export { + batchCreateWhitelist, + createWhitelist, + deleteWhitelist, + getWhitelistList, + updateWhitelist, +}; diff --git a/apps/web-antd/src/views/product-manage/whitelist/data.ts b/apps/web-antd/src/views/product-manage/whitelist/data.ts new file mode 100644 index 0000000..a3a3cbc --- /dev/null +++ b/apps/web-antd/src/views/product-manage/whitelist/data.ts @@ -0,0 +1,207 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { WhitelistApi } from '#/api/product-manage'; + +/** 快捷勾选预设:按模块编号 api_id 匹配 */ +export const WHITELIST_QUICK_PRESETS = [ + { + label: '司法涉诉 + 违约失信', + apiIds: ['FLXG7E8F', 'JRZQ8A2D'], + }, + { + label: '司法涉诉', + apiIds: ['FLXG7E8F'], + }, + { + label: '违约失信', + apiIds: ['JRZQ8A2D'], + }, +] as const; + +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + rules: 'required', + componentProps: { + placeholder: '请输入被屏蔽对象的身份证号', + }, + }, + { + component: 'Select', + fieldName: 'feature_ids', + label: '屏蔽模块', + rules: 'required', + formItemClass: 'items-start', + componentProps: { + mode: 'multiple', + showSearch: true, + optionFilterProp: 'label', + allowClear: true, + placeholder: '请选择要屏蔽的模块,支持多选', + options: [], + class: 'w-full', + }, + }, + { + component: 'InputNumber', + fieldName: 'amount', + label: '费用(元)', + defaultValue: 0, + componentProps: { + min: 0, + precision: 2, + }, + }, + { + component: 'Select', + fieldName: 'status', + label: '状态', + defaultValue: 1, + componentProps: { + options: [ + { label: '生效', value: 1 }, + { label: '已失效', value: 2 }, + ], + }, + }, + ]; +} + +export function useEditFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + componentProps: { + disabled: true, + }, + }, + { + component: 'Input', + fieldName: 'feature_name', + label: '屏蔽模块', + componentProps: { + disabled: true, + }, + }, + { + component: 'InputNumber', + fieldName: 'amount', + label: '费用(元)', + componentProps: { + min: 0, + precision: 2, + }, + }, + { + component: 'Select', + fieldName: 'status', + label: '状态', + componentProps: { + options: [ + { label: '生效', value: 1 }, + { label: '已失效', value: 2 }, + ], + }, + }, + ]; +} + +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id_card', + label: '身份证号', + }, + { + component: 'Input', + fieldName: 'feature_api_id', + label: '模块编号', + }, + { + component: 'Select', + fieldName: 'status', + label: '状态', + componentProps: { + allowClear: true, + options: [ + { label: '生效', value: 1 }, + { label: '已失效', value: 2 }, + ], + }, + }, + ]; +} + +export function useColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id_card', + title: '身份证号', + minWidth: 180, + }, + { + field: 'feature_api_id', + title: '模块编号', + minWidth: 140, + }, + { + field: 'feature_name', + title: '模块名称', + minWidth: 160, + }, + { + field: 'amount', + formatter: ({ cellValue }) => `¥${(cellValue || 0).toFixed(2)}`, + title: '费用(元)', + minWidth: 110, + }, + { + field: 'status_text', + title: '状态', + minWidth: 90, + }, + { + field: 'create_time', + title: '创建时间', + minWidth: 180, + }, + { + field: 'update_time', + title: '更新时间', + minWidth: 180, + }, + { + align: 'center', + cellRender: { + attrs: { + nameField: 'id_card', + nameTitle: '白名单', + onClick: onActionClick, + }, + options: [ + { + code: 'edit', + text: '编辑', + }, + { + code: 'delete', + text: '删除', + }, + ], + name: 'CellOperation', + }, + field: 'operation', + fixed: 'right', + title: '操作', + width: 140, + }, + ]; +} diff --git a/apps/web-antd/src/views/product-manage/whitelist/list.vue b/apps/web-antd/src/views/product-manage/whitelist/list.vue new file mode 100644 index 0000000..63d2a78 --- /dev/null +++ b/apps/web-antd/src/views/product-manage/whitelist/list.vue @@ -0,0 +1,114 @@ + + + diff --git a/apps/web-antd/src/views/product-manage/whitelist/modules/form.vue b/apps/web-antd/src/views/product-manage/whitelist/modules/form.vue new file mode 100644 index 0000000..ad1f598 --- /dev/null +++ b/apps/web-antd/src/views/product-manage/whitelist/modules/form.vue @@ -0,0 +1,186 @@ + + +