feat: 布局调整&卡片组件调整

This commit is contained in:
baiqi 2023-07-27 14:57:31 +08:00 committed by 刘瑞斌
parent 8be2a18195
commit 5bd61bf764
5 changed files with 178 additions and 155 deletions

View File

@ -1,18 +1,26 @@
<template>
<a-spin class="block h-full" :loading="props.loading" :size="28">
<div class="ms-card relative h-full pr-[10px]">
<div
:class="[
'ms-card',
'relative',
'h-full',
props.autoHeight ? '' : 'min-h-[500px]',
props.noContentPadding ? 'ms-card--noContentPadding' : 'p-[24px]',
]"
>
<div v-if="!props.simple" class="card-header">
<div v-if="!props.hideBack" class="back-btn" @click="back"><icon-arrow-left /></div>
<div class="text-[var(--color-text-000)]">{{ props.title }}</div>
</div>
<a-divider v-if="!props.simple" class="mb-[16px]" />
<div class="mr-[-10px]">
<div class="ms-card-container">
<a-scrollbar
class="pr-[10px]"
class="pr-[5px]"
:style="{
overflowY: 'auto',
minWidth: 1000,
height: `calc(100vh - ${cardOverHeight}px)`,
height: props.autoHeight ? 'auto' : `calc(100vh - ${cardOverHeight}px)`,
}"
>
<slot></slot>
@ -49,15 +57,18 @@
const props = withDefaults(
defineProps<
Partial<{
simple: boolean;
title: string;
hideContinue: boolean;
hideFooter: boolean;
loading: boolean;
isEdit: boolean;
simple: boolean; //
title: string; //
hideContinue: boolean; //
hideFooter: boolean; //
loading: boolean; // loading
isEdit: boolean; //
specialHeight: number; //
hideBack: boolean;
handleBack: () => void;
hideBack: boolean; //
autoHeight: boolean; //
hasBreadcrumb: boolean; //
noContentPadding: boolean; // padding
handleBack: () => void; //
}>
>(),
{
@ -67,6 +78,9 @@
isEdit: false,
specialHeight: 0,
hideBack: false,
autoHeight: false,
hasBreadcrumb: false,
noContentPadding: false,
}
);
@ -75,16 +89,18 @@
const router = useRouter();
const { t } = useI18n();
const _spcialHeight = props.hasBreadcrumb ? 31 + props.specialHeight : props.specialHeight; // 31
const cardOverHeight = computed(() => {
if (props.simple) {
//
return 163;
return 136 + _spcialHeight;
}
if (props.hideFooter) {
//
return 192;
}
return 256 + props.specialHeight;
return 246 + _spcialHeight;
});
function back() {
@ -98,6 +114,22 @@
<style lang="less" scoped>
.ms-card {
@apply overflow-hidden bg-white;
border-radius: var(--border-radius-large);
box-shadow: 0 0 10px rgb(120 56 135 / 5%);
&--noContentPadding {
border-radius: var(--border-radius-large) var(--border-radius-large) 0 0;
.card-header {
padding: 24px 24px 0;
}
.arco-divider {
@apply mb-0;
}
.ms-card-container {
padding: 0;
}
}
.card-header {
@apply flex items-center;
.back-btn {

View File

@ -14,12 +14,4 @@
<script lang="ts" setup></script>
<style lang="less" scoped>
.page-content {
@apply overflow-hidden bg-white;
padding: 24px 14px 24px 24px;
border-radius: var(--border-radius-large);
box-shadow: 0 0 10px rgb(120 56 135 / 5%);
}
</style>
<style lang="less" scoped></style>

View File

@ -3,7 +3,7 @@
:loading="loading"
:title="title"
:is-edit="isEdit"
:special-height="34"
has-breadcrumb
@save="beforeSave"
@save-and-continue="beforeSave(true)"
>

View File

@ -1,6 +1,6 @@
<template>
<div>
<MsCard :loading="loading" simple>
<MsCard :loading="loading" has-breadcrumb simple>
<div class="mb-4 flex items-center justify-between">
<a-button type="primary" @click="addPool">
{{ t('system.resourcePool.createPool') }}

View File

@ -1,5 +1,5 @@
<template>
<div>
<MsCard simple>
<div class="mb-4 flex items-center justify-between">
<div>
<a-button class="mr-3" type="primary" @click="showUserModal('create')">
@ -84,6 +84,7 @@
</template>
</template>
</ms-base-table>
</MsCard>
<a-modal
v-model:visible="visible"
:title="userFormMode === 'create' ? t('system.user.createUserModalTitle') : t('system.user.editUserModalTitle')"
@ -128,9 +129,7 @@
{{ t('system.user.editUserModalSaveAndContinue') }}
</a-button>
<a-button type="primary" :loading="loading" @click="beforeCreateUser">
{{
t(userFormMode === 'create' ? 'system.user.editUserModalCreateUser' : 'system.user.editUserModalEditUser')
}}
{{ t(userFormMode === 'create' ? 'system.user.editUserModalCreateUser' : 'system.user.editUserModalEditUser') }}
</a-button>
</template>
</a-modal>
@ -213,7 +212,6 @@
:action="batchAction"
:tree-data="treeData"
></batchModal>
</div>
</template>
<script setup lang="ts">
@ -248,6 +246,7 @@
import type { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import type { SimpleUserInfo, SystemRole, UserListItem } from '@/models/setting/user';
import type { FormItemModel, MsBatchFormInstance } from '@/components/bussiness/ms-batch-form/types';
import MsCard from '@/components/pure/ms-card/index.vue';
const { t } = useI18n();