style: 表格高度自适应
This commit is contained in:
parent
80cc5940c1
commit
29e8e0910a
|
@ -24,7 +24,8 @@
|
||||||
import { watchStyle, watchTheme, setFavicon } from '@/utils/theme';
|
import { watchStyle, watchTheme, setFavicon } from '@/utils/theme';
|
||||||
import { WorkbenchRouteEnum } from './enums/routeEnum';
|
import { WorkbenchRouteEnum } from './enums/routeEnum';
|
||||||
import { getPublicKeyRequest } from './api/modules/user';
|
import { getPublicKeyRequest } from './api/modules/user';
|
||||||
// import MsEmpty from '@/components/pure/ms-empty/index.vue';
|
import MsEmpty from '@/components/pure/ms-empty/index.vue';
|
||||||
|
import { useEventListener, useWindowSize } from '@vueuse/core';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
@ -91,5 +92,12 @@
|
||||||
if (!whiteList.includes(window.location.hash)) {
|
if (!whiteList.includes(window.location.hash)) {
|
||||||
await checkIsLogin();
|
await checkIsLogin();
|
||||||
}
|
}
|
||||||
|
const { height } = useWindowSize();
|
||||||
|
appStore.innerHeight = height.value;
|
||||||
|
});
|
||||||
|
/** 屏幕大小改变时重新赋值innerHeight */
|
||||||
|
useEventListener(window, 'resize', () => {
|
||||||
|
const { height } = useWindowSize();
|
||||||
|
appStore.innerHeight = height.value;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -714,5 +714,12 @@
|
||||||
left: auto;
|
left: auto;
|
||||||
.arco-drawer {
|
.arco-drawer {
|
||||||
box-shadow: -1px 0 4px 0 rgb(2 2 2 / 10%);
|
box-shadow: -1px 0 4px 0 rgb(2 2 2 / 10%);
|
||||||
|
&-header {
|
||||||
|
.arco-drawer-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--color-text-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ export interface MsTableProps<T> {
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
// 是否展示第一行的操作
|
// 是否展示第一行的操作
|
||||||
showFirstOperation?: boolean;
|
showFirstOperation?: boolean;
|
||||||
|
// 已经使用的高度
|
||||||
|
heightUsed?: number;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
// 核心的封装方法,详细参数看文档 https://arco.design/vue/component/table
|
// 核心的封装方法,详细参数看文档 https://arco.design/vue/component/table
|
||||||
// hook/table-props.ts
|
// hook/table-props.ts
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref, watchEffect } from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useAppStore, useTableStore } from '@/store';
|
import { useAppStore, useTableStore } 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 { TableQueryParams, CommonList } from '@/models/common';
|
import type { TableQueryParams, CommonList } from '@/models/common';
|
||||||
import type { MsTableProps, MsTableDataItem, MsTableColumn, MsTableErrorStatus } from './type';
|
import type { MsTableProps, MsTableDataItem, MsTableColumn, MsTableErrorStatus } from './type';
|
||||||
|
@ -37,7 +35,8 @@ export default function useTableProps<T>(
|
||||||
bordered: true,
|
bordered: true,
|
||||||
showPagination: true,
|
showPagination: true,
|
||||||
size: 'default',
|
size: 'default',
|
||||||
scroll: { maxHeight: '800px', minWidth: '1600px', y: '600px' },
|
heightUsed: 294,
|
||||||
|
scroll: { x: 1400, y: appStore.innerHeight - 294 },
|
||||||
checkable: true,
|
checkable: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
data: [],
|
data: [],
|
||||||
|
@ -272,6 +271,11 @@ export default function useTableProps<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
const { heightUsed } = propsRes.value;
|
||||||
|
propsRes.value.scroll = { ...propsRes.value.scroll, y: appStore.innerHeight - (heightUsed || 294) };
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
propsRes,
|
propsRes,
|
||||||
propsEvent,
|
propsEvent,
|
||||||
|
|
|
@ -47,6 +47,7 @@ const useAppStore = defineStore('app', {
|
||||||
defaultThemeConfig,
|
defaultThemeConfig,
|
||||||
defaultLoginConfig,
|
defaultLoginConfig,
|
||||||
defaultPlatformConfig,
|
defaultPlatformConfig,
|
||||||
|
innerHeight: 0,
|
||||||
pageConfig: {
|
pageConfig: {
|
||||||
...defaultThemeConfig,
|
...defaultThemeConfig,
|
||||||
...defaultLoginConfig,
|
...defaultLoginConfig,
|
||||||
|
|
|
@ -32,6 +32,7 @@ export interface AppState {
|
||||||
defaultLoginConfig: LoginConfig;
|
defaultLoginConfig: LoginConfig;
|
||||||
defaultPlatformConfig: PlatformConfig;
|
defaultPlatformConfig: PlatformConfig;
|
||||||
pageConfig: PageConfig;
|
pageConfig: PageConfig;
|
||||||
|
innerHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UploadFileTaskState {
|
export interface UploadFileTaskState {
|
||||||
|
|
|
@ -163,9 +163,7 @@
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await createOrUpdateProjectByOrg({ id: props.currentProject?.id, ...form });
|
await createOrUpdateProjectByOrg({ id: props.currentProject?.id, ...form });
|
||||||
Message.success(
|
Message.success(
|
||||||
isEdit.value
|
isEdit.value ? t('system.project.updateProjectSuccess') : t('system.project.createProjectSuccess')
|
||||||
? t('system.organization.updateOrganizationSuccess')
|
|
||||||
: t('system.organization.createOrganizationSuccess')
|
|
||||||
);
|
);
|
||||||
handleCancel(true);
|
handleCancel(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
{
|
{
|
||||||
title: 'system.organization.userName',
|
title: 'system.organization.userName',
|
||||||
slotName: 'name',
|
slotName: 'name',
|
||||||
|
dataIndex: 'name',
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
|
@ -98,8 +99,9 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, setKeyword } = useTable(postProjectMemberByProjectId, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, setKeyword } = useTable(postProjectMemberByProjectId, {
|
||||||
|
heightUsed: 240,
|
||||||
columns: projectColumn,
|
columns: projectColumn,
|
||||||
scroll: { maxHeight: '700px', y: '650px' },
|
scroll: { x: '100%' },
|
||||||
selectable: false,
|
selectable: false,
|
||||||
noDisable: false,
|
noDisable: false,
|
||||||
pageSimple: true,
|
pageSimple: true,
|
||||||
|
|
|
@ -71,4 +71,6 @@ export default {
|
||||||
'system.project.projectNameRequired': 'Project name cannot be empty',
|
'system.project.projectNameRequired': 'Project name cannot be empty',
|
||||||
'system.project.createTip': 'After the project is enabled, it will be displayed in the project switching list',
|
'system.project.createTip': 'After the project is enabled, it will be displayed in the project switching list',
|
||||||
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',
|
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',
|
||||||
|
'system.project.createProjectSuccess': 'Create project success',
|
||||||
|
'system.project.updateProjectSuccess': 'Update project success',
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,4 +66,6 @@ export default {
|
||||||
'system.project.projectNameRequired': '项目名称不能为空',
|
'system.project.projectNameRequired': '项目名称不能为空',
|
||||||
'system.project.createTip': '项目启用后,将展示在项目切换列表',
|
'system.project.createTip': '项目启用后,将展示在项目切换列表',
|
||||||
'system.project.affiliatedOrgRequired': '所属组织不能为空',
|
'system.project.affiliatedOrgRequired': '所属组织不能为空',
|
||||||
|
'system.project.createProjectSuccess': '创建项目成功',
|
||||||
|
'system.project.updateProjectSuccess': '更新项目成功',
|
||||||
};
|
};
|
||||||
|
|
|
@ -149,7 +149,6 @@
|
||||||
slotName: 'operation',
|
slotName: 'operation',
|
||||||
dataIndex: 'operation',
|
dataIndex: 'operation',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 230,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -163,9 +163,7 @@
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await createOrUpdateProject({ id: props.currentProject?.id, ...form });
|
await createOrUpdateProject({ id: props.currentProject?.id, ...form });
|
||||||
Message.success(
|
Message.success(
|
||||||
isEdit.value
|
isEdit.value ? t('system.project.updateProjectSuccess') : t('system.project.createProjectSuccess')
|
||||||
? t('system.organization.updateOrganizationSuccess')
|
|
||||||
: t('system.organization.createOrganizationSuccess')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
handleCancel(true);
|
handleCancel(true);
|
||||||
|
|
|
@ -72,7 +72,8 @@
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, setKeyword } = useTable(postProjectTableByOrgId, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, setKeyword } = useTable(postProjectTableByOrgId, {
|
||||||
columns: projectColumn,
|
columns: projectColumn,
|
||||||
scroll: { maxHeight: '700px', y: '650px' },
|
scroll: { x: '100%' },
|
||||||
|
heightUsed: 240,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
noDisable: false,
|
noDisable: false,
|
||||||
pageSimple: true,
|
pageSimple: true,
|
||||||
|
|
|
@ -106,7 +106,8 @@
|
||||||
postUserTableByOrgIdOrProjectId,
|
postUserTableByOrgIdOrProjectId,
|
||||||
{
|
{
|
||||||
columns: projectColumn,
|
columns: projectColumn,
|
||||||
scroll: { maxHeight: '700px', y: '650px' },
|
scroll: { x: '100%' },
|
||||||
|
heightUsed: 240,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
noDisable: false,
|
noDisable: false,
|
||||||
pageSimple: true,
|
pageSimple: true,
|
||||||
|
|
Loading…
Reference in New Issue