From d37e2f599c69a877c9da9dbc112f598d6532f6c8 Mon Sep 17 00:00:00 2001 From: Vben Date: Sat, 5 Oct 2024 17:09:42 +0800 Subject: [PATCH 01/19] fix: naive ui form reset does not meet expectations (#4569) * fix: naive ui form reset does not meet expectations * fix: typo --- apps/web-antd/src/api/core/auth.ts | 4 ++-- apps/web-ele/src/api/core/auth.ts | 4 ++-- apps/web-naive/src/adapter/form.ts | 3 +++ apps/web-naive/src/api/core/auth.ts | 4 ++-- packages/@core/ui-kit/form-ui/src/config.ts | 9 +++++++-- .../@core/ui-kit/form-ui/src/form-render/form-field.vue | 7 ++++--- packages/@core/ui-kit/form-ui/src/form-render/form.vue | 2 ++ packages/@core/ui-kit/form-ui/src/types.ts | 5 +++++ .../effects/common-ui/src/ui/authentication/types.ts | 5 +---- packages/effects/plugins/src/vxe-table/use-vxe-grid.vue | 4 ++-- packages/stores/src/modules/user.ts | 1 + packages/utils/src/index.ts | 1 + playground/src/api/core/auth.ts | 4 ++-- 13 files changed, 34 insertions(+), 19 deletions(-) diff --git a/apps/web-antd/src/api/core/auth.ts b/apps/web-antd/src/api/core/auth.ts index 53b8366d..71d9f994 100644 --- a/apps/web-antd/src/api/core/auth.ts +++ b/apps/web-antd/src/api/core/auth.ts @@ -3,8 +3,8 @@ import { baseRequestClient, requestClient } from '#/api/request'; export namespace AuthApi { /** 登录接口参数 */ export interface LoginParams { - password: string; - username: string; + password?: string; + username?: string; } /** 登录接口返回值 */ diff --git a/apps/web-ele/src/api/core/auth.ts b/apps/web-ele/src/api/core/auth.ts index 53b8366d..71d9f994 100644 --- a/apps/web-ele/src/api/core/auth.ts +++ b/apps/web-ele/src/api/core/auth.ts @@ -3,8 +3,8 @@ import { baseRequestClient, requestClient } from '#/api/request'; export namespace AuthApi { /** 登录接口参数 */ export interface LoginParams { - password: string; - username: string; + password?: string; + username?: string; } /** 登录接口返回值 */ diff --git a/apps/web-naive/src/adapter/form.ts b/apps/web-naive/src/adapter/form.ts index 1c051b4a..eb765476 100644 --- a/apps/web-naive/src/adapter/form.ts +++ b/apps/web-naive/src/adapter/form.ts @@ -84,7 +84,10 @@ setupVbenForm({ Upload: NUpload, }, config: { + // naive-ui组件不接受onChang事件,所以需要禁用 disabledOnChangeListener: true, + // naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效 + emptyStateValue: null, baseModelPropName: 'value', modelPropNameMap: { Checkbox: 'checked', diff --git a/apps/web-naive/src/api/core/auth.ts b/apps/web-naive/src/api/core/auth.ts index 53b8366d..71d9f994 100644 --- a/apps/web-naive/src/api/core/auth.ts +++ b/apps/web-naive/src/api/core/auth.ts @@ -3,8 +3,8 @@ import { baseRequestClient, requestClient } from '#/api/request'; export namespace AuthApi { /** 登录接口参数 */ export interface LoginParams { - password: string; - username: string; + password?: string; + username?: string; } /** 登录接口返回值 */ diff --git a/packages/@core/ui-kit/form-ui/src/config.ts b/packages/@core/ui-kit/form-ui/src/config.ts index 7c118634..33b11317 100644 --- a/packages/@core/ui-kit/form-ui/src/config.ts +++ b/packages/@core/ui-kit/form-ui/src/config.ts @@ -43,8 +43,13 @@ export function setupVbenForm< >(options: VbenFormAdapterOptions) { const { components, config, defineRules } = options; - DEFAULT_FORM_COMMON_CONFIG.disabledOnChangeListener = - config?.disabledOnChangeListener ?? false; + const { disabledOnChangeListener = false, emptyStateValue = undefined } = + (config || {}) as FormCommonConfig; + + Object.assign(DEFAULT_FORM_COMMON_CONFIG, { + disabledOnChangeListener, + emptyStateValue, + }); if (defineRules) { for (const key of Object.keys(defineRules)) { diff --git a/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue b/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue index c116d49c..f66a4bb6 100644 --- a/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue +++ b/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue @@ -33,6 +33,7 @@ const { description, disabled, disabledOnChangeListener, + emptyStateValue, fieldName, formFieldProps, label, @@ -55,7 +56,7 @@ const formApi = formRenderProps.form; const isInValid = computed(() => errors.value?.length > 0); -const fieldComponent = computed(() => { +const FieldComponent = computed(() => { const finalComponent = isString(component) ? componentMap.value[component] : component; @@ -213,7 +214,7 @@ function fieldBindEvent(slotProps: Record) { if (bindEventField) { return { [`onUpdate:${bindEventField}`]: handler, - [bindEventField]: value, + [bindEventField]: value === undefined ? emptyStateValue : value, onChange: disabledOnChangeListener ? undefined : (e: Record) => { @@ -300,7 +301,7 @@ function autofocus() { }" > diff --git a/playground/src/locales/langs/zh-CN.json b/playground/src/locales/langs/zh-CN.json index 26f87a03..727d6262 100644 --- a/playground/src/locales/langs/zh-CN.json +++ b/playground/src/locales/langs/zh-CN.json @@ -92,7 +92,7 @@ "editCell": "单元格编辑", "editRow": "行编辑", "custom-cell": "自定义单元格", - "form": "开启搜索表单" + "form": "搜索表单" }, "captcha": { "title": "验证码", From bd340e63b79443d1700970f20fbc240bc5e665e4 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 22:08:32 +0800 Subject: [PATCH 03/19] feat: user --- apps/web-antd/src/views/system/user/index.vue | 210 +++++++++++------- apps/web-antd/src/views/system/user/info.tsx | 4 +- .../src/views/system/user/user-info-modal.vue | 2 +- .../system/user/user-reset-pwd-modal.vue | 18 +- 4 files changed, 148 insertions(+), 86 deletions(-) diff --git a/apps/web-antd/src/views/system/user/index.vue b/apps/web-antd/src/views/system/user/index.vue index 3a82df07..7645ee67 100644 --- a/apps/web-antd/src/views/system/user/index.vue +++ b/apps/web-antd/src/views/system/user/index.vue @@ -10,8 +10,17 @@ import { type VbenFormProps, } from '@vben/common-ui'; import { $t } from '@vben/locales'; +import { getPopupContainer } from '@vben/utils'; -import { Avatar, Modal, Popconfirm, Space } from 'ant-design-vue'; +import { + Avatar, + Dropdown, + Menu, + MenuItem, + Modal, + Popconfirm, + Space, +} from 'ant-design-vue'; import dayjs from 'dayjs'; import { useVbenVxeGrid, type VxeGridProps } from '#/adapter'; @@ -28,6 +37,8 @@ import { columns, querySchema } from './data'; import DeptTree from './dept-tree.vue'; import userDrawer from './user-drawer.vue'; import userImportModal from './user-import-modal.vue'; +import userInfoModal from './user-info-modal.vue'; +import userResetPwdModal from './user-reset-pwd-modal.vue'; /** * 导入 @@ -100,6 +111,7 @@ const gridOptions: VxeGridProps = { rowConfig: { isHover: true, keyField: 'userId', + height: 48, }, round: true, align: 'center', @@ -152,95 +164,133 @@ function handleMultiDelete() { }, }); } + +const [UserInfoModal, userInfoModalApi] = useVbenModal({ + connectedComponent: userInfoModal, +}); +function handleUserInfo(row: Recordable) { + userInfoModalApi.setData({ userId: row.userId }); + userInfoModalApi.open(); +} + +const [UserResetPwdModal, userResetPwdModalApi] = useVbenModal({ + connectedComponent: userResetPwdModal, +}); + +function handleResetPwd(record: Recordable) { + userResetPwdModalApi.setData({ record }); + userResetPwdModalApi.open(); +} diff --git a/apps/web-antd/src/views/system/user/info.tsx b/apps/web-antd/src/views/system/user/info.tsx index 68009601..cd00bb81 100644 --- a/apps/web-antd/src/views/system/user/info.tsx +++ b/apps/web-antd/src/views/system/user/info.tsx @@ -5,10 +5,12 @@ import { DictEnum } from '@vben/constants'; import { Tag } from 'ant-design-vue'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration'; +import relativeTime from 'dayjs/plugin/relativeTime'; import { renderDict } from '#/utils/render'; dayjs.extend(duration); +dayjs.extend(relativeTime); function renderTags(list: string[]) { return ( @@ -100,7 +102,7 @@ export const descSchema: DescItem[] = [ // 默认en显示 dayjs.locale('zh-cn'); // 计算相差秒数 - const diffSeconds = dayjs(new Date()).diff(dayjs(value), 'second'); + const diffSeconds = dayjs().diff(dayjs(value), 'second'); /** * 转为时间显示(x月 x天) * https://dayjs.fenxianglu.cn/category/duration.html#%E4%BA%BA%E6%80%A7%E5%8C%96 diff --git a/apps/web-antd/src/views/system/user/user-info-modal.vue b/apps/web-antd/src/views/system/user/user-info-modal.vue index 63491e42..80a917e9 100644 --- a/apps/web-antd/src/views/system/user/user-info-modal.vue +++ b/apps/web-antd/src/views/system/user/user-info-modal.vue @@ -50,7 +50,7 @@ async function handleOpenChange(open: boolean) { diff --git a/apps/web-antd/src/views/system/user/user-reset-pwd-modal.vue b/apps/web-antd/src/views/system/user/user-reset-pwd-modal.vue index 37c1682a..4cf92e03 100644 --- a/apps/web-antd/src/views/system/user/user-reset-pwd-modal.vue +++ b/apps/web-antd/src/views/system/user/user-reset-pwd-modal.vue @@ -46,7 +46,7 @@ const [BasicForm, formApi] = useVbenForm({ rules: 'required', }, { - component: 'StrengthMeter', + component: 'InputPassword', componentProps: { placeholder: '请输入新的密码, 密码长度为5 - 20', }, @@ -58,6 +58,10 @@ const [BasicForm, formApi] = useVbenForm({ .max(20, { message: '密码长度为5 - 20' }), }, ], + showDefaultActions: false, + commonConfig: { + labelWidth: 80, + }, }); async function handleOpenChange(open: boolean) { @@ -94,8 +98,14 @@ async function handleCancel() { From fdd1d19c8edaa7b2a332315b9732f166a582aede Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 22:20:00 +0800 Subject: [PATCH 04/19] feat: post --- apps/web-antd/src/views/system/post/data.ts | 4 +- apps/web-antd/src/views/system/post/index.vue | 49 +++++++++++++------ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/apps/web-antd/src/views/system/post/data.ts b/apps/web-antd/src/views/system/post/data.ts index 8e8a9ce9..fd0702a6 100644 --- a/apps/web-antd/src/views/system/post/data.ts +++ b/apps/web-antd/src/views/system/post/data.ts @@ -74,8 +74,8 @@ export const drawerSchema: FormSchemaGetter = () => [ show: () => false, triggerFields: [''], }, - fieldName: 'id', - label: 'id', + fieldName: 'postId', + label: 'postId', }, { component: 'TreeSelect', diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue index daaab270..3dc1c821 100644 --- a/apps/web-antd/src/views/system/post/index.vue +++ b/apps/web-antd/src/views/system/post/index.vue @@ -16,21 +16,28 @@ import DeptTree from '#/views/system/user/dept-tree.vue'; import { columns, querySchema } from './data'; import postDrawer from './post-drawer.vue'; -const formOptions: VbenFormProps = { - schema: querySchema(), - wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', -}; - // 左边部门用 const selectDeptId = ref([]); +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + }, + schema: querySchema(), + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', + handleReset: async () => { + selectDeptId.value = []; + // eslint-disable-next-line no-use-before-define + await tableApi.query(); + }, +}; + const gridOptions: VxeGridProps = { checkboxConfig: { // 高亮 highlight: true, // 翻页时保留选中状态 reserve: true, - // 点击行选中 - // trigger: 'row', + trigger: 'cell', }, columns, height: 'auto', @@ -78,7 +85,20 @@ const gridOptions: VxeGridProps = { showOverflow: true, }; -const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions }); +const checked = ref(false); +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + checkboxChange: (e: any) => { + checked.value = e.records.length > 0; + }, + checkboxAll: (e: any) => { + checked.value = e.records.length > 0; + }, + }, +}); + const [PostDrawer, drawerApi] = useVbenDrawer({ connectedComponent: postDrawer, }); @@ -95,7 +115,7 @@ async function handleEdit(record: Recordable) { async function handleDelete(row: Recordable) { await postRemove(row.postId); - await tableApi.reload(); + await tableApi.query(); } function handleMultiDelete() { @@ -119,9 +139,9 @@ function handleMultiDelete() { v-model:select-dept-id="selectDeptId" :height="300" class="w-[260px]" - @select="() => tableApi.reload()" + @select="() => tableApi.query()" /> - + @@ -134,9 +154,10 @@ function handleMultiDelete() { {{ $t('pages.common.export') }} {{ $t('pages.common.delete') }} @@ -169,7 +190,7 @@ function handleMultiDelete() { danger size="small" type="link" - v-access:code="['system:post:delete']" + v-access:code="['system:post:remove']" @click.stop="" > {{ $t('pages.common.delete') }} @@ -178,6 +199,6 @@ function handleMultiDelete() { - + From 9ad4f96e3868e7ef77ee09e789afd9c9d905f7e1 Mon Sep 17 00:00:00 2001 From: Vben Date: Sat, 5 Oct 2024 22:30:13 +0800 Subject: [PATCH 05/19] fix: the vxeUI global configuration does not take effect (#4574) --- packages/effects/plugins/src/vxe-table/use-vxe-grid.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue index f8574a5d..cc0d91a2 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue @@ -63,6 +63,8 @@ const options = computed(() => { const slotActions = slots['toolbar-actions']?.(); const slotTools = slots['toolbar-tools']?.(); + const globalGridConfig = VxeUI?.getConfig()?.grid ?? {}; + const forceUseToolbarOptions = showToolbar.value ? { toolbarConfig: { @@ -79,6 +81,7 @@ const options = computed(() => { {}, forceUseToolbarOptions, toRaw(gridOptions.value), + globalGridConfig, ), ); @@ -205,7 +208,7 @@ async function init() { } // form 由 vben-form代替,所以不适配formConfig,这里给出警告 - const formConfig = options.value.formConfig; + const formConfig = gridOptions.value?.formConfig; if (formConfig) { console.warn( '[Vben Vxe Table]: The formConfig in the grid is not supported, please use the `formOptions` props', From d7d8784bb42fbec43d31e6e0f98991e621645426 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 22:56:44 +0800 Subject: [PATCH 06/19] =?UTF-8?q?feat:=20=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/system/dict/dict-type.ts | 8 +- .../src/views/system/dict/data/data.ts | 42 +++- .../src/views/system/dict/data/index.vue | 218 ++++++++++++++--- apps/web-antd/src/views/system/dict/index.vue | 15 +- .../src/views/system/dict/type/data.ts | 29 ++- ...ict-type-model.vue => dict-type-modal.vue} | 0 .../src/views/system/dict/type/index.vue | 222 ++++++++++++++---- 7 files changed, 441 insertions(+), 93 deletions(-) rename apps/web-antd/src/views/system/dict/type/{dict-type-model.vue => dict-type-modal.vue} (100%) diff --git a/apps/web-antd/src/api/system/dict/dict-type.ts b/apps/web-antd/src/api/system/dict/dict-type.ts index 2f5576de..cbb5e92a 100644 --- a/apps/web-antd/src/api/system/dict/dict-type.ts +++ b/apps/web-antd/src/api/system/dict/dict-type.ts @@ -1,6 +1,6 @@ import type { DictType } from './dict-type-model'; -import type { ID, IDS, PageQuery } from '#/api/common'; +import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; import { commonExport } from '#/api/helper'; import { requestClient } from '#/api/request'; @@ -18,8 +18,8 @@ enum Api { * @param params 请求参数 * @returns list */ -export function dictList(params?: PageQuery) { - return requestClient.get(Api.dictTypeList, { params }); +export function dictTypeList(params?: PageQuery) { + return requestClient.get>(Api.dictTypeList, { params }); } /** @@ -27,7 +27,7 @@ export function dictList(params?: PageQuery) { * @param data 表单参数 * @returns blob */ -export function dictExport(data: any) { +export function dictTypeExport(data: any) { return commonExport(Api.dictTypeExport, data); } diff --git a/apps/web-antd/src/views/system/dict/data/data.ts b/apps/web-antd/src/views/system/dict/data/data.ts index 273fb824..f6d80aa3 100644 --- a/apps/web-antd/src/views/system/dict/data/data.ts +++ b/apps/web-antd/src/views/system/dict/data/data.ts @@ -1,11 +1,14 @@ -import type { FormSchemaGetter } from '#/adapter'; +import type { FormSchemaGetter, VxeGridProps } from '#/adapter'; import { getPopupContainer } from '@vben/utils'; +import { renderDictTag } from '#/utils/render'; + export const querySchema: FormSchemaGetter = () => [ { component: 'Select', componentProps: { + placeholder: 'TODO: 字典类型', getPopupContainer, }, fieldName: 'dictType', @@ -18,6 +21,43 @@ export const querySchema: FormSchemaGetter = () => [ }, ]; +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + { + title: '字典标签', + field: 'cssClass', + slots: { + default: ({ row }) => { + const { dictValue } = row; + return renderDictTag(dictValue, [row as any]); + }, + }, + }, + { + title: '字典键值', + field: 'dictValue', + }, + { + title: '字典排序', + field: 'dictSort', + }, + { + title: '备注', + field: 'remark', + }, + { + title: '创建时间', + field: 'createTime', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 180, + }, +]; + export const drawerSchema: FormSchemaGetter = () => [ { component: 'Input', diff --git a/apps/web-antd/src/views/system/dict/data/index.vue b/apps/web-antd/src/views/system/dict/data/index.vue index 7447562f..3196256d 100644 --- a/apps/web-antd/src/views/system/dict/data/index.vue +++ b/apps/web-antd/src/views/system/dict/data/index.vue @@ -1,63 +1,203 @@ diff --git a/apps/web-antd/src/views/system/dict/index.vue b/apps/web-antd/src/views/system/dict/index.vue index 1254cff9..2f2331f8 100644 --- a/apps/web-antd/src/views/system/dict/index.vue +++ b/apps/web-antd/src/views/system/dict/index.vue @@ -6,8 +6,17 @@ import DictTypePanel from './type/index.vue'; + + diff --git a/apps/web-antd/src/views/system/dict/type/data.ts b/apps/web-antd/src/views/system/dict/type/data.ts index 8fd6c641..78dad00f 100644 --- a/apps/web-antd/src/views/system/dict/type/data.ts +++ b/apps/web-antd/src/views/system/dict/type/data.ts @@ -1,4 +1,4 @@ -import { type FormSchemaGetter, z } from '#/adapter'; +import { type FormSchemaGetter, type VxeGridProps, z } from '#/adapter'; export const querySchema: FormSchemaGetter = () => [ { @@ -13,6 +13,33 @@ export const querySchema: FormSchemaGetter = () => [ }, ]; +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + { + title: '字典名称', + field: 'dictName', + }, + { + title: '字典类型', + field: 'dictType', + }, + { + title: '备注', + field: 'remark', + }, + { + title: '创建时间', + field: 'createTime', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 180, + }, +]; + export const modalSchema: FormSchemaGetter = () => [ { component: 'Input', diff --git a/apps/web-antd/src/views/system/dict/type/dict-type-model.vue b/apps/web-antd/src/views/system/dict/type/dict-type-modal.vue similarity index 100% rename from apps/web-antd/src/views/system/dict/type/dict-type-model.vue rename to apps/web-antd/src/views/system/dict/type/dict-type-modal.vue diff --git a/apps/web-antd/src/views/system/dict/type/index.vue b/apps/web-antd/src/views/system/dict/type/index.vue index 1b169781..4ed77f04 100644 --- a/apps/web-antd/src/views/system/dict/type/index.vue +++ b/apps/web-antd/src/views/system/dict/type/index.vue @@ -1,65 +1,197 @@ From 6a627fe045a6724a92f1fa7292d846aaaaa64783 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 22:59:14 +0800 Subject: [PATCH 07/19] feat: config --- .../src/views/system/config/index.vue | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/apps/web-antd/src/views/system/config/index.vue b/apps/web-antd/src/views/system/config/index.vue index d523599a..a4382e50 100644 --- a/apps/web-antd/src/views/system/config/index.vue +++ b/apps/web-antd/src/views/system/config/index.vue @@ -1,6 +1,8 @@ From a392c0a29360d82d347bf20f652a748ce62708c1 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 23:32:51 +0800 Subject: [PATCH 14/19] =?UTF-8?q?feat:=20=E7=A7=9F=E6=88=B7=E5=A5=97?= =?UTF-8?q?=E9=A4=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/tenant-package/index.ts | 6 +- .../src/views/system/tenantPackage/data.ts | 26 ++- .../src/views/system/tenantPackage/index.vue | 192 +++++++++++++++++- 3 files changed, 213 insertions(+), 11 deletions(-) diff --git a/apps/web-antd/src/api/system/tenant-package/index.ts b/apps/web-antd/src/api/system/tenant-package/index.ts index 4b74faee..1851a7bc 100644 --- a/apps/web-antd/src/api/system/tenant-package/index.ts +++ b/apps/web-antd/src/api/system/tenant-package/index.ts @@ -1,6 +1,6 @@ import type { TenantPackage } from './model'; -import type { ID, IDS, PageQuery } from '#/api/common'; +import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; import { commonExport } from '#/api/helper'; import { requestClient } from '#/api/request'; @@ -14,7 +14,9 @@ enum Api { } export function packageList(params?: PageQuery) { - return requestClient.get(Api.packageList, { params }); + return requestClient.get>(Api.packageList, { + params, + }); } // 下拉框 diff --git a/apps/web-antd/src/views/system/tenantPackage/data.ts b/apps/web-antd/src/views/system/tenantPackage/data.ts index f2dcd25c..7e8fba8c 100644 --- a/apps/web-antd/src/views/system/tenantPackage/data.ts +++ b/apps/web-antd/src/views/system/tenantPackage/data.ts @@ -1,4 +1,4 @@ -import type { FormSchemaGetter } from '#/adapter'; +import type { FormSchemaGetter, VxeGridProps } from '#/adapter'; export const querySchema: FormSchemaGetter = () => [ { @@ -8,6 +8,30 @@ export const querySchema: FormSchemaGetter = () => [ }, ]; +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + { + title: '套餐名称', + field: 'packageName', + }, + { + title: '备注', + field: 'remark', + }, + { + title: '租户状态', + field: 'status', + slots: { default: 'status' }, + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 180, + }, +]; + export const drawerSchema: FormSchemaGetter = () => [ { component: 'Input', diff --git a/apps/web-antd/src/views/system/tenantPackage/index.vue b/apps/web-antd/src/views/system/tenantPackage/index.vue index 261a41ea..3013da23 100644 --- a/apps/web-antd/src/views/system/tenantPackage/index.vue +++ b/apps/web-antd/src/views/system/tenantPackage/index.vue @@ -1,24 +1,200 @@ From 36e6eda147d464ffcb979d3334c86f39ddf5914d Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 23:34:29 +0800 Subject: [PATCH 15/19] feat: online --- apps/web-antd/src/views/monitor/online/index.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/views/monitor/online/index.vue b/apps/web-antd/src/views/monitor/online/index.vue index 3311c7d6..9050c531 100644 --- a/apps/web-antd/src/views/monitor/online/index.vue +++ b/apps/web-antd/src/views/monitor/online/index.vue @@ -11,6 +11,9 @@ import { forceLogout, onlineList } from '#/api/monitor/online'; import { columns, querySchema } from './data'; const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + }, schema: querySchema(), wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', }; @@ -44,7 +47,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions }); async function handleForceOffline(row: Recordable) { await forceLogout(row.tokenId); - await tableApi.reload(); + await tableApi.query(); } From 3b914a231cf65ec540a88be47cc68643d9d819bd Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 23:41:41 +0800 Subject: [PATCH 16/19] =?UTF-8?q?feat:=20=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=20=E5=9C=A8=E7=BA=BF=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/components/online-device.vue | 51 +++++++++++++++++-- .../src/views/_core/profile/index.vue | 7 ++- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/views/_core/profile/components/online-device.vue b/apps/web-antd/src/views/_core/profile/components/online-device.vue index 452097f2..a0309d46 100644 --- a/apps/web-antd/src/views/_core/profile/components/online-device.vue +++ b/apps/web-antd/src/views/_core/profile/components/online-device.vue @@ -1,8 +1,53 @@ - + diff --git a/apps/web-antd/src/views/_core/profile/index.vue b/apps/web-antd/src/views/_core/profile/index.vue index 4e595b03..b27d62df 100644 --- a/apps/web-antd/src/views/_core/profile/index.vue +++ b/apps/web-antd/src/views/_core/profile/index.vue @@ -40,7 +40,12 @@ async function handleUploadFinish() { - + From 36522f44441365b7496e1e656c06f8f429f02f4c Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 23:42:25 +0800 Subject: [PATCH 17/19] chore: wrong text --- apps/web-antd/src/views/monitor/online/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web-antd/src/views/monitor/online/index.vue b/apps/web-antd/src/views/monitor/online/index.vue index 9050c531..f9d5bf17 100644 --- a/apps/web-antd/src/views/monitor/online/index.vue +++ b/apps/web-antd/src/views/monitor/online/index.vue @@ -55,7 +55,7 @@ async function handleForceOffline(row: Recordable) {