feat(组件): 表格组件根据loadListFunc函数返回值类型约束 表格数据data的类型&部分组件调整
This commit is contained in:
parent
8df7cba2e5
commit
7c5792d539
|
@ -14,8 +14,8 @@ import {
|
||||||
AddAuthUrl,
|
AddAuthUrl,
|
||||||
DeleteAuthUrl,
|
DeleteAuthUrl,
|
||||||
} from '@/api/requrls/setting/config';
|
} from '@/api/requrls/setting/config';
|
||||||
import { TableQueryParams } from '@/models/common';
|
|
||||||
|
|
||||||
|
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||||
import type {
|
import type {
|
||||||
SaveInfoParams,
|
SaveInfoParams,
|
||||||
TestEmailParams,
|
TestEmailParams,
|
||||||
|
@ -65,7 +65,7 @@ export function getPageConfig() {
|
||||||
|
|
||||||
// 获取认证源列表
|
// 获取认证源列表
|
||||||
export function getAuthList(data: TableQueryParams) {
|
export function getAuthList(data: TableQueryParams) {
|
||||||
return MSR.post<AuthItem[]>({ url: GetAuthListUrl, data });
|
return MSR.post<CommonList<AuthItem>>({ url: GetAuthListUrl, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取认证源详情
|
// 获取认证源详情
|
||||||
|
|
|
@ -1,116 +1,15 @@
|
||||||
import MSR from '@/api/http/index';
|
import MSR from '@/api/http/index';
|
||||||
import { GetLogListUrl, GetLogOptionstUrl } from '@/api/requrls/setting/log';
|
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) {
|
export function getLogList(data: any) {
|
||||||
return MSR.post({ url: GetLogListUrl, data });
|
return MSR.post<CommonList<LogItem>>({ url: GetLogListUrl, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取日志操作范围选项
|
// 获取日志操作范围选项
|
||||||
export function getLogOptions() {
|
export function getLogOptions() {
|
||||||
// return MSR.get<LogOptions>({ url: GetLogOptionstUrl });
|
return MSR.get<LogOptions>({ 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: '默认项目',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,11 @@ import {
|
||||||
getUserList,
|
getUserList,
|
||||||
getProjectListUrl,
|
getProjectListUrl,
|
||||||
} from '@/api/requrls/setting/member';
|
} from '@/api/requrls/setting/member';
|
||||||
import type { MemberList, AddorUpdateMemberModel, BatchAddProjectModel, LinkItem } from '@/models/setting/member';
|
import type { MemberItem, AddorUpdateMemberModel, BatchAddProjectModel, LinkItem } from '@/models/setting/member';
|
||||||
import type { TableQueryParams } from '@/models/common';
|
import type { TableQueryParams, CommonList } from '@/models/common';
|
||||||
// 获取成员列表
|
// 获取成员列表
|
||||||
export function getMemberList(data: TableQueryParams) {
|
export function getMemberList(data: TableQueryParams) {
|
||||||
return MSR.post<MemberList>({ url: GetMemberListUrl, data });
|
return MSR.post<CommonList<MemberItem>>({ url: GetMemberListUrl, data });
|
||||||
}
|
}
|
||||||
// 添加成员
|
// 添加成员
|
||||||
export function addOrUpdate(data: AddorUpdateMemberModel, type: string) {
|
export function addOrUpdate(data: AddorUpdateMemberModel, type: string) {
|
||||||
|
|
|
@ -15,11 +15,11 @@ import type {
|
||||||
UpdateResourcePoolParams,
|
UpdateResourcePoolParams,
|
||||||
ResourcePoolDetail,
|
ResourcePoolDetail,
|
||||||
} from '@/models/setting/resourcePool';
|
} from '@/models/setting/resourcePool';
|
||||||
import type { TableQueryParams } from '@/models/common';
|
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||||
|
|
||||||
// 获取资源池列表
|
// 获取资源池列表
|
||||||
export function getPoolList(data: TableQueryParams) {
|
export function getPoolList(data: TableQueryParams) {
|
||||||
return MSR.post<ResourcePoolItem[]>({ url: PoolListUrl, data });
|
return MSR.post<CommonList<ResourcePoolItem>>({ url: PoolListUrl, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新资源池信息
|
// 更新资源池信息
|
||||||
|
|
|
@ -21,11 +21,11 @@ import type {
|
||||||
ImportResult,
|
ImportResult,
|
||||||
BatchAddUserGroupParams,
|
BatchAddUserGroupParams,
|
||||||
} from '@/models/setting/user';
|
} from '@/models/setting/user';
|
||||||
import type { TableQueryParams } from '@/models/common';
|
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||||
|
|
||||||
// 获取用户列表
|
// 获取用户列表
|
||||||
export function getUserList(data: TableQueryParams) {
|
export function getUserList(data: TableQueryParams) {
|
||||||
return MSR.post<UserListItem[]>({ url: GetUserListUrl, data });
|
return MSR.post<CommonList<UserListItem>>({ url: GetUserListUrl, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量创建用户
|
// 批量创建用户
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
export interface ActionsItem {
|
export interface ActionsItem {
|
||||||
label?: string;
|
label?: string;
|
||||||
eventTag?: string;
|
eventTag?: string; // 事件标识
|
||||||
isDivider?: boolean;
|
isDivider?: boolean; // 是否分割线,true 的话只展示分割线,没有其他内容
|
||||||
danger?: boolean;
|
danger?: boolean; // 是否危险操作,true 的话会显示红色按钮
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SelectedValue = string | number | Record<string, any> | undefined;
|
export type SelectedValue = string | number | Record<string, any> | undefined;
|
||||||
|
|
|
@ -112,21 +112,15 @@
|
||||||
import { useAttrs, computed, ref, onMounted } from 'vue';
|
import { useAttrs, computed, ref, onMounted } from 'vue';
|
||||||
import { useAppStore, useTableStore } from '@/store';
|
import { useAppStore, useTableStore } from '@/store';
|
||||||
import selectAll from './select-all.vue';
|
import selectAll from './select-all.vue';
|
||||||
import {
|
import { SpecialColumnEnum, SelectAllEnum } from '@/enums/tableEnum';
|
||||||
MsTableProps,
|
|
||||||
SelectAllEnum,
|
|
||||||
MsPaginationI,
|
|
||||||
BatchActionParams,
|
|
||||||
BatchActionConfig,
|
|
||||||
MsTableColumn,
|
|
||||||
SpecialColumnEnum,
|
|
||||||
} from './type';
|
|
||||||
import BatchAction from './batchAction.vue';
|
import BatchAction from './batchAction.vue';
|
||||||
import MsPagination from '@/components/pure/ms-pagination/index';
|
import MsPagination from '@/components/pure/ms-pagination/index';
|
||||||
import type { TableData } from '@arco-design/web-vue';
|
|
||||||
import ColumnSelector from './columnSelector.vue';
|
import ColumnSelector from './columnSelector.vue';
|
||||||
import MsIcon from '@/components/pure/ms-icon-font/index.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 batchleft = ref('10px');
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableStore = useTableStore();
|
const tableStore = useTableStore();
|
||||||
|
@ -157,10 +151,10 @@
|
||||||
const editActiveKey = ref(-1);
|
const editActiveKey = ref(-1);
|
||||||
// 编辑input的Ref
|
// 编辑input的Ref
|
||||||
const currentInputRef = ref(null);
|
const currentInputRef = ref(null);
|
||||||
const { rowKey, editKey }: Partial<MsTableProps> = attrs;
|
const { rowKey, editKey }: Partial<MsTableProps<any>> = attrs;
|
||||||
|
|
||||||
const setSelectAllTotal = (isAll: boolean) => {
|
const setSelectAllTotal = (isAll: boolean) => {
|
||||||
const { data, msPagination }: Partial<MsTableProps> = attrs;
|
const { data, msPagination }: Partial<MsTableProps<any>> = attrs;
|
||||||
if (isAll) {
|
if (isAll) {
|
||||||
selectTotal.value = msPagination?.total || data?.length || appStore.pageSize;
|
selectTotal.value = msPagination?.total || data?.length || appStore.pageSize;
|
||||||
} else {
|
} else {
|
||||||
|
@ -188,7 +182,7 @@
|
||||||
|
|
||||||
// 全选change事件
|
// 全选change事件
|
||||||
const handleChange = (v: string) => {
|
const handleChange = (v: string) => {
|
||||||
const { data, msPagination }: Partial<MsTableProps> = attrs;
|
const { data, msPagination }: Partial<MsTableProps<any>> = attrs;
|
||||||
isSelectAll.value = v === SelectAllEnum.ALL;
|
isSelectAll.value = v === SelectAllEnum.ALL;
|
||||||
if (v === SelectAllEnum.NONE) {
|
if (v === SelectAllEnum.NONE) {
|
||||||
selectionChange([], true);
|
selectionChange([], true);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watchEffect } from 'vue';
|
import { ref, watchEffect } from 'vue';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import { SelectAllEnum } from './type';
|
import { SelectAllEnum } from '@/enums/tableEnum';
|
||||||
import MsIcon from '../ms-icon-font/index.vue';
|
import MsIcon from '../ms-icon-font/index.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
|
@ -21,14 +21,18 @@ export interface MsTableColumnData extends TableColumnData {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MsTableErrorStatus = boolean | 'error' | 'empty';
|
export type MsTableErrorStatus = boolean | 'error' | 'empty';
|
||||||
|
export type MsTableDataItem<T> = T & {
|
||||||
|
updateTime?: string | number | null;
|
||||||
|
createTime?: string | number | null;
|
||||||
|
} & TableData;
|
||||||
// 表格属性
|
// 表格属性
|
||||||
export interface MsTableProps {
|
export interface MsTableProps<T> {
|
||||||
|
// 表格数据 - 详见 TableData https://arco.design/web-vue/components/table-data;
|
||||||
|
data: MsTableDataItem<T>[];
|
||||||
// 表格key, 用于存储表格列配置
|
// 表格key, 用于存储表格列配置
|
||||||
tableKey: string;
|
tableKey: string;
|
||||||
// 表格列 - 详见 TableColumn https://arco.design/web-vue/components/table-column;
|
// 表格列 - 详见 TableColumn https://arco.design/web-vue/components/table-column;
|
||||||
columns: MsTableColumnData[];
|
columns: MsTableColumnData[];
|
||||||
// 表格数据 - 详见 TableData https://arco.design/web-vue/components/table-data;
|
|
||||||
data: TableData[];
|
|
||||||
// 表格尺寸
|
// 表格尺寸
|
||||||
size?: 'mini' | 'small' | 'default' | 'large';
|
size?: 'mini' | 'small' | 'default' | 'large';
|
||||||
// 表格是否可滚动
|
// 表格是否可滚动
|
||||||
|
@ -83,17 +87,10 @@ export interface MsTableSelectAll {
|
||||||
type: 'all' | 'page';
|
type: 'all' | 'page';
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MsTableData = TableData[];
|
// export type MsTableData = TableData[];
|
||||||
export type MsTableColumn = MsTableColumnData[];
|
export type MsTableColumn = MsTableColumnData[];
|
||||||
export type MSTableChangeExtra = TableChangeExtra;
|
export type MSTableChangeExtra = TableChangeExtra;
|
||||||
|
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
export enum SelectAllEnum {
|
|
||||||
ALL = 'all',
|
|
||||||
CURRENT = 'current',
|
|
||||||
NONE = 'none',
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SortItem {
|
export interface SortItem {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
|
@ -112,12 +109,3 @@ export interface BatchActionConfig {
|
||||||
export interface renamePopconfirmVisibleType {
|
export interface renamePopconfirmVisibleType {
|
||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 具有特殊功能的列
|
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
export enum SpecialColumnEnum {
|
|
||||||
// 编辑列
|
|
||||||
NAME = 'name',
|
|
||||||
// 状态列
|
|
||||||
ENABLE = 'enable',
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { TableQueryParams } from '@/models/common';
|
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
|
import { SpecialColumnEnum } from '@/enums/tableEnum';
|
||||||
|
|
||||||
import type { TableData } from '@arco-design/web-vue';
|
import type { TableData } from '@arco-design/web-vue';
|
||||||
import { type MsTableProps, type MsTableData, type MsTableColumn, SpecialColumnEnum, MsTableErrorStatus } from './type';
|
import type { TableQueryParams, CommonList } from '@/models/common';
|
||||||
|
import type { MsTableProps, MsTableDataItem, MsTableColumn, MsTableErrorStatus } from './type';
|
||||||
|
|
||||||
export interface Pagination {
|
export interface Pagination {
|
||||||
current: number;
|
current: number;
|
||||||
|
@ -16,13 +17,13 @@ export interface Pagination {
|
||||||
}
|
}
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
export default function useTableProps(
|
export default function useTableProps<T>(
|
||||||
loadListFunc: (v: TableQueryParams) => Promise<any>,
|
loadListFunc: (v: TableQueryParams) => Promise<CommonList<MsTableDataItem<T>>>,
|
||||||
props?: Partial<MsTableProps>,
|
props?: Partial<MsTableProps<T>>,
|
||||||
// 数据处理的回调函数
|
// 数据处理的回调函数
|
||||||
dataTransform?: (item: TableData) => TableData,
|
dataTransform?: (item: T) => TableData & T,
|
||||||
// 编辑操作的保存回调函数
|
// 编辑操作的保存回调函数
|
||||||
saveCallBack?: (item: TableData) => Promise<any>
|
saveCallBack?: (item: T) => Promise<any>
|
||||||
) {
|
) {
|
||||||
// 行选择
|
// 行选择
|
||||||
const rowSelection = {
|
const rowSelection = {
|
||||||
|
@ -30,7 +31,7 @@ export default function useTableProps(
|
||||||
showCheckedAll: false,
|
showCheckedAll: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultProps: MsTableProps = {
|
const defaultProps: MsTableProps<T> = {
|
||||||
tableKey: '',
|
tableKey: '',
|
||||||
bordered: true,
|
bordered: true,
|
||||||
showPagination: true,
|
showPagination: true,
|
||||||
|
@ -38,7 +39,7 @@ export default function useTableProps(
|
||||||
scroll: { maxHeight: '600px', x: '1400px' },
|
scroll: { maxHeight: '600px', x: '1400px' },
|
||||||
checkable: true,
|
checkable: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
data: [] as MsTableData,
|
data: [],
|
||||||
columns: [] as MsTableColumn,
|
columns: [] as MsTableColumn,
|
||||||
rowKey: 'id',
|
rowKey: 'id',
|
||||||
selectedKeys: [],
|
selectedKeys: [],
|
||||||
|
@ -59,7 +60,7 @@ export default function useTableProps(
|
||||||
};
|
};
|
||||||
|
|
||||||
// 属性组
|
// 属性组
|
||||||
const propsRes = ref(defaultProps);
|
const propsRes = ref<MsTableProps<T>>(defaultProps);
|
||||||
const oldPagination = ref<Pagination>({
|
const oldPagination = ref<Pagination>({
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize: appStore.pageSize,
|
pageSize: appStore.pageSize,
|
||||||
|
@ -135,7 +136,7 @@ export default function useTableProps(
|
||||||
};
|
};
|
||||||
|
|
||||||
// 单独设置默认属性
|
// 单独设置默认属性
|
||||||
const setProps = (params: Partial<MsTableProps>) => {
|
const setProps = (params: Partial<MsTableProps<T>>) => {
|
||||||
const tmpProps = propsRes.value;
|
const tmpProps = propsRes.value;
|
||||||
Object.keys(params).forEach((key) => {
|
Object.keys(params).forEach((key) => {
|
||||||
tmpProps[key] = params[key];
|
tmpProps[key] = params[key];
|
||||||
|
@ -166,8 +167,8 @@ export default function useTableProps(
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
...loadListParams.value,
|
...loadListParams.value,
|
||||||
});
|
});
|
||||||
const tmpArr = data.list as unknown as MsTableData;
|
const tmpArr = data.list;
|
||||||
propsRes.value.data = tmpArr.map((item: TableData) => {
|
(propsRes.value.data as MsTableDataItem<T>[]) = tmpArr.map((item) => {
|
||||||
if (item.updateTime) {
|
if (item.updateTime) {
|
||||||
item.updateTime = dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss');
|
item.updateTime = dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss');
|
||||||
}
|
}
|
||||||
|
@ -243,14 +244,13 @@ export default function useTableProps(
|
||||||
}
|
}
|
||||||
propsRes.value.selectedKeys = arr;
|
propsRes.value.selectedKeys = arr;
|
||||||
},
|
},
|
||||||
change: (_data: MsTableData) => {
|
change: (_data: MsTableDataItem<T>[]) => {
|
||||||
if (propsRes.value.draggable && _data instanceof Array) {
|
if (propsRes.value.draggable && _data instanceof Array) {
|
||||||
// eslint-disable-next-line vue/require-explicit-emits
|
(propsRes.value.data as MsTableDataItem<T>[]) = _data;
|
||||||
propsRes.value.data = _data;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 编辑触发
|
// 编辑触发
|
||||||
rowNameChange: (record: TableData) => {
|
rowNameChange: (record: T) => {
|
||||||
if (saveCallBack) {
|
if (saveCallBack) {
|
||||||
saveCallBack(record);
|
saveCallBack(record);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,19 @@ export enum TableKeyEnum {
|
||||||
ORGANNATIONMEMBER = 'member',
|
ORGANNATIONMEMBER = 'member',
|
||||||
SYSTEM_ORGANIZATION = 'systemOrganization',
|
SYSTEM_ORGANIZATION = 'systemOrganization',
|
||||||
SYSTEM_PROJECT = 'systemProject',
|
SYSTEM_PROJECT = 'systemProject',
|
||||||
|
SYSTEM_LOG = 'systemLog',
|
||||||
|
}
|
||||||
|
|
||||||
|
// 具有特殊功能的列
|
||||||
|
export enum SpecialColumnEnum {
|
||||||
|
// 编辑列
|
||||||
|
NAME = 'name',
|
||||||
|
// 状态列
|
||||||
|
ENABLE = 'enable',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum SelectAllEnum {
|
||||||
|
ALL = 'all',
|
||||||
|
CURRENT = 'current',
|
||||||
|
NONE = 'none',
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default function useModal() {
|
||||||
openModal: (options: ModalOptions) => {
|
openModal: (options: ModalOptions) => {
|
||||||
const okHandlerLoading = ref<boolean>(false);
|
const okHandlerLoading = ref<boolean>(false);
|
||||||
// error 使用 warning的感叹号图标
|
// error 使用 warning的感叹号图标
|
||||||
Modal[options.type === 'error' ? 'warning' : options.type]({
|
Modal[options.type]({
|
||||||
// 默认设置按钮属性,也可通过options传入覆盖
|
// 默认设置按钮属性,也可通过options传入覆盖
|
||||||
okButtonProps: {
|
okButtonProps: {
|
||||||
type: options.mode === 'weak' ? 'text' : 'primary',
|
type: options.mode === 'weak' ? 'text' : 'primary',
|
||||||
|
|
|
@ -7,3 +7,18 @@ export interface LogOptions {
|
||||||
organizationList: OptionsItem[];
|
organizationList: OptionsItem[];
|
||||||
projectList: OptionsItem[];
|
projectList: OptionsItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface LogItem {
|
||||||
|
id: string;
|
||||||
|
createUser: string;
|
||||||
|
userName: string;
|
||||||
|
projectId: string;
|
||||||
|
projectName: string;
|
||||||
|
organizationId: string;
|
||||||
|
organizationName: string;
|
||||||
|
module: string; // 操作对象
|
||||||
|
type: string; // 操作类型
|
||||||
|
content: string; // 操作名称
|
||||||
|
createTime: number;
|
||||||
|
sourceId: string;
|
||||||
|
}
|
||||||
|
|
|
@ -630,7 +630,7 @@
|
||||||
*/
|
*/
|
||||||
function delAuth(record: any) {
|
function delAuth(record: any) {
|
||||||
openModal({
|
openModal({
|
||||||
type: 'warning',
|
type: 'error',
|
||||||
title: t('system.config.auth.deleteTipTitle', { name: characterLimit(record.name) }),
|
title: t('system.config.auth.deleteTipTitle', { name: characterLimit(record.name) }),
|
||||||
content: t('system.config.auth.deleteTipContent'),
|
content: t('system.config.auth.deleteTipContent'),
|
||||||
okText: t('system.config.auth.deleteConfirm'),
|
okText: t('system.config.auth.deleteConfirm'),
|
||||||
|
|
|
@ -244,7 +244,7 @@
|
||||||
};
|
};
|
||||||
function deletePlugin(record: any) {
|
function deletePlugin(record: any) {
|
||||||
openModal({
|
openModal({
|
||||||
type: 'warning',
|
type: 'error',
|
||||||
title: t('system.plugin.deletePluginTip', { name: characterLimit(record.name) }),
|
title: t('system.plugin.deletePluginTip', { name: characterLimit(record.name) }),
|
||||||
content: t('system.plugin.deleteContentTip'),
|
content: t('system.plugin.deleteContentTip'),
|
||||||
okText: t('system.plugin.deletePluginConfirm'),
|
okText: t('system.plugin.deletePluginConfirm'),
|
||||||
|
|
|
@ -227,11 +227,11 @@
|
||||||
:rules="[{ required: true, message: t('system.resourcePool.testResourceDTO.tokenRequired') }]"
|
:rules="[{ required: true, message: t('system.resourcePool.testResourceDTO.tokenRequired') }]"
|
||||||
asterisk-position="end"
|
asterisk-position="end"
|
||||||
>
|
>
|
||||||
<a-input
|
<a-input-password
|
||||||
v-model:model-value="form.testResourceDTO.token"
|
v-model:model-value="form.testResourceDTO.token"
|
||||||
:placeholder="t('system.resourcePool.testResourceDTO.tokenPlaceholder')"
|
:placeholder="t('system.resourcePool.testResourceDTO.tokenPlaceholder')"
|
||||||
:max-length="250"
|
:max-length="250"
|
||||||
></a-input>
|
></a-input-password>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
:label="t('system.resourcePool.testResourceDTO.nameSpaces')"
|
:label="t('system.resourcePool.testResourceDTO.nameSpaces')"
|
||||||
|
@ -258,6 +258,7 @@
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
|
v-if="isCheckedAPI"
|
||||||
:label="t('system.resourcePool.testResourceDTO.deployName')"
|
:label="t('system.resourcePool.testResourceDTO.deployName')"
|
||||||
field="testResourceDTO.deployName"
|
field="testResourceDTO.deployName"
|
||||||
class="form-item"
|
class="form-item"
|
||||||
|
@ -691,7 +692,7 @@
|
||||||
nameSpaces,
|
nameSpaces,
|
||||||
concurrentNumber,
|
concurrentNumber,
|
||||||
podThreads,
|
podThreads,
|
||||||
deployName,
|
deployName: isCheckedAPI.value ? deployName : null, // 勾选了接口测试才需要传
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
// 性能测试资源
|
// 性能测试资源
|
||||||
|
|
|
@ -180,9 +180,6 @@
|
||||||
content: t('system.resourcePool.disablePoolContent'),
|
content: t('system.resourcePool.disablePoolContent'),
|
||||||
okText: t('system.resourcePool.disablePoolConfirm'),
|
okText: t('system.resourcePool.disablePoolConfirm'),
|
||||||
cancelText: t('system.resourcePool.disablePoolCancel'),
|
cancelText: t('system.resourcePool.disablePoolCancel'),
|
||||||
okButtonProps: {
|
|
||||||
status: 'danger',
|
|
||||||
},
|
|
||||||
maskClosable: false,
|
maskClosable: false,
|
||||||
onBeforeOk: async () => {
|
onBeforeOk: async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -202,7 +199,7 @@
|
||||||
*/
|
*/
|
||||||
function deletePool(record: any) {
|
function deletePool(record: any) {
|
||||||
openModal({
|
openModal({
|
||||||
type: 'warning',
|
type: 'error',
|
||||||
title: t('system.resourcePool.deletePoolTip', { name: characterLimit(record.name) }),
|
title: t('system.resourcePool.deletePoolTip', { name: characterLimit(record.name) }),
|
||||||
content: t('system.resourcePool.deletePoolContentUsed'),
|
content: t('system.resourcePool.deletePoolContentUsed'),
|
||||||
okText: t('system.resourcePool.deletePoolConfirm'),
|
okText: t('system.resourcePool.deletePoolConfirm'),
|
||||||
|
|
|
@ -357,9 +357,6 @@
|
||||||
content: t('system.user.disableUserContent'),
|
content: t('system.user.disableUserContent'),
|
||||||
okText: t('system.user.disableUserConfirm'),
|
okText: t('system.user.disableUserConfirm'),
|
||||||
cancelText: t('system.user.disableUserCancel'),
|
cancelText: t('system.user.disableUserCancel'),
|
||||||
okButtonProps: {
|
|
||||||
status: 'danger',
|
|
||||||
},
|
|
||||||
maskClosable: false,
|
maskClosable: false,
|
||||||
onBeforeOk: async () => {
|
onBeforeOk: async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -421,7 +418,7 @@
|
||||||
userIdList = tableSelected.value as string[];
|
userIdList = tableSelected.value as string[];
|
||||||
}
|
}
|
||||||
openModal({
|
openModal({
|
||||||
type: 'warning',
|
type: 'error',
|
||||||
title,
|
title,
|
||||||
content: t('system.user.deleteUserContent'),
|
content: t('system.user.deleteUserContent'),
|
||||||
okText: t('system.user.deleteUserConfirm'),
|
okText: t('system.user.deleteUserConfirm'),
|
||||||
|
|
|
@ -154,7 +154,7 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
openModal({
|
openModal({
|
||||||
type: 'warning',
|
type: 'error',
|
||||||
title: t('system.userGroup.isDeleteUserGroup', { name: characterLimit(store.currentName) }),
|
title: t('system.userGroup.isDeleteUserGroup', { name: characterLimit(store.currentName) }),
|
||||||
content: t('system.userGroup.beforeDeleteUserGroup'),
|
content: t('system.userGroup.beforeDeleteUserGroup'),
|
||||||
okText: t('system.userGroup.confirmDelete'),
|
okText: t('system.userGroup.confirmDelete'),
|
||||||
|
|
Loading…
Reference in New Issue