From aca098640a103198ed8347d5e7aa9babb6bde26a Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Thu, 12 Sep 2024 14:41:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/system/client/index.ts | 41 ++++++ .../web-antd/src/api/system/client/model.d.ts | 12 ++ .../src/views/system/client/client-drawer.vue | 126 ++++++++++++++++++ .../web-antd/src/views/system/client/data.tsx | 106 +++++++++++++++ .../src/views/system/client/index.vue | 20 ++- .../src/views/system/client/secret-input.vue | 60 +++++++++ 6 files changed, 361 insertions(+), 4 deletions(-) create mode 100644 apps/web-antd/src/api/system/client/index.ts create mode 100644 apps/web-antd/src/api/system/client/model.d.ts create mode 100644 apps/web-antd/src/views/system/client/client-drawer.vue create mode 100644 apps/web-antd/src/views/system/client/data.tsx create mode 100644 apps/web-antd/src/views/system/client/secret-input.vue diff --git a/apps/web-antd/src/api/system/client/index.ts b/apps/web-antd/src/api/system/client/index.ts new file mode 100644 index 00000000..4c4b6241 --- /dev/null +++ b/apps/web-antd/src/api/system/client/index.ts @@ -0,0 +1,41 @@ +import type { Client } from './model'; + +import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + clientChangeStatus = '/system/client/changeStatus', + clientExport = '/system/client/export', + clientList = '/system/client/list', + root = '/system/client', +} + +export function clientList(params?: PageQuery) { + return requestClient.get>(Api.clientList, { params }); +} + +export function clientExport(data: any) { + return commonExport(Api.clientExport, data); +} + +export function clientInfo(id: ID) { + return requestClient.get(`${Api.root}/${id}`); +} + +export function clientAdd(data: any) { + return requestClient.postWithMsg(Api.root, data); +} + +export function clientUpdate(data: any) { + return requestClient.putWithMsg(Api.root, data); +} + +export function clientChangeStatus(data: any) { + return requestClient.putWithMsg(Api.root, data); +} + +export function clientRemove(ids: IDS) { + return requestClient.deleteWithMsg(`${Api.root}/${ids.join(',')}`); +} diff --git a/apps/web-antd/src/api/system/client/model.d.ts b/apps/web-antd/src/api/system/client/model.d.ts new file mode 100644 index 00000000..62af21fa --- /dev/null +++ b/apps/web-antd/src/api/system/client/model.d.ts @@ -0,0 +1,12 @@ +export interface Client { + id: number; + clientId: string; + clientKey: string; + clientSecret: string; + grantTypeList: string[]; + grantType: string; + deviceType: string; + activeTimeout: number; + timeout: number; + status: string; +} diff --git a/apps/web-antd/src/views/system/client/client-drawer.vue b/apps/web-antd/src/views/system/client/client-drawer.vue new file mode 100644 index 00000000..11172d61 --- /dev/null +++ b/apps/web-antd/src/views/system/client/client-drawer.vue @@ -0,0 +1,126 @@ + + + diff --git a/apps/web-antd/src/views/system/client/data.tsx b/apps/web-antd/src/views/system/client/data.tsx new file mode 100644 index 00000000..e38f52de --- /dev/null +++ b/apps/web-antd/src/views/system/client/data.tsx @@ -0,0 +1,106 @@ +import type { FormSchemaGetter } from '#/adapter'; + +import { DictEnum } from '@vben/constants'; +import { getPopupContainer } from '@vben/utils'; + +import { getDictOptions } from '#/utils/dict'; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''], + }, + fieldName: 'id', + label: 'id', + }, + { + component: 'Input', + componentProps: { + disabled: true, + placeholder: '请输入', + }, + dependencies: { + show: () => false, + triggerFields: [''], + }, + fieldName: 'clientId', + label: '客户端ID', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'clientKey', + label: '客户端key', + rules: 'required', + }, + { + component: 'Input', + fieldName: 'clientSecret', + label: '客户端密钥', + rules: 'required', + }, + { + component: 'Select', + componentProps: { + class: 'w-full', + getPopupContainer, + mode: 'multiple', + optionFilterProp: 'label', + options: getDictOptions(DictEnum.SYS_GRANT_TYPE), + placeholder: '请选择', + }, + fieldName: 'grantTypeList', + label: '授权类型', + rules: 'required', + }, + { + component: 'Select', + componentProps: { + allowClear: false, + class: 'w-full', + getPopupContainer, + options: getDictOptions(DictEnum.SYS_DEVICE_TYPE), + placeholder: '请选择', + }, + fieldName: 'deviceType', + label: '设备类型', + rules: 'required', + }, + { + component: 'InputNumber', + componentProps: { + addonAfter: '秒', + placeholder: '请输入', + }, + defaultValue: 1800, + fieldName: 'activeTimeout', + label: 'Token活跃超时时间', + rules: 'required', + }, + { + component: 'InputNumber', + componentProps: { + addonAfter: '秒', + placeholder: '请输入', + }, + defaultValue: 604_800, + fieldName: 'timeout', + label: 'Token固定超时时间', + rules: 'required', + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), + optionType: 'button', + }, + defaultValue: '0', + fieldName: 'status', + label: '状态', + }, +]; diff --git a/apps/web-antd/src/views/system/client/index.vue b/apps/web-antd/src/views/system/client/index.vue index 06372a15..c338eb75 100644 --- a/apps/web-antd/src/views/system/client/index.vue +++ b/apps/web-antd/src/views/system/client/index.vue @@ -1,9 +1,21 @@ diff --git a/apps/web-antd/src/views/system/client/secret-input.vue b/apps/web-antd/src/views/system/client/secret-input.vue new file mode 100644 index 00000000..d0e4cd16 --- /dev/null +++ b/apps/web-antd/src/views/system/client/secret-input.vue @@ -0,0 +1,60 @@ + + + + +