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

This commit is contained in:
baiqi 2023-07-27 11:18:12 +08:00 committed by fit2-zhao
parent f428fda5dc
commit c8005b0278
3 changed files with 34 additions and 15 deletions

View File

@ -1,31 +1,32 @@
<template> <template>
<a-spin class="block h-full" :loading="props.loading" :size="28"> <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 pr-[10px]">
<div v-if="!simple" class="card-header"> <div v-if="!props.simple" class="card-header">
<div class="back-btn" @click="back"><icon-arrow-left /></div> <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 class="text-[var(--color-text-000)]">{{ props.title }}</div>
</div> </div>
<a-divider v-if="!simple" class="mb-[16px]" /> <a-divider v-if="!props.simple" class="mb-[16px]" />
<div class="mr-[-10px]"> <div class="mr-[-10px]">
<a-scrollbar <a-scrollbar
class="pr-[10px]" class="pr-[10px]"
:style="{ :style="{
overflowY: 'auto', overflowY: 'auto',
minWidth: 1000, minWidth: 1000,
height: `calc(100vh - ${256 + specialHeight}px)`, height: `calc(100vh - ${cardOverHeight}px)`,
}" }"
> >
<slot></slot> <slot></slot>
</a-scrollbar> </a-scrollbar>
</div> </div>
<div <div
v-if="!hideFooter && !simple" v-if="!props.hideFooter && !props.simple"
class="relative z-10 m-[0_-24px_-24px] flex justify-end gap-[16px] p-[24px] shadow-[0_-1px_4px_rgba(2,2,2,0.1)]" class="fixed bottom-0 right-[16px] z-10 w-full bg-white p-[24px] shadow-[0_-1px_4px_rgba(2,2,2,0.1)]"
> >
<div class="ml-0 mr-auto"> <div class="ml-0 mr-auto">
<slot name="footerLeft"></slot> <slot name="footerLeft"></slot>
</div> </div>
<slot name="footerRight"> <slot name="footerRight">
<div class="flex justify-end gap-[16px]">
<a-button type="secondary" @click="back">{{ t('mscard.defaultCancelText') }}</a-button> <a-button type="secondary" @click="back">{{ t('mscard.defaultCancelText') }}</a-button>
<a-button v-if="!props.hideContinue && !props.isEdit" type="secondary" @click="emit('saveAndContinue')"> <a-button v-if="!props.hideContinue && !props.isEdit" type="secondary" @click="emit('saveAndContinue')">
{{ t('mscard.defaultSaveAndContinueText') }} {{ t('mscard.defaultSaveAndContinueText') }}
@ -33,6 +34,7 @@
<a-button type="primary" @click="emit('save')"> <a-button type="primary" @click="emit('save')">
{{ t(props.isEdit ? 'mscard.defaultUpdate' : 'mscard.defaultConfirm') }} {{ t(props.isEdit ? 'mscard.defaultUpdate' : 'mscard.defaultConfirm') }}
</a-button> </a-button>
</div>
</slot> </slot>
</div> </div>
</div> </div>
@ -42,6 +44,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { computed } from 'vue';
const props = withDefaults( const props = withDefaults(
defineProps< defineProps<
@ -53,6 +56,7 @@
loading: boolean; loading: boolean;
isEdit: boolean; isEdit: boolean;
specialHeight: number; // specialHeight: number; //
hideBack: boolean;
handleBack: () => void; handleBack: () => void;
}> }>
>(), >(),
@ -62,6 +66,7 @@
hideFooter: false, hideFooter: false,
isEdit: false, isEdit: false,
specialHeight: 0, specialHeight: 0,
hideBack: false,
} }
); );
@ -69,6 +74,19 @@
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const cardOverHeight = computed(() => {
if (props.simple) {
//
return 163;
}
if (props.hideFooter) {
//
return 192;
}
return 256 + props.specialHeight;
});
function back() { function back() {
if (typeof props.handleBack === 'function') { if (typeof props.handleBack === 'function') {
props.handleBack(); props.handleBack();

View File

@ -18,10 +18,11 @@
> >
{{ tag }} {{ tag }}
</a-tag> </a-tag>
<span v-show="Array.isArray(item.value) && item.value.length === 0">-</span>
</template> </template>
<a-button v-else-if="item.isButton" type="text" @click="handleItemClick(item)">{{ item.value }}</a-button> <a-button v-else-if="item.isButton" type="text" @click="handleItemClick(item)">{{ item.value }}</a-button>
<div v-else> <div v-else>
{{ item.value }} {{ item.value?.toString() === '' ? '-' : item.value }}
</div> </div>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>

View File

@ -168,7 +168,7 @@
background-color: var(--color-bg-3); background-color: var(--color-bg-3);
transition: padding 0.2s cubic-bezier(0.34, 0.69, 0.1, 1); transition: padding 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
.arco-layout-content { .arco-layout-content {
padding: 16px 16px 16px 0; padding: 16px 16px 0 0;
min-height: 500px; min-height: 500px;
} }
} }