From 7c5792d539fb0743f97f4ca7654f34bb6658975d Mon Sep 17 00:00:00 2001 From: baiqi Date: Wed, 16 Aug 2023 17:54:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BB=84=E4=BB=B6):=20=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B9=E6=8D=AEloadListFunc=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E8=BF=94=E5=9B=9E=E5=80=BC=E7=B1=BB=E5=9E=8B=E7=BA=A6?= =?UTF-8?q?=E6=9D=9F=20=E8=A1=A8=E6=A0=BC=E6=95=B0=E6=8D=AEdata=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B&=E9=83=A8=E5=88=86=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/modules/setting/config.ts | 4 +- frontend/src/api/modules/setting/log.ts | 109 +----------------- frontend/src/api/modules/setting/member.ts | 6 +- .../src/api/modules/setting/resourcePool.ts | 4 +- frontend/src/api/modules/setting/user.ts | 4 +- .../pure/ms-table-more-action/types.ts | 6 +- .../components/pure/ms-table/base-table.vue | 20 ++-- .../components/pure/ms-table/select-all.vue | 2 +- frontend/src/components/pure/ms-table/type.ts | 28 ++--- .../src/components/pure/ms-table/useTable.ts | 34 +++--- frontend/src/enums/tableEnum.ts | 15 +++ frontend/src/hooks/useModal.ts | 2 +- frontend/src/models/setting/log.ts | 15 +++ .../system/config/components/authConfig.vue | 2 +- .../pluginManager/components/pluginTable.vue | 2 +- .../setting/system/resourcePool/detail.vue | 7 +- .../setting/system/resourcePool/index.vue | 5 +- .../src/views/setting/system/user/index.vue | 5 +- .../system/usergroup/components/index.vue | 2 +- 19 files changed, 89 insertions(+), 183 deletions(-) diff --git a/frontend/src/api/modules/setting/config.ts b/frontend/src/api/modules/setting/config.ts index c011846854..d23e1e9589 100644 --- a/frontend/src/api/modules/setting/config.ts +++ b/frontend/src/api/modules/setting/config.ts @@ -14,8 +14,8 @@ import { AddAuthUrl, DeleteAuthUrl, } from '@/api/requrls/setting/config'; -import { TableQueryParams } from '@/models/common'; +import type { CommonList, TableQueryParams } from '@/models/common'; import type { SaveInfoParams, TestEmailParams, @@ -65,7 +65,7 @@ export function getPageConfig() { // 获取认证源列表 export function getAuthList(data: TableQueryParams) { - return MSR.post({ url: GetAuthListUrl, data }); + return MSR.post>({ url: GetAuthListUrl, data }); } // 获取认证源详情 diff --git a/frontend/src/api/modules/setting/log.ts b/frontend/src/api/modules/setting/log.ts index cb9640f2a7..0bc0240a1b 100644 --- a/frontend/src/api/modules/setting/log.ts +++ b/frontend/src/api/modules/setting/log.ts @@ -1,116 +1,15 @@ import MSR from '@/api/http/index'; import { GetLogListUrl, GetLogOptionstUrl } from '@/api/requrls/setting/log'; -import type { LogOptions } from '@/models/setting/log'; +import type { CommonList } from '@/models/common'; +import type { LogOptions, LogItem } from '@/models/setting/log'; // 获取日志列表 export function getLogList(data: any) { - return MSR.post({ url: GetLogListUrl, data }); + return MSR.post>({ url: GetLogListUrl, data }); } // 获取日志操作范围选项 export function getLogOptions() { - // return MSR.get({ url: GetLogOptionstUrl }); - return { - organizationList: [ - { - id: 'bfa4feec-276f-11ee-bc36-0242ac1e0a05', - name: '默认组织默认组织默认组织默认组织默认组织默认组织默认组织默认组织默认组织默认组织', - }, - { - id: 'e21d5270-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织2', - }, - { - id: 'e2433740-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织3', - }, - { - id: 'e2817131-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织4', - }, - { - id: 'e28950e3-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织5', - }, - { - id: 'e2c03258-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织6', - }, - { - id: 'e2f08005-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织7', - }, - { - id: 'e30650b8-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织8', - }, - { - id: 'e3487cf7-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织9', - }, - { - id: 'e363b914-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织10', - }, - { - id: 'e36bd98b-369e-11ee-93aa-0242ac1e0a02', - name: '测试组织11', - }, - ], - projectList: [ - { - id: 'ab11c4a1-369f-11ee-93aa-0242ac1e0a02', - name: '测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目测试2项目', - }, - { - id: 'ab2cf284-369f-11ee-93aa-0242ac1e0a02', - name: '测试3项目', - }, - { - id: 'ab6ffa01-369f-11ee-93aa-0242ac1e0a02', - name: '测试4项目', - }, - { - id: 'ab845cd2-369f-11ee-93aa-0242ac1e0a02', - name: '测试5项目', - }, - { - id: 'ab8aef35-369f-11ee-93aa-0242ac1e0a02', - name: '测试6项目', - }, - { - id: 'ab91ff63-369f-11ee-93aa-0242ac1e0a02', - name: '测试7项目', - }, - { - id: 'abc542d5-369f-11ee-93aa-0242ac1e0a02', - name: '测试8项目', - }, - { - id: 'abcc2352-369f-11ee-93aa-0242ac1e0a02', - name: '测试9项目', - }, - { - id: 'abeeb108-369f-11ee-93aa-0242ac1e0a02', - name: '测试10项目', - }, - { - id: 'ac4e4fc0-369f-11ee-93aa-0242ac1e0a02', - name: '测试11项目', - }, - { - id: 'acb0831f-369f-11ee-93aa-0242ac1e0a02', - name: '测试12项目', - }, - { - id: 'ad5a7bc0-369f-11ee-93aa-0242ac1e0a02', - name: '测试13项目', - }, - { - id: 'bfa52f87-276f-11ee-bc36-0242ac1e0a05', - name: '默认项目', - }, - ], - }; + return MSR.get({ url: GetLogOptionstUrl }); } diff --git a/frontend/src/api/modules/setting/member.ts b/frontend/src/api/modules/setting/member.ts index e949d76f52..5a4b4df963 100644 --- a/frontend/src/api/modules/setting/member.ts +++ b/frontend/src/api/modules/setting/member.ts @@ -10,11 +10,11 @@ import { getUserList, getProjectListUrl, } from '@/api/requrls/setting/member'; -import type { MemberList, AddorUpdateMemberModel, BatchAddProjectModel, LinkItem } from '@/models/setting/member'; -import type { TableQueryParams } from '@/models/common'; +import type { MemberItem, AddorUpdateMemberModel, BatchAddProjectModel, LinkItem } from '@/models/setting/member'; +import type { TableQueryParams, CommonList } from '@/models/common'; // 获取成员列表 export function getMemberList(data: TableQueryParams) { - return MSR.post({ url: GetMemberListUrl, data }); + return MSR.post>({ url: GetMemberListUrl, data }); } // 添加成员 export function addOrUpdate(data: AddorUpdateMemberModel, type: string) { diff --git a/frontend/src/api/modules/setting/resourcePool.ts b/frontend/src/api/modules/setting/resourcePool.ts index 47381d0819..ac68be9a36 100644 --- a/frontend/src/api/modules/setting/resourcePool.ts +++ b/frontend/src/api/modules/setting/resourcePool.ts @@ -15,11 +15,11 @@ import type { UpdateResourcePoolParams, ResourcePoolDetail, } from '@/models/setting/resourcePool'; -import type { TableQueryParams } from '@/models/common'; +import type { CommonList, TableQueryParams } from '@/models/common'; // 获取资源池列表 export function getPoolList(data: TableQueryParams) { - return MSR.post({ url: PoolListUrl, data }); + return MSR.post>({ url: PoolListUrl, data }); } // 更新资源池信息 diff --git a/frontend/src/api/modules/setting/user.ts b/frontend/src/api/modules/setting/user.ts index 6881e3f954..b969e26296 100644 --- a/frontend/src/api/modules/setting/user.ts +++ b/frontend/src/api/modules/setting/user.ts @@ -21,11 +21,11 @@ import type { ImportResult, BatchAddUserGroupParams, } from '@/models/setting/user'; -import type { TableQueryParams } from '@/models/common'; +import type { CommonList, TableQueryParams } from '@/models/common'; // 获取用户列表 export function getUserList(data: TableQueryParams) { - return MSR.post({ url: GetUserListUrl, data }); + return MSR.post>({ url: GetUserListUrl, data }); } // 批量创建用户 diff --git a/frontend/src/components/pure/ms-table-more-action/types.ts b/frontend/src/components/pure/ms-table-more-action/types.ts index c8c3de748d..de3067030a 100644 --- a/frontend/src/components/pure/ms-table-more-action/types.ts +++ b/frontend/src/components/pure/ms-table-more-action/types.ts @@ -1,8 +1,8 @@ export interface ActionsItem { label?: string; - eventTag?: string; - isDivider?: boolean; - danger?: boolean; + eventTag?: string; // 事件标识 + isDivider?: boolean; // 是否分割线,true 的话只展示分割线,没有其他内容 + danger?: boolean; // 是否危险操作,true 的话会显示红色按钮 } export type SelectedValue = string | number | Record | undefined; diff --git a/frontend/src/components/pure/ms-table/base-table.vue b/frontend/src/components/pure/ms-table/base-table.vue index 54bdd3b9cf..ec2e69c410 100644 --- a/frontend/src/components/pure/ms-table/base-table.vue +++ b/frontend/src/components/pure/ms-table/base-table.vue @@ -112,21 +112,15 @@ import { useAttrs, computed, ref, onMounted } from 'vue'; import { useAppStore, useTableStore } from '@/store'; import selectAll from './select-all.vue'; - import { - MsTableProps, - SelectAllEnum, - MsPaginationI, - BatchActionParams, - BatchActionConfig, - MsTableColumn, - SpecialColumnEnum, - } from './type'; + import { SpecialColumnEnum, SelectAllEnum } from '@/enums/tableEnum'; import BatchAction from './batchAction.vue'; import MsPagination from '@/components/pure/ms-pagination/index'; - import type { TableData } from '@arco-design/web-vue'; import ColumnSelector from './columnSelector.vue'; import MsIcon from '@/components/pure/ms-icon-font/index.vue'; + import type { MsTableProps, MsPaginationI, BatchActionParams, BatchActionConfig, MsTableColumn } from './type'; + import type { TableData } from '@arco-design/web-vue'; + const batchleft = ref('10px'); const { t } = useI18n(); const tableStore = useTableStore(); @@ -157,10 +151,10 @@ const editActiveKey = ref(-1); // 编辑input的Ref const currentInputRef = ref(null); - const { rowKey, editKey }: Partial = attrs; + const { rowKey, editKey }: Partial> = attrs; const setSelectAllTotal = (isAll: boolean) => { - const { data, msPagination }: Partial = attrs; + const { data, msPagination }: Partial> = attrs; if (isAll) { selectTotal.value = msPagination?.total || data?.length || appStore.pageSize; } else { @@ -188,7 +182,7 @@ // 全选change事件 const handleChange = (v: string) => { - const { data, msPagination }: Partial = attrs; + const { data, msPagination }: Partial> = attrs; isSelectAll.value = v === SelectAllEnum.ALL; if (v === SelectAllEnum.NONE) { selectionChange([], true); diff --git a/frontend/src/components/pure/ms-table/select-all.vue b/frontend/src/components/pure/ms-table/select-all.vue index 0013becd32..24e52e152b 100644 --- a/frontend/src/components/pure/ms-table/select-all.vue +++ b/frontend/src/components/pure/ms-table/select-all.vue @@ -14,7 +14,7 @@