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] =?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 @@